forked from dotnet/efcore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile.shade
88 lines (79 loc) · 3.65 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
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
#write-package-references target='initialize' if='!IsMono'
var programFilesX86='${Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)}'
var buildProgram='${Path.Combine(programFilesX86, "MSBuild", "12.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'
@{
var packagesDir = Environment.GetEnvironmentVariable("KRE_PACKAGES")
?? Path.Combine(
Environment.GetEnvironmentVariable("USERPROFILE") ?? Environment.GetEnvironmentVariable("HOME"),
".kpm",
"packages");
}
var sqliteTestDir='test/EntityFramework.SQLite.FunctionalTests/bin/Debug'
#copy-sqlite target='initialize' if='!IsMono && !File.Exists(sqliteTestDir + "/sqlite3.dll")'
var sourceDir='${Directory.EnumerateDirectories(packagesDir, "Microsoft.Data.SQLite/*").OrderByDescending(d => d).First() + "/redist/x86"}'
copy outputDir='${sqliteTestDir}'
#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-net451+win81+wpa81\EntityFramework.Commands.targets",
@"build\portable-net451+win81+wpa81\EntityFramework.Commands.targets");
CreatePartFromFile(
package,
@"src\EntityFramework.Commands\lib\portable-net451+win81+wpa81\_._",
@"lib\portable-net451+win81+wpa81\_._");
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");
}
}
}
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;
}
}