-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle
119 lines (103 loc) · 2.91 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
ext.mpsMajor = "2018.2"
ext.mpsMinor = "5"
ext.mbeddrBuildNumber = "1.1.+"
ext.mpsExtensionsVersion = "$mpsMajor.+"
buildscript {
repositories {
maven { url 'https://projects.itemis.de/nexus/content/repositories/mbeddr' }
mavenCentral()
}
dependencies {
classpath 'de.itemis.mps:mps-gradle-plugin:1.0.+'
}
}
repositories {
maven { url 'https://projects.itemis.de/nexus/content/repositories/mbeddr' }
mavenCentral()
ivy {
url "https://download.jetbrains.com/mps/$mpsMajor/"
layout 'pattern', {
artifact "[module]-[revision].[ext]"
}
metadataSources { // skip downloading ivy.xml
artifact()
}
}
}
configurations {
mps
mpsPlugins
}
dependencies {
mps "com.jetbrains:MPS:$mpsMajor.${mpsMinor}@zip"
mpsPlugins "de.itemis.mps:extensions:$mpsExtensionsVersion"
mpsPlugins "com.mbeddr:platform:$mbeddrBuildNumber"
}
task downloadDependencies(type: Copy) {
dependsOn configurations.mps
dependsOn configurations.mpsPlugins
from(zipTree(configurations.mps.singleFile)) {
eachFile {
// Replace "MPS 2018.2/abc/..." with "mps/abc/..." for predictable folder locations
it.path = "mps/" + it.path.substring(it.relativePath.segments[0].length())
}
} into "lib"
from {
configurations.mpsPlugins.collect { zipTree(it) }
} into "lib"
}
task clean() {
doLast {
def buildFiles = ['buildDistribution.xml', 'build.xml', 'buildBootstrap.xml']
for (f in buildFiles) {
if (!file(f).exists()) {
continue;
}
ant.ant(antfile: f) {
target(name: 'clean')
}
}
}
}
task bootstrap(dependsOn: [downloadDependencies]) {
inputs.files(file("solutions/com.hardella.build.bootstrap"))
outputs.files([file("build.xml"), file("buildDistribution.xml")])
doLast {
ant.ant(antfile: 'buildBootstrap.xml') {
target(name: 'generate')
}
}
}
def importMpsBuild(fileName, taskPrefix) {
def antBuilder = antBuilderFactory.create()
antBuilder.importBuild(fileName) { antTargetName ->
taskPrefix + antTargetName
}
antBuilder
}
task languagesGenerate(dependsOn: [downloadDependencies]) {
doLast {
ant.ant(antfile: 'build.xml') {
target(name: 'generate')
}
}
}
if (file('build.xml').exists() && file('buildDistribution.xml').exists()) {
def languages = importMpsBuild('build.xml', 'languages-')
tasks.'languages-fetchDependencies'.dependsOn languagesGenerate
task buildRcp {
}
def distr = ['macOS', 'Linux', 'Windows']
for (os in distr) {
def t = task("build-$os", dependsOn: [tasks.'languages-build']) {
doLast {
ant.ant(antfile: 'buildDistribution.xml') {
target(name: "layout.$os")
property(name: "build.layout.$os", value: 'build/artifacts/st61131Distribution')
}
}
}
buildRcp.dependsOn t
}
defaultTasks 'buildRcp'
}