Skip to content

Commit 74c6ae8

Browse files
author
Vignesh Raja
authored
Add 'ship' task to publish SDK to Bintray using Travis and update Apache licenses for 2017 (#49)
1 parent e6aed1f commit 74c6ae8

File tree

111 files changed

+377
-458
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+377
-458
lines changed

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ jdk:
55
- oraclejdk8
66
install: true
77
script:
8-
- "./gradlew clean build check"
8+
- "./gradlew clean"
9+
- "if [[ -n $TRAVIS_TAG ]]; then
10+
./gradlew ship;
11+
else
12+
./gradlew build;
13+
fi"
914
cache:
1015
gradle: true
1116
directories:

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ following in your `build.gradle` and substitute `VERSION` for the latest SDK ver
1717

1818
```
1919
repositories {
20-
maven {
21-
mavenCentral()
22-
url "http://optimizely.bintray.com/optimizely"
23-
}
20+
jcenter()
2421
}
2522
2623
dependencies {
@@ -92,7 +89,7 @@ Please see [CONTRIBUTING](CONTRIBUTING.md).
9289

9390
## License
9491
```
95-
Copyright 2016, Optimizely
92+
Copyright 2017, Optimizely
9693
9794
Licensed under the Apache License, Version 2.0 (the "License");
9895
you may not use this file except in compliance with the License.

build.gradle

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ buildscript {
77
}
88

99
dependencies {
10+
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
1011
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:latest.release'
1112
}
1213
}
1314

1415
plugins {
15-
id 'net.researchgate.release' version '2.2.1'
1616
id 'nebula.optional-base' version '3.0.3'
1717
id 'me.champeau.gradle.jmh' version '0.3.1'
1818
}
@@ -24,13 +24,22 @@ allprojects {
2424
apply from: 'gradle/license.gradle'
2525
apply from: 'gradle/publish.gradle'
2626

27+
allprojects {
28+
def travis_defined_version = System.getenv('TRAVIS_TAG')
29+
if (travis_defined_version != null) {
30+
version = travis_defined_version
31+
}
32+
}
33+
2734
subprojects {
35+
apply plugin: 'com.jfrog.bintray'
2836
apply plugin: 'findbugs'
2937
apply plugin: 'java'
3038
apply plugin: 'jacoco'
39+
apply plugin: 'maven-publish'
40+
apply plugin: 'me.champeau.gradle.jmh'
3141
apply plugin: 'nebula.provided-base'
3242
apply plugin: 'nebula.optional-base'
33-
apply plugin: 'me.champeau.gradle.jmh'
3443

3544
sourceCompatibility = 1.6
3645
targetCompatibility = 1.6
@@ -102,10 +111,66 @@ subprojects {
102111
testCompile group: 'ch.qos.logback', name: 'logback-core', version: logbackVersion
103112
}
104113

105-
// for commits performed by the release plugin, skip the travis build (as it would attempt to bump the version)
106-
release {
107-
preCommitText = '[ci skip]'
114+
publishing {
115+
publications {
116+
mavenJava(MavenPublication) {
117+
from components.java
118+
artifact sourcesJar
119+
artifact javadocJar
120+
pom.withXml {
121+
asNode().children().last() + {
122+
resolveStrategy = Closure.DELEGATE_FIRST
123+
url 'https://github.com/optimizely/java-sdk'
124+
licenses {
125+
license {
126+
name 'The Apache Software License, Version 2.0'
127+
url 'http://www.apache.org/license/LICENSE-2.0.txt'
128+
distribution 'repo'
129+
}
130+
}
131+
developers {
132+
developer {
133+
id 'optimizely'
134+
name 'Optimizely'
135+
email 'developers@optimizely.com'
136+
}
137+
}
138+
}
139+
}
140+
}
141+
}
142+
}
143+
144+
def bintrayName = 'core-api';
145+
if (name.equals('core-httpclient-impl')) {
146+
bintrayName = 'httpclient'
108147
}
148+
149+
bintray {
150+
user = System.getenv('BINTRAY_USER')
151+
key = System.getenv('BINTRAY_KEY')
152+
pkg {
153+
repo = 'optimizely'
154+
name = "optimizely-sdk-${bintrayName}"
155+
userOrg = 'optimizely'
156+
version {
157+
name = rootProject.version
158+
}
159+
publications = ['mavenJava']
160+
}
161+
}
162+
163+
build.dependsOn('generatePomFileForMavenJavaPublication')
164+
165+
bintrayUpload.dependsOn 'build'
166+
167+
task ship() {
168+
dependsOn('bintrayUpload')
169+
}
170+
}
171+
172+
task ship() {
173+
dependsOn(':core-api:ship', ':core-httpclient-impl:ship')
109174
}
110175

111176
// todo: remove this wrapper version once we're publishing to jcenter/maven central

core-api/build.gradle

Lines changed: 16 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
buildscript {
2-
repositories {
3-
jcenter()
4-
}
5-
dependencies {
6-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
7-
}
8-
}
1+
/*
2+
* Copyright 2017, Optimizely
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
916

1017
plugins {
1118
id 'de.fuerstenau.buildconfig' version '1.1.7'
@@ -25,7 +32,6 @@ dependencies {
2532
provided group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: jacksonVersion, optional
2633
}
2734

28-
apply plugin: 'com.jfrog.bintray'
2935
apply plugin: 'de.fuerstenau.buildconfig'
3036
apply plugin: 'maven-publish'
3137

@@ -38,50 +44,4 @@ sourceSets {
3844
main {
3945
java.srcDir "${buildDir}/gen/buildconfig/src/main/"
4046
}
41-
}
42-
43-
publishing {
44-
publications {
45-
mavenJava(MavenPublication) {
46-
from components.java
47-
artifact sourcesJar
48-
artifact javadocJar
49-
pom.withXml {
50-
asNode().children().last() + {
51-
resolveStrategy = Closure.DELEGATE_FIRST
52-
url 'https://github.com/optimizely/java-sdk'
53-
licenses {
54-
license {
55-
name 'The Apache Software License, Version 2.0'
56-
url 'http://www.apache.org/license/LICENSE-2.0.txt'
57-
distribution 'repo'
58-
}
59-
}
60-
developers {
61-
developer {
62-
id 'optimizely'
63-
name 'Optimizely'
64-
email 'developers@optimizely.com'
65-
}
66-
}
67-
}
68-
}
69-
}
70-
}
71-
}
72-
73-
bintray {
74-
user = System.getenv('BINTRAY_USER')
75-
key = System.getenv('BINTRAY_KEY')
76-
pkg {
77-
repo = 'optimizely'
78-
name = 'optimizely-sdk-core-api'
79-
userOrg = 'optimizely'
80-
version {
81-
name = getVersion()
82-
}
83-
publications = ['mavenJava']
84-
}
85-
}
86-
87-
publishArtifacts()
47+
}

core-api/src/jmh/java/com/optimizely/ab/BenchmarkUtils.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
/**
2-
*
3-
* Copyright 2016, Optimizely
1+
/*
2+
* Copyright 2017, Optimizely
43
*
54
* Licensed under the Apache License, Version 2.0 (the "License");
65
* you may not use this file except in compliance with the License.

core-api/src/jmh/java/com/optimizely/ab/OptimizelyBenchmark.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
/**
2-
*
3-
* Copyright 2016, Optimizely
1+
/*
2+
* Copyright 2017, Optimizely
43
*
54
* Licensed under the Apache License, Version 2.0 (the "License");
65
* you may not use this file except in compliance with the License.

core-api/src/jmh/java/com/optimizely/ab/OptimizelyBuilderBenchmark.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
/**
2-
*
3-
* Copyright 2016, Optimizely
1+
/*
2+
* Copyright 2017, Optimizely
43
*
54
* Licensed under the Apache License, Version 2.0 (the "License");
65
* you may not use this file except in compliance with the License.

core-api/src/jmh/resources/benchmark.properties

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
#
2+
# Copyright 2017, Optimizely
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
117
datafilePathTemplate=config/profiling-test-data-%d-experiments.json
218
activateGroupExperimentUserIdPropTemplate=activateGroupExperiment%dExperimentsUserId
319
activateGroupExperiment10ExperimentsUserId=no
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
<!--
2+
~ Copyright 2017, Optimizely
3+
~
4+
~ Licensed under the Apache License, Version 2.0 (the "License");
5+
~ you may not use this file except in compliance with the License.
6+
~ You may obtain a copy of the License at
7+
~
8+
~ http://www.apache.org/licenses/LICENSE-2.0
9+
~
10+
~ Unless required by applicable law or agreed to in writing, software
11+
~ distributed under the License is distributed on an "AS IS" BASIS,
12+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
~ See the License for the specific language governing permissions and
14+
~ limitations under the License.
15+
-->
16+
117
<configuration>
218
<root level="warn"/>
319
</configuration>

core-api/src/main/java/com/optimizely/ab/Optimizely.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
/**
2-
*
3-
* Copyright 2016, Optimizely
1+
/*
2+
* Copyright 2017, Optimizely
43
*
54
* Licensed under the Apache License, Version 2.0 (the "License");
65
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)