From d9781f3a47ab5177eb607d5d330bc1d731f6efb4 Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Wed, 2 Feb 2022 16:03:05 +0900 Subject: [PATCH] add build instructions add yarn script to prepare exoplayer/ffmpeg --- BUILDING.md | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 3 +++ package.json | 1 + 3 files changed, 63 insertions(+) create mode 100644 BUILDING.md diff --git a/BUILDING.md b/BUILDING.md new file mode 100644 index 0000000..633126f --- /dev/null +++ b/BUILDING.md @@ -0,0 +1,59 @@ +# Building from source +Instructions are provided here for Linux, specifically Ubuntu 20.04, but other operating systems should be fine as long as the requirements are met. + +## Requirements +### Base +- git +- wget +- unzip +- node.js (14.x) +- yarn (1.x) + +### React Native +Subtracks is a React Native application, which means you need to make sure you are set up for that. Follow the guide here to set up your development environment (React Native CLI, not Expo): + +https://reactnative.dev/docs/environment-setup + +When setting up your environment, make sure to install the following dependency versions: +- Node 14 +- Java JDK 11 (tested with openjdk-11-jdk) + +### ExoPlayer +We also need the requirements to build ExoPlayer's ffmpeg extension for Android, which should be covered by: +- build-essential (make, etc.) + +More information on building ffmpeg can be found here (this is what the `prepare` script does): + +https://github.com/google/ExoPlayer/tree/r2.11.4/extensions/ffmpeg + +## Building +Clone the repository, making sure to recurse submodules, and change into the directory: +```sh +git clone --recursive https://github.com/austinried/subtracks.git +cd subtracks +``` + +Install the yarn packages and prepare the ExoPlayer ffmpeg extension by running the yarn script: +```sh +yarn install +yarn prepare +``` + +### Debug +In a separate terminal start Metro, which will be an ongoing process that serves javascript bundles to the build: +```sh +yarn start +``` + +Run the android debug build script, which will start the build and also start your default emulator and push the build to it (or push the build to a running emulator/already connected device): +```sh +yarn android +``` + +### Release +Similar to the debug build, except we don't need to run Metro first: +```sh +yarn android:release +``` + +The generated APK will be written to `android/app/build/outputs/apk/release/app-release.apk` diff --git a/README.md b/README.md index 780b858..949f7a1 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,6 @@ Subtracks is an Android open source music streaming app for [Subsonic-API-compat - Multi-select actions - Performance & animation improvements - More shuffle play modes + +# Building +See [Building from source](BUILDING.md). diff --git a/package.json b/package.json index af459ad..d5cb088 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "android": "react-native run-android", "android:release": "./android/gradlew -p android assembleRelease -PsignReleaseWithDebug=true && adb install -r android/app/build/outputs/apk/release/app-release.apk && adb shell am start -n com.subtracks/.MainActivity", "start": "react-native start", + "prepare": "scripts/prepare-exoplayer-ffmpeg.sh", "test": "jest", "lint": "eslint . --ext .js,.jsx,.ts,.tsx", "license:npm": "yarn licenses generate-disclaimer --production | grep -v '^info\\s\"\\?fsevents' > android/app/src/main/assets/licenses/npm.txt",