mps-coderules/dependencies.gradle

126 lines
3.3 KiB
Groovy

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
import org.gradle.internal.os.OperatingSystem;
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]'
// using a simple hack here: a @zip artifact is mapped to macos dist,
// while a @tar.gz one -- to linux dist
artifact '[module]/[revision]/[revision]-linux.[ext]'
artifact '[module]/[revision]/[revision]-macos-aarch64.[ext]'
}
}
}
configurations {
mps_linux
mps_macos_aarch64
}
dependencies {
// MPS-related stuff declared as project properties
mps_linux "org:${mpsBuildConfiguration}:${mpsBuildNumber}:${mpsBuildLabel}@tar.gz"
mps_macos_aarch64 "org:${mpsBuildConfiguration}:${mpsBuildNumber}:${mpsBuildLabel}macos-aarch64@zip"
}
task installMps_macos(type: Copy) {
onlyIf {
OperatingSystem.current().isMacOsX()
}
from zipTree(configurations.mps_macos_aarch64[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}.app/Contents/")) {
// remap the file to the root
def segments = fcp.relativePath.segments
def pathsegments = segments[2..-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 installMps_linux(type: Copy) {
onlyIf {
OperatingSystem.current().isLinux()
}
from tarTree(resources.gzip(configurations.mps_linux[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 installMps(dependsOn: [installMps_macos, installMps_linux]) {
}
task deleteMps(type: Delete) {
delete 'MPS_HOME'
}