forked from modelix/modelix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
165 lines (129 loc) · 4.64 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import de.itemis.mps.gradle.BuildLanguages
import de.itemis.mps.gradle.RunAntScript
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.2.168.+'
}
}
plugins {
id "com.github.dkorotych.gradle-maven-exec" version "2.2"
}
group 'org.modelix'
description = "Cloud storage and web UI for MPS"
defaultTasks 'assemble'
File scriptFile(String relativePath) {
new File("$rootDir/build/$relativePath")
}
def jdk_home
if (ext.has('java11_home')) {
jdk_home = ext.get('java11_home')
} else if (System.getenv('JB_JAVA11_HOME') != null) {
jdk_home = System.getenv('JB_JAVA11_HOME')
} else {
if (!JavaVersion.current().isJava11Compatible()) {
throw new GradleException("This build script requires Java >=11 but you are currently using ${JavaVersion.current()}.\nWhat you can do:\n"
+ " * Use project property java11_home to point to the Java 11 JDK.\n"
+ " * Use environment variable JAVA11_HOME to point to the Java 11 JDK\n"
+ " * Run Gradle using Java 11")
}
jdk_home = System.getProperty('java.home')
}
// Check JDK location
if (!new File(jdk_home, "lib").exists()) {
throw new GradleException("Unable to locate JDK home folder. Detected folder is: $jdk_home")
}
ext.jdk_home = jdk_home
ext["itemis.mps.gradle.ant.defaultJavaExecutable"] = new File(jdk_home, 'bin/java')
logger.info 'Using JDK at {}', 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 = '2020.1.1'
dependencies {
ant_lib "org.apache.ant:ant-junit:1.10.1"
mps "com.jetbrains:mps:$mpsVersion"
mpsArtifacts "de.itemis.mps:extensions:2020.1+"
libs "de.itemis.mps.build.example:javalib:1.0+"
libs "org.jdom:jdom:2.0.2"
project (':ui-client')
project (':model-server')
}
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("$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 new File("$rootDir/build-scripts.xml")
}
task build_languages(type: BuildLanguages, dependsOn: [allScripts, resolveMps, resolveMpsArtifacts, ':ui-client:packageNpmApp']) {
scriptArgs = defaultScriptArgs
description = "Build all MPS language"
scriptClasspath = buildScriptClasspath
script new File("$rootDir/build/org.modelix/build.xml")
}
task run_tests(type: TestLanguages, dependsOn: build_languages) {
scriptArgs = defaultScriptArgs
scriptClasspath = buildScriptClasspath
script new File("$rootDir/mps/build-tests.xml")
}
task('assemble').dependsOn(build_languages)