diff --git a/.gitignore b/.gitignore index 0616b363c..cbe33660d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ local.properties build/ release/ srclibs/ +libs/ # Studio .idea/ diff --git a/app/build.gradle b/app/build.gradle index e7a25566b..32b227449 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -54,8 +54,6 @@ afterEvaluate { } dependencies { - implementation fileTree(dir: "libs", include: ["*.jar"]) - // Kotlin implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" @@ -94,9 +92,7 @@ dependencies { // --- THIRD PARTY --- - // ExoPlayer - implementation project(':exoplayer-library-core') - implementation project(':exoplayer-extension-flac') + // Exoplayer // Image loading implementation 'io.coil-kt:coil:2.0.0-alpha06' @@ -108,6 +104,16 @@ dependencies { // Lint ktlint 'com.pinterest:ktlint:0.43.2' + + // WARNING: THE EXOPLAYER VERSION MUST BE KEPT IN LOCK-STEP WITH THE CUSTOM EXTRACTOR AND FLAC + // EXTENSION BLOBS. IF NOT, VERY UNFRIENDLY BUILD FAILURES AND CRASHES MAY ENSUE. + def exoplayer_version = "2.16.1" + implementation("com.google.android.exoplayer:exoplayer-core:$exoplayer_version") { + exclude group: "com.google.android.exoplayer", module: "exoplayer-extractor" + } + + implementation fileTree(dir: "libs", include: ["extension-*.aar"]) + implementation fileTree(dir: "libs", include: ["library-*.aar"]) } task ktlint(type: JavaExec, group: "verification") { diff --git a/prebuild.py b/prebuild.py index d2ee9ef5b..e2ccc3d6a 100755 --- a/prebuild.py +++ b/prebuild.py @@ -16,8 +16,6 @@ INFO="\033[1;94m" OK="\033[1;92m" NC="\033[0m" -print('curl "https://ftp.osuosl.org/pub/xiph/releases/flac/flac-' + FLAC_VERSION + '.tar.xz" | tar xJ && mv "flac-' + FLAC_VERSION + '" flac') - system = platform.system() # We do some shell scripting later on, so we can't support windows. @@ -31,8 +29,10 @@ def sh(cmd): if code != 0: print(FATAL + "fatal:" + NC + " command failed with exit code " + str(code)) sys.exit(1) - -exoplayer_path = os.path.join(os.path.abspath(os.curdir), "app", "srclibs", "exoplayer") + +start_path = os.path.join(os.path.abspath(os.curdir)) +libs_path = os.path.join(start_path, "app", "src", "libs") +exoplayer_path = os.path.join(start_path, "app", "srclibs", "exoplayer") if os.path.exists(exoplayer_path): reinstall = input(INFO + "info:" + NC + " exoplayer is already installed. would you like to reinstall it? [y/n] ") @@ -72,6 +72,7 @@ if ndk_path is None or not os.path.isfile(os.path.join(ndk_path, "ndk-build")): # Now try to install ExoPlayer. sh("rm -rf " + exoplayer_path) +sh("rm -rf " + libs_path) print(INFO + "info:" + NC + " cloning exoplayer...") sh("git clone https://github.com/oxygencobalt/ExoPlayer.git " + exoplayer_path) @@ -85,4 +86,20 @@ os.chdir(flac_ext_jni_path) sh('curl "https://ftp.osuosl.org/pub/xiph/releases/flac/flac-' + FLAC_VERSION + '.tar.xz" | tar xJ && mv "flac-' + FLAC_VERSION + '" flac') sh(ndk_build_path + " APP_ABI=all -j4") +print(INFO + "info:" + NC + " assembling libraries") +extractor_aar_path = os.path.join( + exoplayer_path, "library", "extractor", "buildout", + "outputs", "aar", "library-extractor-release.aar" +) +flac_ext_aar_path = os.path.join( + exoplayer_path, "extensions", "flac", "buildout", + "outputs", "aar", "extension-flac-release.aar" +) +os.chdir(exoplayer_path) +sh("./gradlew library-extractor:bundleReleaseAar") +sh("./gradlew extension-flac:bundleReleaseAar") +os.chdir(start_path) +sh("cp " + extractor_aar_path + " " + libs_path) +sh("cp " + flac_ext_aar_path + " " + libs_path) + print(OK + "success:" + NC + " completed pre-build.") diff --git a/settings.gradle b/settings.gradle index 4072ffee5..708e1b7b3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,2 @@ include ':app' rootProject.name = "Auxio" -gradle.ext.exoplayerModulePrefix = 'exoplayer-' -apply from: file("app/srclibs/exoplayer/core_settings.gradle") \ No newline at end of file