-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
104 lines (89 loc) · 2.77 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
import de.itemis.mps.gradle.BuildLanguages
import de.itemis.mps.gradle.TestLanguages
buildscript {
repositories {
maven {
url 'https://projects.itemis.de/nexus/content/repositories/mbeddr'
}
}
dependencies {
classpath 'de.itemis.mps:mps-gradle-plugin:1.0.61+'
}
}
group 'net.php.build'
description = "Build PHP for MPS"
File scriptFile(String relativePath) {
new File("$rootDir/code/$relativePath")
}
//define directories
ext.artifactsDir = new File(rootDir, 'artifacts')
ext.libsDir = new File(rootDir, 'libs')
ext.mpsDir = new File(artifactsDir, 'mps')
configurations {
mps
ant_lib
mpsArtifacts
}
// Dependency versions
ext.mpsVersion = '2018.3.2'
ext.artifactsVersion = '0.2+'
dependencies {
mps "com.jetbrains:mps:$mpsVersion"
ant_lib "org.apache.ant:ant-junit:1.10.1"
mpsArtifacts "org.iets3:opensource:$artifactsVersion"
}
repositories {
maven {
url('https://projects.itemis.de/nexus/content/groups/OS/')
}
mavenCentral()
}
// JDK_HOME required for adding tools.jar into classpath of the forked ant process
if (!hasProperty("jdk_home")) {
def java_home = System.properties['java.home']
def jdk_home = java_home
if (!file("$jdk_home/lib/tools.jar").isFile()) {
jdk_home = jdk_home + "/.."
}
if (!file("$jdk_home/lib/tools.jar").isFile()) {
throw new GradleException("Was not able to locate jdk home folder. Use " +
"'jdk_home' project variable to specify JDK location explicitly. " +
"Current JAVA_HOME is: $java_home"
)
}
ext.jdk_home = jdk_home
}
//define directories
ext.project_home = '-Dproject.home=' + file(rootDir).getAbsolutePath() + '/code'
ext.mps_home = '-Dmps_home=' + mpsDir.getAbsolutePath()
ext.artifacts_dir = '-Dartifacts.root=' + new File(rootDir, 'artifacts')
// default arguments for ANT
ext.defaultScriptArgs = [mps_home, project_home, artifacts_dir]
ext.buildScriptClasspath = project.configurations.ant_lib.fileCollection({
true
}) + project.files("$project.jdk_home/lib/tools.jar")
task resolveMps(type: Copy) {
from { configurations.mps.resolve().collect { zipTree(it) } }
into mpsDir
}
task resolveMpsArtifacts(type: Copy) {
from { configurations.mpsArtifacts.resolve().collect { zipTree(it) } }
into artifactsDir
}
task build_languages(
type: BuildLanguages,
dependsOn: [resolveMps, resolveMpsArtifacts]
) {
scriptArgs = defaultScriptArgs
description = "Build all MPS languages"
scriptClasspath = buildScriptClasspath
script scriptFile('build.xml')
}
task run_tests(
type: TestLanguages,
dependsOn: build_languages
) {
scriptArgs = defaultScriptArgs
scriptClasspath = buildScriptClasspath
script scriptFile('build-tests.xml')
}