зеркало из https://github.com/aspnet/KoreBuild.git
Revert "Build everything with single dotnet build run, skip incremental checks for pack and test"
This reverts commit 3760389907
.
This commit is contained in:
Родитель
5ec21515c4
Коммит
05a0d33997
|
@ -15,7 +15,6 @@ configuration=''
|
|||
*/}
|
||||
|
||||
default configuration = 'Debug'
|
||||
default test_options=' ${E("KOREBUILD_DOTNET_TEST_OPTIONS")}'
|
||||
|
||||
@{
|
||||
var content = File.ReadAllText(projectFile);
|
||||
|
@ -31,7 +30,7 @@ default test_options=' ${E("KOREBUILD_DOTNET_TEST_OPTIONS")}'
|
|||
noParallelTestProjects.UnionWith(NO_PARALLEL_TEST_PROJECTS.Split((char)','));
|
||||
}
|
||||
|
||||
var testArgs = test_options + " --configuration " + configuration;
|
||||
var testArgs = " --configuration " + configuration;
|
||||
if (IsLinux)
|
||||
{
|
||||
testArgs += " -f netcoreapp1.0";
|
||||
|
|
|
@ -16,9 +16,6 @@ default BUILD_DIR='${Path.Combine(TARGET_DIR, "build")}'
|
|||
default TEST_DIR='${Path.Combine(TARGET_DIR, "test")}'
|
||||
default Configuration='${E("Configuration")}'
|
||||
default PACKAGELIST_JSON_FILENAME = 'NuGetPackageVerifier.json'
|
||||
default SRC_PROJECT_GLOB = "src/*/project.json"
|
||||
default TEST_PROJECT_GLOB = "test/*/project.json"
|
||||
default SAMPLES_PROJECT_GLOB = "samples/*/project.json"
|
||||
|
||||
@{
|
||||
if (string.IsNullOrEmpty(E("DOTNET_BUILD_VERSION")))
|
||||
|
@ -98,73 +95,60 @@ default SAMPLES_PROJECT_GLOB = "samples/*/project.json"
|
|||
|
||||
#ci-deep-clean .deep-clean target='clean' if='IsTeamCity'
|
||||
|
||||
#build-compile target='compile'
|
||||
#build-compile target='compile' if='Directory.Exists("src")'
|
||||
@{
|
||||
var projectGlobs = new List<string>();
|
||||
List<string> srcProjects = null;
|
||||
|
||||
if (Directory.Exists("src"))
|
||||
|
||||
Directory.CreateDirectory(TARGET_DIR);
|
||||
|
||||
string commitHash = null;
|
||||
if (AddAssemblyInfo)
|
||||
{
|
||||
Directory.CreateDirectory(TARGET_DIR);
|
||||
|
||||
string commitHash = null;
|
||||
if (AddAssemblyInfo)
|
||||
{
|
||||
var commitHashFile = Path.Combine(TARGET_DIR, "commit");
|
||||
GitCommand("rev-parse HEAD >> " + commitHashFile);
|
||||
commitHash = File.ReadAllLines(commitHashFile)[0];
|
||||
}
|
||||
|
||||
srcProjects = Files.Include(SRC_PROJECT_GLOB).ToList();
|
||||
srcProjects.ForEach(projectFile =>
|
||||
{
|
||||
if (AddAssemblyInfo)
|
||||
{
|
||||
var projectText = File.ReadAllText(projectFile);
|
||||
var project = (JsonObject)Json.Deserialize(projectText);
|
||||
var isSharedProject = project.Keys.Contains("shared");
|
||||
|
||||
// We don't want to embed the commit hash in it because
|
||||
// the consumers would get that file
|
||||
if (!isSharedProject)
|
||||
{
|
||||
Console.WriteLine("Embedding commit hash in assembly");
|
||||
var projectFolder = Path.GetDirectoryName(projectFile);
|
||||
var commitHashAttribute = String.Format("[assembly: System.Reflection.AssemblyMetadata(\"CommitHash\", \"{0}\")]", commitHash);
|
||||
|
||||
var buildInfoFile = Path.Combine(projectFolder, "BuildInfo.generated.cs");
|
||||
File.WriteAllText(buildInfoFile, commitHashAttribute);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
projectGlobs.Add(SRC_PROJECT_GLOB);
|
||||
var commitHashFile = Path.Combine(TARGET_DIR, "commit");
|
||||
GitCommand("rev-parse HEAD >> " + commitHashFile);
|
||||
commitHash = File.ReadAllLines(commitHashFile)[0];
|
||||
}
|
||||
if (!BuildSrcOnly && Directory.Exists("test"))
|
||||
|
||||
var projectFiles = Files.Include("src/*/project.json").ToList();
|
||||
projectFiles.ForEach(projectFile =>
|
||||
{
|
||||
projectGlobs.Add(TEST_PROJECT_GLOB);
|
||||
}
|
||||
if (!BuildSrcOnly && Directory.Exists("samples"))
|
||||
{
|
||||
projectGlobs.Add(SAMPLES_PROJECT_GLOB);
|
||||
}
|
||||
|
||||
DotnetBuild(string.Join(" ", projectGlobs.ToArray()), Configuration, BuildFramework);
|
||||
|
||||
if (srcProjects != null)
|
||||
{
|
||||
srcProjects.ForEach(projectFile =>
|
||||
if (AddAssemblyInfo)
|
||||
{
|
||||
DotnetPack(projectFile, BUILD_DIR, Configuration, " --no-build");
|
||||
});
|
||||
|
||||
foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR, "*/" + Configuration + "/*.nupkg")))
|
||||
{
|
||||
File.Copy(nupkg, Path.Combine(BUILD_DIR, Path.GetFileName(nupkg)), true);
|
||||
var projectText = File.ReadAllText(projectFile);
|
||||
var project = (JsonObject)Json.Deserialize(projectText);
|
||||
var isSharedProject = project.Keys.Contains("shared");
|
||||
|
||||
// We don't want to embed the commit hash in it because
|
||||
// the consumers would get that file
|
||||
if (!isSharedProject)
|
||||
{
|
||||
Console.WriteLine("Embedding commit hash in assembly");
|
||||
var projectFolder = Path.GetDirectoryName(projectFile);
|
||||
var commitHashAttribute = String.Format("[assembly: System.Reflection.AssemblyMetadata(\"CommitHash\", \"{0}\")]", commitHash);
|
||||
|
||||
var buildInfoFile = Path.Combine(projectFolder, "BuildInfo.generated.cs");
|
||||
File.WriteAllText(buildInfoFile, commitHashAttribute);
|
||||
}
|
||||
}
|
||||
|
||||
DotnetPack(projectFile, BUILD_DIR, Configuration);
|
||||
});
|
||||
|
||||
foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR, "*/" + Configuration + "/*.nupkg")))
|
||||
{
|
||||
File.Copy(nupkg, Path.Combine(BUILD_DIR, Path.GetFileName(nupkg)), true);
|
||||
}
|
||||
}
|
||||
|
||||
#build-test target='compile' if='Directory.Exists("test") && !BuildSrcOnly'
|
||||
@{
|
||||
DotnetBuild("test/*/project.json", Configuration, BuildFramework);
|
||||
}
|
||||
|
||||
#build-samples target='compile' if='Directory.Exists("samples") && !BuildSrcOnly'
|
||||
@{
|
||||
DotnetBuild("samples/*/project.json", Configuration, BuildFramework);
|
||||
}
|
||||
|
||||
#native-compile target='compile' if='!IsLinux && Directory.Exists(Path.Combine(BASE_DIR, "src"))'
|
||||
var programFilesX86 = '${Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)}'
|
||||
var nativeProjects ='${Files.Include(Path.Combine(BASE_DIR, "src", "**", "*.vcxproj"))}'
|
||||
|
@ -221,13 +205,14 @@ default SAMPLES_PROJECT_GLOB = "samples/*/project.json"
|
|||
|
||||
#xunit-test target='test' if='Directory.Exists("test")'
|
||||
@{
|
||||
var projectFiles = Files.Include(TEST_PROJECT_GLOB);
|
||||
var projectFiles = Files.Include("test/*/project.json");
|
||||
foreach (var projectFile in projectFiles)
|
||||
{
|
||||
DotnetTest(projectFile, Configuration, " --no-build");
|
||||
DotnetTest(projectFile, Configuration);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#make-roslyn-fast
|
||||
ngen-roslyn
|
||||
|
||||
|
@ -400,13 +385,13 @@ macro name='Dotnet' command='string' dotnetDir='string'
|
|||
macro name="DotnetBuild" projectFile='string' configuration='string' framework='string'
|
||||
dotnet-build
|
||||
|
||||
macro name="DotnetPack" projectFile='string' dotnetPackOutputDir='string' configuration='string' pack_options='string'
|
||||
macro name="DotnetPack" projectFile='string' dotnetPackOutputDir='string' configuration='string'
|
||||
dotnet-pack
|
||||
|
||||
macro name="DotnetPublish" projectFile='string' outputFolder='string' framework='string' configuration='string'
|
||||
dotnet-publish
|
||||
|
||||
macro name="DotnetTest" projectFile='string' configuration='string' test_options='string'
|
||||
macro name="DotnetTest" projectFile='string' configuration='string'
|
||||
dotnet-test
|
||||
|
||||
macro name='Npm' npmCommand='string' npmDir='string'
|
||||
|
|
Загрузка…
Ссылка в новой задаче