@@ -2,6 +2,7 @@ import de.itemis.mps.gradle.*
2
2
import de.itemis.mps.gradle.tasks.MpsMigrate
3
3
import de.itemis.mps.gradle.tasks.Remigrate
4
4
import de.itemis.mps.gradle.downloadJBR.DownloadJbrForPlatform
5
+ import groovy.transform.TupleConstructor
5
6
import groovy.xml.XmlSlurper
6
7
import java.time.LocalDate
7
8
import java.time.format.DateTimeFormatter
@@ -95,17 +96,24 @@ ext.snapshotRepository = 'https://artifacts.itemis.cloud/repository/maven-mps-sn
95
96
ext. publishingRepository = version. toString(). endsWith(" -SNAPSHOT" ) ? snapshotRepository : releaseRepository
96
97
97
98
99
+ def buildDirPath (pathUnderBuildDir ) {
100
+ project. layout. buildDirectory. dir(pathUnderBuildDir). get(). asFile
101
+ }
98
102
99
103
// 'artifacts' is used in the generated ant scripts as build output directory
100
- ext. artifactsDir = new File (buildDir, ' artifacts' )
104
+ ext. artifactsDir = buildDirPath(' artifacts' )
105
+ ext. reportsDir = buildDirPath(' reports' )
106
+
107
+ wrapper {
108
+ gradleVersion ' 8.13'
109
+ distributionType Wrapper.DistributionType . ALL
110
+ }
101
111
102
112
configurations {
103
113
mps
104
114
rerunMigrationsBackend
105
115
languageLibs
106
116
junitAnt
107
- pcollections // Synced to org.iets3.core.expr.base.collections.stubs/lib
108
- bigMath // Synced to org.iets3.core.expr.math.interpreter/lib
109
117
}
110
118
111
119
dependencies {
@@ -114,8 +122,62 @@ dependencies {
114
122
languageLibs " org.mpsqa:all-in-one:$mpsQAVersion "
115
123
languageLibs " com.mbeddr:platform:$mbeddrVersion "
116
124
junitAnt ' org.apache.ant:ant-junit:1.10.15'
117
- pcollections ' org.pcollections:pcollections:4.0.2'
118
- bigMath ' ch.obermuhlner:big-math:2.3.2'
125
+ }
126
+
127
+ @TupleConstructor
128
+ class BundledDep {
129
+ String name
130
+ List<String > entries
131
+ String libSolutionName
132
+ Closure configClosure = { transitive = false }
133
+ // in case a legacy dependency has a broken artifact name, e.g. w/o extension
134
+ String jarNameOverride
135
+ String getConfigName () {
136
+ name + ' _bundled'
137
+ }
138
+ String getResolveTaskName () {
139
+ ' resolve_' + this . configName
140
+ }
141
+ BundledDep overrideArtifactName (String artifactName ) {
142
+ this . jarNameOverride = artifactName
143
+ this
144
+ }
145
+ }
146
+
147
+ def bundledDeps = [
148
+ new BundledDep (' pcollections' , [' org.pcollections:pcollections:4.0.2' ], ' org.iets3.core.expr.base.collections.stubs' ),
149
+ new BundledDep (' bigMath' , [' ch.obermuhlner:big-math:2.3.2' ], ' org.iets3.core.expr.math.interpreter' ),
150
+ new BundledDep (' functionalJava' , [' org.functionaljava:functionaljava:4.8.1' ], ' org.iets3.core.expr.genjava.functionalJava' ),
151
+ new BundledDep (' cpsSuite' , [' io.takari.junit:takari-cpsuite:1.2.7' ], ' org.iets3.opensource.build.gentests.rt' ). overrideArtifactName(' takari-cpsuite.jar' )
152
+ ]
153
+
154
+ bundledDeps. each { dep ->
155
+ configurations {
156
+ create(dep. configName)
157
+ }
158
+ dependencies {
159
+ dep. entries. each {entry ->
160
+ add(dep. configName, entry, dep. configClosure)
161
+ }
162
+ }
163
+ tasks. create(dep. resolveTaskName, Sync . class) {
164
+ from configurations. getByName(dep. configName)
165
+ into file(" code/languages/org.iets3.opensource/solutions/${ dep.libSolutionName} /lib" )
166
+
167
+ // Strip version numbers from file names
168
+ rename { filename ->
169
+ def ra = configurations. getByName(dep. configName). resolvedConfiguration. resolvedArtifacts. find { ResolvedArtifact ra -> ra. file. name == filename }
170
+ String finalName
171
+ if (dep. jarNameOverride != null ) {
172
+ finalName = dep. jarNameOverride
173
+ } else if (ra. classifier != null ) {
174
+ finalName = " ${ ra.name} -${ ra.classifier} .${ ra.extension} "
175
+ } else {
176
+ finalName = " ${ ra.name} .${ ra.extension} "
177
+ }
178
+ return finalName
179
+ }
180
+ }
119
181
}
120
182
121
183
@@ -134,41 +196,8 @@ task resolveLanguageLibs(type: Sync) {
134
196
into " $buildDir /dependencies"
135
197
}
136
198
137
- task resolvePcollections (type : Sync ) {
138
- from configurations. pcollections
139
- into file(' code/languages/org.iets3.opensource/solutions/org.iets3.core.expr.base.collections.stubs/lib' )
140
-
141
- // Strip version numbers from file names
142
- rename { filename ->
143
- def ra = configurations. pcollections. resolvedConfiguration. resolvedArtifacts. find { ResolvedArtifact ra -> ra. file. name == filename }
144
- String finalName
145
- if (ra. classifier != null ) {
146
- finalName = " ${ ra.name} -${ ra.classifier} .${ ra.extension} "
147
- } else {
148
- finalName = " ${ ra.name} .${ ra.extension} "
149
- }
150
- return finalName
151
- }
152
- }
153
-
154
- task resolveBigMath (type : Sync ) {
155
- from configurations. bigMath
156
- into file(' code/languages/org.iets3.opensource/solutions/org.iets3.core.expr.math.interpreter/lib' )
157
-
158
- // Strip version numbers from file names
159
- rename { filename ->
160
- def ra = configurations. bigMath. resolvedConfiguration. resolvedArtifacts. find { ResolvedArtifact ra -> ra. file. name == filename }
161
- String finalName
162
- if (ra. classifier != null ) {
163
- finalName = " ${ ra.name} -${ ra.classifier} .${ ra.extension} "
164
- } else {
165
- finalName = " ${ ra.name} .${ ra.extension} "
166
- }
167
- return finalName
168
- }
169
- }
170
-
171
- task resolveDependencies (dependsOn : [' downloadJbr' , resolveMps, resolveLanguageLibs, resolvePcollections, resolveBigMath])
199
+ task resolveDependencies (dependsOn : [' downloadJbr' , resolveMps, resolveLanguageLibs])
200
+ resolveDependencies. dependsOn << bundledDeps. collect {it. resolveTaskName }
172
201
173
202
ext. mpsHomeDir = resolveMps. destinationDir
174
203
@@ -321,10 +350,14 @@ checkmodels {
321
350
dependsOn(resolveMps)
322
351
}
323
352
324
- task packageLanguages (type : Zip , dependsOn : buildLanguages) {
353
+ task packageLanguages (type : Zip , dependsOn : [ buildLanguages, cyclonedxBom] ) {
325
354
archiveBaseName = ' org.iets3.opensource'
326
- from artifactsDir
327
- include ' org.iets3.opensource/**'
355
+ from(artifactsDir) {
356
+ include ' org.iets3.opensource/**'
357
+ }
358
+ from(reportsDir) {
359
+ include ' sbom.json'
360
+ }
328
361
}
329
362
330
363
task packageTests (type : Zip , dependsOn : buildAndRunTests) {
@@ -542,15 +575,11 @@ tasks.named('githubRelease').configure {
542
575
543
576
cyclonedxBom {
544
577
// SBOM destination directory
545
- destination = file( " build/reports " )
578
+ destination = reportsDir
546
579
// The file name for the generated SBOMs (before the file format suffix)
547
580
outputName = " sbom"
548
581
// The file format generated, can be xml, json or all for generating both
549
582
outputFormat = " json"
550
583
// Don't include license texts in generated SBOMs
551
584
includeLicenseText = false
552
585
}
553
-
554
- assemble {
555
- dependsOn(' cyclonedxBom' )
556
- }
0 commit comments