From d07931c4a2e52e1eccd4d6dcc8a6d10599afc937 Mon Sep 17 00:00:00 2001 From: Fedor Isakov Date: Tue, 8 Feb 2022 12:18:57 +0100 Subject: [PATCH] Fix build: extract installMps task into separate build file The Gradle build file imports Ant build.xml files, which can't be parsed without first importing the correct taskdefs, which are in turn located in MPS artefacts. --- build.gradle | 37 -------------------- dependencies.gradle | 83 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 37 deletions(-) create mode 100644 dependencies.gradle diff --git a/build.gradle b/build.gradle index 4a0d89a3..445b4c96 100644 --- a/build.gradle +++ b/build.gradle @@ -58,7 +58,6 @@ repositories { configurations { junitAnt - mps } dependencies { @@ -67,45 +66,9 @@ dependencies { junitAnt('org.apache.ant:ant-junit:1.9.2') { transitive = false } - - // MPS-related stuff declared as project properties - mps "org:${mpsBuildConfiguration}:${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 -} - -task deleteMps(type: Delete) { - delete 'MPS_HOME' } def allInitDependencies = [ - 'installMps', 'coderules:solutions:jetbrains.mps.logic.reactor:copyDependencies', 'coderules:solutions:jetbrains.mps.logic.test:copyDependencies', 'coderules:solutions:jetbrains.mps.coderules.typechecking:copyDependencies', diff --git a/dependencies.gradle b/dependencies.gradle new file mode 100644 index 00000000..bc056e8f --- /dev/null +++ b/dependencies.gradle @@ -0,0 +1,83 @@ +import groovy.xml.MarkupBuilder +import java.util.regex.* +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' + } +} + +defaultTasks 'installMps' + +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' + patternLayout { + ivy '[module]/[revision]/teamcity-ivy.xml' + artifact '[module]/[revision]/[revision].[ext]' + } + } +} + +configurations { + mps +} + +dependencies { + // MPS-related stuff declared as project properties + mps "org:${mpsBuildConfiguration}:${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 +} + +task deleteMps(type: Delete) { + delete 'MPS_HOME' +}