[Android] Publish to maven central

Nicolas Pomepuy git at videolan.org
Tue Apr 13 07:27:03 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Mar 23 10:05:09 2021 +0100| [2cd00b6c810cb631b7230e00411e3b8f2a5031fe] | committer: Nicolas Pomepuy

Publish to maven central

> https://code.videolan.org/videolan/vlc-android/commit/2cd00b6c810cb631b7230e00411e3b8f2a5031fe
---

 build.gradle                      |  4 ++-
 buildsystem/compile.sh            |  2 +-
 buildsystem/gitlab/.gitlab-ci.yml |  8 +++--
 buildsystem/publish.gradle        | 62 +--------------------------------------
 gradle.properties                 | 13 ++++++++
 libvlc/build.gradle               | 10 +++----
 libvlc/gradle.properties          | 31 ++++++++++++++++++++
 medialibrary/build.gradle         | 10 +++----
 medialibrary/gradle.properties    | 31 ++++++++++++++++++++
 9 files changed, 96 insertions(+), 75 deletions(-)

diff --git a/build.gradle b/build.gradle
index 474ce4c9a..46970e7a6 100644
--- a/build.gradle
+++ b/build.gradle
@@ -7,12 +7,14 @@ buildscript {
         flatDir dirs: "gradle/plugins"
         google()
         jcenter()
-    }
+        mavenCentral()
+   }
     dependencies {
         classpath "com.android.tools.build:gradle:$android_plugin_version"
         classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
         classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
+        classpath 'com.vanniktech:gradle-maven-publish-plugin:0.14.2'
     }
 }
 
diff --git a/buildsystem/compile.sh b/buildsystem/compile.sh
index 665833f7d..787d39bab 100755
--- a/buildsystem/compile.sh
+++ b/buildsystem/compile.sh
@@ -249,7 +249,7 @@ fi
 
 if [ ! -d "gradle/wrapper" ]; then
     diagnostic "Downloading gradle"
-    GRADLE_VERSION=6.5
+    GRADLE_VERSION=6.6
     GRADLE_URL=https://download.videolan.org/pub/contrib/gradle/gradle-${GRADLE_VERSION}-bin.zip
     wget ${GRADLE_URL} 2>/dev/null || curl -O ${GRADLE_URL} || fail "gradle: download failed"
 
diff --git a/buildsystem/gitlab/.gitlab-ci.yml b/buildsystem/gitlab/.gitlab-ci.yml
index 46d0d6127..d9e701896 100644
--- a/buildsystem/gitlab/.gitlab-ci.yml
+++ b/buildsystem/gitlab/.gitlab-ci.yml
@@ -4,6 +4,7 @@ cache:
         - gradle-5.4.1/
         - gradle-6.1.1/
         - gradle-6.5/
+        - gradle-6.6/
         - gradle/
         - gradlew
 
@@ -153,15 +154,18 @@ publish_libs:
         - if: '$CI_COMMIT_TAG =~ /^libvlc-.*$/'
     variables:
         ARCH: all
+        M2_REPO: "$CI_PROJECT_DIR/aars/repository"
     script:
+        - mkdir -p $M2_REPO
         - ./buildsystem/compile.sh -l -a ${ARCH} release
-        - GRADLE_ABI=ALL ./gradlew -p libvlc bintrayupload
+        - GRADLE_ABI=ALL RELEASE_SIGNING_ENABLED=false ./gradlew -Dmaven.repo.local=$M2_REPO -p libvlc publishToMavenLocal
         - ./buildsystem/compile.sh -ml -a ${ARCH} release
-        - GRADLE_ABI=ALL ./gradlew -p medialibrary bintrayupload
+        - GRADLE_ABI=ALL RELEASE_SIGNING_ENABLED=false ./gradlew -Dmaven.repo.local=$M2_REPO -p medialibrary publishToMavenLocal
     artifacts:
         name: "${CI_COMMIT_TAG}.dbg"
         paths:
             - .dbg/
+            - $M2_REPO
         expire_in: 2 weeks
 
 release:
diff --git a/buildsystem/publish.gradle b/buildsystem/publish.gradle
index bbe81359f..356623b6b 100644
--- a/buildsystem/publish.gradle
+++ b/buildsystem/publish.gradle
@@ -28,64 +28,4 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
 artifacts {
     archives javadocJar
     archives sourcesJar
-}
-
-install {
-    group = 'publishing'
-    repositories.mavenInstaller {
-        // This generates POM.xml with proper parameters
-        pom.project {
-            packaging 'aar'
-            artifactId lib_artifact
-            name repoName
-            description libraryDescription
-            url 'https://code.videolan.org/videolan/vlc-android/'
-
-            licenses {
-                license {
-                    name licenseName
-                    url licenseUrl
-                }
-            }
-            developers {
-                developer {
-                    id 'videolan'
-                    name 'VideoLAN'
-                    email 'android at videolan.org'
-                }
-            }
-            scm {
-                connection gitUrl
-                developerConnection gitUrl
-                url siteUrl
-            }
-        }
-    }
-}
-
-apply plugin: 'com.jfrog.bintray'
-
-Properties properties = new Properties()
-properties.load(project.rootProject.file('local.properties').newDataInputStream())
-bintray {
-    user = System.getenv('K8S_SECRET_BINTRAY_USER') ?: properties.getProperty("bintray.user")
-    key = System.getenv('K8S_SECRET_BINTRAY_KEY') ?: properties.getProperty("bintray.apikey")
-    configurations = ['archives']
-    pkg {
-        repo = repoName
-        name = libraryName
-        desc = libraryDescription
-        websiteUrl = siteUrl
-        issueTrackerUrl = 'https://code.videolan.org/videolan/vlc-android/issues'
-        licenses = allLicenses
-        vcsUrl = gitUrl
-        labels = ['aar', 'android', 'vlc']
-        dryRun = false
-        override = true
-        publicDownloadNumbers = true
-        version {
-            desc = libraryDescription
-        }
-    }
-    publish = true
-}
+}
\ No newline at end of file
diff --git a/gradle.properties b/gradle.properties
index 9a71bd821..717b48a61 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -6,3 +6,16 @@ kapt.use.worker.api=true
 kapt.include.compile.classpath=false
 org.gradle.jvmargs=-Xms512M -Xmx4g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
 org.gradle.parallel=true
+
+POM_URL=https://code.videolan.org/videolan/vlc-android/
+POM_SCM_URL=https://code.videolan.org/videolan/vlc-android/
+POM_SCM_CONNECTION=scm:git:https://code.videolan.org/videolan/vlc-android.git
+POM_SCM_DEV_CONNECTION=scm:git:https://code.videolan.org/videolan/vlc-android.git
+
+POM_LICENCE_NAME=GNU Lesser General Public License, version 2.1
+POM_LICENCE_URL=https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
+POM_LICENCE_DIST=repo
+
+POM_DEVELOPER_ID=videolan
+POM_DEVELOPER_NAME=VideoLAN
+POM_DEVELOPER_URL=https://www.videolan.org/
\ No newline at end of file
diff --git a/libvlc/build.gradle b/libvlc/build.gradle
index 5c1ff57c7..d94d0673a 100644
--- a/libvlc/build.gradle
+++ b/libvlc/build.gradle
@@ -1,15 +1,11 @@
 apply plugin: 'com.android.library'
 apply plugin: 'com.github.dcendents.android-maven'
+apply plugin: "com.vanniktech.maven.publish"
 
 def abi = System.getenv('GRADLE_ABI')?.toLowerCase()
 def vlcSrcDirs = System.getenv('GRADLE_VLC_SRC_DIRS')
 ext {
     library_version = "$rootProject.ext.libvlcVersion"
-    repoName = 'Android'
-    libraryName = 'LibVLC-Android'
-    lib_artifact = "libvlc-$abi"
-
-    libraryDescription = 'Android bindings and API for VLC'
 }
 android {
 
@@ -108,4 +104,8 @@ def vlcRevision() {
     return vlc.toString()
 }
 
+mavenPublish {
+    releaseSigningEnabled = false
+}
+
 apply from: '../buildsystem/publish.gradle'
diff --git a/libvlc/gradle.properties b/libvlc/gradle.properties
new file mode 100644
index 000000000..a46a41a20
--- /dev/null
+++ b/libvlc/gradle.properties
@@ -0,0 +1,31 @@
+#
+# *************************************************************************
+#  gradle.properties
+# **************************************************************************
+# Copyright © 2021 VLC authors and VideoLAN
+# Author: Nicolas POMEPUY
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+# ***************************************************************************
+#
+#
+#
+
+GROUP=org.videolan.android
+POM_ARTIFACT_ID=libvlc-all
+
+
+POM_NAME=LibVLC-Android
+POM_DESCRIPTION=Android bindings and API for VLC
+POM_INCEPTION_YEAR=2021
\ No newline at end of file
diff --git a/medialibrary/build.gradle b/medialibrary/build.gradle
index 41af6a94e..984f1a655 100644
--- a/medialibrary/build.gradle
+++ b/medialibrary/build.gradle
@@ -22,15 +22,11 @@
  */
 apply plugin: 'com.android.library'
 apply plugin: 'com.github.dcendents.android-maven'
+apply plugin: "com.vanniktech.maven.publish"
 
 def abi = System.getenv('GRADLE_ABI')?.toLowerCase()
 ext {
     library_version = "$rootProject.ext.medialibraryVersion"
-    repoName = 'Android'
-    libraryName = 'Medialibrary-Android'
-    lib_artifact = "medialibrary-$abi"
-
-    libraryDescription = 'Android bindings and API for Medialibrary'
 }
 android {
     compileOptions {
@@ -107,4 +103,8 @@ dependencies {
 
 }
 
+mavenPublish {
+    releaseSigningEnabled = false
+}
+
 apply from: '../buildsystem/publish.gradle'
diff --git a/medialibrary/gradle.properties b/medialibrary/gradle.properties
new file mode 100644
index 000000000..695f8e7e0
--- /dev/null
+++ b/medialibrary/gradle.properties
@@ -0,0 +1,31 @@
+#
+# *************************************************************************
+#  gradle.properties
+# **************************************************************************
+# Copyright © 2021 VLC authors and VideoLAN
+# Author: Nicolas POMEPUY
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+# ***************************************************************************
+#
+#
+#
+
+GROUP=org.videolan.android
+POM_ARTIFACT_ID=medialibrary-all
+
+
+POM_NAME=Medialibrary-Android
+POM_DESCRIPTION=Android bindings and API for Medialibrary
+POM_INCEPTION_YEAR=2021
\ No newline at end of file



More information about the Android mailing list