forked from dotnet/efcore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile.shade
109 lines (91 loc) · 5.12 KB
/
makefile.shade
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
use namespace="System.IO"
use namespace="System.IO.Compression"
use namespace="System.Linq"
default CONFIGURATION_LOCAL='${E("Configuration")}'
default BASE_DIR_LOCAL='${Directory.GetCurrentDirectory()}'
default BUILD_DIR_LOCAL='${Path.Combine(BASE_DIR_LOCAL, "artifacts", "build")}'
default TOOL_PACKAGE_NAME='Microsoft.EntityFrameworkCore.Tools'
default CLI_TOOL_PROJECT_NAME='Microsoft.EntityFrameworkCore.Tools.Cli'
default TOOL_EXE_NAME='${CLI_TOOL_PROJECT_NAME}.exe'
var VERSION='0.1'
var FULL_VERSION='0.1'
var AUTHORS='Microsoft Open Technologies, Inc.'
-BuildQuality = '';
use-standard-lifecycle
k-standard-goals
#initialize-tools target='initialize'
@{
// workaround bug in dotnet-build for netcore50 on .Tools and .Tools.Core
string restoreOptions = " --infer-runtimes " + E("KOREBUILD_DOTNET_RESTORE_OPTIONS");
}
dotnet-restore restore_options='${ restoreOptions } src/Microsoft.EntityFrameworkCore.Tools/'
#csproj-initialize target='initialize' if='(!IsMono && !IsTeamCity && E("APPVEYOR") == null) || E("IsEFPerfBuild") != null'
var programFilesX86='${Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)}'
var buildProgram='${Path.Combine(programFilesX86, "MSBuild", "14.0", "Bin", "MSBuild.exe")}'
for each='var projectFile in Files.Include("src/**/*.csproj").Include("test/**/*.csproj")'
exec program='${buildProgram}' commandline='${projectFile} /t:GenerateProjectLockTargets /v:m /nologo /p:Configuration=${E("Configuration")}'
#publish-efci-artifacts target="test-compile" if='IsTeamCity'
@{
// produce .NET Core test artifacts for testing
var testProjects = Files.Include("test/Microsoft.EntityFrameworkCore.SqlServer.FunctionalTests/project.json")
.Include("test/Microsoft.EntityFrameworkCore.SqlServer.Design.FunctionalTests/project.json");
var tfm = "netcoreapp1.0";
foreach (var projectFile in testProjects)
{
var projectName = Path.GetFileName(Path.GetDirectoryName(projectFile));
var output = Path.Combine(Directory.GetCurrentDirectory(), "artifacts/tests", projectName, tfm);
Dotnet(string.Format("publish --configuration Release --output {0} --framework {1} {2}", output, tfm, projectFile));
}
}
#repack-cli-tools target='compile' if='Directory.Exists("src")'
@{
if (string.IsNullOrEmpty(CONFIGURATION_LOCAL))
{
CONFIGURATION_LOCAL = "Debug";
}
// Forcing to lower to match the entry in the sources project.json.
var configurationX86 = CONFIGURATION_LOCAL.ToLower() + "_x86";
var projectNupkg = Files
.Include(Path.Combine(BUILD_DIR_LOCAL, CLI_TOOL_PROJECT_NAME + ".1.*.nupkg")) // Assuming the package version starts with 1.
.Where(path => !path.EndsWith(".symbols.nupkg", StringComparison.OrdinalIgnoreCase))
.OrderByDescending(f => f) // On local builds multiple nupkgs are generated.
.First();
Log.Info("Repacking Nupkg: " + projectNupkg);
var extractToDirectory = projectNupkg + "-temp";
ZipFile.ExtractToDirectory(projectNupkg, extractToDirectory);
// don't want the exe in the "lib" folder
File.Delete(Path.Combine(extractToDirectory, "lib/net451", TOOL_EXE_NAME));
File.Delete(Path.Combine(extractToDirectory, "lib/net451", CLI_TOOL_PROJECT_NAME + ".xml"));
var projectDirectory = Path.Combine(BASE_DIR_LOCAL, "src", CLI_TOOL_PROJECT_NAME);
var projectFilePath = Path.Combine(projectDirectory, "project.json");
var projectFile = Files.Include(projectFilePath).Single();
// Generate the x86 exe variation for the nupkg.
DotnetBuild(projectFile, configurationX86, "net451");
var runtimesDirectory = Path.Combine(extractToDirectory, "runtimes");
var win7x86Directory = Path.Combine(runtimesDirectory, "win7-x86", "lib", "net451");
var win7x64Directory = Path.Combine(runtimesDirectory, "win7-x64", "lib", "net451");
Directory.CreateDirectory(win7x86Directory);
Directory.CreateDirectory(win7x64Directory);
var binDirectory = Path.Combine(projectDirectory, "bin");
var x86OutputPath = Path.Combine(binDirectory, configurationX86, "net451");
var x86ExePath = Path.Combine(x86OutputPath, TOOL_EXE_NAME);
var x86ExeDestinationPath = Path.Combine(win7x86Directory, TOOL_EXE_NAME);
File.Copy(x86ExePath, x86ExeDestinationPath);
var x64OutputPath = Path.Combine(binDirectory, CONFIGURATION_LOCAL, "net451");
var x64ExePath = Path.Combine(x64OutputPath, TOOL_EXE_NAME);
var x64ExeDestinationPath = Path.Combine(win7x64Directory, TOOL_EXE_NAME);
File.Copy(x64ExePath, x64ExeDestinationPath);
// repack
var nugetExePath = Path.Combine(BASE_DIR_LOCAL, ".build", "nuget.exe");
var nuspecPath = Path.Combine(extractToDirectory, CLI_TOOL_PROJECT_NAME + ".nuspec");
ExecClr(nugetExePath, "pack " + nuspecPath + " -OutputDirectory " + BUILD_DIR_LOCAL);
try
{
// Delete temporary directory we used to repack.
Directory.Delete(extractToDirectory, true);
}
catch
{
// Don't care if we couldn't delete the temp directory.
}
}