Use new packInclude feature to include native assets

- Now Kestrel won't break when people overwrite the build.cmd
This commit is contained in:
David Fowler 2015-09-19 03:59:58 -07:00
parent 3470c6206a
commit 891b991a34
3 changed files with 50 additions and 86 deletions

View File

@ -9,7 +9,6 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Server.Kes
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7972A5D6-3385-4127-9277-428506DD44FF}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7972A5D6-3385-4127-9277-428506DD44FF}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
build\_custom-goals.shade = build\_custom-goals.shade
build.cmd = build.cmd build.cmd = build.cmd
global.json = global.json global.json = global.json
makefile.shade = makefile.shade makefile.shade = makefile.shade

View File

@ -1,40 +0,0 @@
use assembly="System.IO.Compression.FileSystem, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
use assembly="System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
use namespace="System.IO"
use namespace="System.IO.Compression"
use namespace="System.Net"
#add-files target="compile"
var each='var nupkgFile in Files.Include("artifacts\\build\\Microsoft.AspNet.Server.Kestrel.*.nupkg").Where(x=>!x.EndsWith("symbols.nupkg"))'
log info='Adding content to ${nupkgFile}'
var archive='${ZipFile.Open(nupkgFile, ZipArchiveMode.Update)}'
@{
archive.CreateEntryFromFile(
"src/Microsoft.AspNet.Server.Kestrel/native/windows/amd64/libuv.dll",
"native/windows/amd64/libuv.dll");
archive.CreateEntryFromFile(
"src/Microsoft.AspNet.Server.Kestrel/native/windows/x86/libuv.dll",
"native/windows/x86/libuv.dll");
archive.CreateEntryFromFile(
"src/Microsoft.AspNet.Server.Kestrel/native/darwin/universal/libuv.dylib",
"native/darwin/universal/libuv.dylib");
XDocument doc;
var entry = archive.GetEntry("[Content_Types].xml");
using (var stream = entry.Open())
{
doc = XDocument.Load(stream);
}
doc.Root.Add(
new XElement(
XName.Get("Default", "http://schemas.openxmlformats.org/package/2006/content-types"),
new XAttribute("Extension", "dylib"),
new XAttribute("ContentType", "application/octet")
));
using (var stream = entry.Open())
{
doc.Save(stream);
}
archive.Dispose();
}

View File

@ -44,5 +44,10 @@
"dnu restore ../../tools/Microsoft.AspNet.Server.Kestrel.GeneratedCode", "dnu restore ../../tools/Microsoft.AspNet.Server.Kestrel.GeneratedCode",
"dnx --appbase ../../tools/Microsoft.AspNet.Server.Kestrel.GeneratedCode Microsoft.Dnx.ApplicationHost run Http/FrameHeaders.Generated.cs" "dnx --appbase ../../tools/Microsoft.AspNet.Server.Kestrel.GeneratedCode Microsoft.Dnx.ApplicationHost run Http/FrameHeaders.Generated.cs"
] ]
},
"packInclude": {
"native/darwin/universal/": "native/darwin/universal/*",
"native/windows/amd64/": "native/windows/amd64/*",
"native/windows/x86/": "native/windows/x86/*"
} }
} }