1+ import de.itemis.mps.gradle.*
2+
3+ import java.time.LocalDate
4+ import java.time.format.DateTimeFormatter
5+ import java.time.format.FormatStyle
6+
7+ // will pull the groovy classes/types from nexus to the classpath
8+ buildscript {
9+ repositories {
10+ mavenCentral()
11+ maven { url ' https://projects.itemis.de/nexus/content/repositories/mbeddr' }
12+ }
13+ dependencies {
14+ classpath ' de.itemis.mps:mps-gradle-plugin:1.2.175.cc60dc8'
15+ }
16+ }
17+
18+ plugins {
19+ id ' base'
20+ id ' maven-publish'
21+ id " co.riiid.gradle" version " 0.4.2"
22+ }
23+
24+ def incrementalBuild = ! project. hasProperty(" disableIncrementalBuild" )
25+ def artifactsDir = new File (buildDir, ' artifacts' )
26+
27+
28+ configurations {
29+ mps
30+ languageLibs
31+ junitAnt
32+ }
33+
34+ dependencies {
35+ mps " com.jetbrains:mps:2020.1.+"
36+ languageLibs " com.mbeddr:mbeddr:2020.1.+"
37+ junitAnt ' org.apache.ant:ant-junit:1.10.6'
38+ }
39+
40+ repositories {
41+ maven {
42+ url " https://projects.itemis.de/nexus/content/repositories/mbeddr"
43+ }
44+
45+ mavenCentral()
46+ }
47+
48+ task resolveMps (type : Copy ) {
49+ dependsOn configurations. mps
50+ from {
51+ configurations. mps. resolve(). collect { zipTree(it) }
52+ }
53+ into " $buildDir /mps"
54+ }
55+
56+ task resolveAllLanguageLibs (type : Copy ) {
57+ from {
58+ configurations. languageLibs. resolve(). collect { zipTree(it) }
59+ }
60+ into " $buildDir /dependencies"
61+ }
62+
63+ def testsupportVersion = project. findProperty(" testsupportVersion" ) ?: ' 0.1'
64+
65+ // Default arguments for ant scripts
66+ def defaultScriptArgs = [
67+ ' mps.home' : resolveMps. destinationDir,
68+ ' testsupport.home' : projectDir,
69+ ' build.dir' : buildDir,
70+ ' mps.generator.skipUnmodifiedModels' : incrementalBuild,
71+ ' version' : testsupportVersion,
72+ ' testsupport.version' : testsupportVersion,
73+ ]
74+ def defaultScriptClasspath = project. configurations. junitAnt. fileCollection { true }
75+
76+ // enables https://github.com/mbeddr/mps-gradle-plugin#providing-global-defaults
77+ ext[" itemis.mps.gradle.ant.defaultScriptArgs" ] = defaultScriptArgs. collect { " -D$it . key =$it . value " . toString() }
78+ ext[" itemis.mps.gradle.ant.defaultScriptClasspath" ] = defaultScriptClasspath
79+
80+
81+ task buildAllScripts (type : BuildLanguages , dependsOn : [resolveMps, resolveAllLanguageLibs]) {
82+ script " scripts/allScripts.xml"
83+ }
84+
85+ task buildLanguages (type : BuildLanguages , dependsOn : buildAllScripts) {
86+ script " $buildDir /languageBuild.xml"
87+ }
88+
89+ task packageLanguages (type : Zip , dependsOn : buildLanguages) {
90+ archiveBaseName = ' com.dslfoundry.testsupport'
91+ from artifactsDir
92+ include ' com.dslfoundry.testsupport/**'
93+ }
94+
95+ task setup {
96+ dependsOn resolveAllLanguageLibs
97+ description ' Set up MPS project libraries. Libraries are read in from projectlibraries.properties file.'
98+ }
99+
100+
101+ def releaseArtifacts = [" ${ artifactsDir} /com.dslfoundry.testsupport/com.dslfoundry.testsupport-${ testsupportVersion} .zip" ]
102+
103+ github {
104+ owner = ' DSLFoundry'
105+ repo = ' mps-testsupport'
106+ token = System . getenv(). GITHUB_TOKEN != null ? System . getenv(). GITHUB_TOKEN : " empty"
107+ tagName = " v-$testsupportVersion "
108+ targetCommitish = System . getenv(). CI_COMMIT_SHA != null ? System . getenv(). CI_COMMIT_SHA : " master"
109+ name = " Fixes for MPS XML Language v$testsupportVersion "
110+ assets = releaseArtifacts
111+ // body = ReleaseNotes.getReleaseNotes(file("RELEASE_NOTES.md"))
112+ }
113+
114+ publishing {
115+ repositories {
116+ maven {
117+ name = " GitHubPackages"
118+ url = uri(" https://maven.pkg.github.com/DSLFoundry/mps-testsupport" )
119+ credentials {
120+ username = project. findProperty(" gpr.user" ) ?: System . getenv(" GITHUB_ACTOR" )
121+ password = project. findProperty(" gpr.key" ) ?: System . getenv(" GITHUB_TOKEN" )
122+ }
123+ }
124+ }
125+
126+ publications {
127+ gpr(MavenPublication ) {
128+ groupId = ' com.dslfoundry.testsupport'
129+ artifactId = ' testsupport'
130+ version = " $testsupportVersion "
131+
132+ artifacts = releaseArtifacts
133+ pom {
134+ name = " Fixes for MPS XML Language"
135+ url = " https://github.com/DSLFoundry/mps-testsupport"
136+ }
137+ }
138+ }
139+ }
140+
141+ build. dependsOn buildLanguages
142+ githubRelease. dependsOn build
143+
144+ defaultTasks ' buildLanguages'
145+
146+ publish. dependsOn build
0 commit comments