publish to gitlab.matrix.org Maven repository

This commit is contained in:
Hubert Chathi 2021-09-29 18:35:18 -04:00
parent 336e1d56a8
commit 6da33e1b3b
4 changed files with 53 additions and 3 deletions

View file

@ -126,8 +126,8 @@ endorsed by the Matrix.org Foundation C.I.C.
## Release process ## Release process
First: bump version numbers in ``common.mk``, ``CMakeLists.txt``, First: bump version numbers in ``common.mk``, ``CMakeLists.txt``,
``javascript/package.json``, ``python/olm/__version__.py``, ``OLMKit.podspec``, ``Package.swift``, ``javascript/package.json``, ``python/olm/__version__.py``, ``OLMKit.podspec``,
and ``android/olm-sdk/src/main/java/org/matrix/olm/OlmManager.java`` in function ``getVersion()```. ``Package.swift``, and ``android/gradle.properties``.
Also, ensure the changelog is up to date, and that everything is committed to Also, ensure the changelog is up to date, and that everything is committed to
git. git.

View file

@ -21,3 +21,7 @@
android.useAndroidX=true android.useAndroidX=true
org.gradle.configureondemand=false org.gradle.configureondemand=false
GROUP=org.matrix.android
ARTIFACT_ID=olm
VERSION_NAME=3.2.6

View file

@ -2,6 +2,7 @@ import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
apply plugin: 'signing'
android { android {
compileSdkVersion 30 compileSdkVersion 30
@ -15,6 +16,8 @@ android {
// "pm clear" command after each test invocation. This command ensures // "pm clear" command after each test invocation. This command ensures
// that the app's state is completely cleared between tests. // that the app's state is completely cleared between tests.
testInstrumentationRunnerArguments clearPackageData: 'true' testInstrumentationRunnerArguments clearPackageData: 'true'
buildConfigField "String", "OLM_VERSION", "\"${project.getProperties().getOrDefault("VERSION_NAME", "0.0.0")}\""
} }
buildTypes { buildTypes {
debug { debug {
@ -74,6 +77,27 @@ android {
compileTask.dependsOn buildJavaDoc 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 clean.dependsOn cleanNative
@ -135,7 +159,29 @@ project.afterEvaluate {
publications { publications {
release(MavenPublication) { release(MavenPublication) {
from components.release 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 = "Deploy-Token"
value = matrixOrgPrivateToken
}
authentication {
header(HttpHeaderAuthentication)
}
} }
} }
} }
signing {
useGpgCmd()
sign publishing.publications.release
}
} }

View file

@ -46,7 +46,7 @@ public class OlmManager {
* @return the library version * @return the library version
*/ */
public String getVersion() { public String getVersion() {
return "3.2.6"; return BuildConfig.OLM_VERSION;
} }
/** /**