Initial implementation of kotlin + intellij combined repo
This commit is contained in:
@@ -236,6 +236,31 @@ fun Project.idePluginDependency(block: () -> Unit) {
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.publishJarsForIde(projects: List<String>, libraryDependencies: List<String> = emptyList()) {
|
||||
idePluginDependency {
|
||||
publishProjectJars(projects, libraryDependencies)
|
||||
}
|
||||
dependencies {
|
||||
projects.forEach {
|
||||
jpsLikeJarDependency(project(it), JpsDepScope.COMPILE, { isTransitive = false }, exported = true)
|
||||
}
|
||||
libraryDependencies.forEach {
|
||||
jpsLikeJarDependency(it, JpsDepScope.COMPILE, exported = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.publishTestJarsForIde(projectNames: List<String>) {
|
||||
idePluginDependency {
|
||||
publishTestJar(projectNames)
|
||||
}
|
||||
dependencies {
|
||||
for (projectName in projectNames) {
|
||||
jpsLikeJarDependency(projectTests(projectName), JpsDepScope.COMPILE, exported = true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.publishProjectJars(projects: List<String>, libraryDependencies: List<String> = emptyList()) {
|
||||
apply<JavaPlugin>()
|
||||
|
||||
|
||||
@@ -11,11 +11,13 @@ import org.gradle.api.GradleException
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.Dependency
|
||||
import org.gradle.api.artifacts.ExternalModuleDependency
|
||||
import org.gradle.api.artifacts.ModuleDependency
|
||||
import org.gradle.api.artifacts.ProjectDependency
|
||||
import org.gradle.api.artifacts.dsl.DependencyHandler
|
||||
import org.gradle.api.file.ConfigurableFileCollection
|
||||
import org.gradle.api.file.FileCollection
|
||||
import org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo
|
||||
import org.gradle.kotlin.dsl.closureOf
|
||||
import org.gradle.kotlin.dsl.extra
|
||||
import org.gradle.kotlin.dsl.project
|
||||
import java.io.File
|
||||
@@ -115,6 +117,87 @@ fun DependencyHandler.projectTests(name: String): ProjectDependency = project(na
|
||||
fun DependencyHandler.projectRuntimeJar(name: String): ProjectDependency = project(name, configuration = "runtimeJar")
|
||||
fun DependencyHandler.projectArchives(name: String): ProjectDependency = project(name, configuration = "archives")
|
||||
|
||||
enum class JpsDepScope {
|
||||
COMPILE, TEST, RUNTIME, PROVIDED
|
||||
}
|
||||
|
||||
fun DependencyHandler.add(configurationName: String, dependencyNotation: Any, configure: (ModuleDependency.() -> Unit)?) {
|
||||
// Avoid `dependencyNotation` to `ModuleDependency` class cast exception if possible
|
||||
if (configure != null) {
|
||||
add(configurationName, dependencyNotation, closureOf(configure))
|
||||
} else {
|
||||
add(configurationName, dependencyNotation)
|
||||
}
|
||||
}
|
||||
|
||||
fun DependencyHandler.jpsLikeJarDependency(
|
||||
dependencyNotation: Any,
|
||||
scope: JpsDepScope,
|
||||
dependencyConfiguration: (ModuleDependency.() -> Unit)? = null,
|
||||
exported: Boolean = false
|
||||
) {
|
||||
when (scope) {
|
||||
JpsDepScope.COMPILE -> {
|
||||
if (exported) {
|
||||
add("api", dependencyNotation, dependencyConfiguration)
|
||||
add("testCompile", dependencyNotation, dependencyConfiguration)
|
||||
} else {
|
||||
add("implementation", dependencyNotation, dependencyConfiguration)
|
||||
}
|
||||
}
|
||||
JpsDepScope.TEST -> {
|
||||
if (exported) {
|
||||
add("testCompile", dependencyNotation, dependencyConfiguration)
|
||||
} else {
|
||||
add("testImplementation", dependencyNotation, dependencyConfiguration)
|
||||
}
|
||||
}
|
||||
JpsDepScope.RUNTIME -> {
|
||||
add("testRuntimeOnly", dependencyNotation, dependencyConfiguration)
|
||||
}
|
||||
JpsDepScope.PROVIDED -> {
|
||||
if (exported) {
|
||||
add("compileOnlyApi", dependencyNotation, dependencyConfiguration)
|
||||
add("testCompile", dependencyNotation, dependencyConfiguration)
|
||||
} else {
|
||||
add("compileOnly", dependencyNotation, dependencyConfiguration)
|
||||
add("testImplementation", dependencyNotation, dependencyConfiguration)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun DependencyHandler.jpsLikeModuleDependency(moduleName: String, scope: JpsDepScope, exported: Boolean = false) {
|
||||
jpsLikeJarDependency(project(moduleName), scope, exported = exported)
|
||||
when (scope) {
|
||||
JpsDepScope.COMPILE -> {
|
||||
if (exported) {
|
||||
add("testCompile", projectTests(moduleName))
|
||||
} else {
|
||||
add("testImplementation", projectTests(moduleName))
|
||||
}
|
||||
}
|
||||
JpsDepScope.TEST -> {
|
||||
if (exported) {
|
||||
add("testCompile", projectTests(moduleName))
|
||||
} else {
|
||||
add("testImplementation", projectTests(moduleName))
|
||||
}
|
||||
}
|
||||
JpsDepScope.RUNTIME -> {
|
||||
add("runtimeOnly", projectTests(moduleName))
|
||||
}
|
||||
JpsDepScope.PROVIDED -> {
|
||||
if (exported) {
|
||||
add("testCompile", projectTests(moduleName))
|
||||
} else {
|
||||
add("testImplementation", projectTests(moduleName))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun Project.testApiJUnit5(
|
||||
vintageEngine: Boolean = false,
|
||||
runner: Boolean = false,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
idePluginDependency {
|
||||
publishProjectJars(listOf(":kotlin-allopen-compiler-plugin"))
|
||||
}
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
publishJarsForIde(listOf(":kotlin-allopen-compiler-plugin"))
|
||||
|
||||
+5
-3
@@ -1,3 +1,5 @@
|
||||
idePluginDependency {
|
||||
publishTestJar(listOf(":compiler:incremental-compilation-impl"))
|
||||
}
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
publishTestJarsForIde(listOf(":compiler:incremental-compilation-impl"))
|
||||
|
||||
+5
-3
@@ -1,3 +1,5 @@
|
||||
idePluginDependency {
|
||||
publishProjectJars(listOf(":plugins:android-extensions-compiler"))
|
||||
}
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
publishJarsForIde(listOf(":plugins:android-extensions-compiler"))
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
idePluginDependency {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val compilerComponents = rootProject.extra["compilerModulesForJps"] as List<String>
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
val otherProjects = listOf(":kotlin-daemon-client")
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val compilerComponents = rootProject.extra["compilerModulesForJps"] as List<String>
|
||||
|
||||
publishProjectJars(compilerComponents + otherProjects)
|
||||
}
|
||||
val otherProjects = listOf(":kotlin-daemon-client")
|
||||
|
||||
publishJarsForIde(compilerComponents + otherProjects)
|
||||
|
||||
+5
-3
@@ -1,3 +1,5 @@
|
||||
idePluginDependency {
|
||||
publishTestJar(listOf(":compiler:incremental-compilation-impl"))
|
||||
}
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
publishTestJarsForIde(listOf(":compiler:incremental-compilation-impl"))
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
idePluginDependency {
|
||||
publishTestJar(listOf(":kotlin-build-common"))
|
||||
}
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
publishTestJarsForIde(listOf(":kotlin-build-common"))
|
||||
|
||||
@@ -1,27 +1,29 @@
|
||||
idePluginDependency {
|
||||
val compilerModules: Array<String> by rootProject.extra
|
||||
|
||||
val excludedCompilerModules = listOf(
|
||||
":compiler:cli",
|
||||
":compiler:cli-js",
|
||||
":compiler:javac-wrapper",
|
||||
":compiler:backend.js",
|
||||
":compiler:backend.wasm",
|
||||
":js:js.dce",
|
||||
":compiler:ir.serialization.js",
|
||||
":compiler:incremental-compilation-impl",
|
||||
":compiler:fir:raw-fir:light-tree2fir"
|
||||
)
|
||||
|
||||
val projects = compilerModules.asList() - excludedCompilerModules + listOf(
|
||||
":kotlin-compiler-runner",
|
||||
":kotlin-preloader",
|
||||
":daemon-common",
|
||||
":kotlin-daemon-client"
|
||||
)
|
||||
|
||||
publishProjectJars(
|
||||
projects = projects,
|
||||
libraryDependencies = listOf(protobufFull())
|
||||
)
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
val compilerModules: Array<String> by rootProject.extra
|
||||
|
||||
val excludedCompilerModules = listOf(
|
||||
":compiler:cli",
|
||||
":compiler:cli-js",
|
||||
":compiler:javac-wrapper",
|
||||
":compiler:backend.js",
|
||||
":compiler:backend.wasm",
|
||||
":js:js.dce",
|
||||
":compiler:ir.serialization.js",
|
||||
":compiler:incremental-compilation-impl",
|
||||
":compiler:fir:raw-fir:light-tree2fir"
|
||||
)
|
||||
|
||||
val projects = compilerModules.asList() - excludedCompilerModules + listOf(
|
||||
":kotlin-compiler-runner",
|
||||
":kotlin-preloader",
|
||||
":daemon-common",
|
||||
":kotlin-daemon-client"
|
||||
)
|
||||
|
||||
publishJarsForIde(
|
||||
projects = projects,
|
||||
libraryDependencies = listOf(protobufFull())
|
||||
)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
idePluginDependency {
|
||||
publishProjectJars(listOf(":kotlin-gradle-statistics"))
|
||||
}
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
publishJarsForIde(listOf(":kotlin-gradle-statistics"))
|
||||
|
||||
+5
-3
@@ -1,3 +1,5 @@
|
||||
idePluginDependency {
|
||||
publishProjectJars(listOf(":kotlinx-serialization-compiler-plugin"))
|
||||
}
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
publishJarsForIde(listOf(":kotlinx-serialization-compiler-plugin"))
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
idePluginDependency {
|
||||
publishProjectJars(listOf(":kotlin-noarg-compiler-plugin"))
|
||||
}
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
publishJarsForIde(listOf(":kotlin-noarg-compiler-plugin"))
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
idePluginDependency {
|
||||
publishProjectJars(
|
||||
listOf(
|
||||
":plugins:parcelize:parcelize-compiler"
|
||||
)
|
||||
)
|
||||
}
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
publishJarsForIde(listOf(":plugins:parcelize:parcelize-compiler"))
|
||||
|
||||
+5
-3
@@ -1,3 +1,5 @@
|
||||
idePluginDependency {
|
||||
publishProjectJars(listOf(":kotlin-sam-with-receiver-compiler-plugin"))
|
||||
}
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
publishJarsForIde(listOf(":kotlin-sam-with-receiver-compiler-plugin"))
|
||||
|
||||
@@ -382,6 +382,23 @@ include ":prepare:ide-plugin-dependencies:android-extensions-compiler-plugin-for
|
||||
":prepare:ide-plugin-dependencies:compiler-components-for-jps",
|
||||
":prepare:ide-plugin-dependencies:kotlin-compiler-tests-for-ide"
|
||||
|
||||
if (buildProperties.getBoolean("attachedIntellijVersion", false)) {
|
||||
logger.info("Including kotlin-ide modules in settings.gradle")
|
||||
new File(rootDir, "kotlin-ide").eachFileRecurse {
|
||||
String fileName = it.name
|
||||
if (fileName.endsWith(".iml") && fileName.startsWith("kotlin.") && new File(it.parentFile, "build.gradle.kts").exists() ||
|
||||
fileName == "intellij.platform.debugger.testFramework.iml" || fileName == "intellij.gradle.tests.iml" ||
|
||||
fileName == "intellij.platform.externalSystem.tests.iml" || fileName == "intellij.platform.lang.tests.iml" ||
|
||||
fileName == "intellij.platform.testExtensions.iml" || fileName == "intellij.java.compiler.tests.iml" ||
|
||||
fileName == "intellij.gradle.toolingExtension.tests.iml"
|
||||
) {
|
||||
String projectName = ":kotlin-ide.${fileName.substring(0, fileName.length() - ".iml".length())}"
|
||||
include(projectName)
|
||||
project(projectName).projectDir = it.parentFile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (buildProperties.includeCidrPlugins) {
|
||||
logger.info("Including CIDR modules in settings.gradle")
|
||||
include ":kotlin-ultimate:ide:cidr-gradle-tooling",
|
||||
|
||||
Reference in New Issue
Block a user