Skip to content

Commit 64b5427

Browse files
author
Josh Deffibaugh
committed
Add tasks to make javadoc jar and upload it for each module
1 parent b61b73e commit 64b5427

File tree

6 files changed

+214
-0
lines changed

6 files changed

+214
-0
lines changed

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android-sdk/build.gradle

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2016, Optimizely
3+
* <p/>
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+
* <p/>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p/>
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
apply plugin: 'com.android.library'
218
apply plugin: 'maven'
319
apply plugin: 'maven-publish'
@@ -53,6 +69,7 @@ dependencies {
5369
}
5470

5571
uploadArchives {
72+
dependsOn = [':android-sdk:clean', ':android-sdk:releaseJavadoc']
5673
shouldRunAfter = [':event-handler:uploadArchives', ':user-experiment-record:uploadArchives']
5774
repositories {
5875
mavenDeployer {
@@ -63,3 +80,34 @@ uploadArchives {
6380
}
6481
}
6582
}
83+
84+
android.libraryVariants.all { variant ->
85+
task("${variant.name}Javadoc", type: Javadoc, dependsOn: "assemble${variant.name.capitalize()}") {
86+
source = variant.javaCompile.source
87+
88+
title = "Optimizely X Android SDK"
89+
90+
options.links("http://docs.oracle.com/javase/7/docs/api/");
91+
options.linksOffline("http://d.android.com/reference", "${android.sdkDirectory}/docs/reference");
92+
93+
// First add all of your dependencies to the classpath, then add the android jars
94+
classpath += files(variant.javaCompile.classpath.files)
95+
classpath += files(android.getBootClasspath())
96+
97+
// We're excluding these generated files
98+
exclude '**/BuildConfig.java'
99+
exclude '**/R.java'
100+
101+
options.tags = ["hide"]
102+
}
103+
}
104+
105+
android.libraryVariants.all { variant ->
106+
task("${variant.name}JavadocJar", type: Jar, dependsOn: "${variant.name}Javadoc") {
107+
classifier = 'javadoc'
108+
from tasks["${variant.name}Javadoc"].destinationDir
109+
}
110+
111+
// Add the Javadoc jar to the project's artifacts. This will allow us to upload it easily later
112+
project.artifacts.add("archives", tasks["${variant.name}JavadocJar"]);
113+
}

build.gradle

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2016, Optimizely
3+
* <p/>
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+
* <p/>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p/>
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
// Top-level build file where you can add configuration options common to all sub-projects/modules.
218

319
buildscript {
@@ -52,6 +68,7 @@ task ship() {
5268
task testAllModules << {
5369
logger.info("Running android tests for all modules")
5470
}
71+
5572
testAllModules.dependsOn(':android-sdk:connectedAndroidTest', ':android-sdk:test',
5673
':event-handler:connectedAndroidTest', ':event-handler:test',
5774
':user-experiment-record:connectedAndroidTest', ':shared:connectedAndroidTest')

event-handler/build.gradle

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2016, Optimizely
3+
* <p/>
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+
* <p/>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p/>
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
apply plugin: 'com.android.library'
218
apply plugin: 'maven'
319
apply plugin: 'maven-publish'
@@ -50,6 +66,7 @@ dependencies {
5066
}
5167

5268
uploadArchives {
69+
dependsOn = [':event-handler:clean', ':event-handler:releaseJavadoc']
5370
shouldRunAfter = [':shared:uploadArchives']
5471
repositories {
5572
mavenDeployer {
@@ -60,3 +77,35 @@ uploadArchives {
6077
}
6178
}
6279
}
80+
81+
android.libraryVariants.all { variant ->
82+
task("${variant.name}Javadoc", type: Javadoc, dependsOn: "assemble${variant.name.capitalize()}") {
83+
source = variant.javaCompile.source
84+
85+
title = "Optimizely X Android Event Handler"
86+
87+
options.links("http://docs.oracle.com/javase/7/docs/api/");
88+
options.linksOffline("http://d.android.com/reference", "${android.sdkDirectory}/docs/reference");
89+
90+
// First add all of your dependencies to the classpath, then add the android jars
91+
classpath += files(variant.javaCompile.classpath.files)
92+
classpath += files(android.getBootClasspath())
93+
94+
// We're excluding these generated files
95+
exclude '**/BuildConfig.java'
96+
exclude '**/R.java'
97+
98+
options.tags = ["hide"]
99+
}
100+
}
101+
102+
android.libraryVariants.all { variant ->
103+
task("${variant.name}JavadocJar", type: Jar, dependsOn: "${variant.name}Javadoc") {
104+
classifier = 'javadoc'
105+
from tasks["${variant.name}Javadoc"].destinationDir
106+
}
107+
108+
// Add the Javadoc jar to the project's artifacts. This will allow us to upload it easily later
109+
project.artifacts.add("archives", tasks["${variant.name}JavadocJar"]);
110+
}
111+

shared/build.gradle

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2016, Optimizely
3+
* <p/>
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+
* <p/>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p/>
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
apply plugin: 'com.android.library'
218
apply plugin: 'maven'
319
apply plugin: 'maven-publish'
@@ -52,6 +68,7 @@ dependencies {
5268
}
5369

5470
uploadArchives {
71+
dependsOn = [':shared:clean', 'shared:releaseJavadoc']
5572
repositories {
5673
mavenDeployer {
5774
repository(url: "https://api.bintray.com/maven/optimizely/optimizely/optimizely-sdk-android-shared") {
@@ -61,3 +78,35 @@ uploadArchives {
6178
}
6279
}
6380
}
81+
82+
android.libraryVariants.all { variant ->
83+
task("${variant.name}Javadoc", type: Javadoc, dependsOn: "assemble${variant.name.capitalize()}") {
84+
source = variant.javaCompile.source
85+
86+
title = "Optimizely X Android Shared"
87+
88+
options.links("http://docs.oracle.com/javase/7/docs/api/");
89+
options.linksOffline("http://d.android.com/reference", "${android.sdkDirectory}/docs/reference");
90+
91+
// First add all of your dependencies to the classpath, then add the android jars
92+
classpath += files(variant.javaCompile.classpath.files)
93+
classpath += files(android.getBootClasspath())
94+
95+
// We're excluding these generated files
96+
exclude '**/BuildConfig.java'
97+
exclude '**/R.java'
98+
99+
100+
options.tags = ["hide"]
101+
}
102+
}
103+
104+
android.libraryVariants.all { variant ->
105+
task("${variant.name}JavadocJar", type: Jar, dependsOn: "${variant.name}Javadoc") {
106+
classifier = 'javadoc'
107+
from tasks["${variant.name}Javadoc"].destinationDir
108+
}
109+
110+
// Add the Javadoc jar to the project's artifacts. This will allow us to upload it easily later
111+
project.artifacts.add("archives", tasks["${variant.name}JavadocJar"]);
112+
}

user-experiment-record/build.gradle

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2016, Optimizely
3+
* <p/>
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+
* <p/>
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* <p/>
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
apply plugin: 'com.android.library'
218
apply plugin: 'maven'
319
apply plugin: 'maven-publish'
@@ -50,6 +66,7 @@ dependencies {
5066
}
5167

5268
uploadArchives {
69+
dependsOn = [':user-experiment-record:clean', ':user-experiment-record:releaseJavadoc']
5370
shouldRunAfter = [':shared:uploadArchives']
5471
repositories {
5572
mavenDeployer {
@@ -60,3 +77,34 @@ uploadArchives {
6077
}
6178
}
6279
}
80+
81+
android.libraryVariants.all { variant ->
82+
task("${variant.name}Javadoc", type: Javadoc, dependsOn: "assemble${variant.name.capitalize()}") {
83+
source = variant.javaCompile.source
84+
85+
title = "Optimizely X Android User Experiment Record"
86+
87+
options.links("http://docs.oracle.com/javase/7/docs/api/");
88+
options.linksOffline("http://d.android.com/reference", "${android.sdkDirectory}/docs/reference");
89+
90+
// First add all of your dependencies to the classpath, then add the android jars
91+
classpath += files(variant.javaCompile.classpath.files)
92+
classpath += files(android.getBootClasspath())
93+
94+
// We're excluding these generated files
95+
exclude '**/BuildConfig.java'
96+
exclude '**/R.java'
97+
98+
options.tags = ["hide"]
99+
}
100+
}
101+
102+
android.libraryVariants.all { variant ->
103+
task("${variant.name}JavadocJar", type: Jar, dependsOn: "${variant.name}Javadoc") {
104+
classifier = 'javadoc'
105+
from tasks["${variant.name}Javadoc"].destinationDir
106+
}
107+
108+
// Add the Javadoc jar to the project's artifacts. This will allow us to upload it easily later
109+
project.artifacts.add("archives", tasks["${variant.name}JavadocJar"]);
110+
}

0 commit comments

Comments
 (0)