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
79
80
81
82
|
#!/usr/bin/perl -w
use strict;
my $git = "C:\\Program Files\\Git\\bin\\git.exe";
my $repo = "C:\\Users\\am\\Documents\\ShemovCleaner";
my $builddir = 'C:\Users\am\Documents\ShemovCleaner-Release';
my $sevenzip = 'C:\Program Files\7-Zip\7z.exe';
my $finaldest = 'C:\Users\am\bin\ShemovCleaner\ShemovCleaner.exe';
chdir $repo;
my $branchcmd = "\"$git\" branch";
my $branch;
open (my $bfh, '-|', $branchcmd);
while(<$bfh>){
if(m#\*\s*(.*)#){
$branch = $1;
}
}
close($bfh);
my $commitcmd = "\"$git\" log -n 1 --format=" . '"%h - %aD" --abbrev-commit --abbrev=12';
open (my $cfh, '-|', $commitcmd);
my $commit = <$cfh>;
close ($cfh);
chomp($commit);
chdir $builddir;
unlink glob "*.*";
chdir "$builddir\\release" or die "horribly";
unlink glob "*.*";
chdir $repo;
my $archivecmd = "\"$git\" archive --format zip -o $builddir\\smc.zip HEAD";
system($archivecmd);
chdir $builddir;
my $unzipcmd = "\"$sevenzip\" x $builddir\\smc.zip";
system($unzipcmd);
open (my $main, '<', "main.cpp");
open (my $main2, '>', "main2.cpp");
while(<$main>){
if(m#__build_info__#){
my $new = $_;
$new =~ s#__build_info__#$branch branch#;
print $main2 $new;
}else{
print $main2 $_;
}
}
close ($main);
close ($main2);
unlink ("main.cpp");
rename ("main2.cpp", "main.cpp");
open (my $cleaner, '<', "shemovcleaner.cpp");
open (my $cleaner2, '>', "shemovcleaner2.cpp");
while(<$cleaner>){
if(m#/\* __debug build__ \*/#){
my $new = $_;
$new =~ s#/\* __debug build__ \*/#$commit#;
print $cleaner2 $new;
}else{
print $cleaner2 $_;
}
}
close ($cleaner);
close ($cleaner2);
unlink ("shemovclenaner.cpp");
rename ("shemovcleaner2.cpp", "shemovcleaner.cpp");
open (my $batch, '>', "make.cmd");
print $batch 'PATH="C:\Qt\5.10.0\mingw53_32\bin;C:\Qt\Tools\mingw530_32\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\OpenVPN\bin;C:\Progr Files (x86)\GNU\GnuPG\pub;C:\Program Files\Git\cmd;C:\psql\10.1\lib;C:\psql\10.1\bin;C:\psql\10.1include"', "\n";
print $batch 'C:\Qt\5.10.0\mingw53_32\bin\qmake.exe ShemovCleaner.pro -r -spec win32-g++', "\n";
//print $batch 'C:\Qt\5.10.0\mingw53_32\bin\qmake.exe ShemovCleaner.pro', "\n";
print $batch 'C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe -j 5', "\n";
print $batch 'copy /Y release\ShemovCleaner.exe ', $finaldest;
close($batch);
system("make.cmd");
|