Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle plugin for appling transformation during gradle build #1

Merged
merged 2 commits into from
Sep 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
96 changes: 96 additions & 0 deletions atomicfu-gradle-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<!--
~ Copyright 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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>atomicfu-parent</artifactId>
<version>0.7-SNAPSHOT</version>
</parent>

<artifactId>atomicfu-gradle-plugin</artifactId>
<packaging>jar</packaging>

<properties>
<gradle.version>3.5</gradle.version>
<groovy.version>2.4.12</groovy.version>
</properties>

<repositories>
<repository>
<id>gradle-libs-releases-local</id>
<name>libs releases local</name>
<url>https://repo.gradle.org/gradle/libs-releases-local/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>atomicfu-transformer</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
<version>2.4.12</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-core</artifactId>
<version>${gradle.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-base-services</artifactId>
<version>${gradle.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gradle</groupId>
<artifactId>gradle-base-services-groovy</artifactId>
<version>${gradle.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!-- publish empty javadocs -->
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>empty-javadoc-jar</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>javadoc</classifier>
<classesDirectory>${basedir}/javadoc</classesDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package kotlinx.atomicfu.plugin.gradle

import kotlinx.atomicfu.transformer.AtomicFUTransformer
import org.gradle.api.DefaultTask
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputDirectory
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import java.io.File

open class AtomicFUGradlePlugin : Plugin<Project> {
private val TASK_NAME = "atomicFU"
override fun apply(target: Project) {
target.tasks.create(TASK_NAME, AtomicFUTransformTask::class.java)
}
}

open class AtomicFUTransformTask : DefaultTask() {
@InputDirectory
lateinit var inputDir: File
@OutputDirectory
lateinit var outputDir: File
@Input
var classPath: List<String> = listOf()
@Input
var verbose: Boolean = false

@TaskAction
fun transform() {
val t = AtomicFUTransformer(classPath, inputDir, outputDir)
t.verbose = verbose
t.transform()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
implementation-class=kotlinx.atomicfu.plugin.gradle.AtomicFUGradlePlugin
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
</licenses>

<modules>
<module>atomicfu-gradle-plugin</module>
<module>atomicfu-maven-plugin</module>
<module>atomicfu-transformer</module>
<module>atomicfu-test</module>
Expand Down