diff --git a/build.gradle b/build.gradle index 223c3cf59..294b4e66a 100644 --- a/build.gradle +++ b/build.gradle @@ -20,6 +20,9 @@ allprojects { repositories { google() jcenter() + maven { + url "https://dl.bintray.com/videolan/LibVLC" + } } } @@ -29,6 +32,8 @@ ext { minSdkVersion = 17 targetSdkVersion = 28 compileSdkVersion = 28 + libvlcVersion = '3.1.0' + medialibraryVersion = '0.4' androidxVersion = '1.0.0' constraintLayoutVersion = '2.0.0-alpha2' archVersion = '2.0.0' diff --git a/compile.sh b/compile.sh index 70aeed774..f75d487fc 100755 --- a/compile.sh +++ b/compile.sh @@ -40,9 +40,6 @@ while [ $# -gt 0 ]; do ANDROID_ABI=$2 shift ;; - -c) - CHROME_OS=1 - ;; -r|release|--release) RELEASE=1 ;; @@ -74,6 +71,10 @@ while [ $# -gt 0 ]; do --no-ml) NO_ML=1 ;; + --publish) + RELEASE=1 + PUBLISH=1 + ;; *) diagnostic "$0: Invalid option '$1'." diagnostic "$0: Try --help for more information." @@ -275,7 +276,7 @@ compile() { fi # Build LibVLC if asked for it, or needed by medialibrary - if [ "$BUILD_MEDIALIB" != 1 -o ! -d "libvlc/jni/libs/$ANDROID_ABI" ]; then + if [ "$BUILD_MEDIALIB" != 1 -o ! -d "libvlc/jni/libs/$1" ]; then ./compile-libvlc.sh $OPTS fi @@ -283,51 +284,60 @@ compile() { ./compile-medialibrary.sh $OPTS fi } -if [ "$ANDROID_ABI" = "all" ]; then - if [ -d libvlc/tmp ]; then - rm -rf libvlc/tmp +if [ "$BUILD_MEDIALIB" = 1 -o "$BUILD_LIBVLC" = 1 -o "$RELEASE" != 1 ]; then + if [ "$ANDROID_ABI" = "all" ]; then + if [ -d tmp ]; then + rm -rf tmp + fi + mkdir tmp + LIB_DIR="libvlc" + if [ "$NO_ML" != 1 ]; then + LIB_DIR="medialibrary" + fi + compile armeabi-v7a + cp -r $LIB_DIR/jni/libs/armeabi-v7a tmp + compile arm64-v8a + cp -r $LIB_DIR/jni/libs/arm64-v8a tmp + compile x86 + cp -r $LIB_DIR/jni/libs/x86 tmp + compile x86_64 + mv tmp/* $LIB_DIR/jni/libs + rm -rf tmp + else + compile $ANDROID_ABI fi - mkdir libvlc/tmp - compile armeabi-v7a - mv libvlc/jni/libs/armeabi-v7a libvlc/tmp - compile arm64-v8a - mv libvlc/jni/libs/arm64-v8a libvlc/tmp - compile x86 - mv libvlc/jni/libs/x86 libvlc/tmp - compile x86_64 - mv libvlc/tmp/* libvlc/jni/libs -else - compile $ANDROID_ABI fi ################## # Compile the UI # ################## -PLATFORM="Vanilla" -BUILDTYPE="Debug" +BUILDTYPE="Dev" if [ "$SIGNED_RELEASE" = 1 ]; then BUILDTYPE="signedRelease" elif [ "$RELEASE" = 1 ]; then BUILDTYPE="Release" fi -if [ "$CHROME_OS" = 1 ]; then - PLATFORM="Chrome" -fi if [ "$BUILD_LIBVLC" = 1 ];then GRADLE_ABI=$GRADLE_ABI ./gradlew -p libvlc assemble${BUILDTYPE} RUN=0 CHROME_OS=0 + if [ "$PUBLISH" = 1 ];then + GRADLE_ABI=$GRADLE_ABI ./gradlew -p libvlc install bintrayUpload + fi elif [ "$BUILD_MEDIALIB" = 1 ]; then GRADLE_ABI=$GRADLE_ABI ./gradlew -p medialibrary assemble${BUILDTYPE} RUN=0 CHROME_OS=0 + if [ "$PUBLISH" = 1 ];then + GRADLE_ABI=$GRADLE_ABI ./gradlew -p medialibrary install bintrayUpload + fi else if [ "$RUN" = 1 ]; then ACTION="install" else ACTION="assemble" fi - TARGET="${ACTION}${PLATFORM}${GRADLE_ABI}${BUILDTYPE}" + TARGET="${ACTION}${BUILDTYPE}" CLI="" ./gradlew $TARGET fi diff --git a/libvlc/build.gradle b/libvlc/build.gradle index c6c3cf9c5..ae84110e1 100644 --- a/libvlc/build.gradle +++ b/libvlc/build.gradle @@ -37,6 +37,10 @@ android { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } + dev { + initWith debug + matchingFallbacks = ['debug'] + } } // Make per-variant version code diff --git a/medialibrary/build.gradle b/medialibrary/build.gradle index 16fb5b6bc..d9d87a9fe 100644 --- a/medialibrary/build.gradle +++ b/medialibrary/build.gradle @@ -66,6 +66,10 @@ android { minifyEnabled false proguardFile 'proguard.cfg' } + dev { + initWith debug + matchingFallbacks = ['debug'] + } } dataBinding { @@ -88,7 +92,9 @@ clean { } dependencies { - implementation project(':libvlc') + releaseImplementation "org.videolan.android:libvlc-all:$rootProject.ext.libvlcVersion" + debugImplementation "org.videolan.android:libvlc-all:$rootProject.ext.libvlcVersion" + devImplementation project(':libvlc') api "androidx.legacy:legacy-support-v4:$rootProject.ext.androidxVersion" api "androidx.core:core:$rootProject.ext.androidxVersion" api "androidx.fragment:fragment:$rootProject.ext.androidxVersion" diff --git a/publish.gradle b/publish.gradle index cd5550d59..9c9cf1a89 100644 --- a/publish.gradle +++ b/publish.gradle @@ -81,8 +81,7 @@ bintray { vcsUrl = gitUrl labels = ['aar', 'android', 'vlc'] dryRun = false - publish = true - override = false + override = true publicDownloadNumbers = true version { desc = libraryDescription diff --git a/vlc-android/build.gradle b/vlc-android/build.gradle index a9717bd27..c2baf3c68 100644 --- a/vlc-android/build.gradle +++ b/vlc-android/build.gradle @@ -1,3 +1,5 @@ +import com.android.build.OutputFile + apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' @@ -20,7 +22,7 @@ android { compileSdkVersion rootProject.ext.compileSdkVersion - flavorDimensions "target", "abi" + flavorDimensions "abi" lintOptions { abortOnError false @@ -122,49 +124,40 @@ android { applicationIdSuffix ".debug" jniDebuggable true } - } - productFlavors { - vanilla { - dimension "target" - versionCode = 1 - } - ARMv7 { - dimension "abi" - versionCode = 4 - } - x86 { - dimension "abi" - versionCode = 5 - } - MIPS { - dimension "abi" - versionCode = 6 - } - ARMv8 { - dimension "abi" - versionCode = 7 + dev { + initWith debug + matchingFallbacks = ['debug'] } - x86_64 { - dimension "abi" - versionCode = 8 - } - MIPS64 { - dimension "abi" - versionCode = 9 + } + + splits { + abi { + def isReleaseBuild = false + gradle.startParameter.taskNames.find { + // Enable split for release builds in different build flavors + // (assemblePaidRelease, assembleFreeRelease, etc.). + if (it.toLowerCase() ==~ /assemble.*Release/.toLowerCase()) { + isReleaseBuild = true + return true // break + } + return false // continue + } + enable isReleaseBuild + reset() + include "x86", "x86_64", "armeabi-v7a", "arm64-v8a" +// universalApk !isReleaseBuild } } + def abiCodes = ['x86':5, 'x86_64':8, 'armeabi-v7a':4, 'arm64-v8a':7] // make per-variant version code applicationVariants.all { variant -> - - def generatedCode = variant.productFlavors.get(0).versionCode * 10000000 + defaultConfig.versionCode + variant.productFlavors.get(1).versionCode //Custom APK name and versionCode variant.outputs.each { output -> - output.versionCodeOverride = generatedCode + def abiName = output.getFilter(OutputFile.ABI) ?: "all" + output.versionCodeOverride = 10000000 + defaultConfig.versionCode + abiCodes.get(abiName, 0) def outputName = "VLC-Android-" - if (variant.productFlavors.get(0).name != "vanilla") - outputName += variant.productFlavors.get(0).name.toUpperCase() + "-" - outputName += variant.versionName + "-" + variant.productFlavors.get(1).name + ".apk" + outputName += variant.versionName + "-" + abiName + ".apk" output.outputFileName = outputName } } @@ -199,9 +192,14 @@ task generateSources (type: Jar) { } dependencies { - implementation project(':libvlc') - implementation project(':medialibrary') + devImplementation project(':libvlc') + devImplementation project(':medialibrary') + debugImplementation "org.videolan.android:libvlc-all:$rootProject.ext.libvlcVersion" + debugImplementation "org.videolan.android:medialibrary-all:$rootProject.ext.medialibraryVersion" + releaseImplementation "org.videolan.android:libvlc-all:$rootProject.ext.libvlcVersion" + releaseImplementation "org.videolan.android:medialibrary-all:$rootProject.ext.medialibraryVersion" implementation project(':api') + implementation project(':tools') // AppCompat implementation "androidx.recyclerview:recyclerview:$rootProject.ext.androidxVersion" implementation "com.google.android.material:material:$rootProject.ext.androidxVersion" @@ -224,7 +222,6 @@ dependencies { // Retrofit implementation "com.squareup.retrofit2:retrofit:$rootProject.ext.retrofit" implementation "com.squareup.retrofit2:converter-moshi:$rootProject.ext.retrofit" - implementation project(":tools") // Test androidTestImplementation "androidx.test.espresso:espresso-contrib:$rootProject.espressoVersion" androidTestImplementation "androidx.test.espresso:espresso-core:$rootProject.espressoVersion" diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java index ece22e776..ca3cab19f 100644 --- a/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java +++ b/vlc-android/src/org/videolan/vlc/gui/helpers/UiTools.java @@ -236,7 +236,7 @@ public class UiTools { final TextView compiled = v.findViewById(R.id.main_compiled); compiled.setText(builder + " (" + builddate + ")"); final TextView textview_rev = v.findViewById(R.id.main_revision); - textview_rev.setText(v.getContext().getString(R.string.revision) + " " + revision + " (" + builddate + ") " + BuildConfig.FLAVOR_abi); + textview_rev.setText(v.getContext().getString(R.string.revision) + " " + revision + " (" + builddate + ") " + BuildConfig.FLAVOR); final ImageView logo = v.findViewById(R.id.logo); logo.setOnClickListener(new View.OnClickListener() {