-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.pl
77 lines (61 loc) · 1.44 KB
/
build.pl
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
#!/usr/bin/perl
use strict;
#
# Build script for OrigoDB.Models.Redis
# Note:
#
# tools
my $msbuild = 'C:/Windows/Microsoft.NET/Framework/v4.0.30319/msbuild.exe';
my $nuget = "nuget.exe";
my $sevenZip = "C:/Program Files/7-Zip/7z.exe";
my $version = extract('src/Properties/AssemblyInfo.cs');
die "missing or bad version: [$version]\n" unless $version =~ /^\d+\.\d+\.\d+(-[a-z]+)?$/;
my $target = shift || 'default';
my $config = shift || 'Release';
my $solution = 'Models.Redis.sln';
my $output = "build";
my $x = "src/bin/$config/";
sub run;
my $targets = {
default => sub
{
run qw|clean compile copy zip pack|;
},
clean => sub
{
system "rm -fr $output";
mkdir $output;
},
compile => sub
{
system "$msbuild $solution -target:clean,rebuild -p:Configuration=$config -p:NoWarn=1591 > build/build.log";
},
copy => sub
{
system("cp -r $x/OrigoDB.* $output");
#remove test assemblies
system("rm $output/*Test*");
},
zip => sub {
system "\"$sevenZip\" a -r -tzip OrigoDB.Core.binaries.$version-$config.zip build/*";
},
pack => sub
{
system("$nuget pack OrigoDB.Models.Redis.nuspec -OutputDirectory build -version $version -symbols")
}
};
run $target;
sub run
{
for my $targetName (@_) {
die "No such target: $targetName\n" unless exists $targets->{$targetName};
print "target: $targetName\n";
$targets->{$targetName}->();
}
}
sub extract
{
my $file = shift;
`grep AssemblyVersion $file` =~ /(\d+\.\d+\.\d+)/;
$1;
}