From 0e8a04c4ba897b7c28856723a7459c8fd20a9ecb Mon Sep 17 00:00:00 2001 From: Raluca Sauciuc Date: Tue, 19 Jun 2018 21:54:43 -0700 Subject: [PATCH] as33: Android dependency reversal (cherry picked from commit be781f4f462f74ca0efcc91b5c07a5b3756ba5b2) --- .bunch | 3 +- build.gradle.kts.as33 | 702 ++++ idea/src/META-INF/extensions/ide.xml.as33 | 59 + idea/src/META-INF/plugin.xml.as33 | 2942 +++++++++++++++++ .../idea/KaptProjectResolverExtension.kt.as33 | 161 + .../build.gradle.kts.as33 | 31 + prepare/jps-plugin/build.gradle.kts.as33 | 37 + 7 files changed, 3934 insertions(+), 1 deletion(-) create mode 100644 build.gradle.kts.as33 create mode 100644 idea/src/META-INF/extensions/ide.xml.as33 create mode 100644 idea/src/META-INF/plugin.xml.as33 create mode 100644 plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt.as33 create mode 100644 plugins/sam-with-receiver/sam-with-receiver-ide/build.gradle.kts.as33 create mode 100644 prepare/jps-plugin/build.gradle.kts.as33 diff --git a/.bunch b/.bunch index 92dd71f778c..7871389e44a 100644 --- a/.bunch +++ b/.bunch @@ -3,4 +3,5 @@ 172_173 as31_173 as32 -182 \ No newline at end of file +182 +as33_as32 diff --git a/build.gradle.kts.as33 b/build.gradle.kts.as33 new file mode 100644 index 00000000000..0757f810b60 --- /dev/null +++ b/build.gradle.kts.as33 @@ -0,0 +1,702 @@ + +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import org.gradle.api.Project +import java.util.* +import java.io.File +import org.gradle.api.tasks.bundling.Jar +import org.gradle.plugins.ide.idea.model.IdeaModel +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile +import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile +import proguard.gradle.ProGuardTask + +buildscript { + extra["defaultSnapshotVersion"] = "1.2-SNAPSHOT" + + kotlinBootstrapFrom(BootstrapOption.TeamCity("1.2.60-dev-544", onlySuccessBootstrap = false)) + + val mirrorRepo: String? = findProperty("maven.repository.mirror")?.toString() + + val repos = listOfNotNull( + mirrorRepo, + bootstrapKotlinRepo, + "https://jcenter.bintray.com/", + "https://plugins.gradle.org/m2", + "http://dl.bintray.com/kotlin/kotlinx", + "https://repo.gradle.org/gradle/ext-releases-local", // for native-platform + "https://jetbrains.bintray.com/intellij-third-party-dependencies", // for jflex + "https://dl.bintray.com/jetbrains/markdown" // for org.jetbrains:markdown + ) + + extra["repos"] = repos + + repositories { + for (repo in repos) { + maven(url = repo) + } + } + + dependencies { + classpath("com.gradle.publish:plugin-publish-plugin:0.9.7") + classpath(kotlinDep("gradle-plugin", bootstrapKotlinVersion)) + classpath("net.sf.proguard:proguard-gradle:5.3.3") + } +} + +plugins { + `build-scan` + idea + id("jps-compatible") +} + +pill { + excludedDirs( + "out", + "buildSrc/build", + "buildSrc/prepare-deps/android-dx/build", + "buildSrc/prepare-deps/intellij-sdk/build" + ) +} + +buildScan { + setTermsOfServiceUrl("https://gradle.com/terms-of-service") + setTermsOfServiceAgree("yes") +} + +val configuredJdks: List = + getConfiguredJdks().also { + it.forEach { + logger.info("Using ${it.majorVersion} home: ${it.homeDir}") + } + } + +val defaultSnapshotVersion: String by extra +val buildNumber by extra(findProperty("build.number")?.toString() ?: defaultSnapshotVersion) +val kotlinVersion by extra(findProperty("deployVersion")?.toString() ?: buildNumber) + +val kotlinLanguageVersion by extra("1.2") + +allprojects { + group = "org.jetbrains.kotlin" + version = kotlinVersion +} + +extra["kotlin_root"] = rootDir + +val bootstrapCompileCfg = configurations.create("bootstrapCompile") + +repositories { + for (repo in (rootProject.extra["repos"] as List)) { + maven(url = repo) + } +} + +val cidrKotlinPlugin by configurations.creating + +dependencies { + bootstrapCompileCfg(kotlinDep("compiler-embeddable", bootstrapKotlinVersion)) + + cidrKotlinPlugin(project(":prepare:cidr-plugin", "runtimeJar")) +} + +val commonBuildDir = File(rootDir, "build") +val distDir by extra("$rootDir/dist") +val distKotlinHomeDir by extra("$distDir/kotlinc") +val distLibDir = "$distKotlinHomeDir/lib" +val commonLocalDataDir = "$rootDir/local" +val ideaSandboxDir = "$commonLocalDataDir/ideaSandbox" +val ideaUltimateSandboxDir = "$commonLocalDataDir/ideaUltimateSandbox" +val ideaPluginDir = "$distDir/artifacts/ideaPlugin/Kotlin" +val ideaUltimatePluginDir = "$distDir/artifacts/ideaUltimatePlugin/Kotlin" +val cidrPluginDir = "$distDir/artifacts/cidrPlugin/Kotlin" + +// TODO: use "by extra()" syntax where possible +extra["distLibDir"] = project.file(distLibDir) +extra["libsDir"] = project.file(distLibDir) +extra["commonLocalDataDir"] = project.file(commonLocalDataDir) +extra["ideaSandboxDir"] = project.file(ideaSandboxDir) +extra["ideaUltimateSandboxDir"] = project.file(ideaUltimateSandboxDir) +extra["ideaPluginDir"] = project.file(ideaPluginDir) +extra["ideaUltimatePluginDir"] = project.file(ideaUltimatePluginDir) +extra["cidrPluginDir"] = project.file(cidrPluginDir) +extra["isSonatypeRelease"] = false + +extra["JDK_16"] = jdkPath("1.6") +extra["JDK_17"] = jdkPath("1.7") +extra["JDK_18"] = jdkPath("1.8") +extra["JDK_9"] = jdkPath("9") +extra["JDK_10"] = jdkPathIfFound("10") + +rootProject.apply { + from(rootProject.file("versions.gradle.kts")) + from(rootProject.file("report.gradle.kts")) +} + +extra["versions.protobuf-java"] = "2.6.1" +extra["versions.javax.inject"] = "1" +extra["versions.jsr305"] = "1.3.9" +extra["versions.jansi"] = "1.16" +extra["versions.jline"] = "3.3.1" +extra["versions.junit"] = "4.12" +extra["versions.javaslang"] = "2.0.6" +extra["versions.ant"] = "1.8.2" +extra["versions.android"] = "2.3.1" +extra["versions.kotlinx-coroutines-core"] = "0.20" +extra["versions.kotlinx-coroutines-jdk8"] = "0.20" +extra["versions.json"] = "20160807" +extra["versions.native-platform"] = "0.14" +extra["versions.ant-launcher"] = "1.8.0" +extra["versions.robolectric"] = "3.1" +extra["versions.org.springframework"] = "4.2.0.RELEASE" +extra["versions.jflex"] = "1.7.0" +extra["versions.markdown"] = "0.1.25" + +val isTeamcityBuild = project.hasProperty("teamcity") || System.getenv("TEAMCITY_VERSION") != null +val intellijUltimateEnabled = project.getBooleanProperty("intellijUltimateEnabled") ?: isTeamcityBuild +val effectSystemEnabled by extra(project.getBooleanProperty("kotlin.compiler.effectSystemEnabled") ?: false) +val newInferenceEnabled by extra(project.getBooleanProperty("kotlin.compiler.newInferenceEnabled") ?: false) + +val intellijSeparateSdks = project.getBooleanProperty("intellijSeparateSdks") ?: false + +extra["intellijUltimateEnabled"] = intellijUltimateEnabled +extra["intellijSeparateSdks"] = intellijSeparateSdks + +extra["IntellijCoreDependencies"] = + listOf("annotations", + "asm-all", + "guava-21.0", + "jdom", + "jna", + "log4j", + "picocontainer", + "snappy-in-java-0.5.1", + "streamex", + "trove4j") + +extra["nativePlatformVariants"] = + listOf("windows-amd64", + "windows-i386", + "osx-amd64", + "osx-i386", + "linux-amd64", + "linux-i386", + "freebsd-amd64-libcpp", + "freebsd-amd64-libstdcpp", + "freebsd-i386-libcpp", + "freebsd-i386-libstdcpp") + +extra["compilerModules"] = arrayOf( + ":compiler:util", + ":compiler:container", + ":compiler:resolution", + ":compiler:serialization", + ":compiler:psi", + ":compiler:frontend", + ":compiler:frontend.java", + ":compiler:frontend.script", + ":compiler:cli-common", + ":compiler:daemon-common", + ":compiler:daemon", + ":compiler:ir.tree", + ":compiler:ir.psi2ir", + ":compiler:backend.js", + ":compiler:backend-common", + ":compiler:backend", + ":compiler:plugin-api", + ":compiler:light-classes", + ":compiler:cli", + ":compiler:incremental-compilation-impl", + ":js:js.ast", + ":js:js.serializer", + ":js:js.parser", + ":js:js.frontend", + ":js:js.translator", + ":js:js.dce", + ":compiler", + ":kotlin-build-common", + ":core:metadata", + ":core:metadata.jvm", + ":core:descriptors", + ":core:descriptors.jvm", + ":core:deserialization", + ":core:util.runtime" +) + +val coreLibProjects = listOf( + ":kotlin-stdlib", + ":kotlin-stdlib-common", + ":kotlin-stdlib-js", + ":kotlin-stdlib-jre7", + ":kotlin-stdlib-jre8", + ":kotlin-stdlib-jdk7", + ":kotlin-stdlib-jdk8", + ":kotlin-test:kotlin-test-common", + ":kotlin-test:kotlin-test-jvm", + ":kotlin-test:kotlin-test-junit", + ":kotlin-test:kotlin-test-junit5", + ":kotlin-test:kotlin-test-testng", + ":kotlin-test:kotlin-test-js", + ":kotlin-reflect" +) + +val gradlePluginProjects = listOf( + ":kotlin-gradle-plugin", + ":kotlin-gradle-plugin:plugin-marker", + ":kotlin-gradle-plugin-api", +// ":kotlin-gradle-plugin-integration-tests", // TODO: build fails + ":kotlin-allopen", + ":kotlin-allopen:plugin-marker", + ":kotlin-annotation-processing-gradle", + ":kotlin-noarg", + ":kotlin-noarg:plugin-marker", + ":kotlin-sam-with-receiver" +) + +apply { + from("libraries/commonConfiguration.gradle") + from("libraries/configureGradleTools.gradle") +} + +apply { + if (extra["isSonatypeRelease"] as? Boolean == true) { + logger.info("Applying configuration for sonatype release") + from("libraries/prepareSonatypeStaging.gradle") + } +} + +fun Task.listConfigurationContents(configName: String) { + doFirst { + project.configurations.findByName(configName)?.let { + println("$configName configuration files:\n${it.allArtifacts.files.files.joinToString("\n ", " ")}") + } + } +} + +val defaultJvmTarget = "1.8" +val defaultJavaHome = jdkPath(defaultJvmTarget!!) +val ignoreTestFailures by extra(project.findProperty("ignoreTestFailures")?.toString()?.toBoolean() ?: project.hasProperty("teamcity")) + +allprojects { + + jvmTarget = defaultJvmTarget + javaHome = defaultJavaHome + + // There are problems with common build dir: + // - some tests (in particular js and binary-compatibility-validator depend on the fixed (default) location + // - idea seems unable to exclude common builddir from indexing + // therefore it is disabled by default + // buildDir = File(commonBuildDir, project.name) + + val repos: List by rootProject.extra + repositories { + intellijSdkRepo(project) + androidDxJarRepo(project) + + for (repo in repos) { + maven(repo) + } + } + + configureJvmProject(javaHome!!, jvmTarget!!) + + val commonCompilerArgs = listOf("-Xallow-kotlin-package", "-Xread-deserialized-contracts") + + tasks.withType> { + kotlinOptions { + languageVersion = kotlinLanguageVersion + apiVersion = kotlinLanguageVersion + freeCompilerArgs = commonCompilerArgs + } + } + + tasks.withType { + kotlinOptions { + freeCompilerArgs = commonCompilerArgs + listOf("-Xnormalize-constructor-calls=enable") + } + } + + tasks.withType(VerificationTask::class.java as Class) { + (this as VerificationTask).ignoreFailures = ignoreTestFailures + } + + tasks.withType { + enabled = false + } + + task("javadocJar") { + classifier = "javadoc" + } + + tasks.withType { + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + } + + task("listArchives") { listConfigurationContents("archives") } + + task("listRuntimeJar") { listConfigurationContents("runtimeJar") } + + task("listDistJar") { listConfigurationContents("distJar") } + + afterEvaluate { + logger.info("configuring project $name to compile to the target jvm version $jvmTarget using jdk: $javaHome") + if (javaHome != defaultJavaHome || jvmTarget != defaultJvmTarget) { + configureJvmProject(javaHome!!, jvmTarget!!) + } + + fun File.toProjectRootRelativePathOrSelf() = (relativeToOrNull(rootDir)?.takeUnless { it.startsWith("..") } ?: this).path + + fun FileCollection.printClassPath(role: String) = + println("${project.path} $role classpath:\n ${joinToString("\n ") { it.toProjectRootRelativePathOrSelf() } }") + + try { the() } catch (_: UnknownDomainObjectException) { null }?.let { javaConvention -> + task("printCompileClasspath") { doFirst { javaConvention.sourceSets["main"].compileClasspath.printClassPath("compile") } } + task("printRuntimeClasspath") { doFirst { javaConvention.sourceSets["main"].runtimeClasspath.printClassPath("runtime") } } + task("printTestCompileClasspath") { doFirst { javaConvention.sourceSets["test"].compileClasspath.printClassPath("test compile") } } + task("printTestRuntimeClasspath") { doFirst { javaConvention.sourceSets["test"].runtimeClasspath.printClassPath("test runtime") } } + } + } +} + +val dist by task { + val childDistTasks = getTasksByName("dist", true) - this@task + dependsOn(childDistTasks) + + into(distDir) + from(files("compiler/cli/bin")) { into("kotlinc/bin") } + from(files("license")) { into("kotlinc/license") } +} + +val copyCompilerToIdeaPlugin by task { + dependsOn(dist) + into(ideaPluginDir) + from(distDir) { include("kotlinc/**") } +} + +val ideaPlugin by task { + dependsOn(copyCompilerToIdeaPlugin) + val childIdeaPluginTasks = getTasksByName("ideaPlugin", true) - this@task + dependsOn(childIdeaPluginTasks) + + doLast { + delete("$ideaPluginDir/lib/android-ide.jar") + delete("$ideaPluginDir/lib/android-output-parser-ide.jar") + delete("$ideaPluginDir/lib/android-extensions-ide.jar") + } +} + +tasks { + "clean" { + doLast { + delete("$buildDir/repo") + delete(distDir) + } + } + + "cleanupArtifacts" { + doLast { + delete(ideaPluginDir) + delete(ideaUltimatePluginDir) + delete(cidrPluginDir) + } + } + + "coreLibsTest" { + (coreLibProjects + listOf( + ":kotlin-stdlib:samples", + ":kotlin-test:kotlin-test-js:kotlin-test-js-it", + ":kotlinx-metadata-jvm", + ":tools:binary-compatibility-validator" + )).forEach { + dependsOn(it + ":check") + } + } + + "gradlePluginTest" { + gradlePluginProjects.forEach { + dependsOn(it + ":check") + } + } + + "gradlePluginIntegrationTest" { + dependsOn(":kotlin-gradle-plugin-integration-tests:check") + } + + "jvmCompilerTest" { + dependsOn("dist") + dependsOn(":compiler:test", + ":compiler:container:test", + ":compiler:tests-java8:test") + } + + "jsCompilerTest" { + dependsOn(":js:js.tests:test") + dependsOn(":js:js.tests:runMocha") + } + + "scriptingTest" { + dependsOn("dist") + dependsOn(":kotlin-script-util:test") + } + + "compilerTest" { + dependsOn("jvmCompilerTest") + dependsOn("jsCompilerTest") + + dependsOn("scriptingTest") + dependsOn(":kotlin-build-common:test") + dependsOn(":compiler:incremental-compilation-impl:test") + } + + "toolsTest" { + dependsOn(":tools:kotlinp:test") + } + + "examplesTest" { + dependsOn("dist") + (project(":examples").subprojects + project(":kotlin-gradle-subplugin-example")).forEach { p -> + dependsOn("${p.path}:check") + } + } + + "distTest" { + dependsOn("compilerTest") + dependsOn("toolsTest") + dependsOn("gradlePluginTest") + dependsOn("examplesTest") + } + + "androidCodegenTest" { + dependsOn(":compiler:android-tests:test") + } + + "jps-tests" { + dependsOn("dist") + dependsOn(":jps-plugin:test") + } + + "idea-plugin-main-tests" { + dependsOn("dist") + dependsOn(":idea:test") + } + + "idea-plugin-additional-tests" { + dependsOn("dist") + dependsOn(":idea:idea-gradle:test", + ":idea:idea-maven:test", + ":j2k:test", + ":eval4j:test") + } + + "idea-plugin-tests" { + dependsOn("dist") + dependsOn("idea-plugin-main-tests", + "idea-plugin-additional-tests") + } + + "android-ide-tests" { + dependsOn("dist") + dependsOn(":plugins:android-extensions-ide:test", + ":idea:idea-android:test", + ":kotlin-annotation-processing:test") + } + + "plugins-tests" { + dependsOn("dist") + dependsOn(":kotlin-annotation-processing:test", + ":kotlin-source-sections-compiler-plugin:test", + ":kotlin-allopen-compiler-plugin:test", + ":kotlin-noarg-compiler-plugin:test", + ":kotlin-sam-with-receiver-compiler-plugin:test", + ":plugins:uast-kotlin:test", + ":kotlin-annotation-processing-gradle:test") + } + + + "ideaPluginTest" { + dependsOn( + "idea-plugin-tests", + "jps-tests", + "plugins-tests", + "android-ide-tests", + ":generators:test" + ) + } + + + "test" { + doLast { + throw GradleException("Don't use directly, use aggregate tasks *-check instead") + } + } + "check" { dependsOn("test") } +} + +fun CopySpec.setExecutablePermissions() { + filesMatching("**/bin/*") { mode = 0b111101101 } + filesMatching("**/bin/*.bat") { mode = 0b110100100 } +} + +val zipCompiler by task { + dependsOn(dist) + destinationDir = file(distDir) + archiveName = "kotlin-compiler-$kotlinVersion.zip" + + from(distKotlinHomeDir) + into("kotlinc") + setExecutablePermissions() + + doLast { + logger.lifecycle("Compiler artifacts packed to $archivePath") + } +} + +val zipTestData by task { + destinationDir = file(distDir) + archiveName = "kotlin-test-data.zip" + from("compiler/testData") { into("compiler") } + from("idea/testData") { into("ide") } + from("idea/idea-completion/testData") { into("ide/completion") } + doLast { + logger.lifecycle("Test data packed to $archivePath") + } +} + +val zipPlugin by task { + val src = when (project.findProperty("pluginArtifactDir") as String?) { + "Kotlin" -> ideaPluginDir + "KotlinUltimate" -> ideaUltimatePluginDir + null -> if (project.hasProperty("ultimate")) ideaUltimatePluginDir else ideaPluginDir + else -> error("Unsupported plugin artifact dir") + } + val destPath = project.findProperty("pluginZipPath") as String? + val dest = File(destPath ?: "$buildDir/kotlin-plugin.zip") + destinationDir = dest.parentFile + archiveName = dest.name + doFirst { + if (destPath == null) throw GradleException("Specify target zip path with 'pluginZipPath' property") + } + + from(src) + into("Kotlin") + setExecutablePermissions() + + doLast { + logger.lifecycle("Plugin artifacts packed to $archivePath") + } +} + +val cidrPlugin by task { + dependsOn(ideaPlugin) + into(cidrPluginDir) + from(ideaPluginDir) { + exclude("lib/kotlin-plugin.jar") + + exclude("lib/uast-kotlin.jar") + exclude("lib/uast-kotlin-ide.jar") + exclude("lib/android-ide.jar") + exclude("lib/android-output-parser-ide.jar") + exclude("lib/android-extensions-ide.jar") + exclude("lib/android-extensions-compiler.jar") + exclude("lib/kapt3-idea.jar") + exclude("lib/jps-ide.jar") + exclude("lib/jps/**") + exclude("kotlinc/**") + exclude("lib/maven-ide.jar") + } + from(cidrKotlinPlugin) { into("lib") } +} + +val zipCidrPlugin by task { + val destPath = project.findProperty("pluginZipPath") as String? + ?: "$distDir/artifacts/kotlin-plugin-$kotlinVersion-CIDR.zip" + val destFile = File(destPath) + + destinationDir = destFile.parentFile + archiveName = destFile.name + + from(cidrPlugin) + into("Kotlin") + setExecutablePermissions() + + doLast { + logger.lifecycle("Plugin artifacts packed to $archivePath") + } +} + +configure { + module { + excludeDirs = files( + project.buildDir, + commonLocalDataDir, + ".gradle", + "dependencies", + "dist" + ).toSet() + } +} + +fun jdkPathIfFound(version: String): String? { + val jdkName = "JDK_${version.replace(".", "")}" + val jdkMajorVersion = JdkMajorVersion.valueOf(jdkName) + return configuredJdks.find { it.majorVersion == jdkMajorVersion }?.homeDir?.canonicalPath +} + +fun jdkPath(version: String): String = jdkPathIfFound(version) + ?: throw GradleException ("Please set environment variable JDK_${version.replace(".", "")} to point to JDK $version installation") + +fun Project.configureJvmProject(javaHome: String, javaVersion: String) { + tasks.withType { + if (name != "compileJava9Java") { + options.isFork = true + options.forkOptions.javaHome = file(javaHome) + options.compilerArgs.add("-proc:none") + options.encoding = "UTF-8" + } + } + + tasks.withType { + kotlinOptions.jdkHome = javaHome + kotlinOptions.jvmTarget = javaVersion + } + + tasks.withType { + executable = File(javaHome, "bin/java").canonicalPath + } +} + +tasks.create("findShadowJarsInClasspath").doLast { + fun Collection.printSorted(indent: String = " ") { + sortedBy { it.path }.forEach { println(indent + it.relativeTo(rootProject.projectDir)) } + } + + val shadowJars = hashSetOf() + for (project in rootProject.allprojects) { + for (task in project.tasks) { + when (task) { + is ShadowJar -> { + shadowJars.add(File(task.archivePath)) + } + is ProGuardTask -> { + shadowJars.addAll(task.outputs.files.toList()) + } + } + } + } + + println("Shadow jars:") + shadowJars.printSorted() + + fun Project.checkConfig(configName: String) { + val config = configurations.findByName(configName) ?: return + val shadowJarsInConfig = config.resolvedConfiguration.files.filter { it in shadowJars } + if (shadowJarsInConfig.isNotEmpty()) { + println() + println("Project $project contains shadow jars in configuration '$configName':") + shadowJarsInConfig.printSorted() + } + } + + for (project in rootProject.allprojects) { + project.checkConfig("compileClasspath") + project.checkConfig("testCompileClasspath") + } +} diff --git a/idea/src/META-INF/extensions/ide.xml.as33 b/idea/src/META-INF/extensions/ide.xml.as33 new file mode 100644 index 00000000000..ced5e044c59 --- /dev/null +++ b/idea/src/META-INF/extensions/ide.xml.as33 @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/idea/src/META-INF/plugin.xml.as33 b/idea/src/META-INF/plugin.xml.as33 new file mode 100644 index 00000000000..9ba8dfabbaa --- /dev/null +++ b/idea/src/META-INF/plugin.xml.as33 @@ -0,0 +1,2942 @@ + + org.jetbrains.kotlin + + Kotlin + +Getting Started in IntelliJ IDEA
+Getting Started in Android Studio
+Public Slack
+Issue tracker
+]]>
+ @snapshot@ + JetBrains + + + + com.intellij.modules.platform + + + org.jetbrains.kotlin.native.platform.deps + + JUnit + org.jetbrains.plugins.gradle + org.jetbrains.idea.maven + TestNG-J + com.intellij.copyright + Coverage + com.intellij.java-i18n + org.intellij.intelliLang + org.jetbrains.java.decompiler + + + + + com.intellij.modules.java + JavaScriptDebugger + + + + + org.jetbrains.kotlin.idea.highlighter.KotlinBeforeResolveHighlightingPass$Factory + + + org.jetbrains.kotlin.idea.refactoring.cutPaste.MoveDeclarationsPassFactory + + + + org.jetbrains.kotlin.idea.highlighter.ScriptExternalHighlightingPass$Factory + + + org.jetbrains.kotlin.idea.completion.LookupCancelWatcher + + + org.jetbrains.kotlin.idea.project.KotlinCodeBlockModificationListener + + + org.jetbrains.kotlin.idea.caches.KotlinPackageContentModificationListener + + + org.jetbrains.kotlin.idea.completion.CompletionBindingContextProvider + org.jetbrains.kotlin.idea.completion.CompletionBindingContextProvider + + + + + + org.jetbrains.kotlin.idea.PluginStartupComponent + + + + org.jetbrains.kotlin.idea.versions.KotlinUpdatePluginComponent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.jetbrains.kotlin.idea.intentions.FoldInitializerAndIfToElvisIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ImportMemberIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ImportAllMembersIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.SpecifyTypeExplicitlyIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.SpecifyTypeExplicitlyInDestructuringAssignmentIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.RemoveExplicitTypeIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertToBlockBodyIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.conventionNameCalls.ReplaceContainsIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.conventionNameCalls.ReplaceInvokeIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.conventionNameCalls.ReplaceCallWithUnaryOperatorIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.FoldIfToReturnAsymmetricallyIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.UnfoldAssignmentToIfIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.UnfoldPropertyToIfIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.UnfoldAssignmentToWhenIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.UnfoldPropertyToWhenIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.UnfoldReturnToIfIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.UnfoldReturnToWhenIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.DoubleBangToIfThenIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfThenToDoubleBangIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.ElvisToIfThenIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.SafeAccessToIfThenIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.IfToWhenIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.WhenToIfIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.FlattenWhenIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.EliminateWhenSubjectIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.branchedTransformations.intentions.MergeWhenIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.RemoveUnnecessaryParenthesesIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.RemoveExplicitTypeArgumentsIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.RemoveExplicitSuperQualifierIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.RemoveCurlyBracesFromTemplateIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.InsertCurlyBracesToTemplateIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.MoveLambdaInsideParenthesesIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.InsertExplicitTypeArgumentsIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.declarations.SplitPropertyDeclarationIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.declarations.ConvertMemberToExtensionIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ReconstructTypeInCastOrIsIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.InfixCallToOrdinaryIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ToInfixCallIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ReplaceExplicitFunctionLiteralParamWithItIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ReplaceItWithExplicitFunctionLiteralParamIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ReplaceSubstringWithDropLastIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ReplaceSubstringWithSubstringAfterIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ReplaceSubstringWithSubstringBeforeIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ReplaceSubstringWithTakeIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.RemoveBracesIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.AddBracesIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertNegatedBooleanSequenceIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertBinaryExpressionWithDemorgansLawIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.SimplifyBooleanWithConstantsIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.AddForLoopIndicesIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.RemoveForLoopIndicesIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.loopToCallChain.UseWithIndexIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.SwapBinaryExpressionIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.SwapStringEqualsIgnoreCaseIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.SplitIfIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ReplaceWithOrdinaryAssignmentIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertAssertToIfWithThrowIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertIfWithThrowToAssertIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.SpecifyExplicitLambdaSignatureIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.RemoveExplicitLambdaParameterTypesIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertForEachToForLoopIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertToForEachFunctionCallIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertToStringTemplateIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertToRawStringTemplateIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.OperatorToFunctionIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertToConcatenatedStringIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertFunctionToPropertyIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertPropertyToFunctionIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertReceiverToParameterIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertParameterToReceiverIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertPropertyInitializerToGetterIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.InvertIfConditionIntention + Kotlin + + + + org.jetbrains.kotlin.idea.refactoring.move.changePackage.ChangePackageIntention + Kotlin + + + + org.jetbrains.kotlin.idea.refactoring.move.moveDeclarations.MoveDeclarationToSeparateFileIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ChangeVisibilityModifierIntention$Public + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ChangeVisibilityModifierIntention$Private + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ChangeVisibilityModifierIntention$Protected + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ChangeVisibilityModifierIntention$Internal + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.AddNameToArgumentIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ReplaceUnderscoreWithParameterNameIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.AddJvmOverloadsIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.AddJvmStaticIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.RemoveArgumentNameIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.IterateExpressionIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.UsePropertyAccessSyntaxIntention + Kotlin + + + + org.jetbrains.kotlin.idea.quickfix.AddConstModifierIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.IntroduceBackingPropertyIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.JoinDeclarationAndAssignmentIntention + Kotlin + + + + org.jetbrains.kotlin.idea.testIntegration.KotlinCreateTestIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.AddOperatorModifierIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ObjectLiteralToLambdaIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.DestructureIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.AnonymousFunctionToLambdaIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ImplementAbstractMemberIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ImplementAbstractMemberAsConstructorParameterIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.AddValVarToConstructorParameterAction$Intention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.MoveMemberToCompanionObjectIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.MoveMemberOutOfCompanionObjectIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.CreateKotlinSubClassIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ToRawStringLiteralIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ToOrdinaryStringLiteralIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.IntroduceVariableIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.RemoveSingleExpressionStringTemplateIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ReplaceUntilWithRangeToIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.RemoveEmptyParenthesesFromLambdaCallIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertCamelCaseTestFunctionToSpacedIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ReplaceSingleLineLetIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.copyConcatenatedStringToClipboard.CopyConcatenatedStringToClipboardIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ReplaceMathMaxWithCoerceAtLeastIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ReplaceMathMinWithCoerceAtMostIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertPrimaryConstructorToSecondaryIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertSecondaryConstructorToPrimaryIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ReplaceSizeCheckWithIsNotEmptyIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ReplaceSizeZeroCheckWithIsEmptyIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.RemoveEmptyClassBodyIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertEnumToSealedClassIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertSealedClassToEnumIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.RemoveRedundantCallsOfConversionMethodsIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.RemoveEmptyPrimaryConstructorIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.RemoveEmptySecondaryConstructorBodyIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertTryFinallyToUseCallIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.AddNamesToCallArgumentsIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertFunctionTypeParameterToReceiverIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertFunctionTypeReceiverToParameterIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertTwoComparisonsToRangeCheckIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertRangeCheckToTwoComparisonsIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.RenameFileToMatchClassIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertObjectLiteralToClassIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.MergeIfsIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.AddMissingDestructuringIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertToApplyIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertToWithIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertToRunIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.MovePropertyToClassBodyIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.MovePropertyToConstructorIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.AddOpenModifierIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ValToObjectIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ChopParameterListIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ChopArgumentListIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.NullableBooleanEqualityCheckToElvisIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ReplaceAddWithPlusAssignIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertClassToSealedClassIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.AddPropertyAccessorsIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.AddPropertyGetterIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.AddPropertySetterIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.MoveMemberToTopLevelIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ReplaceSubstringWithIndexingOperationIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertUnsafeCastCallToUnsafeCastIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertUnsafeCastToUnsafeCastCallIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.RemoveLabeledReturnInLambdaIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.AddLabeledReturnInLambdaIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.AddAnnotationUseSiteTargetIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.JoinParameterListIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.JoinArgumentListIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertLineCommentToBlockCommentIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertBlockCommentToLineCommentIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.IndentRawStringIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertVarargParameterToArrayIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.ConvertArrayParameterToVarargIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.LambdaToAnonymousFunctionIntention + Kotlin + + + + org.jetbrains.kotlin.idea.intentions.AddWhenRemainingBranchesIntention + Kotlin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt.as33 b/plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt.as33 new file mode 100644 index 00000000000..846f0760428 --- /dev/null +++ b/plugins/kapt3/kapt3-idea/src/org/jetbrains/kotlin/kapt/idea/KaptProjectResolverExtension.kt.as33 @@ -0,0 +1,161 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.kapt.idea + +import com.intellij.openapi.diagnostic.Logger +import com.intellij.openapi.externalSystem.model.DataNode +import com.intellij.openapi.externalSystem.model.ProjectKeys +import com.intellij.openapi.externalSystem.model.project.* +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.tooling.model.idea.IdeaModule +import org.jetbrains.kotlin.gradle.AbstractKotlinGradleModelBuilder +import org.jetbrains.kotlin.idea.framework.GRADLE_SYSTEM_ID +import org.jetbrains.plugins.gradle.model.data.GradleSourceSetData +import org.jetbrains.plugins.gradle.service.project.AbstractProjectResolverExtension +import org.jetbrains.plugins.gradle.tooling.ErrorMessageBuilder +import java.io.File +import java.io.Serializable +import java.lang.Exception +import java.lang.reflect.Modifier + +interface KaptSourceSetModel : Serializable { + val sourceSetName: String + val isTest: Boolean + val generatedSourcesDir: String + val generatedClassesDir: String + val generatedKotlinSourcesDir: String + + val generatedSourcesDirFile get() = generatedSourcesDir.takeIf { it.isNotEmpty() }?.let(::File) + val generatedClassesDirFile get() = generatedClassesDir.takeIf { it.isNotEmpty() }?.let(::File) + val generatedKotlinSourcesDirFile get() = generatedKotlinSourcesDir.takeIf { it.isNotEmpty() }?.let(::File) +} + +class KaptSourceSetModelImpl( + override val sourceSetName: String, + override val isTest: Boolean, + override val generatedSourcesDir: String, + override val generatedClassesDir: String, + override val generatedKotlinSourcesDir: String +) : KaptSourceSetModel + +interface KaptGradleModel : Serializable { + val isEnabled: Boolean + val buildDirectory: File + val sourceSets: List +} + +class KaptGradleModelImpl( + override val isEnabled: Boolean, + override val buildDirectory: File, + override val sourceSets: List +) : KaptGradleModel + +@Suppress("unused") +class KaptProjectResolverExtension : AbstractProjectResolverExtension() { + private companion object { + private val LOG = Logger.getInstance(KaptProjectResolverExtension::class.java) + } + + override fun getExtraProjectModelClasses() = setOf(KaptGradleModel::class.java) + override fun getToolingExtensionsClasses() = setOf(KaptModelBuilderService::class.java, Unit::class.java) + + override fun populateModuleExtraModels(gradleModule: IdeaModule, ideModule: DataNode) { + val kaptModel = resolverCtx.getExtraProject(gradleModule, KaptGradleModel::class.java) ?: return + + if (kaptModel.isEnabled) { + for (sourceSet in kaptModel.sourceSets) { + val sourceSetDataNode = ideModule.findGradleSourceSet(sourceSet.sourceSetName) ?: continue + + fun addSourceSet(path: String, type: ExternalSystemSourceType) { + val contentRootData = ContentRootData(GRADLE_SYSTEM_ID, path) + contentRootData.storePath(type, path) + sourceSetDataNode.createChild(ProjectKeys.CONTENT_ROOT, contentRootData) + } + + val sourceType = if (sourceSet.isTest) ExternalSystemSourceType.TEST_GENERATED else ExternalSystemSourceType.SOURCE_GENERATED + sourceSet.generatedSourcesDirFile?.let { addSourceSet(it.absolutePath, sourceType) } + sourceSet.generatedKotlinSourcesDirFile?.let { addSourceSet(it.absolutePath, sourceType) } + + sourceSet.generatedClassesDirFile?.let { generatedClassesDir -> + val libraryData = LibraryData(GRADLE_SYSTEM_ID, "kaptGeneratedClasses") + libraryData.addPath(LibraryPathType.BINARY, generatedClassesDir.absolutePath) + val libraryDependencyData = LibraryDependencyData(sourceSetDataNode.data, libraryData, LibraryLevel.MODULE) + sourceSetDataNode.createChild(ProjectKeys.LIBRARY_DEPENDENCY, libraryDependencyData) + } + } + } + + super.populateModuleExtraModels(gradleModule, ideModule) + } + + private fun DataNode.findGradleSourceSet(sourceSetName: String): DataNode? { + val moduleName = data.id + for (child in children) { + val gradleSourceSetData = child.data as? GradleSourceSetData ?: continue + if (gradleSourceSetData.id == "$moduleName:$sourceSetName") { + @Suppress("UNCHECKED_CAST") + return child as DataNode? + } + } + + return null + } +} + +class KaptModelBuilderService : AbstractKotlinGradleModelBuilder() { + override fun getErrorMessageBuilder(project: Project, e: Exception): ErrorMessageBuilder { + return ErrorMessageBuilder.create(project, e, "Gradle import errors") + .withDescription("Unable to build kotlin-kapt plugin configuration") + } + + override fun canBuild(modelName: String?): Boolean = modelName == KaptGradleModel::class.java.name + + override fun buildAll(modelName: String?, project: Project): Any { + val kaptPlugin: Plugin<*>? = project.plugins.findPlugin("kotlin-kapt") + val kaptIsEnabled = kaptPlugin != null + + val sourceSets = mutableListOf() + + if (kaptIsEnabled) { + project.getAllTasks(false)[project]?.forEach { compileTask -> + if (compileTask.javaClass.name !in kotlinCompileTaskClasses) return@forEach + + val sourceSetName = compileTask.getSourceSetName() + val isTest = sourceSetName.toLowerCase().endsWith("test") + + val kaptGeneratedSourcesDir = getKaptDirectory("getKaptGeneratedSourcesDir", project, sourceSetName) + val kaptGeneratedClassesDir = getKaptDirectory("getKaptGeneratedClassesDir", project, sourceSetName) + val kaptGeneratedKotlinSourcesDir = getKaptDirectory("getKaptGeneratedKotlinSourcesDir", project, sourceSetName) + sourceSets += KaptSourceSetModelImpl( + sourceSetName, isTest, kaptGeneratedSourcesDir, kaptGeneratedClassesDir, kaptGeneratedKotlinSourcesDir) + } + } + + return KaptGradleModelImpl(kaptIsEnabled, project.buildDir, sourceSets) + } + + private fun getKaptDirectory(funName: String, project: Project, sourceSetName: String): String { + val kotlinKaptPlugin = project.plugins.findPlugin("kotlin-kapt") ?: return "" + + val targetMethod = kotlinKaptPlugin::class.java.methods.firstOrNull { + Modifier.isStatic(it.modifiers) && it.name == funName && it.parameterCount == 2 + } ?: return "" + + return (targetMethod(null, project, sourceSetName) as? File)?.absolutePath ?: "" + } +} \ No newline at end of file diff --git a/plugins/sam-with-receiver/sam-with-receiver-ide/build.gradle.kts.as33 b/plugins/sam-with-receiver/sam-with-receiver-ide/build.gradle.kts.as33 new file mode 100644 index 00000000000..906b7335142 --- /dev/null +++ b/plugins/sam-with-receiver/sam-with-receiver-ide/build.gradle.kts.as33 @@ -0,0 +1,31 @@ + +description = "Kotlin SamWithReceiver IDEA Plugin" + +plugins { + kotlin("jvm") + id("jps-compatible") +} + +jvmTarget = "1.6" + +dependencies { + compile(project(":kotlin-sam-with-receiver-compiler-plugin")) + compile(project(":plugins:annotation-based-compiler-plugins-ide-support")) + compile(project(":compiler:util")) + compile(project(":compiler:frontend")) + compile(project(":compiler:frontend.java")) + compile(project(":idea:idea-core")) + compile(project(":idea")) + compile(project(":idea:idea-jvm")) + compile(intellijDep()) { includeJars("openapi", "platform-api", "extensions", "util") } +} + +sourceSets { + "main" { projectDefault() } + "test" {} +} + +runtimeJar() + +ideaPlugin() + diff --git a/prepare/jps-plugin/build.gradle.kts.as33 b/prepare/jps-plugin/build.gradle.kts.as33 new file mode 100644 index 00000000000..73c2fee4a65 --- /dev/null +++ b/prepare/jps-plugin/build.gradle.kts.as33 @@ -0,0 +1,37 @@ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + +description = "Kotlin JPS plugin" + +plugins { + `java-base` + id("pill-configurable") +} + +val projectsToShadow = listOf( + ":kotlin-build-common", + ":compiler:cli-common", + ":kotlin-compiler-runner", + ":compiler:daemon-common", + ":core:descriptors", + ":core:descriptors.jvm", + ":idea:idea-jps-common", + ":jps-plugin", + ":kotlin-preloader", + ":compiler:util", + ":core:util.runtime") + +dependencies { + projectsToShadow.forEach { + embeddedComponents(project(it)) { isTransitive = false } + } + embeddedComponents(projectRuntimeJar(":kotlin-daemon-client")) +} + +runtimeJar(task("jar")) { + manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.runner.Main") + manifest.attributes.put("Class-Path", "kotlin-stdlib.jar") + from(files("$rootDir/resources/kotlinManifest.properties")) + fromEmbeddedComponents() +} + +ideaPlugin("lib/jps")