-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
111 lines (93 loc) · 3.73 KB
/
build.gradle
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
apply plugin: 'java';
import org.apache.tools.ant.filters.*
def jmePomVersion = "";
task downloadSuite << {
def suite_folder = "suite" // Is not completely implemented yet.
File folder = file(suite_folder + "/nbproject");
if (!folder.exists()) {
println "Downloading the plugins suite...";
exec {
commandLine 'git', 'clone', '--depth', '1', suite_repo_url, suite_folder
}
} else {
println "Updating the plugins suite...";
exec {
workingDir suite_folder
commandLine 'git', 'pull'
}
}
}
task setupSuite(type: GradleBuild, dependsOn: downloadSuite) {
println "Setting up the plugins suite....."
buildFile = 'suite/build.gradle'
tasks = ['setupSuite']
}
task applySuitePath(dependsOn: setupSuite) << {
println "Applying new suite path"
File f = file("nbproject/suite.properties")
if (f.exists())
f.delete();
f.createNewFile();
f.write('suite.dir=${basedir}/suite\r\n');
}
task suite(dependsOn: applySuitePath) << {
}
task CreateVersionFile(dependsOn: suite) << {
// Since it's a bit problematic to call version.gradle from a different directory and project (it won't pick the right repo, it won't export the vars), we copy and patch it a bit
copy {
from 'suite/engine'
into '.'
include 'version.gradle'
filter { line ->
line = line.replace("def grgit = Grgit.open(project.file('.'))", "def grgit = Grgit.open(project.file('suite/engine/'))")
line = line.replace("import java.text.SimpleDateFormat", "ext.jmeVersion = \"3.1.0\"\n" +
"ext.jmeMainVersion = \"3.1\"\n" +
"ext.jmeVersionTag = \"SNAPSHOT\"\n" +
"ext.jmeVersionTagID = \"0\"\n" +
"import java.text.SimpleDateFormat")
} // Properties and git repo
def f = file("task.tmp")
f.text = "task writeVersion(dependsOn: configureVersionInfo) << {\n" + // since I can't find a way to access those version files..
"\tdef f1 = file(\"version.txt\")\n"+
"\tf1.text = jmePomVersion\n"+
"}\n"
filter(ConcatFilter, append: f)
}
delete(file("task.tmp"))
}
task getEngineVersion(type: GradleBuild, dependsOn: CreateVersionFile) {
buildFile = "version.gradle"
tasks = ['writeVersion'] // Our injected task.
doLast {
def f = file("version.txt")
jmePomVersion = f.text
delete(f)
delete("version.gradle")
}
}
task assemble(dependsOn: [suite, getEngineVersion], overwrite: true) << {
println "Setting myself as the module to be compiled..."
ant.propertyfile(file: "suite/nbproject/project.properties") {
entry(key: "project.com.jme3.ai", value: "../") // Set the current directory as directory for module
entry(key: "modules", value: '${project.com.jme3.ai}')
}
println "Manually fixing/adding Library Entries (jMonkey Version):"
ant.propertyfile(file: "suite/nbproject/jme-project-libs.properties") {
entry(key: "jme3-version-string", value: jmePomVersion)
/*entry(key: 'libs.jme3.dir', value:'/Users/MeFisto94/Documents/Coding/jme3-artificial-intelligence/suite/libs')
file("suite/nbproject/jme-project-libs.properties").withReader { reader ->
def userProps = new Properties()
userProps.load(reader)
for(String k: userProps.keySet()) {
if (k != "libs.jme3.dir")
entry(key: k, value: userProps.getProperty(k))
}
}*/
}
//ant.ant(dir: ".", antfile: "build.xml") // Already called by nbm
// ant.ant(dir: ".", antfile: "build.xml", target: "nbm") // Note: for some reason, the nbm target isn't really executed?
println "Building Netbeans Modules"
exec {
commandLine 'ant', 'nbm'
}
}