diff --git a/README.md b/README.md index f5e7b64..cf5c110 100644 --- a/README.md +++ b/README.md @@ -126,8 +126,8 @@ endorsed by the Matrix.org Foundation C.I.C. ## Release process First: bump version numbers in ``common.mk``, ``CMakeLists.txt``, -``javascript/package.json``, ``python/olm/__version__.py``, ``OLMKit.podspec``, ``Package.swift``, -and ``android/olm-sdk/src/main/java/org/matrix/olm/OlmManager.java`` in function ``getVersion()```. +``javascript/package.json``, ``python/olm/__version__.py``, ``OLMKit.podspec``, +``Package.swift``, and ``android/gradle.properties``. Also, ensure the changelog is up to date, and that everything is committed to git. diff --git a/android/gradle.properties b/android/gradle.properties index 6328e86..37853c8 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -21,3 +21,7 @@ android.useAndroidX=true org.gradle.configureondemand=false + +GROUP=org.matrix.android +ARTIFACT_ID=olm +VERSION_NAME=3.2.6 diff --git a/android/olm-sdk/build.gradle b/android/olm-sdk/build.gradle index 52a1337..f6c0477 100644 --- a/android/olm-sdk/build.gradle +++ b/android/olm-sdk/build.gradle @@ -2,6 +2,7 @@ import org.apache.tools.ant.taskdefs.condition.Os apply plugin: 'com.android.library' apply plugin: 'maven-publish' +apply plugin: 'signing' android { compileSdkVersion 30 @@ -15,6 +16,8 @@ android { // "pm clear" command after each test invocation. This command ensures // that the app's state is completely cleared between tests. testInstrumentationRunnerArguments clearPackageData: 'true' + + buildConfigField "String", "OLM_VERSION", "\"${project.getProperties().getOrDefault("VERSION_NAME", "0.0.0")}\"" } buildTypes { debug { @@ -74,6 +77,27 @@ android { compileTask.dependsOn buildJavaDoc } + task androidJavadocs(type: Javadoc) { + source = android.sourceSets.main.java.srcDirs + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + android.libraryVariants.all { variant -> + if (variant.name == 'release') { + owner.classpath += variant.javaCompileProvider.get().classpath + } + } + exclude '**/R.html', '**/R.*.html', '**/index.html' + } + + task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { + archiveClassifier.set('javadoc') + from androidJavadocs.destinationDir + } + + task androidSourcesJar(type: Jar) { + archiveClassifier.set('sources') + from android.sourceSets.main.java.srcDirs + } + clean.dependsOn cleanNative @@ -135,7 +159,29 @@ project.afterEvaluate { publications { release(MavenPublication) { from components.release + artifact androidJavadocsJar + artifact androidSourcesJar + groupId = project.getProperties().getOrDefault("GROUP", "org.matrix.android") + artifactId = project.getProperties().getOrDefault("ARTIFACT_ID", "olm") + version = project.getProperties().getOrDefault("VERSION_NAME", "0.0.0") + } + } + repositories { + maven { + url "https://gitlab.matrix.org/api/v4/projects/27/packages/maven" + credentials(HttpHeaderCredentials) { + name = System.getenv("REPO_TOKEN_TYPE") + value = System.getenv("REPO_TOKEN") + } + authentication { + header(HttpHeaderAuthentication) + } } } } + + signing { + useGpgCmd() + sign publishing.publications.release + } } diff --git a/android/olm-sdk/src/main/java/org/matrix/olm/OlmManager.java b/android/olm-sdk/src/main/java/org/matrix/olm/OlmManager.java index 42ff873..3c76922 100644 --- a/android/olm-sdk/src/main/java/org/matrix/olm/OlmManager.java +++ b/android/olm-sdk/src/main/java/org/matrix/olm/OlmManager.java @@ -46,7 +46,7 @@ public class OlmManager { * @return the library version */ public String getVersion() { - return "3.2.6"; + return BuildConfig.OLM_VERSION; } /**