diff --git a/README.md b/README.md index 9ad1689..ad739c7 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ CompileOnlyPlugin ================= -Adds a _compileOnly_ configuration to a Java based gradle build. +Adds a _compileOnly_ configuration to a Java based Gradle build. The plugin will also take care of registering the _compilyOnly_ dependencies to the matching scopes of IntelliJ Idea and Eclipse Usage ----- -Add the following lines to your gradle build script +Add the following lines to your Gradle build script: buildscript { repositories { @@ -23,3 +23,13 @@ Add the following lines to your gradle build script dependencies { compileOnly } + +or if using Gradle 2.1 or higher: + + plugins { + id 'com.coders-kitchen.compileonlyplugin' version '1.0.0' + } + + dependencies { + compileOnly + } \ No newline at end of file diff --git a/build.gradle b/build.gradle index faf45fc..4f9a4fd 100644 --- a/build.gradle +++ b/build.gradle @@ -1,15 +1,37 @@ import org.gradle.api.artifacts.maven.MavenDeployment +plugins { + id "java-gradle-plugin" + id "com.gradle.plugin-publish" version "0.9.4" +} + apply plugin: 'groovy' apply plugin: 'maven' apply plugin: 'signing' +def mvnName = 'CompileOnlyPlugin' +def mvnUrl = 'http://coders-kitchen.github.com' // 404, maybe use https://github.com/coders-kitchen/CompileOnlyPlugin instead? +def mvnDescription = 'Adds a compile only configuration to the Java plugin of Gradle' +def pluginId = 'com.coders-kitchen.compileonlyplugin' + +repositories { + jcenter() +} dependencies { compile gradleApi() compile localGroovy() } +gradlePlugin { + plugins { + compileOnlyPlugin { + id = pluginId + implementationClass = "com.coderskitchen.compileonly.CompileOnlyPlugin" + } + } +} + task sourcesJar(type: Jar) { from sourceSets.main.allSource classifier = 'sources' @@ -32,7 +54,8 @@ artifacts { archives sourcesJar } -if (hasProperty('sonatypeUsername')) { +if (hasProperty('sonatypeUsername')) +{ signing { sign configurations.archives } @@ -47,10 +70,10 @@ if (hasProperty('sonatypeUsername')) { } pom { project { - name 'CompileOnlyPlugin' + name mvnName packaging 'jar' - description 'Adds a compile only configuration to the Java plugin of Gradle' - url 'http://coders-kitchen.github.com' + description mvnDescription + url mvnUrl scm { url 'scm:git@github:CodersKitchen/CompileOnlyPlugin.git' @@ -81,4 +104,16 @@ if (hasProperty('sonatypeUsername')) { } } +pluginBundle { + website = mvnUrl + vcsUrl = 'https://github.com/coders-kitchen/CompileOnlyPlugin' + description = mvnDescription + tags = ['compile', 'compileOnly', 'java'] + plugins { + compileOnlyPlugin { + id = pluginId + displayName = mvnName + } + } +} \ No newline at end of file