-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
138 lines (113 loc) · 4.1 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import de.itemis.mps.gradle.BuildLanguages
import de.itemis.mps.gradle.GenerateLibrariesXml
import de.itemis.mps.gradle.TestLanguages
buildscript {
repositories {
maven { url 'https://projects.itemis.de/nexus/content/repositories/mbeddr' }
mavenCentral()
}
dependencies {
classpath 'de.itemis.mps:mps-gradle-plugin:1.0.+'
}
}
group 'de.itemis.mps.build.example'
description = "sample project for building MPS projects"
File scriptFile(String relativePath) {
new File("$rootDir/build/$relativePath")
}
// 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.artifactsDir = new File(rootDir, 'artifacts')
ext.libsDir = new File(rootDir, 'libs')
ext.mpsDir = new File(artifactsDir, 'mps')
configurations {
ant_lib
mps
mpsArtifacts
libs
}
ext.mpsVersion = '2018.2.4'
dependencies {
ant_lib "org.apache.ant:ant-junit:1.10.1"
mps "com.jetbrains:mps:$mpsVersion"
mpsArtifacts "org.iets3:opensource:0.1+"
libs "de.itemis.mps.build.example:javalib:1.0+"
libs "org.jdom:jdom:2.0.2"
//libs group: 'org.javamoney.moneta', name: 'moneta-core', version: '1.2.1'
}
repositories {
maven {
url 'https://projects.itemis.de/nexus/content/groups/OS/'
}
mavenCentral()
mavenLocal()
}
ext.project_home = '-Dproject.home=' + file(rootDir).getAbsolutePath()
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 generateLibrariesXml(type: GenerateLibrariesXml) {
description "Will read project libraries from projectlibraries.properties and generate libraries.xml in .mps directory. Libraries are loaded in mps during start."
defaults rootProject.file('projectlibraries.properties')
destination file('code/.mps/libraries.xml')
overrides rootProject.file('projectlibraries.overrides.properties')
}
task resolveLibs(type: Copy) {
doFirst {
delete libsDir
}
from {
configurations.libs.resolve()
}
into libsDir
}
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 setup {
// We resolve MPS not for the users to use it but for the distribution packaging script to be able to refer to it.
dependsOn resolveMpsArtifacts
dependsOn generateLibrariesXml
description 'Set up MPS project libraries. Libraries are read in from projectlibraries.properties file.'
}
//idea: run tasks for the generate .xml files directly
task allScripts(type: BuildLanguages, dependsOn: [resolveMps, resolveMpsArtifacts]) {
scriptArgs = defaultScriptArgs
scriptClasspath = buildScriptClasspath
script scriptFile('de.itemis.mps.build.example.all.scripts/build.xml')
}
task build_languages(type: BuildLanguages, dependsOn: [allScripts, resolveMps, resolveMpsArtifacts]) {
scriptArgs = defaultScriptArgs
description = "Build all MPS language"
scriptClasspath = buildScriptClasspath
script scriptFile('de.itemis.mps.build.example/build.xml')
}
task run_tests(type: TestLanguages, dependsOn: build_languages) {
scriptArgs = defaultScriptArgs
scriptClasspath = buildScriptClasspath
script scriptFile('de.itemis.mps.build.example/build-tests.xml')
}