deps: use aar

Bundle our custom ExoPlayer components into aar instead of directly
depending on the project. This just makes things far better regarding
ease of use and reproducible builds.
This commit is contained in:
OxygenCobalt 2022-01-27 14:59:23 -07:00
parent f2e4a3a369
commit 5b5aa24f5c
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
4 changed files with 33 additions and 11 deletions

1
.gitignore vendored
View file

@ -4,6 +4,7 @@ local.properties
build/
release/
srclibs/
libs/
# Studio
.idea/

View file

@ -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") {

View file

@ -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.")

View file

@ -1,4 +1,2 @@
include ':app'
rootProject.name = "Auxio"
gradle.ext.exoplayerModulePrefix = 'exoplayer-'
apply from: file("app/srclibs/exoplayer/core_settings.gradle")