KotlinX serialization plugin applied onto latest master
IntelliJ project, ant task and maven goal for serialization plugin Serialization IDEA plugin
This commit is contained in:
@@ -0,0 +1,158 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<properties>
|
||||
<maven.version>3.0.4</maven.version>
|
||||
<serialization.src>${basedir}/../../../plugins/kotlin-serialization/kotlin-serialization-compiler/src</serialization.src>
|
||||
<serialization.gradle.plugin.src>${basedir}/src/main/kotlin</serialization.gradle.plugin.src>
|
||||
<serialization.gradle.plugin.resources>${basedir}/src/main/resources</serialization.gradle.plugin.resources>
|
||||
<serialization.target-src>${basedir}/target/src/main/kotlin</serialization.target-src>
|
||||
<serialization.target-resources>${basedir}/target/resource</serialization.target-resources>
|
||||
</properties>
|
||||
|
||||
<parent>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-project</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>org.jetbrains.kotlinx</groupId>
|
||||
<artifactId>kotlinx-serialization</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<description>Serialization plugin for Gradle</description>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>jetbrains-utils</id>
|
||||
<url>http://repository.jetbrains.com/utils</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-compiler-embeddable</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-gradle-plugin-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>gradle-api</artifactId>
|
||||
<version>2.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>${serialization.target-src}</sourceDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${serialization.target-resources}</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-sources</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${serialization.target-src}</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${serialization.src}</directory>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>${serialization.gradle.plugin.src}</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>copy-resources</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${serialization.target-resources}/META-INF</outputDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${serialization.src}/META-INF</directory>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>${serialization.gradle.plugin.resources}/META-INF</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.google.code.maven-replacer-plugin</groupId>
|
||||
<artifactId>replacer</artifactId>
|
||||
<version>1.5.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>replace</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>${serialization.target-src}/**</include>
|
||||
</includes>
|
||||
<replacements>
|
||||
<replacement>
|
||||
<token>(?<!\.)com\.intellij</token>
|
||||
<value>org.jetbrains.kotlin.com.intellij</value>
|
||||
</replacement>
|
||||
</replacements>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>kotlin-maven-plugin</artifactId>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<version>${project.version}</version>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
<id>compile</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sourceDirs>
|
||||
<sourceDir>${serialization.target-src}</sourceDir>
|
||||
</sourceDirs>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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.kotlinx.serialization.gradle
|
||||
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.artifacts.ResolvedArtifact
|
||||
import org.gradle.api.internal.AbstractTask
|
||||
import org.gradle.api.tasks.SourceSet
|
||||
import org.gradle.api.tasks.compile.AbstractCompile
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin
|
||||
import org.jetbrains.kotlin.gradle.plugin.SubpluginOption
|
||||
|
||||
class SerializationGradleSubplugin : Plugin<Project> {
|
||||
companion object {
|
||||
fun isEnabled(project: Project) = project.plugins.findPlugin(SerializationGradleSubplugin::class.java) != null
|
||||
}
|
||||
|
||||
override fun apply(project: Project) {
|
||||
// nothing here
|
||||
}
|
||||
}
|
||||
|
||||
class SerializationKotlinGradleSubplugin : KotlinGradleSubplugin<AbstractCompile> {
|
||||
companion object {
|
||||
val SERIALIZATION_GROUP_NAME = "org.jetbrains.kotlinx"
|
||||
val SERIALIZATION_ARTIFACT_NAME = "kotlinx-serialization"
|
||||
}
|
||||
|
||||
override fun isApplicable(project: Project, task: AbstractCompile) = SerializationGradleSubplugin.isEnabled(project)
|
||||
|
||||
override fun apply(
|
||||
project: Project, kotlinCompile: AbstractCompile, javaCompile: AbstractCompile, variantData: Any?, androidProjectHandler: Any?, javaSourceSet: SourceSet?)
|
||||
: List<SubpluginOption> {
|
||||
if (!SerializationGradleSubplugin.isEnabled(project)) return emptyList()
|
||||
val options = mutableListOf<SubpluginOption>()
|
||||
// nothing here
|
||||
return options
|
||||
}
|
||||
|
||||
override fun getGroupName() = SERIALIZATION_GROUP_NAME
|
||||
override fun getArtifactName() = SERIALIZATION_ARTIFACT_NAME
|
||||
override fun getCompilerPluginId() = "org.jetbrains.kotlinx.serialization"
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
implementation-class=org.jetbrains.kotlinx.serialization.gradle.SerializationGradleSubplugin
|
||||
+1
@@ -0,0 +1 @@
|
||||
implementation-class=org.jetbrains.kotlinx.serialization.gradle.SerializationGradleSubplugin
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
org.jetbrains.kotlinx.serialization.gradle.SerializationKotlinGradleSubplugin
|
||||
Reference in New Issue
Block a user