This repository has been archived by the owner on Feb 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
makefile.shade
103 lines (82 loc) · 4.52 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
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_PROJECT_NAME='Microsoft.AspNetCore.Razor.Design'
default TOOL_EXE_NAME='Microsoft.AspNetCore.Razor.Design.exe'
default TEST_PROJECT_PACKAGE_NAME='RazorToolingTestApp.LibraryPackage'
default TEST_ARTIFACTS_DIR='${Path.Combine(BASE_DIR_LOCAL, "testartifacts")}'
default TEST_ARTIFACTS_INITIAL_PACKAGE_DIR='${Path.Combine(TEST_ARTIFACTS_DIR, "initialpackages")}'
var VERSION='0.1'
var FULL_VERSION='0.1'
var AUTHORS='Microsoft Open Technologies, Inc.'
-BuildQuality = "preview4";
use-standard-lifecycle
k-standard-goals
default CONFIGURATION_LOCAL='${E("Configuration")}'
#repo-initialize target='initialize'
use-volatile-feed
rimraf rimrafDir='${TEST_ARTIFACTS_INITIAL_PACKAGE_DIR}' if='Directory.Exists(TEST_ARTIFACTS_INITIAL_PACKAGE_DIR)'
@{
Directory.CreateDirectory(TEST_ARTIFACTS_INITIAL_PACKAGE_DIR);
var srcDirectory = Path.Combine(BASE_DIR_LOCAL, "src");
Dotnet("restore " + srcDirectory);
foreach (var directory in Directory.EnumerateDirectories(srcDirectory))
{
Dotnet("pack " + directory + " -o " + TEST_ARTIFACTS_INITIAL_PACKAGE_DIR);
}
// Restore testapps folder locally to ensure all dynamically generated packages have been cached.
var testProjectDirectory = Path.Combine(BASE_DIR_LOCAL, "testapps");
Dotnet("restore " + BASE_DIR_LOCAL + " -f " + TEST_ARTIFACTS_INITIAL_PACKAGE_DIR);
}
#repack-x86 target='compile' if='Directory.Exists("src")'
@{
// 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, 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 projectDirectory = Path.Combine(BASE_DIR_LOCAL, "src", 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);
var nugetExePath = Environment.GetEnvironmentVariable("KOREBUILD_NUGET_EXE");
if (string.IsNullOrEmpty(nugetExePath))
{
nugetExePath = Path.Combine(BASE_DIR_LOCAL, ".build", "nuget.exe");
}
var nuspecPath = Path.Combine(extractToDirectory, 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.
}
}
macro name="DotnetRestore" restoreDir='string'
dotnet-restore