From 7cbef4cf9de217dd7812bb96e2a62536e5310ac7 Mon Sep 17 00:00:00 2001 From: Fedor Isakov Date: Fri, 9 Jun 2017 12:08:12 +0200 Subject: [PATCH] Download and unpack MPS release as a dependency before the build. The root folder "MPS_HOME" to always point to the MPS installation or contain the MPS itself. --- .gitignore | 2 + build.gradle | 78 +++++++++++++---- build.xml | 2 +- gradle.properties | 4 + plugin.xml | 2 +- .../jetbrains.mps.typechecking.build.mps | 5 +- test.xml | 86 +++++++++---------- .../lang/typesystem2/samplechecker/build.mps | 18 ++-- 8 files changed, 121 insertions(+), 76 deletions(-) create mode 100644 gradle.properties diff --git a/.gitignore b/.gitignore index cf80fb70..b207fee2 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ config/* system/* logic/solutions/jetbrains.mps.logic.reactor/lib/* logic/solutions/jetbrains.mps.logic.test/lib/* +MPS_HOME +TEST-* diff --git a/build.gradle b/build.gradle index f75c52a3..10da7a2e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,31 +1,73 @@ defaultTasks 'init' allprojects { - repositories { - mavenCentral() - } -} - -def alldependencies = [ - 'logic/solutions/jetbrains.mps.logic.reactor:copyDependencies', - 'logic/solutions/jetbrains.mps.logic.test:copyDependencies' ] - -task init(dependsOn: alldependencies) { - doLast { - println 'Initialized all dependencies.' + repositories { + mavenCentral() + } +} + +repositories { + ivy { + url 'https://teamcity.jetbrains.com/guestAuth/repository/download' + layout ('pattern') { + artifact '[organization]/[classifier]/[module]-[revision].[ext]' + } } } -// initialize JUnit optional ant task 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}:${mpsRelease}.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', + 'logic/solutions/jetbrains.mps.logic.reactor:copyDependencies', + 'logic/solutions/jetbrains.mps.logic.test:copyDependencies' ] + +task init(dependsOn: allInitDependencies) { + doLast { + println 'Initialized all dependencies.' + } } ant.taskdef(name: 'junit', @@ -34,14 +76,20 @@ ant.taskdef(name: 'junit', ant.importBuild('build.xml') -// ensure 'init' runs before 'fetchDependencies' task from ant build +// ensure 'init' runs before 'fetchDependencies' and 'declare-mps-tasks' fetchDependencies { dependsOn { 'init' } } -// ensure 'generate' runs before 'classes' +'declare-mps-tasks' { + dependsOn { + 'init' + } +} + +// ensure 'generate' runs before 'classes' ('generate' is NOT optional) classes { dependsOn { 'generate' diff --git a/build.xml b/build.xml index 14778036..54814c29 100644 --- a/build.xml +++ b/build.xml @@ -4,7 +4,7 @@ - + diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..cb0a37f9 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,4 @@ + +mpsBuildConfiguration = MPS_35_Distribution_DownloadableArtifacts +mpsRelease = 2017.1 +mpsBuildNumber = 171.1065 diff --git a/plugin.xml b/plugin.xml index 8b2efcd1..d693bddb 100644 --- a/plugin.xml +++ b/plugin.xml @@ -3,7 +3,7 @@ - + diff --git a/plugin/solutions/jetbrains.mps.typechecking.build/models/jetbrains.mps.typechecking.build.mps b/plugin/solutions/jetbrains.mps.typechecking.build/models/jetbrains.mps.typechecking.build.mps index bf558c6f..5d0b6f4b 100644 --- a/plugin/solutions/jetbrains.mps.typechecking.build/models/jetbrains.mps.typechecking.build.mps +++ b/plugin/solutions/jetbrains.mps.typechecking.build/models/jetbrains.mps.typechecking.build.mps @@ -1452,10 +1452,7 @@ - - - - + diff --git a/test.xml b/test.xml index 51abc688..ae67fa59 100644 --- a/test.xml +++ b/test.xml @@ -4,7 +4,7 @@ - + @@ -17,13 +17,13 @@ - + - + @@ -856,28 +856,28 @@ mps.build.number=${mps.build.number}${line.separator}mps.date=${mps.date}${line.separator}mps.build.vcs.number=${mps.build.vcs.number}${line.separator}mps.teamcity.buildConfName=${mps.teamcity.buildConfName}${line.separator}mps.idea.platform.build.number=${mps.idea.platform.build.number}${line.separator}mps.mps.build.counter=${mps.mps.build.counter}${line.separator}mpsBootstrapCore.version=${mpsBootstrapCore.version} - + - + - + - + - + - + - + - + - + - + @@ -992,15 +992,15 @@ - + - + - + - + @@ -1050,7 +1050,7 @@ - + @@ -1099,7 +1099,7 @@ - + @@ -1135,7 +1135,7 @@ - + @@ -1169,7 +1169,7 @@ - + @@ -1217,7 +1217,7 @@ - + @@ -1281,7 +1281,7 @@ - + @@ -1344,7 +1344,7 @@ - + @@ -1399,7 +1399,7 @@ - + @@ -1453,7 +1453,7 @@ - + @@ -1491,7 +1491,7 @@ - + @@ -1530,7 +1530,7 @@ - + @@ -1581,7 +1581,7 @@ - + @@ -1625,7 +1625,7 @@ - + @@ -1675,7 +1675,7 @@ - + @@ -1715,7 +1715,7 @@ - + @@ -1767,7 +1767,7 @@ - + @@ -1810,7 +1810,7 @@ - + @@ -1822,7 +1822,7 @@ - + @@ -1895,7 +1895,7 @@ - + @@ -1960,7 +1960,7 @@ - + @@ -2027,7 +2027,7 @@ - + @@ -2155,23 +2155,23 @@ - + - + - + - + @@ -2198,4 +2198,4 @@ - \ No newline at end of file + diff --git a/typechecking/solutions/jetbrains.mps.lang.typesystem2.samplechecker.build/models/jetbrains/mps/lang/typesystem2/samplechecker/build.mps b/typechecking/solutions/jetbrains.mps.lang.typesystem2.samplechecker.build/models/jetbrains/mps/lang/typesystem2/samplechecker/build.mps index 60bc78cf..f7dd8213 100644 --- a/typechecking/solutions/jetbrains.mps.lang.typesystem2.samplechecker.build/models/jetbrains/mps/lang/typesystem2/samplechecker/build.mps +++ b/typechecking/solutions/jetbrains.mps.lang.typesystem2.samplechecker.build/models/jetbrains/mps/lang/typesystem2/samplechecker/build.mps @@ -222,12 +222,9 @@ - - - - - - + + + @@ -1407,12 +1404,9 @@ - - - - - - + + +