forked from aspnet/Microsoft.Data.Sqlite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile.shade
76 lines (67 loc) · 2.94 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
use assembly='System.IO.Compression, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
use assembly='System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
use assembly='WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
use namespace='System.IO.Compression'
use namespace='System.IO.Packaging'
use namespace='System.Net.Http'
var VERSION='0.1'
var FULL_VERSION='0.1'
var AUTHORS='Microsoft Open Technologies, Inc.'
use-standard-lifecycle
k-standard-goals
var sqliteDllPath='src/Microsoft.Data.Sqlite/redist/x86/sqlite3.dll'
#sqlite-download target='initialize' if='!File.Exists(sqliteDllPath)'
var sqliteUri='http://sqlite.org/2015/sqlite-dll-win32-x86-3080803.zip'
@{
using (var client = new HttpClient())
using (var archiveStream = client.GetStreamAsync(sqliteUri).Result)
using (var archive = new ZipArchive(archiveStream))
{
var entry = archive.GetEntry("sqlite3.dll");
if (entry == null)
throw new FileNotFoundException("Could not find file 'sqlite3.dll'.");
Directory.CreateDirectory(Path.GetDirectoryName(sqliteDllPath));
using (var entryStream = entry.Open())
using (var dllStream = File.OpenWrite(sqliteDllPath))
{
entryStream.CopyTo(dllStream);
}
}
}
copy sourceDir='${Path.GetDirectoryName(sqliteDllPath)}' include='${Path.GetFileName(sqliteDllPath)}' outputDir='test/Microsoft.Data.Sqlite.Tests/bin/Debug'
#nupkg-patch target='compile'
@{
var packagePaths = Files.Include("artifacts/build/**/Microsoft.Data.Sqlite.*.nupkg")
.Exclude("**/*.symbols.nupkg");
foreach (var packagePath in packagePaths)
{
using (var package = Package.Open(packagePath, FileMode.Open, FileAccess.ReadWrite))
{
CreatePartFromFile(
package,
@"src\Microsoft.Data.Sqlite\build\net451\Microsoft.Data.Sqlite.targets",
@"build\net451\Microsoft.Data.Sqlite.targets");
CreatePartFromFile(
package,
@"src\Microsoft.Data.Sqlite\redist\x86\sqlite3.dll",
@"redist\x86\sqlite3.dll");
}
}
}
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;
}
}