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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
|
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="GetBuildUid" TaskFactory="CodeTaskFactory" AssemblyName="Microsoft.Build.Tasks.v12.0">
<ParameterGroup>
<BuildUid ParameterType="System.String" Output="true" />
</ParameterGroup>
<Task>
<Code>
BuildUid = System.Guid.NewGuid().ToString().Replace("-", "").Substring(0, 8);
</Code>
</Task>
</UsingTask>
<Target Name="BuildNuGetPackages" AfterTargets="Build">
<!-- This is to fool the machine local DNX cache so each build is treated as unique. %USERPROFILE%\.dnx -->
<GetBuildUid>
<Output PropertyName="BuildUid" TaskParameter="BuildUid" />
</GetBuildUid>
<!-- Property needed for creating nupkgs -->
<PropertyGroup>
<ToolchainMilestone Condition="'$(ToolchainMilestone)'==''">prerelease</ToolchainMilestone>
<ToolchainVersion>1.0.4-$(ToolchainMilestone)-00001</ToolchainVersion>
<RuntimeSdkVersion>$(ToolchainVersion)</RuntimeSdkVersion>
<NuPkgRid>$(NuPkgRuntimeOS)-$(NuPkgRuntimePlatform)</NuPkgRid>
<ToolchainPackageName>Microsoft.DotNet.ILCompiler</ToolchainPackageName>
<RuntimeSdkPackageNameSuffix Condition="'$(Configuration)'=='Debug'">.Debug</RuntimeSdkPackageNameSuffix>
<RuntimeSdkPackageName>Microsoft.DotNet.ILCompiler.SDK$(RuntimeSdkPackageNameSuffix)</RuntimeSdkPackageName>
<!-- Uniqify package name per machine-local DNX cache for development purposes -->
<ToolchainPackageName Condition="'$(ToolchainMilestone)'=='testing'">$(ToolchainPackageName).$(BuildUid)</ToolchainPackageName>
<RuntimeSdkPackageName Condition="'$(ToolchainMilestone)'=='testing'">$(RuntimeSdkPackageName).$(BuildUid)</RuntimeSdkPackageName>
<LibPrefix Condition="'$(OsEnvironment)'!='Windows_NT'">lib</LibPrefix>
<StaticLibExt Condition="'$(OsEnvironment)'=='Windows_NT'">lib</StaticLibExt>
<StaticLibExt Condition="'$(OsEnvironment)'!='Windows_NT'">a</StaticLibExt>
</PropertyGroup>
<ItemGroup>
<!-- IL.Compiler target files -->
<ILCompilerFiles Include="ilc.exe" />
<ILCompilerFiles Include="ILCompiler.Compiler.dll" />
<ILCompilerFiles Include="ILCompiler.DependencyAnalysisFramework.dll" />
<ILCompilerFiles Include="ILCompiler.TypeSystem.dll" />
<ILCompilerBinPlace Include="@(ILCompilerFiles)">
<Text><![CDATA[ <file src="$(RelativeProductBinDir)/%(Identity)" target="runtimes/any/lib/dotnet/%(Identity)" /> ]]></Text>
</ILCompilerBinPlace>
<ILCompilerNativeFiles Include="jitinterface.dll" Condition="'$(OSGroup)'=='Windows_NT'" />
<ILCompilerNativeFiles Include="jitinterface.so" Condition="'$(OSGroup)'=='Linux'" />
<ILCompilerNativeFiles Include="jitinterface.dylib" Condition="'$(OSGroup)'=='OSX'" />
<ILCompilerBinPlace Include="@(ILCompilerNativeFiles)">
<Text><![CDATA[ <file src="$(RelativeProductBinDir)/%(Identity)" target="runtimes/$(NuPkgRid)/native/%(Identity)" /> ]]></Text>
</ILCompilerBinPlace>
<!-- IL.Compiler.SDK target files -->
<ILCompilerSdkFiles Include="Runtime" />
<ILCompilerSdkFiles Include="PortableRuntime" />
<ILCompilerSdkFiles Include="bootstrapper" />
<ILCompilerSdkFiles Include="bootstrappercpp" />
<ILCompilerSdkFiles Include="System.Private.CoreLib.Native" Condition="'$(OsEnvironment)'!='Windows_NT'" />
<!-- ILCompiler.SDK Cpp Codegen support files -->
<ILCompilerSdkCppCodegenFiles Include="Native/inc/unix/sal.h" />
<ILCompilerSdkCppCodegenFiles Include="Native/gc/env/gcenv.base.h" />
<ILCompilerSdkCppCodegenFiles Include="Native/gc/env/gcenv.structs.h" />
<ILCompilerSdkCppCodegenFiles Include="Native/Bootstrap/common.h" />
<ILCompilerSdkFilesManaged Include="System.Private.CoreLib" />
<ILCompilerSdkFilesManaged Include="System.Private.DeveloperExperience.Console" />
<ILCompilerSdkFilesManaged Include="System.Private.Interop" />
<ILCompilerSdkFilesManaged Include="System.Private.Reflection" />
<ILCompilerSdkFilesManaged Include="System.Private.Reflection.Core" />
<ILCompilerSdkFilesManaged Include="System.Private.Reflection.Execution" />
<ILCompilerSdkFilesManaged Include="System.Private.Reflection.Metadata" />
<ILCompilerSdkFilesManaged Include="System.Private.StackTraceGenerator" />
<ILCompilerSdkFilesManaged Include="System.Private.Threading" />
<ILCompilerSdkBinPlace Include="@(ILCompilerSdkFiles)">
<Text><![CDATA[ <file src="$(RelativeProductBinDir)/lib/$(LibPrefix)%(Identity).$(StaticLibExt)" target="runtimes/$(NuPkgRid)/native/sdk/$(LibPrefix)%(Identity).$(StaticLibExt)" /> ]]></Text>
</ILCompilerSdkBinPlace>
<ILCompilerSdkBinPlace Include="@(ILCompilerSdkFilesManaged)">
<Text><![CDATA[ <file src="$(RelativeProductBinDir)/%(Identity).dll" target="runtimes/$(NuPkgRid)/native/sdk/%(Identity).dll" /> ]]></Text>
</ILCompilerSdkBinPlace>
<ILCompilerSdkBinPlace Include="@(ILCompilerSdkCppCodegenFiles)">
<Text><![CDATA[ <file src="src/%(Identity)" target="runtimes/$(NuPkgRid)/native/inc/%(Filename)%(Extension)" /> ]]></Text>
</ILCompilerSdkBinPlace>
<!-- ILCompiler nuspec file -->
<NuSpecFile Include="$(ToolchainPackageName)">
<Stage>0</Stage>
<Version>$(ToolchainVersion)</Version>
<Title>Microsoft .NET Native Toolchain</Title>
<Description>Provides the toolchain to compile managed code to native.</Description>
<Files>@(ILCompilerBinPlace -> '%(Text)', '')</Files>
<!-- TODO: Obtain this from project.lock.json -->
<Dependencies><![CDATA[
<dependency id="Microsoft.DiaSymReader" version="1.0.6" />
<dependency id="Microsoft.DotNet.ObjectWriter" version="1.0.3-prerelease-00001" />
<dependency id="Microsoft.DotNet.RyuJit" version="1.0.3-prerelease-00001" />
<dependency id="System.AppContext" version="4.0.0" />
<dependency id="System.Collections" version="4.0.10" />
<dependency id="System.Collections.Concurrent" version="4.0.10" />
<dependency id="System.Collections.Immutable" version="1.1.37" />
<dependency id="System.Console" version="4.0.0-rc2-23616" />
<dependency id="System.Diagnostics.Debug" version="4.0.10" />
<dependency id="System.Diagnostics.Tracing" version="4.0.20" />
<dependency id="System.IO" version="4.0.10" />
<dependency id="System.IO.FileSystem" version="4.0.0" />
<dependency id="System.IO.MemoryMappedFiles" version="4.0.0-rc2-23616" />
<dependency id="System.Linq" version="4.0.0" />
<dependency id="System.Reflection" version="4.0.10" />
<dependency id="System.Reflection.Extensions" version="4.0.0" />
<dependency id="System.Reflection.Metadata" version="1.1.0" />
<dependency id="System.Reflection.Primitives" version="4.0.0" />
<dependency id="System.Resources.ResourceManager" version="4.0.0" />
<dependency id="System.Runtime" version="4.0.20" />
<dependency id="System.Runtime.Extensions" version="4.0.10" />
<dependency id="System.Runtime.InteropServices" version="4.0.20" />
<dependency id="System.Text.Encoding" version="4.0.10" />
<dependency id="System.Text.Encoding.Extensions" version="4.0.10" />
<dependency id="System.Threading" version="4.0.10" />
<dependency id="System.Threading.Tasks" version="4.0.10" />
<dependency id="System.Xml.ReaderWriter" version="4.0.0" />
<dependency id="System.Runtime.InteropServices.RuntimeInformation" version="4.0.0-beta-23504" />
]]></Dependencies>
</NuSpecFile>
<!-- ILCompiler.SDK nuspec file -->
<NuSpecFile Include="$(RuntimeSdkPackageName)">
<Stage>1</Stage>
<Version>$(RuntimeSdkVersion)</Version>
<Title>Microsoft .NET Native Runtime SDK</Title>
<Description>Provides the runtime and link libraries to compile managed code to native.</Description>
<Files>@(ILCompilerSdkBinPlace -> '%(Text)', '')</Files>
<Dependencies><![CDATA[
<dependency id="$(ToolchainPackageName)" version="$(ToolchainVersion)"/>]]>
</Dependencies>
</NuSpecFile>
<!-- A pair of platform and runtime package info per nuspec file -->
<NuSpecFileGroup Include="@(NuSpecFile)">
<Stage>%(Stage)</Stage>
<RedirPackage>%(Identity)</RedirPackage>
<Version>%(Version)</Version>
<PlatformPackage>toolchain.$(NuPkgRid).%(Identity)</PlatformPackage>
<NuSpecPackageMetadata><![CDATA[
<version>%(Version)</version>
<title>%(Title)</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<licenseUrl>http://go.microsoft.com/fwlink/?LinkId=329770</licenseUrl>
<projectUrl>https://github.com/dotnet/corert</projectUrl>
<iconUrl>http://go.microsoft.com/fwlink/?LinkID=288859</iconUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<description>%(Description)</description>
<releaseNotes>Initial release</releaseNotes>
<copyright>Copyright ©%3B Microsoft Corporation</copyright>
<dependencies>
%(Dependencies)
</dependencies>]]>
</NuSpecPackageMetadata>
<PlatformPkgFiles>%(Files)</PlatformPkgFiles>
</NuSpecFileGroup>
<!-- NuSpecCollection: A collection of NuSpecFileGroup -->
<NuSpecCollection Include="@(NuSpecFileGroup)">
<Stage>%(Stage)</Stage>
<RuntimeJsonFile>$(ProductPackageDir)/%(RedirPackage).runtime.json</RuntimeJsonFile>
<RuntimeJsonLines><![CDATA[
{
"runtimes": {
"win7-x64": {
"%(RedirPackage)": {
"toolchain.win7-x64.%(RedirPackage)": "%(Version)"
}
},
"osx.10.10-x64": {
"%(RedirPackage)": {
"toolchain.osx.10.10-x64.%(RedirPackage)": "%(Version)"
}
},
"ubuntu.14.04-x64": {
"%(RedirPackage)": {
"toolchain.ubuntu.14.04-x64.%(RedirPackage)": "%(Version)"
}
}
}
}]]>
</RuntimeJsonLines>
<RedirFile>$(ProductPackageDir)/%(RedirPackage).nuspec</RedirFile>
<RedirLines><![CDATA[<?xml version="1.0"?>
<package>
<metadata>
<id>%(RedirPackage)</id>
%(NuSpecPackageMetadata)
</metadata>
<files>
<file src="$(RelativeProductBinDir)/.nuget/%(RedirPackage).runtime.json" target="runtime.json"></file>
</files>
</package>
]]>
</RedirLines>
<PlatformFile>$(ProductPackageDir)/%(PlatformPackage).nuspec</PlatformFile>
<PlatformLines><![CDATA[<?xml version="1.0"?>
<package>
<metadata>
<id>%(PlatformPackage)</id>
%(NuSpecPackageMetadata)
</metadata>
<files>
%(PlatformPkgFiles)
</files>
</package>
]]>
</PlatformLines>
</NuSpecCollection>
</ItemGroup>
<!-- Recreate the package dir -->
<RemoveDir Directories="$(ProductPackageDir)" />
<MakeDir Directories="$(ProductPackageDir)" Condition="!Exists('$(ProductPackageDir)')" />
<!-- =================== stage0 ==================== -->
<!-- Write the runtime.json redirection package and the runtime platform file -->
<WriteLinesToFile File="%(NuSpecCollection.RuntimeJsonFile)" Lines="%(NuSpecCollection.RuntimeJsonLines)" Overwrite="true" Condition="'%(NuSpecCollection.Stage)'=='0'" />
<WriteLinesToFile File="%(NuSpecCollection.PlatformFile)" Lines="%(NuSpecCollection.PlatformLines)" Overwrite="true" Condition="'%(NuSpecCollection.Stage)'=='0'" />
<WriteLinesToFile File="%(NuSpecCollection.RedirFile)" Lines="%(NuSpecCollection.RedirLines)" Overwrite="true" Condition="'%(NuSpecCollection.Stage)'=='0'" />
<ItemGroup>
<Stage0NuSpecs Include="%(NuSpecCollection.PlatformFile)" Condition="'%(NuSpecCollection.Stage)'=='0'" />
<Stage0NuSpecs Include="%(NuSpecCollection.RedirFile)" Condition="'%(NuSpecCollection.Stage)'=='0'" />
</ItemGroup>
<Exec Command=""$(NuGetToolPath)" pack "%(Stage0NuSpecs.Identity)" -NoPackageAnalysis -NoDefaultExcludes -BasePath "$(RepoPath)" -OutputDirectory "$(ProductPackageDir)"" />
<PropertyGroup>
<Stage0ProjectDir>$(ProductPackageDir)stage0/</Stage0ProjectDir>
<Stage0PublishDir>$(ProductPackageDir)publish0/</Stage0PublishDir>
<Stage0ProjectJsonFile>$(Stage0ProjectDir)project.json</Stage0ProjectJsonFile>
<Stage0ProjectJsonLines><![CDATA[
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true,
},
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1-beta-23504",
"Microsoft.NETCore.Runtime": "1.0.1-beta-23504",
"Microsoft.NETCore.TestHost": "1.0.0-beta-23504",
"toolchain.$(NuPkgRid).$(ToolchainPackageName)": "$(ToolchainVersion)",
},
"frameworks": {
"dnxcore50": { }
}
}]]>
</Stage0ProjectJsonLines>
</PropertyGroup>
<MakeDir Directories="$(Stage0ProjectDir)" Condition="!Exists('$(Stage0ProjectDir)')" />
<WriteLinesToFile File="$(Stage0ProjectJsonFile)" Lines="$(Stage0ProjectJsonLines)" Overwrite="true" />
<WriteLinesToFile File="$(Stage0ProjectDir)/Program.cs" Lines="class Program { public static void Main() { } }" Overwrite="true" />
<Exec Command=""$(DnuToolPath)" restore -s "$(ProductPackageDir)" $(DnuRestoreSource) "$(Stage0ProjectDir)" --runtime "$(NuPkgRid)"" />
<Exec Command=""$(DnuToolPath)" publish "$(Stage0ProjectDir)" --native-subdirectory -o "$(Stage0PublishDir)" -f "dnxcore50" --runtime "$(NuPkgRid)"" />
<!-- =================== self-host ================= -->
<!-- Use stage0 ilc.exe/corerun to compile stage1 runtime libs -->
<!-- =================== stage1 ==================== -->
<!-- Write the runtime.json redirection package and the runtime platform file -->
<WriteLinesToFile File="%(NuSpecCollection.RuntimeJsonFile)" Lines="%(NuSpecCollection.RuntimeJsonLines)" Overwrite="true" Condition="'%(NuSpecCollection.Stage)'=='1'" />
<WriteLinesToFile File="%(NuSpecCollection.PlatformFile)" Lines="%(NuSpecCollection.PlatformLines)" Overwrite="true" Condition="'%(NuSpecCollection.Stage)'=='1'" />
<WriteLinesToFile File="%(NuSpecCollection.RedirFile)" Lines="%(NuSpecCollection.RedirLines)" Overwrite="true" Condition="'%(NuSpecCollection.Stage)'=='1'" />
<ItemGroup>
<Stage1NuSpecs Include="%(NuSpecCollection.PlatformFile)" Condition="'%(NuSpecCollection.Stage)'=='1'" />
<Stage1NuSpecs Include="%(NuSpecCollection.RedirFile)" Condition="'%(NuSpecCollection.Stage)'=='1'" />
</ItemGroup>
<Exec Command=""$(NuGetToolPath)" pack "%(Stage1NuSpecs.Identity)" -NoPackageAnalysis -NoDefaultExcludes -BasePath "$(RepoPath)" -OutputDirectory "$(ProductPackageDir)"" />
<PropertyGroup>
<Stage1ProjectDir>$(ProductPackageDir)stage1/</Stage1ProjectDir>
<Stage1PublishDir>$(ProductPackageDir)publish1/</Stage1PublishDir>
<Stage1ProjectJsonFile>$(Stage1ProjectDir)project.json</Stage1ProjectJsonFile>
<Stage1ProjectJsonLines><![CDATA[
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true,
},
"dependencies": {
"Microsoft.NETCore.Platforms": "1.0.1-beta-23504",
"Microsoft.NETCore.Runtime": "1.0.1-beta-23504",
"Microsoft.NETCore.TestHost": "1.0.0-beta-23504",
"toolchain.$(NuPkgRid).$(RuntimeSdkPackageName)": "$(RuntimeSdkVersion)",
},
"frameworks": {
"dnxcore50": { }
}
}]]>
</Stage1ProjectJsonLines>
</PropertyGroup>
<MakeDir Directories="$(Stage1ProjectDir)" Condition="!Exists('$(Stage1ProjectDir)')" />
<WriteLinesToFile File="$(Stage1ProjectJsonFile)" Lines="$(Stage1ProjectJsonLines)" Overwrite="true" />
<WriteLinesToFile File="$(Stage1ProjectDir)/Program.cs" Lines="class Program { public static void Main() { } }" Overwrite="true" />
<Exec Command=""$(DnuToolPath)" restore -s "$(ProductPackageDir)" $(DnuRestoreSource) "$(Stage1ProjectDir)" --runtime "$(NuPkgRid)"" />
<Exec Command=""$(DnuToolPath)" publish "$(Stage1ProjectDir)" --native-subdirectory -o "$(Stage1PublishDir)" -f "dnxcore50" --runtime "$(NuPkgRid)"" />
</Target>
</Project>
|