forked from justin-espedal/polydes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.seb
115 lines (90 loc) · 2.91 KB
/
.seb
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
//SETUP
var baseDir = dir();
// HELPERS
var getBuildProp = function(propertyName:String):String
{
return grep("build.xml", 'property name="' + propertyName + '" value="(.*)"');
};
var getVersionProp = function(propertyName:String):String
{
return grep(".version", propertyName + '=(.*)');
};
var getInfoProp = function(propertyName:String):String
{
return grep("info.txt", propertyName + '=(.*)');
};
var removeEmpty = function(input:Array<String>):Array<String>
{
return input.split("\n").filter(function(s) return s.length > 0).join("\n");
};
// OPERATIONS
var rebuildToolsetExtension = function():Void
{
var pkg=getBuildProp("pkg");
var id=pkg.split("/").join(".");
var hash = getVersionProp("hash");
if(ant().exitCode != 0)
return;
var output = (hash != "") ?
git("log", "--format=%s", hash + '...HEAD', "--", ".").output :
"Initial Repository Version.";
File.saveContent(dir() + '/changes', removeEmpty(output));
srm("add", Path.normalize(baseDir + '/dist/' + id + '.jar'), dir() + '/changes');
var semver = getBuildProp("version");
var hash = git("log", "-1", "--format=%H").output;
File.saveContent(dir() + '/.version', 'semver=' + semver + '\nhash=' + hash);
};
var rebuildEngineExtension = function(id:String):Void
{
var hash = getVersionProp("hash");
var output = (hash != "") ?
git("log", "--format=%s", hash + '...HEAD', "--", ".").output :
"Initial Repository Version.";
File.saveContent(dir() + '/changes', removeEmpty(output));
srm("add", dir(), dir() + '/changes', id);
var semver = getInfoProp("version");
var hash = git("log", "-1", "--format=%H").output;
File.saveContent(dir() + '/.version', 'semver=' + semver + '\nhash=' + hash);
};
var conditionalToolsetBuild = function():Void
{
var buildVersion = getBuildProp("version");
var cvString = getVersionProp("semver");
var cachedVersion = cvString != "" ? cvString : "0.0.0";
if(compareVersions(buildVersion, cachedVersion) > 0)
rebuildToolsetExtension();
};
var conditionalEngineBuild = function(id:String):Void
{
var buildVersion = getInfoProp("version");
var cvString = getVersionProp("semver");
var cachedVersion = cvString != "" ? cvString : "0.0.0";
if(compareVersions(buildVersion, cachedVersion) > 0)
rebuildEngineExtension(id);
};
// BUILD TYPES
var toolsetBuild = function(folder:String):Void
{
var prev = dir();
cd(folder);
conditionalToolsetBuild();
cd(prev);
};
var engineBuild = function(folder:String, id:String):Void
{
var prev = dir();
cd(folder);
conditionalEngineBuild(id);
cd(prev);
};
// MAIN BUILD INSTRUCTIONS
git("pull");
toolsetBuild("Common");
toolsetBuild("Data Structures Extension");
toolsetBuild("Dialog Extension");
toolsetBuild("Extras Manager Extension");
toolsetBuild("Imgur Extension");
toolsetBuild("Paint Extension");
toolsetBuild("Scene Link Extension");
engineBuild("Data Structures Extension/engine", "com.polydes.datastruct");
engineBuild("Dialog Extension/engine", "com.polydes.dialog");