Build: Use intellij maven repo instead of downloaded IDEA
#KTI-82
This commit is contained in:
committed by
teamcity
parent
9f725da7f7
commit
f7a9065b75
@@ -237,11 +237,8 @@ fun Project.testApiJUnit5(
|
||||
testApi("$component:$componentsVersion")
|
||||
}
|
||||
|
||||
addDependencyTo<ExternalModuleDependency>(this, "testImplementation", intellijDep()) {
|
||||
// This dependency is needed only for FileComparisonFailure
|
||||
includeJars("idea_rt", rootProject = rootProject)
|
||||
isTransitive = false
|
||||
}
|
||||
// This dependency is needed only for FileComparisonFailure
|
||||
add("testImplementation", intellijJavaRt())
|
||||
|
||||
// This is needed only for using FileComparisonFailure, which relies on JUnit 3 classes
|
||||
add("testRuntimeOnly", commonDependency("junit:junit"))
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.extra
|
||||
import org.gradle.kotlin.dsl.project
|
||||
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
val Project.intellijVersion
|
||||
get() = rootProject.extra["versions.intellijSdk"]
|
||||
|
||||
fun Project.intellijCore() = dependencies.project(":dependencies:intellij-core")
|
||||
|
||||
fun Project.jpsModel() = "com.jetbrains.intellij.platform:jps-model:$intellijVersion"
|
||||
fun Project.jpsModelSerialization() = "com.jetbrains.intellij.platform:jps-model-serialization:$intellijVersion"
|
||||
fun Project.jpsModelImpl() = "com.jetbrains.intellij.platform:jps-model-impl:$intellijVersion"
|
||||
fun Project.jpsBuildTest() = "com.jetbrains.intellij.idea:jps-build-test:$intellijVersion"
|
||||
fun Project.intellijPlatformUtil() = "com.jetbrains.intellij.platform:util:$intellijVersion"
|
||||
fun Project.intellijJavaRt() = "com.jetbrains.intellij.java:java-rt:$intellijVersion"
|
||||
fun Project.intellijAnalysis() = "com.jetbrains.intellij.platform:analysis:$intellijVersion"
|
||||
|
||||
/**
|
||||
* Runtime version of annotations that are already in Kotlin stdlib (historically Kotlin has older version of this one).
|
||||
*
|
||||
* SHOULD NOT BE USED IN COMPILE CLASSPATH!
|
||||
*
|
||||
* `@NonNull`, `@Nullabe` from `idea/annotations.jar` has `TYPE` target which leads to different types treatment in Kotlin compiler.
|
||||
* On the other hand, `idea/annotations.jar` contains org/jetbrains/annotations/Async annations which is required for IDEA debugger.
|
||||
*
|
||||
* So, we are excluding `annotaions.jar` from all other `kotlin.build` and using this one for runtime only
|
||||
* to avoid accidentally including `annotations.jar` by calling `intellijDep()`.
|
||||
*/
|
||||
fun Project.intellijRuntimeAnnotations() = "org.jetbrains:annotations:${rootProject.extra["versions.annotations"]}"
|
||||
@@ -80,33 +80,16 @@ fun Project.intellijDep(module: String? = null, forIde: Boolean = false) =
|
||||
|
||||
fun Project.intellijCoreDep() = "kotlin.build:intellij-core:${rootProject.extra["versions.intellijSdk"]}"
|
||||
|
||||
fun Project.jpsStandalone() = "kotlin.build:jps-standalone:${rootProject.extra["versions.intellijSdk"]}"
|
||||
|
||||
fun Project.jpsBuildTest() = "com.jetbrains.intellij.idea:jps-build-test:${rootProject.extra["versions.intellijSdk"]}"
|
||||
|
||||
/**
|
||||
* Runtime version of annotations that are already in Kotlin stdlib (historically Kotlin has older version of this one).
|
||||
*
|
||||
* SHOULD NOT BE USED IN COMPILE CLASSPATH!
|
||||
*
|
||||
* `@NonNull`, `@Nullabe` from `idea/annotations.jar` has `TYPE` target which leads to different types treatment in Kotlin compiler.
|
||||
* On the other hand, `idea/annotations.jar` contains org/jetbrains/annotations/Async annations which is required for IDEA debugger.
|
||||
*
|
||||
* So, we are excluding `annotaions.jar` from all other `kotlin.build` and using this one for runtime only
|
||||
* to avoid accidentally including `annotations.jar` by calling `intellijDep()`.
|
||||
*/
|
||||
fun Project.intellijRuntimeAnnotations() = "org.jetbrains:annotations:${rootProject.extra["versions.annotations"]}"
|
||||
|
||||
fun Project.intellijPluginDep(plugin: String, forIde: Boolean = false) = intellijDep(plugin, forIde)
|
||||
|
||||
fun ModuleDependency.includeJars(vararg names: String, rootProject: Project? = null) {
|
||||
names.forEach {
|
||||
var baseName = it.removeSuffix(".jar")
|
||||
if (rootProject != null && rootProject.extra.has("ignore.jar.$baseName")) {
|
||||
if (rootProject != null && rootProject.extra.has("ignore.$baseName")) {
|
||||
return@forEach
|
||||
}
|
||||
if (rootProject != null && rootProject.extra.has("versions.jar.$baseName")) {
|
||||
baseName += "-${rootProject.extra["versions.jar.$baseName"]}"
|
||||
if (rootProject != null && rootProject.extra.has("versions.$baseName")) {
|
||||
baseName += "-${rootProject.extra["versions.$baseName"]}"
|
||||
}
|
||||
artifact {
|
||||
name = baseName
|
||||
@@ -130,11 +113,4 @@ object IntellijRootUtils {
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun ModuleDependency.includeIntellijCoreJarDependencies(project: Project, jarsFilterPredicate: (String) -> Boolean = { true }): Unit =
|
||||
includeJars(
|
||||
*(project.rootProject.extra["IntellijCoreDependencies"] as List<String>).filter(jarsFilterPredicate).toTypedArray(),
|
||||
rootProject = project.rootProject
|
||||
)
|
||||
|
||||
fun Project.intellijRootDir() = IntellijRootUtils.getIntellijRootDir(project)
|
||||
Reference in New Issue
Block a user