Integrate serialization plugin into big Kotlin plugin

Split import handlers into multiple files
Add empty Maven handler for Android Studio

Add testRuntime dependency on kx-serialization-plugin for all modules which require compiler
plugins in test classpath
This commit is contained in:
Leonid Startsev
2018-09-05 16:03:16 +03:00
parent 087f60389a
commit dea69e4469
60 changed files with 117 additions and 184 deletions
-2
View File
@@ -88,7 +88,6 @@ val commonLocalDataDir = "$rootDir/local"
val ideaSandboxDir = "$commonLocalDataDir/ideaSandbox"
val ideaUltimateSandboxDir = "$commonLocalDataDir/ideaUltimateSandbox"
val ideaPluginDir = "$distDir/artifacts/ideaPlugin/Kotlin"
val serialPluginDir = "$distDir/artifacts/Serialization"
val ideaUltimatePluginDir = "$distDir/artifacts/ideaUltimatePlugin/Kotlin"
val cidrPluginDir = "$distDir/artifacts/cidrPlugin/Kotlin"
@@ -99,7 +98,6 @@ extra["commonLocalDataDir"] = project.file(commonLocalDataDir)
extra["ideaSandboxDir"] = project.file(ideaSandboxDir)
extra["ideaUltimateSandboxDir"] = project.file(ideaUltimateSandboxDir)
extra["ideaPluginDir"] = project.file(ideaPluginDir)
extra["serialPluginDir"] = project.file(serialPluginDir)
extra["ideaUltimatePluginDir"] = project.file(ideaUltimatePluginDir)
extra["cidrPluginDir"] = project.file(cidrPluginDir)
extra["isSonatypeRelease"] = false
+2 -4
View File
@@ -17,9 +17,7 @@ dependencies {
val ideaPluginDir: File by rootProject.extra
val ideaSandboxDir: File by rootProject.extra
val serialPluginDir: File by rootProject.extra
runIdeTask("runIde", ideaPluginDir, ideaSandboxDir, serialPluginDir) {
// TODO: add serialization plugin to pluginDir
dependsOn(":dist", ":ideaPlugin", ":kotlinx-serialization-compiler-plugin:dist")
runIdeTask("runIde", ideaPluginDir, ideaSandboxDir) {
dependsOn(":dist", ":ideaPlugin")
}
+1
View File
@@ -78,6 +78,7 @@ dependencies {
testRuntime(project(":kotlin-scripting-idea")) { isTransitive = false }
testRuntime(project(":kotlin-scripting-compiler"))
testRuntime(project(":sam-with-receiver-ide-plugin")) { isTransitive = false }
testRuntime(project(":kotlinx-serialization-compiler-plugin")) { isTransitive = false }
testRuntime(project(":idea:idea-android")) { isTransitive = false }
testRuntime(project(":plugins:lint")) { isTransitive = false }
testRuntime(project(":plugins:uast-kotlin"))
+1
View File
@@ -78,6 +78,7 @@ dependencies {
testRuntime(project(":kotlin-scripting-compiler"))
testRuntime(project(":plugins:annotation-based-compiler-plugins-ide-support")) { isTransitive = false }
testRuntime(project(":sam-with-receiver-ide-plugin")) { isTransitive = false }
testRuntime(project(":kotlinx-serialization-compiler-plugin")) { isTransitive = false }
testRuntime(project(":idea:idea-android")) { isTransitive = false }
testRuntime(project(":plugins:lint")) { isTransitive = false }
testRuntime(project(":plugins:uast-kotlin"))
+1
View File
@@ -78,6 +78,7 @@ dependencies {
testRuntime(project(":kotlin-scripting-compiler"))
testRuntime(project(":plugins:annotation-based-compiler-plugins-ide-support")) { isTransitive = false }
testRuntime(project(":sam-with-receiver-ide-plugin")) { isTransitive = false }
testRuntime(project(":kotlinx-serialization-compiler-plugin")) { isTransitive = false }
testRuntime(project(":idea:idea-android")) { isTransitive = false }
testRuntime(project(":plugins:lint")) { isTransitive = false }
testRuntime(project(":plugins:uast-kotlin"))
+1
View File
@@ -78,6 +78,7 @@ dependencies {
testRuntime(project(":sam-with-receiver-ide-plugin")) { isTransitive = false }
testRuntime(project(":kotlin-scripting-idea")) { isTransitive = false }
testRuntime(project(":kotlin-scripting-compiler"))
testRuntime(project(":kotlinx-serialization-compiler-plugin")) { isTransitive = false }
testRuntime(project(":idea:idea-android")) { isTransitive = false }
testRuntime(project(":plugins:lint")) { isTransitive = false }
testRuntime(project(":plugins:uast-kotlin"))
+1
View File
@@ -78,6 +78,7 @@ dependencies {
testRuntime(project(":kotlin-scripting-idea")) { isTransitive = false }
testRuntime(project(":kotlin-scripting-compiler"))
testRuntime(project(":sam-with-receiver-ide-plugin")) { isTransitive = false }
testRuntime(project(":kotlinx-serialization-compiler-plugin")) { isTransitive = false }
testRuntime(project(":idea:idea-android")) { isTransitive = false }
testRuntime(project(":plugins:lint")) { isTransitive = false }
testRuntime(project(":plugins:uast-kotlin"))
+1
View File
@@ -46,6 +46,7 @@ dependencies {
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(intellijPluginDep("android"))
testRuntime(intellijPluginDep("smali"))
+1
View File
@@ -46,6 +46,7 @@ dependencies {
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(intellijPluginDep("android"))
testRuntime(intellijPluginDep("copyright"))
+1
View File
@@ -46,6 +46,7 @@ dependencies {
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(intellijPluginDep("android"))
testRuntime(intellijPluginDep("smali"))
+1
View File
@@ -46,6 +46,7 @@ dependencies {
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(intellijPluginDep("android"))
testRuntime(intellijPluginDep("smali"))
+1
View File
@@ -46,6 +46,7 @@ dependencies {
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(intellijPluginDep("android"))
testRuntime(intellijPluginDep("smali"))
+1
View File
@@ -39,6 +39,7 @@ dependencies {
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
// TODO: the order of the plugins matters here, consider avoiding order-dependency
testRuntime(intellijPluginDep("junit"))
testRuntime(intellijPluginDep("testng"))
+1
View File
@@ -39,6 +39,7 @@ dependencies {
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
// TODO: the order of the plugins matters here, consider avoiding order-dependency
testRuntime(intellijPluginDep("junit"))
testRuntime(intellijPluginDep("testng"))
+1
View File
@@ -39,6 +39,7 @@ dependencies {
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
// TODO: the order of the plugins matters here, consider avoiding order-dependency
testRuntime(intellijPluginDep("junit"))
testRuntime(intellijPluginDep("testng"))
+1
View File
@@ -39,6 +39,7 @@ dependencies {
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
// TODO: the order of the plugins matters here, consider avoiding order-dependency
testRuntime(intellijPluginDep("junit"))
testRuntime(intellijPluginDep("testng"))
+1
View File
@@ -39,6 +39,7 @@ dependencies {
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
// TODO: the order of the plugins matters here, consider avoiding order-dependency
testRuntime(intellijPluginDep("junit"))
testRuntime(intellijPluginDep("testng"))
+1
View File
@@ -37,6 +37,7 @@ dependencies {
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(intellijDep())
// TODO: the order of the plugins matters here, consider avoiding order-dependency
+1
View File
@@ -37,6 +37,7 @@ dependencies {
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(intellijDep())
// TODO: the order of the plugins matters here, consider avoiding order-dependency
+1
View File
@@ -37,6 +37,7 @@ dependencies {
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(intellijDep())
// TODO: the order of the plugins matters here, consider avoiding order-dependency
+1
View File
@@ -37,6 +37,7 @@ dependencies {
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(intellijDep())
// TODO: the order of the plugins matters here, consider avoiding order-dependency
+1
View File
@@ -37,6 +37,7 @@ dependencies {
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(intellijDep())
// TODO: the order of the plugins matters here, consider avoiding order-dependency
+1
View File
@@ -71,6 +71,7 @@
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.kapt.idea.KaptGradleProjectImportHandler"/>
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.noarg.ide.NoArgGradleProjectImportHandler"/>
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.samWithReceiver.ide.SamWithReceiverGradleProjectImportHandler"/>
<gradleProjectImportHandler implementation="org.jetbrains.kotlinx.serialization.idea.KotlinSerializationGradleImportHandler"/>
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleModuleConfigurator"/>
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinJsGradleModuleConfigurator"/>
+1
View File
@@ -69,6 +69,7 @@
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.kapt.idea.KaptGradleProjectImportHandler"/>
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.noarg.ide.NoArgGradleProjectImportHandler"/>
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.samWithReceiver.ide.SamWithReceiverGradleProjectImportHandler"/>
<gradleProjectImportHandler implementation="org.jetbrains.kotlinx.serialization.idea.KotlinSerializationGradleImportHandler"/>
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleModuleConfigurator"/>
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinJsGradleModuleConfigurator"/>
+1
View File
@@ -60,6 +60,7 @@
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.kapt.idea.KaptGradleProjectImportHandler"/>
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.noarg.ide.NoArgGradleProjectImportHandler"/>
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.samWithReceiver.ide.SamWithReceiverGradleProjectImportHandler"/>
<gradleProjectImportHandler implementation="org.jetbrains.kotlinx.serialization.idea.KotlinSerializationGradleImportHandler"/>
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleModuleConfigurator"/>
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinJsGradleModuleConfigurator"/>
+1
View File
@@ -79,6 +79,7 @@
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.kapt.idea.KaptGradleProjectImportHandler"/>
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.noarg.ide.NoArgGradleProjectImportHandler"/>
<gradleProjectImportHandler implementation="org.jetbrains.kotlin.samWithReceiver.ide.SamWithReceiverGradleProjectImportHandler"/>
<gradleProjectImportHandler implementation="org.jetbrains.kotlinx.serialization.idea.KotlinSerializationGradleImportHandler"/>
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinGradleModuleConfigurator"/>
<projectConfigurator implementation="org.jetbrains.kotlin.idea.configuration.KotlinJsGradleModuleConfigurator"/>
@@ -0,0 +1,8 @@
<idea-plugin>
<extensions defaultExtensionNs="org.jetbrains.kotlin">
<expressionCodegenExtension implementation="org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationCodegenExtension"/>
<syntheticResolveExtension implementation="org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationResolveExtension"/>
<jsSyntheticTranslateExtension implementation="org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationJsExtension"/>
<irGenerationExtension implementation="org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationLoweringExtension"/>
</extensions>
</idea-plugin>
+1
View File
@@ -11,6 +11,7 @@
<mavenProjectImportHandler implementation="org.jetbrains.kotlin.allopen.ide.AllOpenMavenProjectImportHandler"/>
<mavenProjectImportHandler implementation="org.jetbrains.kotlin.noarg.ide.NoArgMavenProjectImportHandler"/>
<mavenProjectImportHandler implementation="org.jetbrains.kotlin.samWithReceiver.ide.SamWithReceiverMavenProjectImportHandler"/>
<mavenProjectImportHandler implementation="org.jetbrains.kotlinx.serialization.idea.KotlinSerializationMavenImportHandler"/>
<buildSystemTypeDetector implementation="org.jetbrains.kotlin.idea.maven.MavenDetector"/>
</extensions>
+2
View File
@@ -3101,6 +3101,8 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
<xi:include href="extensions/ide.xml" xpointer="xpointer(/idea-plugin/*)"/>
<xi:include href="kotlinx-serialization.xml" xpointer="xpointer(/idea-plugin/*)"/>
<extensionPoints>
<xi:include href="extensions/compiler.xml" xpointer="xpointer(/idea-plugin/extensionPoints/*)"/>
+1
View File
@@ -29,6 +29,7 @@ dependencies {
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(intellijPluginDep("properties"))
testRuntime(intellijPluginDep("gradle"))
testRuntime(intellijPluginDep("Groovy"))
+1
View File
@@ -28,6 +28,7 @@ dependencies {
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(intellijPluginDep("properties"))
testRuntime(intellijPluginDep("gradle"))
testRuntime(intellijPluginDep("Groovy"))
+1
View File
@@ -28,6 +28,7 @@ dependencies {
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(intellijPluginDep("properties"))
testRuntime(intellijPluginDep("gradle"))
testRuntime(intellijPluginDep("Groovy"))
+1
View File
@@ -29,6 +29,7 @@ dependencies {
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(intellijPluginDep("properties"))
testRuntime(intellijPluginDep("gradle"))
testRuntime(intellijPluginDep("Groovy"))
+1
View File
@@ -29,6 +29,7 @@ dependencies {
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(intellijPluginDep("properties"))
testRuntime(intellijPluginDep("gradle"))
testRuntime(intellijPluginDep("Groovy"))
-28
View File
@@ -42,31 +42,3 @@ If your maven build is failing with Out-Of-Memory errors, set JVM options for ma
MAVEN_OPTS="-Xmx2G"
## Kotlin serialization Gradle Plugin
First, build all the above. Then run `./gradlew :kotlinx-gradle-serialization-plugin:publishToMavenLocal` to install it to your local maven repository.
When it is installed in local maven repository, you can add it as a dependency in buildscript classpath and apply it:
```
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1-SNAPSHOT"
classpath "org.jetbrains.kotlinx:kotlinx-gradle-serialization-plugin:0.1"
}
}
apply plugin: 'kotlin'
apply plugin: 'kotlinx-serialization'
```
You can also obtain it from bintray: https://bintray.com/kotlin/kotlinx/kotlinx.serialization.plugin
@@ -16,10 +16,16 @@
<kotlin.version>1.2-SNAPSHOT</kotlin.version>
</properties>
<groupId>org.jetbrains.kotlinx</groupId>
<parent>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-project</artifactId>
<version>1.3-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>kotlinx-maven-serialization-plugin</artifactId>
<packaging>jar</packaging>
<version>0.7.0-eap-1</version>
<description>Serialization plugin for Maven</description>
<repositories>
@@ -138,14 +144,4 @@
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>bintray-repo</id>
<url>https://api.bintray.com/maven/kotlin/kotlinx/kotlinx.serialization.plugin/</url>
</repository>
</distributionManagement>
</project>
@@ -3,9 +3,6 @@ apply plugin: 'kotlin'
configureJvmProject(project)
configurePublishing(project)
group = 'org.jetbrains.kotlinx'
version = project(':kotlinx-gradle-serialization-plugin').version
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
@@ -23,15 +20,10 @@ dependencies {
compileOnly project(':kotlin-stdlib')
compileOnly project(path: ':kotlin-compiler-embeddable', configuration: 'runtimeJar')
compileOnly project(':kotlin-allopen-compiler-plugin')
compileOnly 'org.jetbrains.kotlin:gradle-api:1.6'
}
processResources {
expand(project.properties)
}
evaluationDependsOn(":kotlinx-serialization-compiler-plugin")
jar {
@@ -40,6 +32,8 @@ jar {
manifestAttributes(manifest, project)
}
ArtifactsKt.runtimeJar(project, jar, {})
artifacts {
archives sourcesJar
archives javadocJar
@@ -1,18 +1,8 @@
plugins {
id "com.jfrog.bintray" version "1.7.3"
}
apply plugin: 'kotlin'
configureJvmProject(project)
configurePublishing(project)
group = 'org.jetbrains.kotlinx'
version = '0.7.0'
if (!project.hasProperty("deploy")) {
version = "$version-eap-1"
}
compileJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
@@ -37,10 +27,6 @@ dependencies {
evaluationDependsOn(":kotlinx-serialization-compiler-plugin")
processResources {
expand(project.properties)
}
jar {
from(project(":kotlinx-serialization-compiler-plugin").sourceSets.main.output.classesDirs)
from(project(":kotlinx-serialization-compiler-plugin").sourceSets.main.output.resourcesDir)
@@ -53,26 +39,3 @@ artifacts {
archives sourcesJar
archives javadocJar
}
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
configurations = ['archives']
if (!project.hasProperty("deploy")) {
dryRun = true
}
pkg {
repo = 'kotlinx'
name = 'kotlinx.serialization.plugin'
userOrg = 'kotlin'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/JetBrains/kotlin/tree/rr/kotlinx.serialization/libraries'
websiteUrl = 'https://github.com/Kotlin/kotlinx.serialization'
issueTrackerUrl = 'https://github.com/Kotlin/kotlinx.serialization/issues'
githubRepo = 'JetBrains/kotlin'
version {
name = project.version
}
}
}
@@ -18,17 +18,12 @@ package org.jetbrains.kotlinx.serialization.gradle
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.logging.Logger
import org.gradle.api.logging.Logging
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.compile.AbstractCompile
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
import org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin
import org.jetbrains.kotlin.gradle.plugin.SubpluginArtifact
import org.jetbrains.kotlin.gradle.plugin.SubpluginOption
import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile
import java.io.FileNotFoundException
import java.util.*
class SerializationGradleSubplugin : Plugin<Project> {
companion object {
@@ -42,13 +37,11 @@ class SerializationGradleSubplugin : Plugin<Project> {
class SerializationKotlinGradleSubplugin : KotlinGradleSubplugin<AbstractCompile> {
companion object {
const val SERIALIZATION_GROUP_NAME = "org.jetbrains.kotlinx"
const val SERIALIZATION_GROUP_NAME = "org.jetbrains.kotlin"
const val SERIALIZATION_ARTIFACT_NAME = "kotlinx-gradle-serialization-plugin"
const val SERIALIZATION_ARTIFACT_UNSHADED_NAME = "kotlinx-gradle-serialization-plugin-unshaded"
}
private val log = Logging.getLogger(this.javaClass)
private val pluginVersion = "0.7.0-eap-1"
private var useUnshaded = false
override fun isApplicable(project: Project, task: AbstractCompile): Boolean {
@@ -65,36 +58,15 @@ class SerializationKotlinGradleSubplugin : KotlinGradleSubplugin<AbstractCompile
variantData: Any?,
androidProjectHandler: Any?,
kotlinCompilation: KotlinCompilation?
)
: List<SubpluginOption> {
): List<SubpluginOption> {
return emptyList()
}
override fun getPluginArtifact(): SubpluginArtifact {
val artifact = if (useUnshaded) SERIALIZATION_ARTIFACT_UNSHADED_NAME else SERIALIZATION_ARTIFACT_NAME
return SubpluginArtifact(SERIALIZATION_GROUP_NAME, artifact, pluginVersion)
return SubpluginArtifact(SERIALIZATION_GROUP_NAME, artifact)
}
override fun getCompilerPluginId() = "org.jetbrains.kotlinx.serialization"
}
// taken from KotlinPluginWrapper.kt
internal fun Logger.kotlinDebug(message: String) {
this.debug("[KOTLIN] $message")
}
private fun Any.findPluginVersion(log: Logger): String {
log.kotlinDebug("Loading version information about kotlinx.serialization")
val props = Properties()
val propFileName = "plugin.properties"
val loader = javaClass.classLoader!!
val inputStream = loader.getResourceAsStream(propFileName)
?: throw FileNotFoundException("property file '$propFileName' not found in the classpath")
props.load(inputStream)
val pluginVersion = props["plugin.version"] as String
log.kotlinDebug("Found plugin version [$pluginVersion]")
return pluginVersion
}
@@ -1 +0,0 @@
plugin.version=${project.version}
@@ -43,6 +43,7 @@ dependencies {
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(project(":plugins:lint"))
testRuntime(intellijPluginDep("junit"))
testRuntime(intellijPluginDep("IntelliLang"))
@@ -43,6 +43,7 @@ dependencies {
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(project(":plugins:lint"))
testRuntime(intellijPluginDep("junit"))
testRuntime(intellijPluginDep("IntelliLang"))
@@ -43,6 +43,7 @@ dependencies {
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(project(":plugins:lint"))
testRuntime(intellijPluginDep("junit"))
testRuntime(intellijPluginDep("IntelliLang"))
@@ -43,6 +43,7 @@ dependencies {
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(project(":plugins:lint"))
testRuntime(intellijPluginDep("junit"))
testRuntime(intellijPluginDep("IntelliLang"))
@@ -43,6 +43,7 @@ dependencies {
testRuntime(project(":noarg-ide-plugin"))
testRuntime(project(":allopen-ide-plugin"))
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(project(":plugins:lint"))
testRuntime(intellijPluginDep("junit"))
testRuntime(intellijPluginDep("IntelliLang"))
@@ -5,12 +5,13 @@ plugins {
kotlin("jvm")
id("jps-compatible")
}
jvmTarget = "1.6"
dependencies {
// val compileOnly by configurations
// val runtime by configurations
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
compileOnly(intellijDep())
compileOnly(intellijPluginDep("maven"))
excludeInAndroidStudio(rootProject) { compileOnly(intellijPluginDep("maven")) }
compileOnly(project(":jps-plugin"))
compileOnly(project(":compiler:plugin-api"))
compileOnly(project(":compiler:frontend"))
@@ -35,10 +36,8 @@ val jar = runtimeJar {
from(fileTree("$projectDir/src")) { include("META-INF/**") }
}
val serialPluginDir: File by rootProject.extra
dist(targetDir = File(serialPluginDir,"lib"), targetName = the<BasePluginConvention>().archivesBaseName.removePrefix("kotlin-") + ".jar")
dist(targetName = the<BasePluginConvention>().archivesBaseName + ".jar")
ideaPlugin {
from(jar)
rename("^kotlin-", "")
}
runtimeJar()
ideaPlugin()
@@ -1,23 +0,0 @@
<idea-plugin url="https://github.com/Kotlin/kotlinx.serialization" >
<name>Kotlin-serialization</name>
<id>org.jetbrains.kotlinx.serialization</id>
<version>0.5.2-SNAPSHOT</version>
<depends>org.jetbrains.kotlin</depends>
<idea-version since-build="172"/>
<extensions defaultExtensionNs="org.jetbrains.kotlin">
<expressionCodegenExtension implementation="org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationCodegenExtension"/>
<syntheticResolveExtension implementation="org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationResolveExtension"/>
<jsSyntheticTranslateExtension implementation="org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationJsExtension"/>
<irGenerationExtension implementation="org.jetbrains.kotlinx.serialization.compiler.extensions.SerializationLoweringExtension"/>
<gradleProjectImportHandler implementation="org.jetbrains.kotlinx.serialization.idea.KotlinSerializationGradleImportHandler"/>
<mavenProjectImportHandler implementation="org.jetbrains.kotlinx.serialization.idea.KotlinSerializationMavenImportHandler"/>
</extensions>
<extensions defaultExtensionNs="com.intellij">
<compileServer.plugin classpath="kotlinx-serialization-compiler-plugin.jar"/>
</extensions>
</idea-plugin>
@@ -0,0 +1,24 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlinx.serialization.idea
import com.intellij.openapi.externalSystem.model.DataNode
import com.intellij.openapi.externalSystem.model.project.ModuleData
import org.jetbrains.kotlin.idea.configuration.GradleProjectImportHandler
import org.jetbrains.kotlin.idea.facet.KotlinFacet
import org.jetbrains.plugins.gradle.model.data.GradleSourceSetData
class KotlinSerializationGradleImportHandler : GradleProjectImportHandler {
override fun importBySourceSet(facet: KotlinFacet, sourceSetNode: DataNode<GradleSourceSetData>) {
KotlinSerializationImportHandler.modifyCompilerArguments(facet, PLUGIN_GRADLE_JAR)
}
override fun importByModule(facet: KotlinFacet, moduleNode: DataNode<ModuleData>) {
KotlinSerializationImportHandler.modifyCompilerArguments(facet, PLUGIN_GRADLE_JAR)
}
private val PLUGIN_GRADLE_JAR = "kotlinx-gradle-serialization-plugin"
}
@@ -16,38 +16,11 @@
package org.jetbrains.kotlinx.serialization.idea
import com.intellij.openapi.externalSystem.model.DataNode
import com.intellij.openapi.externalSystem.model.project.ModuleData
import com.intellij.util.PathUtil
import org.jetbrains.idea.maven.project.MavenProject
import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments
import org.jetbrains.kotlin.idea.configuration.GradleProjectImportHandler
import org.jetbrains.kotlin.idea.facet.KotlinFacet
import org.jetbrains.kotlin.idea.maven.MavenProjectImportHandler
import org.jetbrains.kotlinx.serialization.idea.KotlinSerializationImportHandler.modifyCompilerArguments
import org.jetbrains.plugins.gradle.model.data.GradleSourceSetData
import java.io.File
class KotlinSerializationGradleImportHandler : GradleProjectImportHandler {
override fun importBySourceSet(facet: KotlinFacet, sourceSetNode: DataNode<GradleSourceSetData>) {
modifyCompilerArguments(facet, PLUGIN_GRADLE_JAR)
}
override fun importByModule(facet: KotlinFacet, moduleNode: DataNode<ModuleData>) {
modifyCompilerArguments(facet, PLUGIN_GRADLE_JAR)
}
private val PLUGIN_GRADLE_JAR = "kotlinx-gradle-serialization-plugin"
}
class KotlinSerializationMavenImportHandler: MavenProjectImportHandler {
override fun invoke(facet: KotlinFacet, mavenProject: MavenProject) {
modifyCompilerArguments(facet, PLUGIN_MAVEN_JAR)
}
private val PLUGIN_MAVEN_JAR = "kotlinx-maven-serialization-plugin"
}
internal object KotlinSerializationImportHandler {
private val PLUGIN_JPS_JAR :String
get() = File(PathUtil.getJarPathForClass(this::class.java)).absolutePath
@@ -0,0 +1,18 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlinx.serialization.idea
import org.jetbrains.idea.maven.project.MavenProject
import org.jetbrains.kotlin.idea.facet.KotlinFacet
import org.jetbrains.kotlin.idea.maven.MavenProjectImportHandler
class KotlinSerializationMavenImportHandler: MavenProjectImportHandler {
override fun invoke(facet: KotlinFacet, mavenProject: MavenProject) {
KotlinSerializationImportHandler.modifyCompilerArguments(facet, PLUGIN_MAVEN_JAR)
}
private val PLUGIN_MAVEN_JAR = "kotlinx-maven-serialization-plugin"
}
+1
View File
@@ -34,6 +34,7 @@ dependencies {
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":plugins:android-extensions-ide"))
testRuntime(project(":plugins:kapt3-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(intellijDep())
testRuntime(intellijPluginDep("junit"))
testRuntime(intellijPluginDep("gradle"))
+1
View File
@@ -32,6 +32,7 @@ dependencies {
testRuntime(project(":kotlin-scripting-idea"))
testRuntime(project(":plugins:android-extensions-ide"))
testRuntime(project(":plugins:kapt3-idea"))
testRuntime(project(":kotlinx-serialization-compiler-plugin"))
testRuntime(intellijDep())
testRuntime(intellijPluginDep("junit"))
testRuntime(intellijPluginDep("gradle"))
+1
View File
@@ -88,6 +88,7 @@ dependencies {
testRuntime(project(":kotlin-allopen-compiler-plugin")) { isTransitive = false }
testRuntime(project(":kotlin-scripting-idea")) { isTransitive = false }
testRuntime(project(":kotlin-scripting-compiler")) { isTransitive = false }
testRuntime(project(":kotlinx-serialization-compiler-plugin")) { isTransitive = false }
testRuntime(project(":plugins:kapt3-idea")) { isTransitive = false }
testRuntime(project(":plugins:uast-kotlin"))
testRuntime(project(":plugins:uast-kotlin-idea"))
+1
View File
@@ -88,6 +88,7 @@ dependencies {
testRuntime(project(":kotlin-allopen-compiler-plugin")) { isTransitive = false }
testRuntime(project(":kotlin-scripting-idea")) { isTransitive = false }
testRuntime(project(":kotlin-scripting-compiler")) { isTransitive = false }
testRuntime(project(":kotlinx-serialization-compiler-plugin")) { isTransitive = false }
testRuntime(project(":plugins:kapt3-idea")) { isTransitive = false }
testRuntime(project(":plugins:uast-kotlin"))
testRuntime(project(":plugins:uast-kotlin-idea"))
+1
View File
@@ -88,6 +88,7 @@ dependencies {
testRuntime(project(":kotlin-noarg-compiler-plugin")) { isTransitive = false }
testRuntime(project(":allopen-ide-plugin")) { isTransitive = false }
testRuntime(project(":kotlin-allopen-compiler-plugin")) { isTransitive = false }
testRuntime(project(":kotlinx-serialization-compiler-plugin")) { isTransitive = false }
testRuntime(project(":kotlin-scripting-idea")) { isTransitive = false }
testRuntime(project(":kotlin-scripting-compiler")) { isTransitive = false }
testRuntime(project(":plugins:kapt3-idea")) { isTransitive = false }
+1
View File
@@ -89,6 +89,7 @@ dependencies {
testRuntime(project(":allopen-ide-plugin")) { isTransitive = false }
testRuntime(project(":kotlin-allopen-compiler-plugin")) { isTransitive = false }
testRuntime(project(":kotlin-scripting-idea")) { isTransitive = false }
testRuntime(project(":kotlinx-serialization-compiler-plugin")) { isTransitive = false }
testRuntime(project(":kotlin-scripting-compiler")) { isTransitive = false }
testRuntime(project(":plugins:kapt3-idea")) { isTransitive = false }
testRuntime(project(":plugins:uast-kotlin"))
+1 -2
View File
@@ -17,10 +17,9 @@ val intellijUltimateEnabled : Boolean by rootProject.extra
val ideaUltimatePluginDir: File by rootProject.extra
val ideaUltimateSandboxDir: File by rootProject.extra
val serialPluginDir: File by rootProject.extra
if (intellijUltimateEnabled) {
runIdeTask("runUltimate", ideaUltimatePluginDir, ideaUltimateSandboxDir, serialPluginDir) {
runIdeTask("runUltimate", ideaUltimatePluginDir, ideaUltimateSandboxDir) {
dependsOn(":dist", ":ideaPlugin", ":ultimate:ideaUltimatePlugin")
}
}