Skip to content

Commit

Permalink
Added support to publish binaries to bintray (requires gradle 2.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
vyazelenko committed Jul 24, 2014
1 parent e087c50 commit fc770ae
Show file tree
Hide file tree
Showing 5 changed files with 190 additions and 149 deletions.
147 changes: 90 additions & 57 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@ defaultTasks 'build'

apply plugin: 'groovy'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'maven-publish'
apply plugin: 'license'
apply plugin: 'com.jfrog.bintray'

buildscript {
repositories {
jcenter()
}

dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:0.5'
}
}

group = 'nl.javadude.gradle.plugins'

sourceCompatibility = 1.6
targetCompatibility = 1.6

repositories { mavenCentral() }
repositories { jcenter() }

idea {
module {
Expand All @@ -32,6 +42,13 @@ dependencies {
testCompile 'org.spockframework:spock-core:0.7-groovy-1.8'
}

// This disables the pedantic doclint feature of JDK8
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}

task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
Expand All @@ -46,67 +63,83 @@ license {
ignoreFailures true
}

artifacts { archives sourcesJar, javadocJar }

signing {
required { gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
def pomConfig = {
name project.name
description project.project_description
url project.project_url
inceptionYear '2011'

scm { url project.project_scm }

licenses {
license([:]) {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}

developers {
developer {
id 'hierynomus'
name 'Jeroen van Erp'
url 'http://www.javadude.nl/'
email 'jeroen@javadude.nl'
roles { role 'Developer' }
}
}

uploadArchives {
dependsOn signArchives
doFirst {
repositories.mavenDeployer {
uniqueVersion = false
beforeDeployment { org.gradle.api.artifacts.maven.MavenDeployment deployment -> signing.signPom(deployment) }
contributors {
contributor {
name 'Tim Harsch'
email 'harschware@yahoo.com'
}
contributor {
name 'Justin Ryan'
email 'jryan@netflix.com'
}
}
}

//repository(url: "file://localhost/${rootProject.rootDir}/repo")
publishing {
publications {
mavenCustom(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar

repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
authentication(userName: sonatypeUsername, password: sonatypePassword)
pom.withXml {
asNode().children().last() + pomConfig
}
}
}
}

pom.project {
name 'license-gradle-plugin'
description 'Applies a header to files, typically a license'
url 'https://github.com/hierynomus/gradle-plugins'
inceptionYear '2011'

scm { url 'https://github.com/hierynomus/gradle-plugins' }

licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}

developers {
developer {
id 'hierynomus'
name 'Jeroen van Erp'
url 'http://www.javadude.nl/'
email 'jeroen@javadude.nl'
roles { role 'Developer' }
}
}

contributors {
contributor {
name 'Tim Harsch'
email 'harschware@yahoo.com'
}
contributor {
name 'Justin Ryan'
email 'jryan@netflix.com'
}
}
}
// Both 'bintrayUsername' and 'bintrayApiKey' must defined in the ~/.gradle/gradle.properties
if (!project.hasProperty('bintrayUsername')) ext.bintrayUsername = 'invalid'
if (!project.hasProperty('bintrayApiKey')) ext.bintrayApiKey = 'invalid'

bintray {
user = project.bintrayUsername
key = project.bintrayApiKey
publications = ['mavenCustom']
pkg {
repo = project.project_bintray_repo
userOrg = project.project_bintray_org
name = project.name
desc = project.project_description
licenses = ['Apache-2.0']
labels = ['gradle', 'plugin']
websiteUrl = project.project_url
issueTrackerUrl = project.project_issues_url
vcsUrl = project.project_scm
publicDownloadNumbers = true
version {
vcsTag = project.version
attributes = [
'gradle-plugin': ['com.github.hierynomus.license', project.group, project.name].join(':')
]
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
version=0.10.0

project_vendor = hierynomus
project_description = Applies a header to files, typically a license
project_url = https://github.com/hierynomus/gradle-plugins
project_scm = https://github.com/hierynomus/gradle-plugins
project_issues_url = https://github.com/hierynomus/gradle-plugins/issues
project_bintray_repo = maven
project_bintray_org = hierynomus
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Oct 16 08:27:10 EDT 2013
#Thu Jul 24 19:31:32 CEST 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip
180 changes: 90 additions & 90 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,90 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega

0 comments on commit fc770ae

Please sign in to comment.