forked from dotnet/efcore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile.shade
149 lines (134 loc) · 6.34 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
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
use assembly='WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
use namespace='System.IO.Packaging'
var VERSION='0.1'
var FULL_VERSION='0.1'
var AUTHORS='Microsoft Open Technologies, Inc.'
use-standard-lifecycle
k-standard-goals
#compile-tests target='test-compile'
@{
var BASE_DIR = Directory.GetCurrentDirectory();
var TARGET_DIR = Path.Combine(BASE_DIR, "artifacts");
var BUILD_DIR = Path.Combine(TARGET_DIR, "build");
var Configuration = E("Configuration") ?? "Debug";
var projectFiles = Files.Include("test/EntityFramework.Relational.FunctionalTests/project.json")
.Include("test/EntityFramework.Core.FunctionalTests/project.json");
if (ShouldRunInParallel)
{
Parallel.ForEach(projectFiles, projectFile => DnuPack(projectFile, BUILD_DIR, Configuration));
}
else
{
foreach (var projectFile in projectFiles)
{
DnuPack(projectFile, BUILD_DIR, Configuration);
}
}
foreach (var nupkg in Files.Include(Path.Combine(BUILD_DIR, "*.FunctionalTests/*.nupkg")))
{
File.Copy(nupkg, Path.Combine(BUILD_DIR, Path.GetFileName(nupkg)), true);
}
}
#write-package-references target='initialize' if='!IsMono && !IsTeamCity'
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:WritePackageReferences /v:m /nologo /p:Configuration=${E("Configuration")}'
#nuget-restore target='initialize' if='!IsMono && !IsTeamCity'
exec-clr program='.nuget/NuGet.exe' commandline='restore EntityFramework.sln'
@{
var packagesDir = Environment.GetEnvironmentVariable("DNX_PACKAGES")
?? Path.Combine(
Environment.GetEnvironmentVariable("USERPROFILE") ?? Environment.GetEnvironmentVariable("HOME"),
".dnx",
"packages");
}
var sqliteTestDir='test/EntityFramework.Sqlite.FunctionalTests/bin/${E("Configuration")}/x86'
#copy-sqlite target='initialize' if='!IsMono && !IsTeamCity && !File.Exists(sqliteTestDir + "/sqlite3.dll")'
var sourceDir='${Directory.EnumerateDirectories(packagesDir, "Microsoft.Data.Sqlite/*").OrderByDescending(d => d).First() + "/redist/x86"}'
copy outputDir='${sqliteTestDir}'
copy outputDir='test/EntityFramework.CrossStore.FunctionalTests/bin/${E("Configuration")}/x86'
#nuspec-pack target="compile"
var DNX_BUILD_VERSION='${E("DNX_BUILD_VERSION")}'
var DNX_AUTHOR='${E("DNX_AUTHOR")}'
nuget-pack each='var nuspecFile in Files.Include("src/**/*.nuspec")' outputDir='artifacts/build' extra='-Properties "star=${DNX_BUILD_VERSION};author=${DNX_AUTHOR}"'
#nupkg-patch target='compile'
@{
var packagePaths = Files.Include("artifacts/build/**/EntityFramework.Commands.*.nupkg")
.Exclude("**/*.symbols.nupkg");
foreach (var packagePath in packagePaths)
{
using (var package = Package.Open(packagePath, FileMode.Open, FileAccess.ReadWrite))
{
CreatePartFromFile(
package,
@"src\EntityFramework.Commands\build\portable-net45+win\EntityFramework.Commands.targets",
@"build\portable-net45+win\EntityFramework.Commands.targets");
CreatePartFromFile(
package,
@"src\EntityFramework.Commands\lib\portable-net45+win\_._",
@"lib\portable-net45+win\_._");
CreatePartFromFile(
package,
@"src\EntityFramework.Commands\tools\about_EntityFramework.help.txt",
@"tools\about_EntityFramework.help.txt");
CreatePartFromFile(
package,
@"src\EntityFramework.Commands\tools\EntityFramework.psd1",
@"tools\EntityFramework.psd1");
CreatePartFromFile(
package,
@"src\EntityFramework.Commands\tools\EntityFramework.psm1",
@"tools\EntityFramework.psm1");
CreatePartFromFile(
package,
@"src\EntityFramework.Commands\tools\Handlers.cs",
@"tools\Handlers.cs");
CreatePartFromFile(
package,
@"src\EntityFramework.Commands\IHandlers.cs",
@"tools\IHandlers.cs");
CreatePartFromFile(
package,
@"src\EntityFramework.Commands\tools\init.ps1",
@"tools\init.ps1");
CreatePartFromFile(
package,
@"src\EntityFramework.Commands\tools\install.ps1",
@"tools\install.ps1");
}
}
packagePaths = Files.Include("artifacts/build/**/EntityFramework.Relational.Design.*.nupkg")
.Exclude("**/*.symbols.nupkg");
foreach (var packagePath in packagePaths)
{
using (var package = Package.Open(packagePath, FileMode.Open, FileAccess.ReadWrite))
{
CreatePartFromFile(
package,
@"src\EntityFramework.Relational.Design\build\portable-net45+win\EntityFramework.Relational.Design.targets",
@"build\portable-net45+win\EntityFramework.Relational.Design.targets");
CreatePartFromFile(
package,
@"src\EntityFramework.Relational.Design\lib\portable-net45+win\_._",
@"lib\portable-net45+win\_._");
}
}
}
functions
@{
PackagePart CreatePartFromFile(
Package destination,
string sourceFileName,
string partUriString)
{
var partUri = PackUriHelper.CreatePartUri(new Uri(partUriString, UriKind.Relative));
var packagePart = destination.CreatePart(partUri, "application/octet", CompressionOption.Maximum);
using (var sourceStream = File.OpenRead(sourceFileName))
using (var stream = packagePart.GetStream())
{
sourceStream.CopyTo(stream);
}
return packagePart;
}
}