mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
Build scripts depend on some code from IntelliJ project (they use JpsModel interfaces to introspect the project configuration, and use code from jps.build modules to compile Java and Groovy code). Before this change when build scripts were invoked from the IDE by running *.gant files they took required classes directly from module output directories, but when they were invoked via gant.xml (e.g. on TeamCity) use prebuilt bootstrap version of these modules from community/build/lib/jps/*.jar files. So if you added usage of a recently added class or method in a script, this will work when running scripts from IDE but fail on TeamCity. Also updating a library used directly or indirectly by build scripts may cause problems because the bootstrap version of JPS JARs may become incompatible with it. And in order to update the bootstrap version of JPS JARs it was needed to build the new JARs and put them to Git. Now dependencies of build scripts are specified in a special intellij.tools.jps.buildScriptDependencies module which is uploaded as a Maven artifact to https://bintray.com/jetbrains/intellij-third-party-dependencies/intellij-modules-preview and added as a Maven library 'jps-build-script-dependencies-bootstrap', so the same version of dependencies is used when running build scripts from IDE and on TeamCity. GitOrigin-RevId: 232561ddc3135e97c238c8d4850fbbc2f1a8ab10
64 lines
2.5 KiB
Groovy
64 lines
2.5 KiB
Groovy
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
|
import java.nio.file.Files
|
|
import java.nio.file.Paths
|
|
|
|
repositories {
|
|
maven { url "https://cache-redirector.jetbrains.com/intellij-third-party-dependencies" }
|
|
maven { url "https://cache-redirector.jetbrains.com/jetbrains.bintray.com/test-discovery" }
|
|
maven { url "https://cache-redirector.jetbrains.com/jcenter.bintray.com" }
|
|
maven { url 'https://www.jetbrains.com/intellij-repository/releases' }
|
|
}
|
|
|
|
configurations {
|
|
buildScriptsDeps
|
|
testDiscoveryDeps
|
|
}
|
|
|
|
dependencies {
|
|
def jpsLibraryCoordinates = loadProjectLibraryProperties("jps-build-script-dependencies-bootstrap").first
|
|
def jpsLibraryVersion = jpsLibraryCoordinates.substring(jpsLibraryCoordinates.lastIndexOf(':')+1)
|
|
buildScriptsDeps(jpsLibraryCoordinates)
|
|
buildScriptsDeps('commons-cli:commons-cli:1.2')
|
|
buildScriptsDeps('com.jetbrains.intellij.platform:test-framework-core:' + jpsLibraryVersion)
|
|
}
|
|
|
|
/**
|
|
* Resolve libraries used from build scripts sources
|
|
*/
|
|
task setupBuildScriptsDeps(dependsOn: configurations.buildScriptsDeps, type: Sync) {
|
|
from configurations.buildScriptsDeps.files
|
|
into "${project.buildDir}/build-scripts-deps"
|
|
}
|
|
|
|
task setupTestDiscoveryDeps {
|
|
doFirst {
|
|
def dir = "${project.buildDir}/test-discovery-deps"
|
|
def testDiscoveryDeps = file(dir)
|
|
testDiscoveryDeps.deleteDir()
|
|
testDiscoveryDeps.mkdirs()
|
|
configurations.detachedConfiguration(
|
|
dependencies.create(loadProjectLibraryProperties('test-discovery-plugin-base', '../../..').first)
|
|
).files.each { from ->
|
|
def into = Paths.get("$dir/$from.name")
|
|
Files.copy(from.toPath(), into)
|
|
}
|
|
}
|
|
}
|
|
|
|
private Tuple2<String, Boolean> loadProjectLibraryProperties(String libraryName, String idea = '../..') {
|
|
File file = new File(project.rootDir, "$idea/.idea/libraries/${libraryName.replace('-', '_')}.xml")
|
|
if (!file.exists()) {
|
|
throw new GradleException("Cannot find $libraryName project library: $file doesn't exist")
|
|
}
|
|
def root = new XmlParser().parse(file)
|
|
NodeList propertiesTags = root.library.first().properties
|
|
if (propertiesTags.isEmpty()) {
|
|
throw new GradleException("$libraryName project library is not a repository library")
|
|
}
|
|
//noinspection GroovyAssignabilityCheck
|
|
loadLibraryProperties(propertiesTags.first())
|
|
}
|
|
|
|
private static Tuple2<String, Boolean> loadLibraryProperties(Node propertiesTag) {
|
|
new Tuple2(propertiesTag.'@maven-id', propertiesTag.'@include-transitive-deps' != "false")
|
|
} |