Skip to content

Commit 3db480f

Browse files
author
Vignesh Raja
authored
Improve publishing process and update Apache license headers (#50)
2 parents 32aea2c + 74c6ae8 commit 3db480f

File tree

114 files changed

+404
-531
lines changed

Some content is hidden

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

114 files changed

+404
-531
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: 71 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ 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'
17-
id "me.champeau.gradle.jmh" version "0.3.1"
17+
id 'me.champeau.gradle.jmh' version '0.3.1'
1818
}
1919

2020
allprojects {
@@ -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: 28 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
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+
17+
plugins {
18+
id 'de.fuerstenau.buildconfig' version '1.1.7'
19+
}
20+
121
dependencies {
222
compile group: 'org.slf4j', name: 'slf4j-api', version: slf4jVersion
323
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: jacksonVersion
@@ -12,66 +32,16 @@ dependencies {
1232
provided group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: jacksonVersion, optional
1333
}
1434

15-
task build << {
16-
// add the build version information into a file that'll go into the distribution
17-
ext.buildVersion = new File(projectDir, "src/main/resources/optimizely-build-version")
18-
buildVersion.text = version
19-
}
20-
21-
buildscript {
22-
repositories {
23-
jcenter()
24-
}
25-
dependencies {
26-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
27-
}
28-
}
29-
30-
apply plugin: 'com.jfrog.bintray'
35+
apply plugin: 'de.fuerstenau.buildconfig'
3136
apply plugin: 'maven-publish'
3237

33-
publishing {
34-
publications {
35-
mavenJava(MavenPublication) {
36-
from components.java
37-
artifact sourcesJar
38-
artifact javadocJar
39-
pom.withXml {
40-
asNode().children().last() + {
41-
resolveStrategy = Closure.DELEGATE_FIRST
42-
url 'https://github.com/optimizely/java-sdk'
43-
licenses {
44-
license {
45-
name 'The Apache Software License, Version 2.0'
46-
url 'http://www.apache.org/license/LICENSE-2.0.txt'
47-
distribution 'repo'
48-
}
49-
}
50-
developers {
51-
developer {
52-
id 'optimizely'
53-
name 'Optimizely'
54-
email 'developers@optimizely.com'
55-
}
56-
}
57-
}
58-
}
59-
}
60-
}
38+
buildConfig {
39+
appName = 'core-api'
40+
version = rootProject.version
6141
}
6242

63-
bintray {
64-
user = System.getenv('BINTRAY_USER')
65-
key = System.getenv('BINTRAY_KEY')
66-
pkg {
67-
repo = 'optimizely'
68-
name = 'optimizely-sdk-core-api'
69-
userOrg = 'optimizely'
70-
version {
71-
name = getVersion()
72-
}
73-
publications = ['mavenJava']
43+
sourceSets {
44+
main {
45+
java.srcDir "${buildDir}/gen/buildconfig/src/main/"
7446
}
75-
}
76-
77-
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: 3 additions & 5 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.
@@ -33,7 +32,6 @@
3332
import com.optimizely.ab.error.RaiseExceptionErrorHandler;
3433
import com.optimizely.ab.event.EventHandler;
3534
import com.optimizely.ab.event.LogEvent;
36-
import com.optimizely.ab.event.internal.BuildVersionInfo;
3735
import com.optimizely.ab.event.internal.EventBuilder;
3836
import com.optimizely.ab.event.internal.EventBuilderV1;
3937
import com.optimizely.ab.event.internal.EventBuilderV2;
@@ -693,7 +691,7 @@ public Optimizely build() throws ConfigParseException {
693691
}
694692

695693
if (clientVersion == null) {
696-
clientVersion = BuildVersionInfo.VERSION;
694+
clientVersion = BuildConfig.VERSION;
697695
}
698696

699697
if (eventBuilder == null) {

0 commit comments

Comments
 (0)