[Android] gradle: use base plugin to set the archive name
Steve Lhomme
git at videolan.org
Mon Jul 20 10:58:32 UTC 2026
vlc-android | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jun 11 13:22:36 2026 +0200| [27ce3a304a1ef6eb9af141bee8d46cfcf21ddf7d] | committer: Nicolas Pomepuy
gradle: use base plugin to set the archive name
See https://docs.gradle.org/current/userguide/base_plugin.html#sec:base_plugin_extension
It doesn't rely on variants outputFileName which will be removed in the future.
> https://code.videolan.org/videolan/vlc-android/commit/27ce3a304a1ef6eb9af141bee8d46cfcf21ddf7d
---
application/remote-access-client/build.gradle | 17 ++++++-----------
buildsystem/maven/deploy-to-mavencentral.sh | 6 +++---
medialibrary/build.gradle | 21 +++++++++------------
3 files changed, 18 insertions(+), 26 deletions(-)
diff --git a/application/remote-access-client/build.gradle b/application/remote-access-client/build.gradle
index 33239c4170..3e52d3af56 100644
--- a/application/remote-access-client/build.gradle
+++ b/application/remote-access-client/build.gradle
@@ -24,7 +24,7 @@
plugins {
id 'com.android.library'
- id 'org.jetbrains.kotlin.android'
+ id 'base'
id 'com.vanniktech.maven.publish'
}
@@ -32,6 +32,11 @@ ext {
library_version = "$rootProject.ext.remoteAccessVersion"
}
+base {
+ //Custom APK name
+ archivesName = "vlc-android-remote-access-${library_version}"
+}
+
def remoteclientSourceDir = "$projectDir/remoteaccess"
File remoteAccessPackage = file("$remoteclientSourceDir/package.json")
def remoteAccessRevision = remoteAccessPackage.exists() ? providers.exec {
@@ -73,16 +78,6 @@ android {
assets.srcDirs = ['assets']
}
- // Make per-variant version code
- libraryVariants.all { variant ->
- //Custom APK name
- variant.outputs.each { output ->
- if (output.outputFileName != null && output.outputFileName.endsWith('.aar')) {
- output.outputFileName = "vlc-android-remote-access-${library_version}.aar"
- }
- }
- }
-
buildFeatures {
resValues = true
}
diff --git a/buildsystem/maven/deploy-to-mavencentral.sh b/buildsystem/maven/deploy-to-mavencentral.sh
index a126f100ae..d6477ea6ea 100755
--- a/buildsystem/maven/deploy-to-mavencentral.sh
+++ b/buildsystem/maven/deploy-to-mavencentral.sh
@@ -113,7 +113,7 @@ else
mvn gpg:sign-and-deploy-file \
--settings settings.xml \
-DpomFile=$BASE_DIR/libvlc-all-$LIBVLC_VERSION.pom \
- -Dfile=$BASE_DIR/libvlc-all-$LIBVLC_VERSION.aar \
+ -Dfile=$BASE_DIR/libvlc-all-$LIBVLC_VERSION-release.aar \
-Dsources=$BASE_DIR/libvlc-all-$LIBVLC_VERSION-sources.jar \
-Djavadoc=$BASE_DIR/libvlc-all-$LIBVLC_VERSION-javadoc.jar \
-Durl="https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/" \
@@ -134,7 +134,7 @@ else
mvn gpg:sign-and-deploy-file \
--settings settings.xml \
-DpomFile=$BASE_DIR/medialibrary-all-$MEDIALIB_VERSION.pom \
- -Dfile=$BASE_DIR/medialibrary-all-$MEDIALIB_VERSION.aar \
+ -Dfile=$BASE_DIR/medialibrary-all-$MEDIALIB_VERSION-release.aar \
-Dsources=$BASE_DIR/medialibrary-all-$MEDIALIB_VERSION-sources.jar \
-Djavadoc=$BASE_DIR/medialibrary-all-$MEDIALIB_VERSION-javadoc.jar \
-Durl="https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/" \
@@ -155,7 +155,7 @@ else
mvn gpg:sign-and-deploy-file \
--settings settings.xml \
-DpomFile=$BASE_DIR/remote-access-$REMOTE_ACCESS_VERSION.pom \
- -Dfile=$BASE_DIR/remote-access-$REMOTE_ACCESS_VERSION.aar \
+ -Dfile=$BASE_DIR/remote-access-$REMOTE_ACCESS_VERSION-release.aar \
-Dsources=$BASE_DIR/remote-access-$REMOTE_ACCESS_VERSION-sources.jar \
-Djavadoc=$BASE_DIR/remote-access-$REMOTE_ACCESS_VERSION-javadoc.jar \
-Durl="https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/" \
diff --git a/medialibrary/build.gradle b/medialibrary/build.gradle
index d24e40d087..cb378fec54 100644
--- a/medialibrary/build.gradle
+++ b/medialibrary/build.gradle
@@ -20,13 +20,20 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
* ***************************************************************************
*/
-apply plugin: 'com.android.library'
-apply plugin: "com.vanniktech.maven.publish"
+plugins {
+ id 'com.android.library'
+ id 'base'
+ id 'com.vanniktech.maven.publish'
+}
def abi = project.hasProperty('vlcLibVariant') ? project.getProperty('vlcLibVariant') : 'all'
ext {
library_version = "$rootProject.ext.medialibraryVersion"
}
+base {
+ //Custom APK name
+ archivesName = "medialibrary-${abi}-${library_version}"
+}
android {
namespace = 'org.videolan.medialibrary'
compileOptions {
@@ -78,16 +85,6 @@ android {
renderScript = true
aidl = true
}
-
- // Make per-variant version code
- libraryVariants.all { variant ->
- //Custom APK name
- variant.outputs.each { output ->
- if (output.outputFileName != null && output.outputFileName.endsWith('.aar')) {
- output.outputFileName = "medialibrary-${abi}-${library_version}.aar"
- }
- }
- }
}
clean {
More information about the Android
mailing list