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
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.

View file

@ -21,3 +21,7 @@
android.useAndroidX=true
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: '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 = "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
*/
public String getVersion() {
return "3.2.6";
return BuildConfig.OLM_VERSION;
}
/**