Moving native resources, updating loading code

This commit is contained in:
Louis DeJardin 2014-06-27 19:33:48 -07:00
parent 63637be073
commit 08a3685f53
5 changed files with 41 additions and 12 deletions

View File

@ -9,7 +9,14 @@ use namespace="System.Net"
log info='Adding content to ${nupkgFile}' log info='Adding content to ${nupkgFile}'
var archive='${ZipFile.Open(nupkgFile, ZipArchiveMode.Update)}' var archive='${ZipFile.Open(nupkgFile, ZipArchiveMode.Update)}'
@{ @{
archive.CreateEntryFromFile("src/Microsoft.AspNet.Server.Kestrel/amd64/libuv.dll", "amd64/libuv.dll"); archive.CreateEntryFromFile(
archive.CreateEntryFromFile("src/Microsoft.AspNet.Server.Kestrel/x86/libuv.dll", "x86/libuv.dll"); "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");
archive.Dispose(); archive.Dispose();
} }

View File

@ -21,17 +21,39 @@ namespace Microsoft.AspNet.Server.Kestrel
Memory = new MemoryPool(); Memory = new MemoryPool();
Libuv = new Libuv(); Libuv = new Libuv();
var library = libraryManager.GetLibraryInformation("Microsoft.AspNet.Server.Kestrel"); var libraryPath = default(string);
var libraryPath = library.Path;
if (library.Type == "Project")
{
libraryPath = Path.GetDirectoryName(libraryPath);
}
var architecture = IntPtr.Size == 4
? "x86"
: "amd64";
libraryPath = Path.Combine(libraryPath, architecture, "libuv.dll");
if (libraryManager != null)
{
var library = libraryManager.GetLibraryInformation("Microsoft.AspNet.Server.Kestrel");
libraryPath = library.Path;
if (library.Type == "Project")
{
libraryPath = Path.GetDirectoryName(libraryPath);
}
if (Libuv.IsWindows)
{
var architecture = IntPtr.Size == 4
? "x86"
: "amd64";
libraryPath = Path.Combine(
libraryPath,
"native",
"windows",
architecture,
"libuv.dll");
}
else
{
libraryPath = Path.Combine(
libraryPath,
"native",
"darwin",
"universal",
"libuv.dylib");
}
}
Libuv.Load(libraryPath); Libuv.Load(libraryPath);
} }