173 lines
4.0 KiB
Groovy
173 lines
4.0 KiB
Groovy
import groovy.xml.MarkupBuilder
|
|
import java.util.regex.*
|
|
|
|
defaultTasks 'assemble'
|
|
|
|
allprojects {
|
|
apply plugin: 'java'
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
mavenCentral()
|
|
}
|
|
|
|
// please no jars, no manifests, no build folders
|
|
jar { onlyIf { false } }
|
|
}
|
|
|
|
repositories {
|
|
ivy {
|
|
url 'https://teamcity.jetbrains.com/guestAuth/repository/download'
|
|
layout ('pattern') {
|
|
artifact '[organization]/[revision]/[revision].[ext]'
|
|
}
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
junitAnt
|
|
mps
|
|
}
|
|
|
|
dependencies {
|
|
// initialize JUnit optional ant task
|
|
junitAnt 'junit:junit:4.8.2'
|
|
junitAnt('org.apache.ant:ant-junit:1.9.2') {
|
|
transitive = false
|
|
}
|
|
|
|
// MPS-related stuff declared as project properties
|
|
mps "${mpsBuildConfiguration}:MPS:${mpsBuildNumber}:${mpsBuildLabel}.tcbuildtag@zip"
|
|
}
|
|
|
|
task installMps(type: Copy) {
|
|
onlyIf {
|
|
! file('MPS_HOME').exists()
|
|
}
|
|
|
|
from zipTree(configurations.mps[0])
|
|
into 'MPS_HOME'
|
|
|
|
// Gradle woodoo for unzipping an archive
|
|
eachFile { FileCopyDetails fcp ->
|
|
// copy the contents of the directory named "MPS ${mpsRelease}"
|
|
if (fcp.relativePath.pathString.startsWith("MPS ${mpsRelease}/")) {
|
|
// remap the file to the root
|
|
def segments = fcp.relativePath.segments
|
|
def pathsegments = segments[1..-1] as String[]
|
|
fcp.relativePath = new RelativePath(!fcp.file.isDirectory(), pathsegments)
|
|
|
|
} else {
|
|
fcp.exclude()
|
|
}
|
|
// avoid overriding files
|
|
if (fcp.relativePath.getFile(destinationDir).exists()) {
|
|
it.exclude()
|
|
}
|
|
}
|
|
includeEmptyDirs = false
|
|
}
|
|
|
|
def allInitDependencies = [
|
|
'installMps',
|
|
'coderules:solutions:jetbrains.mps.logic.reactor:copyDependencies',
|
|
'coderules:solutions:jetbrains.mps.logic.test:copyDependencies',
|
|
'coderules:solutions:jetbrains.mps.typechecking:copyDependencies',
|
|
'coderules:solutions:jetbrains.mps.coderules:copyDependencies' ]
|
|
|
|
task setup(dependsOn: allInitDependencies) {
|
|
doLast {
|
|
println 'Initialized all dependencies.'
|
|
}
|
|
}
|
|
|
|
def tagMatcher() {
|
|
System.env.TRAVIS_TAG =~ /v([0-9.]+)-.*\.([0-9]+)/
|
|
}
|
|
|
|
task generateUpdatePluginsXml {
|
|
onlyIf {
|
|
tagMatcher().find()
|
|
}
|
|
doLast {
|
|
def updatesDir = project.projectDir.absolutePath + "/build/artifacts/coderules/updates"
|
|
mkdir(updatesDir)
|
|
|
|
def baseUrl = "https://github.com/fisakov/constraints-typechecking/releases/download"
|
|
def zip = "/coderules-0.5.zip"
|
|
|
|
file(updatesDir + "/updatePlugins.xml").withWriter { w ->
|
|
new MarkupBuilder(new IndentPrinter(w, " ", true)).
|
|
plugins {
|
|
plugin( id: "jetbrains.mps.coderules" ,
|
|
url: baseUrl + "/$System.env.TRAVIS_TAG" + zip ,
|
|
version: "${tagMatcher()[0][1]}-b${tagMatcher()[0][2]}" )
|
|
{ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
ant.taskdef(name: 'junit',
|
|
classname: 'org.apache.tools.ant.taskdefs.optional.junit.JUnitTask',
|
|
classpath: configurations.junitAnt.asPath)
|
|
|
|
ant.importBuild('build.xml') { antTarget ->
|
|
'coderules-'+antTarget
|
|
}
|
|
ant.properties.'ci.build.num' = "${tagMatcher().find() ? tagMatcher()[0][2] : '9999'}".toString()
|
|
|
|
// ensure 'setup' runs before 'fetchDependencies' and 'declare-mps-tasks'
|
|
'coderules-fetchDependencies' {
|
|
dependsOn {
|
|
'setup'
|
|
}
|
|
}
|
|
|
|
'coderules-declare-mps-tasks' {
|
|
dependsOn {
|
|
'setup'
|
|
}
|
|
}
|
|
|
|
// ensure 'generate' runs before 'classes' ('generate' is NOT optional)
|
|
'coderules-classes' {
|
|
dependsOn {
|
|
'coderules-generate'
|
|
}
|
|
mustRunAfter {
|
|
'coderules-generate'
|
|
}
|
|
}
|
|
|
|
'coderules-assemble' {
|
|
finalizedBy {
|
|
'generateUpdatePluginsXml'
|
|
}
|
|
}
|
|
|
|
assemble {
|
|
dependsOn {
|
|
[
|
|
':coderules-assemble',
|
|
':samples:mpscore:mpscore-assemble',
|
|
':samples:lambdacalc:lambdacalc-assemble',
|
|
':samples:fitch:fitch-assemble'
|
|
]
|
|
}
|
|
}
|
|
|
|
check {
|
|
dependsOn {
|
|
[
|
|
':samples:mpscore:mpscore-check',
|
|
':samples:lambdacalc:lambdacalc-check',
|
|
':samples:fitch:fitch-check'
|
|
]
|
|
}
|
|
// tests from this target also include model checker invocation, which requires everything to be built
|
|
finalizedBy {
|
|
':coderules-check'
|
|
}
|
|
}
|