Skip to content

Commit d076619

Browse files
committed
Build: Packaging for driver-embedded projects
* Refactored how plugins are applied across the projects. As the android plugin can't be used if the java plugin is installed. * Added driver-embedded-android project to handle building aar. * Updated gradle and plugin versions JAVA-2929 JAVA-2930
1 parent f4f21fe commit d076619

File tree

23 files changed

+529
-314
lines changed

23 files changed

+529
-314
lines changed

.evergreen/.evg.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,6 @@ buildvariants:
640640

641641
- name: publish-snapshot
642642
display_name: "Publish Snapshot"
643-
run_on: *hosts
643+
run_on: ubuntu1604-test
644644
tasks:
645645
- name: "publish-snapshot"

.evergreen/publish.sh

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,33 @@ echo ${RING_FILE_GPG_BASE64} | base64 -d > ${PROJECT_DIRECTORY}/secring.gpg
1212

1313
trap "rm ${PROJECT_DIRECTORY}/secring.gpg; exit" EXIT HUP
1414

15-
echo "Publishing snapshot with jdk9"
1615

17-
export JAVA_HOME="/opt/java/jdk9"
1816

1917
export ORG_GRADLE_PROJECT_nexusUsername=${NEXUS_USERNAME}
2018
export ORG_GRADLE_PROJECT_nexusPassword=${NEXUS_PASSWORD}
2119
export ORG_GRADLE_PROJECT_signing_keyId=${SIGNING_KEY_ID}
2220
export ORG_GRADLE_PROJECT_signing_password=${SIGNING_PASSWORD}
2321
export ORG_GRADLE_PROJECT_signing_secretKeyRingFile=${PROJECT_DIRECTORY}/secring.gpg
2422

23+
SDK_ROOT=$PWD/android_sdk
24+
if [ ! -e $SDK_ROOT ]; then
25+
echo "Installing ANDROID SDK"
26+
mkdir $SDK_ROOT
27+
(
28+
cd $SDK_ROOT
29+
export JAVA_HOME="/opt/java/jdk8"
30+
SDK_PACKAGE=sdk-tools-linux-4333796.zip
31+
curl -O https://dl.google.com/android/repository/$SDK_PACKAGE
32+
unzip $SDK_PACKAGE
33+
yes | ./tools/bin/sdkmanager --channel=0 \
34+
"platforms;android-28" \
35+
"build-tools;28.0.0"
36+
)
37+
fi
38+
export ANDROID_HOME=${SDK_ROOT}
39+
40+
echo "Publishing snapshot with jdk9"
41+
export JAVA_HOME="/opt/java/jdk9"
42+
2543
./gradlew -version
26-
./gradlew uploadSnapshotArchives
44+
./gradlew publishSnapshots

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ For binaries containing the asynchronous API, see the [driver-async README](driv
104104

105105
## Build
106106

107-
To build and test the driver:
107+
Java 9+ is required to build and compile the source. To build and test the driver:
108108

109109
```
110110
$ git clone https://github.com/mongodb/mongo-java-driver.git
@@ -125,7 +125,7 @@ the number of available file descriptors prior to starting mongod as described i
125125

126126
A couple of manual configuration steps are required to run the code in IntelliJ:
127127

128-
- Java 9 is required to build and compile the source.
128+
- Java 9+ is required to build and compile the source.
129129

130130
- **Error:** `java: cannot find symbol: class SNIHostName location: package javax.net.ssl`<br>
131131
**Fix:** Settings > Build, Execution, Deployment > Compiler > Java Compiler - untick "Use '--release' option for cross-compilation (Java 9 and later)"

bson/build.gradle

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
* limitations under the License.
1515
*/
1616

17-
apply plugin: 'osgi'
18-
apply plugin: 'java'
19-
apply plugin: 'org.kordamp.gradle.clirr'
20-
21-
def configDir = new File(rootDir, 'config')
2217
archivesBaseName = 'bson'
18+
description = 'The BSON library'
19+
20+
ext {
21+
pomName = 'BSON'
22+
pomURL = 'https://bsonspec.org'
23+
}
2324

2425
clirr {
2526
excludeFilter = new File("$configDir/clirr-exclude.yml")
@@ -30,17 +31,9 @@ clirr {
3031
jar {
3132
manifest {
3233
instruction 'Automatic-Module-Name', 'org.mongodb.bson'
33-
instruction 'Build-Version', getGitVersion()
34+
instruction 'Build-Version', project.gitVersion
3435
instruction 'Import-Package',
3536
'javax.xml.bind.*',
3637
'org.slf4j;resolution:=optional'
3738
}
3839
}
39-
40-
modifyPom {
41-
project {
42-
name 'BSON'
43-
description 'The BSON library'
44-
url 'http://bsonspec.org'
45-
}
46-
}

0 commit comments

Comments
 (0)