Release the library on MavenCentral

Delete stuff added for Jitpack
This commit is contained in:
Benoit Marty 2022-01-06 10:04:40 +01:00
parent 1c3af112c8
commit 23380ca331
6 changed files with 49 additions and 49 deletions

View file

@ -167,6 +167,14 @@ Python and JavaScript packages are published to the registry at
documentation contains instructions on how to set up twine (Python) and npm documentation contains instructions on how to set up twine (Python) and npm
(JavaScript) to upload to the registry. (JavaScript) to upload to the registry.
To publish the Android library to MavenCentral (you will need some secrets), in the /android folder:
- Run the command `./gradlew clean publish --no-daemon --no-parallel --stacktrace`.
- Connect to https://s01.oss.sonatype.org
- Click on Staging Repositories and check the the files have been uploaded
- Click on close
- Wait (check Activity tab until step "Repository closed" is displayed)
- Click on release. The staging repository will disappear
- Check that the release is available in https://repo1.maven.org/maven2/org/matrix/android/olm/ (it can take a few minutes)
## Design ## Design

View file

@ -5,20 +5,16 @@ OlmLibSdk exposes an android wrapper to libolm.
Installation Installation
------------ ------------
Create a libs directory in your project directory
Copy the olm-sdk.aar into it.
In your build.gradle file, add in the android section:: Android Olm library is released on MavenCentral.
repositories { Add this dependency to your project:
flatDir {
dir 'libs'
}
}
Add in the dependencies category:: ```groovy
implementation "org.matrix.android:olm:3.2.8"
```
compile(name: 'olm-sdk', ext: 'aar') Latest version: ![Latest version](https://img.shields.io/maven-central/v/org.matrix.android/olm)
Development Development
----------- -----------

View file

@ -9,7 +9,7 @@ buildscript {
// Release notes of Android Gradle Plugin (AGP): // Release notes of Android Gradle Plugin (AGP):
// https://developer.android.com/studio/releases/gradle-plugin // https://developer.android.com/studio/releases/gradle-plugin
classpath 'com.android.tools.build:gradle:7.0.4' classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.17.0'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
} }
@ -20,6 +20,14 @@ allprojects {
mavenCentral() mavenCentral()
google() google()
} }
plugins.withId("com.vanniktech.maven.publish") {
// Publish on s01.oss.sonatype.org
//https://github.com/vanniktech/gradle-maven-publish-plugin#where-to-upload-to
mavenPublish {
sonatypeHost = "S01"
}
}
} }
task clean(type: Delete) { task clean(type: Delete) {

View file

@ -22,6 +22,28 @@
android.useAndroidX=true android.useAndroidX=true
org.gradle.configureondemand=false org.gradle.configureondemand=false
# Maven publication
# Ref: https://github.com/vanniktech/gradle-maven-publish-plugin
GROUP=org.matrix.android GROUP=org.matrix.android
ARTIFACT_ID=olm POM_ARTIFACT_ID=olm
VERSION_NAME=3.2.8 VERSION_NAME=3.2.8
POM_PACKAGING=aar
POM_NAME=Olm Android wrapper
POM_DESCRIPTION=An Android wrapper to libolm.
POM_INCEPTION_YEAR=2021
POM_URL=https://gitlab.matrix.org/matrix-org/olm
POM_LICENSE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_SCM_URL=https://gitlab.matrix.org/matrix-org/olm
POM_SCM_CONNECTION=scm:git:git://gitlab.matrix.org/matrix-org/olm.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@gitlab.matrix.org/matrix-org/olm.git
POM_DEVELOPER_ID=matrixdev
POM_DEVELOPER_NAME=matrixdev
POM_DEVELOPER_URL=https://gitlab.matrix.org/matrix-org
POM_DEVELOPER_EMAIL=android@element.io

View file

@ -1,3 +0,0 @@
install:
- ./gradlew :olm-sdk:build :olm-sdk:publishToMavenLocal -x :olm-sdk:test
- find . -name "*.aar"

View file

@ -1,8 +1,7 @@
import org.apache.tools.ant.taskdefs.condition.Os import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
apply plugin: 'maven-publish' apply plugin: "com.vanniktech.maven.publish"
apply plugin: 'signing'
android { android {
compileSdk 31 compileSdk 31
@ -12,6 +11,8 @@ android {
targetSdk 31 targetSdk 31
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField "String", "OLM_VERSION", "\"${project.getProperties().getOrDefault("VERSION_NAME", "0.0.0")}\""
// The following argument makes the Android Test Orchestrator run its // The following argument makes the Android Test Orchestrator run its
// "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.
@ -158,35 +159,3 @@ dependencies {
androidTestImplementation 'androidx.test:rules:1.4.0' androidTestImplementation 'androidx.test:rules:1.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.ext:junit:1.1.3'
} }
project.afterEvaluate {
publishing {
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
}
}