Skip to content

Commit

Permalink
Publish source and Javadoc JARs (#679)
Browse files Browse the repository at this point in the history
Add tasks and artifacts for publishing JARs with source code and
generated Javadocs. These are required for admission to Bintray's
JCenter -- well-known public repository of open-source libraries.

With this, the users will be able to import Themis without adding
Cossack Labs repository. It's highly likely that they already have
JCenter added for other dependencies:

    repositories {
        jcenter()
    }

Since it's the same package, the dependency is specified as before:

    dependencies {
        implementation 'com.cossacklabs.com:themis:0.13.0'
    }

Many Bothans died to bring us this information. No, really, Gradle
documentation on this is less than stellar, and Groovy does not make
it make it easier. *sigh* Android ecosystem vOv

(cherry picked from commit 2344484)
  • Loading branch information
ilammy committed Jul 21, 2020
1 parent 66b6727 commit bbf1456
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@ Changes that are currently in development and have not been released yet.

_Code:_

- **Android**

- AndroidThemis is now available on JCenter ([#679](https://github.com/cossacklabs/themis/pull/679)).

- **Go**

- Fixed panics on 32-bit systems when processing corrupted data ([#677](https://github.com/cossacklabs/themis/pull/677)).

_Infrastructure:_

- AndroidThemis is now available on JCenter ([#679](https://github.com/cossacklabs/themis/pull/679)).

## [0.13.0](https://github.com/cossacklabs/themis/releases/tag/0.13.0), July 8th 2020

**TL;DR:**
Expand Down
43 changes: 41 additions & 2 deletions src/wrappers/themis/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,15 @@ android {

// publishing and bitray upload tasks should not run for ':boringssl' project
tasks.whenTaskAdded { task ->
println "executing $task ..."
if (task.name != 'bintrayUpload' && task.name != 'publishProductionPublicationToMavenLocal' && task.name != 'generatePomFileForProductionPublication') {
def excludeBoringSSL = [
'bintrayUpload',
'publishProductionPublicationToMavenLocal',
'generatePomFileForProductionPublication',
'generateSourceJar',
'generateJavadoc',
'generateJavadocJar',
]
if (!excludeBoringSSL.contains(task.name)) {
task.dependsOn(':boringssl:' + task.name)
}
}
Expand All @@ -94,6 +101,36 @@ android {
}
}

// Publishing on JCenter requires packages with Java source code and Javadocs.
// Note that "archiveClassifier" values are important for JCenter.

task generateSourceJar(type: Jar) {
description = 'Assembles a JAR with Java source code'
archiveClassifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

task generateJavadoc(type: Javadoc) {
description = 'Generates Javadocs from the source code'
source = android.sourceSets.main.java.srcDirs
title = 'Themis API Reference'
// Javadoc chokes on non-Java files so exclude non-sources from the source dir.
excludes = ['build', 'build.gradle']
// Add Android core system and all dependencies to classpath so that Javadoc
// finds their classes and links to them correctly.
classpath += files(android.bootClasspath)
android.libraryVariants.all { variant ->
classpath += variant.javaCompile.classpath
}
}

task generateJavadocJar(type: Jar) {
description = 'Assembles a JAR with Javadocs'
archiveClassifier = 'javadoc'
from generateJavadoc.destinationDir
dependsOn 'generateJavadoc'
}

// distribution

apply plugin: 'com.jfrog.bintray'
Expand All @@ -103,6 +140,8 @@ publishing {
publications {
Production(MavenPublication) {
artifact("build/outputs/aar/android.aar")
artifact generateSourceJar
artifact generateJavadocJar
groupId 'com.cossacklabs.com'
artifactId 'themis'
version androidThemisVersion
Expand Down

0 comments on commit bbf1456

Please sign in to comment.