From f0ee7f30a52c2a21f4452984c9b9ab92d37e8a1b Mon Sep 17 00:00:00 2001 From: Nicolas Pomepuy Date: Tue, 28 Jan 2025 11:42:22 +0100 Subject: [PATCH] Create the new remote access client module and setup maven and CI Fixes #3131 --- application/app/build.gradle | 5 +- application/remote-access-client/.gitignore | 1 + application/remote-access-client/build.gradle | 126 ++++++++++++++++++ .../remote-access-client/consumer-rules.pro | 0 .../gradle.properties | 4 +- .../remote-access-client/proguard-rules.pro | 21 +++ .../src/main/AndroidManifest.xml | 28 ++++ application/remote-access-server/build.gradle | 60 +-------- buildsystem/gitlab/.gitlab-ci.yml | 2 +- settings.gradle | 1 + 10 files changed, 186 insertions(+), 62 deletions(-) create mode 100644 application/remote-access-client/.gitignore create mode 100644 application/remote-access-client/build.gradle create mode 100644 application/remote-access-client/consumer-rules.pro rename application/{remote-access-server => remote-access-client}/gradle.properties (94%) create mode 100644 application/remote-access-client/proguard-rules.pro create mode 100644 application/remote-access-client/src/main/AndroidManifest.xml diff --git a/application/app/build.gradle b/application/app/build.gradle index be1e8e0d5..64adb29a2 100644 --- a/application/app/build.gradle +++ b/application/app/build.gradle @@ -162,10 +162,7 @@ android { dependencies { implementation project(':application:vlc-android') implementation project(':application:television') - devImplementation project(':application:remote-access-server') - debugImplementation project(':application:remote-access-server') - releaseImplementation "org.videolan.android:remote-access:$rootProject.ext.remoteAccessVersion" - vlcBundleImplementation "org.videolan.android:remote-access:$rootProject.ext.remoteAccessVersion" + implementation project(':application:remote-access-server') testImplementation project(':application:television') testImplementation project(':application:remote-access-server') diff --git a/application/remote-access-client/.gitignore b/application/remote-access-client/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/application/remote-access-client/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/application/remote-access-client/build.gradle b/application/remote-access-client/build.gradle new file mode 100644 index 000000000..b39ecc5d5 --- /dev/null +++ b/application/remote-access-client/build.gradle @@ -0,0 +1,126 @@ +/* + * ************************************************************************ + * build.gradle + * ************************************************************************* + * Copyright © 2025 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. + * ************************************************************************** + * + * + */ + +plugins { + id 'com.android.library' + id 'org.jetbrains.kotlin.android' + id 'com.vanniktech.maven.publish' +} + +ext { + library_version = "$rootProject.ext.remoteAccessVersion" +} + +android { + namespace 'org.videolan.vlc.remoteaccessclient' + + defaultConfig { + minSdkVersion rootProject.ext.minSdkVersion + targetSdkVersion rootProject.ext.targetSdkVersion + compileSdk rootProject.ext.compileSdkVersion + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" + resValue "string", "build_remote_access_revision", remoteAccessRevision() + resValue "string", "remote_access_version", remoteAccessVersion() + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } + + task webCopy(type: Copy) { + from '../../remoteaccess/dist' + into 'assets/dist' + } + + sourceSets.main { + assets.srcDirs = ['assets'] + } + + sourceSets.main { + 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" + } + } + } +} + +preBuild.dependsOn(webCopy) + +def remoteAccessVersion() { + def code = new ByteArrayOutputStream() + try { + if (file("../../remoteaccess/package.json").exists()) { + + exec { + commandLine = ['bash', '-c', 'grep -m1 "version" ../../remoteaccess/package.json'] + standardOutput = code + } + return code.toString().split("\"")[3] + + } + } catch (Exception e) { + } + return "unknown" +} + +def remoteAccessRevision() { + try { + def hash = new ByteArrayOutputStream() + exec { + commandLine = ['bash', '-c', 'git -C ../../remoteaccess rev-parse --short HEAD'] + standardOutput = hash + } + return hash.toString() + } catch (Exception e) { + } + return "unknown" +} + +dependencies { + + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.2.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' +} + +apply from: '../../buildsystem/publish.gradle' diff --git a/application/remote-access-client/consumer-rules.pro b/application/remote-access-client/consumer-rules.pro new file mode 100644 index 000000000..e69de29bb diff --git a/application/remote-access-server/gradle.properties b/application/remote-access-client/gradle.properties similarity index 94% rename from application/remote-access-server/gradle.properties rename to application/remote-access-client/gradle.properties index ee9ac55a8..26f8de862 100644 --- a/application/remote-access-server/gradle.properties +++ b/application/remote-access-client/gradle.properties @@ -2,7 +2,7 @@ # ************************************************************************* # gradle.properties # ************************************************************************** -# Copyright © 2024 VLC authors and VideoLAN +# Copyright © 2025 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 @@ -28,4 +28,4 @@ POM_ARTIFACT_ID=remote-access POM_NAME=VLC-Android-RemoteAccess POM_DESCRIPTION=Android port of VLC's Remote Access -POM_INCEPTION_YEAR=2021 \ No newline at end of file +POM_INCEPTION_YEAR=2024 \ No newline at end of file diff --git a/application/remote-access-client/proguard-rules.pro b/application/remote-access-client/proguard-rules.pro new file mode 100644 index 000000000..481bb4348 --- /dev/null +++ b/application/remote-access-client/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/application/remote-access-client/src/main/AndroidManifest.xml b/application/remote-access-client/src/main/AndroidManifest.xml new file mode 100644 index 000000000..13a607c10 --- /dev/null +++ b/application/remote-access-client/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + \ No newline at end of file diff --git a/application/remote-access-server/build.gradle b/application/remote-access-server/build.gradle index c6c72aecd..cb7d371d0 100644 --- a/application/remote-access-server/build.gradle +++ b/application/remote-access-server/build.gradle @@ -1,12 +1,8 @@ plugins { id 'com.android.library' id 'org.jetbrains.kotlin.android' - id 'com.vanniktech.maven.publish' } -ext { - library_version = "$rootProject.ext.remoteAccessVersion" -} android { namespace 'org.videolan.vlc.remoteaccessserver' @@ -23,8 +19,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" buildConfigField 'Boolean', 'VLC_REMOTE_ACCESS_DEBUG', project.hasProperty("vlc_remote_access_debug") ? vlc_remote_access_debug : "false" - resValue "string", "build_remote_access_revision", remoteAccessRevision() - resValue "string", "remote_access_version", remoteAccessVersion() } @@ -43,11 +37,6 @@ android { } } - task webCopy(type: Copy) { - from '../../remoteaccess/dist' - into 'assets/dist' - } - sourceSets.main { assets.srcDirs = ['assets'] } @@ -68,51 +57,14 @@ android { buildConfig 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 = "vlc-android-remote-access-${library_version}.aar" - } - } - } -} - -def remoteAccessVersion() { - def code = new ByteArrayOutputStream() - try { - if (file("../../remoteaccess/package.json").exists()) { - - exec { - commandLine = ['bash', '-c', 'grep -m1 "version" ../../remoteaccess/package.json'] - standardOutput = code - } - return code.toString().split("\"")[3] - - } - } catch (Exception e) { - } - return "unknown" -} - -def remoteAccessRevision() { - try { - def hash = new ByteArrayOutputStream() - exec { - commandLine = ['bash', '-c', 'git -C ../../remoteaccess rev-parse --short HEAD'] - standardOutput = hash - } - return hash.toString() - } catch (Exception e) { - } - return "unknown" } -preBuild.dependsOn(webCopy) - dependencies { coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4' + devImplementation project(':application:remote-access-client') + debugImplementation project(':application:remote-access-client') + releaseImplementation "org.videolan.android:remote-access:$rootProject.ext.remoteAccessVersion" + vlcBundleImplementation "org.videolan.android:remote-access:$rootProject.ext.remoteAccessVersion" implementation project(':application:vlc-android') implementation "io.ktor:ktor:$rootProject.ext.ktorVersion" implementation "io.ktor:ktor-server-netty:$rootProject.ext.ktorVersion" @@ -130,6 +82,4 @@ dependencies { testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' -} - -apply from: '../../buildsystem/publish.gradle' +} \ No newline at end of file diff --git a/buildsystem/gitlab/.gitlab-ci.yml b/buildsystem/gitlab/.gitlab-ci.yml index edc279541..9f0fb4712 100644 --- a/buildsystem/gitlab/.gitlab-ci.yml +++ b/buildsystem/gitlab/.gitlab-ci.yml @@ -466,7 +466,7 @@ publish_remote_access_lib: script: - mkdir -p $M2_REPO - ./buildsystem/compile.sh --init -b - - GRADLE_ABI=ALL RELEASE_SIGNING_ENABLED=false ./gradlew -Dmaven.repo.local=$M2_REPO -p application/webserver publishToMavenLocal + - GRADLE_ABI=ALL RELEASE_SIGNING_ENABLED=false ./gradlew -Dmaven.repo.local=$M2_REPO -p application/remote-access-client publishToMavenLocal artifacts: name: "${CI_COMMIT_TAG}" paths: diff --git a/settings.gradle b/settings.gradle index c7fa53916..097de50d8 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,3 +2,4 @@ include ':libvlcjni:libvlc', ':medialibrary' include ':application:tools', ':application:resources', ':application:mediadb', ':application:app', ':application:live-plot-graph', ':application:television', ':application:donations', ':application:remote-access-server' include ':application:vlc-android' include ':application:moviepedia' +include ':application:remote-access-client'