-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deployment to build process (close #183)
- Loading branch information
Showing
4 changed files
with
151 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
tag_version=$1 | ||
|
||
cd $TRAVIS_BUILD_DIR | ||
pwd | ||
|
||
project_version=`./gradlew -q printVersion` | ||
if [ "${project_version}" == "${tag_version}" ]; then | ||
./gradlew bintrayUpload | ||
else | ||
echo "Tag version '${tag_version}' doesn't match version in project ('${project_version}'). Aborting!" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (c) 2014 Snowplow Analytics Ltd. All rights reserved. | ||
* Copyright (c) 2017 Snowplow Analytics Ltd. All rights reserved. | ||
* | ||
* This program is licensed to you under the Apache License Version 2.0, | ||
* and you may not use this file except in compliance with the Apache License Version 2.0. | ||
|
@@ -11,8 +11,6 @@ | |
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under. | ||
*/ | ||
|
||
wrapper.gradleVersion = '5.0' | ||
|
||
buildscript { | ||
repositories { | ||
maven { url 'http://repo.spring.io/plugins-release' } | ||
|
@@ -22,18 +20,27 @@ buildscript { | |
} | ||
} | ||
|
||
plugins { | ||
id "com.jfrog.bintray" version "1.8.4" | ||
} | ||
|
||
apply plugin: 'java' | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'idea' | ||
apply plugin: 'propdeps' | ||
apply plugin: 'propdeps-maven' | ||
apply plugin: 'propdeps-idea' | ||
|
||
wrapper.gradleVersion = '5.0.0' | ||
|
||
group = 'com.snowplowanalytics' | ||
archivesBaseName = 'snowplow-java-tracker' | ||
version = '0.8.3' | ||
sourceCompatibility = '1.8' | ||
targetCompatibility = '1.8' | ||
|
||
def javaVersion = JavaVersion.VERSION_1_8 | ||
|
||
repositories { | ||
// Use 'maven central' for resolving our dependencies | ||
mavenCentral() | ||
|
@@ -42,6 +49,8 @@ repositories { | |
} | ||
|
||
configure([compileJava, compileTestJava]) { | ||
sourceCompatibility = javaVersion | ||
targetCompatibility = javaVersion | ||
options.encoding = 'UTF-8' | ||
} | ||
|
||
|
@@ -56,18 +65,17 @@ sourceSets { | |
} | ||
|
||
dependencies { | ||
|
||
// Apache Commons | ||
compile 'commons-codec:commons-codec:1.10' | ||
compile 'commons-net:commons-net:3.3' | ||
|
||
// Apache HTTP | ||
optional 'org.apache.httpcomponents:httpclient:4.3.3' | ||
optional 'org.apache.httpcomponents:httpasyncclient:4.0.1' | ||
|
||
// Square OK HTTP | ||
optional 'com.squareup.okhttp:okhttp:2.2.0' | ||
|
||
// SLF4J logging API | ||
compile 'org.slf4j:slf4j-api:1.7.7' | ||
testRuntime 'org.slf4j:slf4j-simple:1.7.7' | ||
|
@@ -90,34 +98,15 @@ task sourceJar(type: Jar, dependsOn: 'generateSources') { | |
from sourceSets.main.allJava | ||
} | ||
|
||
// Publishing | ||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
artifactId 'snowplow-java-tracker' | ||
from components.java | ||
|
||
artifact sourceJar { | ||
classifier "sources" | ||
} | ||
} | ||
} | ||
repositories { | ||
maven { | ||
url "$buildDir/repo" // change to point to your repo, e.g. http://my.org/repo | ||
} | ||
} | ||
} | ||
|
||
task generateSources { | ||
project.ext.set("outputDir", "$projectDir/src/main/java/com/snowplowanalytics/snowplow/tracker") | ||
doFirst { | ||
println outputDir | ||
def srcFile = new File((String)outputDir, "Version.java") | ||
def srcFile = new File((String) outputDir, "Version.java") | ||
srcFile.parentFile.mkdirs() | ||
srcFile.write( | ||
"""/* | ||
* Copyright (c) 2014-2015 Snowplow Analytics Ltd. All rights reserved. | ||
* Copyright (c) 2014-2018 Snowplow Analytics Ltd. All rights reserved. | ||
* | ||
* This program is licensed to you under the Apache License Version 2.0, | ||
* and you may not use this file except in compliance with the Apache License Version 2.0. | ||
|
@@ -128,9 +117,7 @@ task generateSources { | |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the Apache License Version 2.0 for the specific language governing permissions and limitations there under. | ||
*/ | ||
package com.snowplowanalytics.snowplow.tracker; | ||
// DO NOT EDIT. AUTO-GENERATED. | ||
public class Version { | ||
static final String TRACKER = "java-$project.version"; | ||
|
@@ -142,3 +129,114 @@ public class Version { | |
|
||
compileJava.dependsOn generateSources | ||
compileJava.source generateSources.outputs.files, sourceSets.main.java | ||
|
||
|
||
task printVersion { | ||
doLast { | ||
print "$project.version" | ||
} | ||
} | ||
|
||
// custom tasks for creating source/javadoc jars | ||
task sourcesJar(type: Jar, dependsOn: classes) { | ||
classifier = 'sources' | ||
from sourceSets.main.allSource | ||
} | ||
|
||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from javadoc.destinationDir | ||
} | ||
|
||
// add javadoc/source jar tasks as artifacts | ||
artifacts { | ||
archives sourcesJar, javadocJar | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
artifact sourcesJar | ||
artifact javadocJar | ||
groupId group | ||
artifactId 'snowplow-java-tracker' | ||
version version | ||
} | ||
} | ||
} | ||
|
||
install { | ||
repositories.mavenInstaller { | ||
pom.artifactId = 'snowplow-java-tracker' | ||
pom.version = "$project.version" | ||
pom.project { | ||
name = 'snowplow-java-tracker' | ||
description = 'Snowplow event tracker for Java. Add analytics to your Java desktop and server apps, servlets and games.' | ||
url = 'https://github.com/snowplow/snowplow-java-tracker/' | ||
inceptionYear = '2014' | ||
|
||
packaging = 'jar' | ||
groupId = 'com.snowplowanalytics' | ||
|
||
licenses { | ||
license { | ||
name = 'The Apache Software License, Version 2.0' | ||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
distribution = 'repo' | ||
} | ||
} | ||
scm { | ||
connection = 'https://github.com/snowplow/snowplow-java-tracker.git' | ||
url = 'https://github.com/snowplow/snowplow-java-tracker' | ||
} | ||
developers { | ||
developer { | ||
name = 'Snowplow Analytics Ltd' | ||
email = '[email protected]' | ||
organization = 'Snowplow Analytics Ltd' | ||
organizationUrl = 'http://snowplowanalytics.com' | ||
} | ||
} | ||
organization { | ||
name = 'com.snowplowanalytics' | ||
url = 'http://snowplowanalytics.com' | ||
} | ||
} | ||
} | ||
} | ||
|
||
bintray { | ||
user = System.getenv('BINTRAY_SNOWPLOW_MAVEN_USER') | ||
key = System.getenv('BINTRAY_SNOWPLOW_MAVEN_API_KEY') | ||
|
||
publish = true | ||
|
||
pkg { | ||
repo = 'snowplow-maven' | ||
name = 'snowplow-java-tracker' | ||
|
||
group = 'com.snowplowanalytics' | ||
userOrg = 'snowplow' | ||
|
||
websiteUrl = 'https://github.com/snowplow/snowplow-java-tracker' | ||
vcsUrl = 'https://github.com/snowplow/snowplow-java-tracker' | ||
issueTrackerUrl = 'https://github.com/snowplow/snowplow-java-tracker/issues' | ||
|
||
licenses = ['Apache-2.0'] | ||
publications = ['mavenJava'] | ||
|
||
version { | ||
name = "$project.version" | ||
gpg { | ||
sign = true | ||
} | ||
mavenCentralSync { | ||
sync = true | ||
user = System.getenv('SONA_USER') | ||
password = System.getenv('SONA_PASS') | ||
close = '1' | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#Wed Jan 09 17:33:41 EST 2019 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip |