-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.pl
79 lines (63 loc) · 1.51 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
77
78
#!/usr/bin/perl
use strict;
#
# Build script for OrigoDB
# 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('OrigoDB.Modules.ProtoBuf/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 = 'OrigoDB.Modules.Protobuf.sln';
my $output = "build";
my $x = "OrigoDB.Modules.Protobuf/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/* $output");
#remove test assemblies
system("rm $output/*Test*");
},
zip => sub {
chdir "build";
system "\"$sevenZip\" a -r -tzip ../OrigoDB.Modules.Protobuf.binaries.$version-$config.zip *";
chdir "..";
},
pack => sub
{
system("$nuget pack OrigoDB.ProtoBuf.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;
}