forked from dotnet/efcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile.shade
More file actions
158 lines (126 loc) · 7.26 KB
/
Copy pathmakefile.shade
File metadata and controls
158 lines (126 loc) · 7.26 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
use namespace="System.IO"
use namespace="System.IO.Compression"
use namespace="System.Linq"
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.Design'
default TOOL_EXE_NAME='${CLI_TOOL_PROJECT_NAME}.exe'
default NUGET_EXE_PATH='${E("KOREBUILD_NUGET_EXE") ?? Path.Combine(BASE_DIR_LOCAL, ".build", "nuget.exe")}'
var VERSION='0.1'
var FULL_VERSION='0.1'
var AUTHORS='Microsoft Open Technologies, Inc.'
-BuildQuality = '';
use-standard-lifecycle
k-standard-goals
#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-tools target='compile' if='Directory.Exists("src") && !IsTravisCi'
@{
// copies the net451 target for UWP, minus the dependency on CLI tooling
var projectNupkg = Files
.Include(Path.Combine(BUILD_DIR_LOCAL, TOOL_PACKAGE_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);
var nuspecFile = Files.Include(Path.Combine(extractToDirectory, "*.nuspec")).First();
var nuspec = new List<string>(File.ReadAllLines(nuspecFile));
var uap = nuspec.SkipWhile(l => !l.Contains("<group targetFramework=\".NETFramework4.5.1"))
.TakeWhile(l => !l.Contains("</group>"))
.ToList();
uap[0] = uap[0].Replace(".NETFramework4.5.1", ".NETCore5.0");
uap.Add(" </group>");
var dependencies = Array.FindIndex<string>(nuspec.ToArray(), l => l.Contains("<dependencies>"));
nuspec.InsertRange(dependencies + 1, uap);
nuspec.Insert(dependencies - 1, " <developmentDependency>true</developmentDependency>");
File.WriteAllLines(nuspecFile, nuspec);
// repack
var nuspecPath = Path.Combine(extractToDirectory, TOOL_PACKAGE_NAME + ".nuspec");
ExecClr(NUGET_EXE_PATH, "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.
}
}
#repack-design-package target='compile' if='Directory.Exists("src") && !IsTravisCi'
@{
var configurationX86 = E("Configuration").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);
var nuspecFile = Files.Include(Path.Combine(extractToDirectory, "*.nuspec")).First();
var nuspec = new List<string>(File.ReadAllLines(nuspecFile));
var uap = nuspec.SkipWhile(l => !l.Contains("<group targetFramework=\".NETFramework4.5.1"))
.TakeWhile(l => !l.Contains("</group>"))
.Where(l => !l.Contains("Microsoft.Extensions.CommandLineUtils"))
.ToList();
uap[0] = uap[0].Replace(".NETFramework4.5.1", ".NETCore5.0");
uap.Add(" </group>");
var dependencies = Array.FindIndex<string>(nuspec.ToArray(), l => l.Contains("<dependencies>"));
nuspec.InsertRange(dependencies + 1, uap);
nuspec.Insert(dependencies - 1, " <developmentDependency>true</developmentDependency>");
File.WriteAllLines(nuspecFile, nuspec);
// 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, E("Configuration"), "net451");
var x64ExePath = Path.Combine(x64OutputPath, TOOL_EXE_NAME);
var x64ExeDestinationPath = Path.Combine(win7x64Directory, TOOL_EXE_NAME);
File.Copy(x64ExePath, x64ExeDestinationPath);
// repack
var nuspecPath = Path.Combine(extractToDirectory, CLI_TOOL_PROJECT_NAME + ".nuspec");
ExecClr(NUGET_EXE_PATH, "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.
}
}