94 lines
2.6 KiB
Groovy
94 lines
2.6 KiB
Groovy
import java.util.zip.*
|
|
import java.io.*
|
|
import com.jetbrains.plugin.blockmap.core.BlockMap
|
|
import com.jetbrains.plugin.blockmap.core.FileHash
|
|
import com.fasterxml.jackson.databind.ObjectMapper
|
|
|
|
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
classpath group: 'org.jetbrains.intellij', name: 'blockmap', version: '1.0.5'
|
|
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
|
|
classpath group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.12.3'
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
junitAnt
|
|
}
|
|
|
|
dependencies {
|
|
// initialize JUnit optional ant task
|
|
junitAnt 'junit:junit:4.8.2'
|
|
junitAnt('org.apache.ant:ant-junit:1.9.2') {
|
|
transitive = false
|
|
}
|
|
}
|
|
|
|
task createBlockmap {
|
|
onlyIf {
|
|
buildNumber().find()
|
|
}
|
|
doLast {
|
|
def version = "${buildNumber()[0][1]}-0.9-b${buildNumber()[0][4]}"
|
|
def path = "build/artifacts/mpscore"
|
|
def distFile = file("${path}/jetbrains.mps.core.types-${version}.zip")
|
|
def blockMapFileZipFile = new File(distFile.absolutePath + ".blockmap.zip")
|
|
def blockMapFileZip = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(blockMapFileZipFile)))
|
|
blockMapFileZip.putNextEntry(new ZipEntry("blockmap.json"))
|
|
blockMapFileZip.write(new ObjectMapper().writeValueAsBytes(new BlockMap(new BufferedInputStream(new FileInputStream(distFile)), "SHA-256")))
|
|
blockMapFileZip.closeEntry()
|
|
blockMapFileZip.close()
|
|
def distFileHash = new File(distFile.absolutePath + ".hash.json")
|
|
distFileHash.append(new ObjectMapper().writeValueAsString(new FileHash(new BufferedInputStream(new FileInputStream(distFile)), "SHA-256")))
|
|
}
|
|
}
|
|
|
|
ant.taskdef(name: 'junit',
|
|
classname: 'org.apache.tools.ant.taskdefs.optional.junit.JUnitTask',
|
|
classpath: configurations.junitAnt.asPath)
|
|
|
|
ant.importBuild('build.xml') {antTarget ->
|
|
'mpscore-'+antTarget
|
|
}
|
|
ant.properties.'ci.build.num' = "${buildNumber().find() ? buildNumber()[0][4] : '9999'}".toString()
|
|
ant.properties.'ci.build.tag' = "${buildNumber().find() ? buildNumber()[0][4] : 'SNAPSHOT'}".toString()
|
|
ant.properties.'ci.mps.release' = "${buildNumber().find() ? buildNumber()[0][1] : '211'}".toString()
|
|
|
|
// ensure 'generate' runs before 'classes' ('generate' is NOT optional)
|
|
'mpscore-compileJava' {
|
|
dependsOn {
|
|
'mpscore-generate'
|
|
}
|
|
mustRunAfter {
|
|
'mpscore-generate'
|
|
}
|
|
}
|
|
|
|
'mpscore-declare-mps-tasks' {
|
|
dependsOn {
|
|
':setup'
|
|
}
|
|
}
|
|
|
|
'mpscore-generate' {
|
|
dependsOn {
|
|
':coderules-assemble'
|
|
}
|
|
}
|
|
|
|
assemble {
|
|
dependsOn {
|
|
'mpscore-assemble'
|
|
}
|
|
}
|
|
|
|
check {
|
|
dependsOn {
|
|
'mpscore-check'
|
|
}
|
|
}
|
|
|