Fix DataProtection after build globbing changes will go in

This commit is contained in:
Pavel Krymets 2016-05-24 15:33:28 -07:00
parent e8faec59f0
commit a4118e75aa
1 changed files with 18 additions and 18 deletions

View File

@ -11,27 +11,27 @@ var Configuration_Local = '${E("Configuration")}'
default BASE_DIR_LOCAL='${Directory.GetCurrentDirectory()}' default BASE_DIR_LOCAL='${Directory.GetCurrentDirectory()}'
default TARGET_DIR_LOCAL='${Path.Combine(BASE_DIR_LOCAL, "artifacts")}' default TARGET_DIR_LOCAL='${Path.Combine(BASE_DIR_LOCAL, "artifacts")}'
default BUILD_DIR_LOCAL='${Path.Combine(TARGET_DIR_LOCAL, "build")}' default BUILD_DIR_LOCAL='${Path.Combine(TARGET_DIR_LOCAL, "build")}'
default SRC_PROJECT_GLOB_LOCAL="src/*/project.json"
default TEST_PROJECT_GLOB_LOCAL="test/*/project.json"
#build-compile target='compile' if='Directory.Exists("src")' #build-compile target='compile'
@{ @{
Directory.CreateDirectory(TARGET_DIR_LOCAL); Directory.CreateDirectory(TARGET_DIR_LOCAL);
string commitHash = null; string commitHash = null;
if (AddAssemblyInfo) if (AddAssemblyInfo)
{ {
var commitHashFile = Path.Combine(TARGET_DIR_LOCAL, "commit"); var commitHashFile = Path.Combine(TARGET_DIR_LOCAL, "commit");
GitCommand("rev-parse HEAD >> " + commitHashFile); GitCommand("rev-parse HEAD >> " + commitHashFile);
commitHash = File.ReadAllLines(commitHashFile)[0]; commitHash = File.ReadAllLines(commitHashFile)[0];
} }
var projectFiles = Files.Include("src/*/project.json").ToList(); var srcProjects = Files.Include(SRC_PROJECT_GLOB_LOCAL).ToList();
if (IsLinux) if (IsLinux)
{ {
projectFiles.Remove("src/Microsoft.AspNetCore.DataProtection.SystemWeb/project.json"); srcProjects.Remove("src/Microsoft.AspNetCore.DataProtection.SystemWeb/project.json");
} }
srcProjects.ForEach(projectFile =>
projectFiles.ForEach(projectFile =>
{ {
if (AddAssemblyInfo) if (AddAssemblyInfo)
{ {
@ -39,24 +39,24 @@ default BUILD_DIR_LOCAL='${Path.Combine(TARGET_DIR_LOCAL, "build")}'
var project = (JsonObject)Json.Deserialize(projectText); var project = (JsonObject)Json.Deserialize(projectText);
var isSharedProject = project.Keys.Contains("shared"); var isSharedProject = project.Keys.Contains("shared");
// We don't want to embed the commit hash in it because // We don't want to embed the commit hash in it because
// the consumers would get that file // the consumers would get that file
if (!isSharedProject) if (!isSharedProject)
{ {
Console.WriteLine("Embedding commit hash in assembly"); Console.WriteLine("Embedding commit hash in assembly");
var projectFolder = Path.GetDirectoryName(projectFile); var projectFolder = Path.GetDirectoryName(projectFile);
var commitHashAttribute = String.Format("[assembly: System.Reflection.AssemblyMetadata(\"CommitHash\", \"{0}\")]", commitHash); var commitHashAttribute = String.Format("[assembly: System.Reflection.AssemblyMetadata(\"CommitHash\", \"{0}\")]", commitHash);
var buildInfoFile = Path.Combine(projectFolder, "BuildInfo.generated.cs"); var buildInfoFile = Path.Combine(projectFolder, "BuildInfo.generated.cs");
File.WriteAllText(buildInfoFile, commitHashAttribute); File.WriteAllText(buildInfoFile, commitHashAttribute);
} }
} }
DotnetPack(projectFile, BUILD_DIR_LOCAL, Configuration_Local, "");
DotnetPack(projectFile, BUILD_DIR_LOCAL, Configuration_Local);
}); });
DotnetBuild(TEST_PROJECT_GLOB_LOCAL, Configuration_Local, BuildFramework);
foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR_LOCAL, "*/" + Configuration_Local + "/*.nupkg"))) foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR_LOCAL, "*/" + Configuration_Local + "/*.nupkg")))
{ {
File.Copy(nupkg, Path.Combine(BUILD_DIR_LOCAL, Path.GetFileName(nupkg)), true); File.Copy(nupkg, Path.Combine(BUILD_DIR_LOCAL, Path.GetFileName(nupkg)), true);
} }
} }