forked from dotnet/efcore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile.shade
79 lines (70 loc) · 3.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
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 && !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")}'
@{
var packagesDir = Environment.GetEnvironmentVariable("DOTNET_PACKAGES")
?? Path.Combine(
Environment.GetEnvironmentVariable("USERPROFILE") ?? Environment.GetEnvironmentVariable("HOME"),
".dotnet",
"packages");
}
#nuspec-pack target="compile"
var K_BUILD_VERSION='${E("K_BUILD_VERSION")}'
nuget-pack each='var nuspecFile in Files.Include("src/**/*.nuspec")' outputDir='artifacts/build' extra='-Properties "star=${K_BUILD_VERSION};author=${AUTHORS}"'
#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\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;
}
}