Skip to content

Open-source music player for YouTube Music's catalog, with genres, full albums and playlists. Windows, macOS, Linux, Android, iPhone and Docker. No account needed.

TypeScript
3.4 KB
Raw Blame
apply plugin: 'com.android.application'

// One version for the whole app: mobile/package.json (1.3.0 becomes versionCode 10300).
def appVersion = new groovy.json.JsonSlurper().parse(file('../../package.json')).version
def versionParts = appVersion.tokenize('.').collect { it.find(/\d+/).toInteger() }

// Release signing, kept out of the repository: android/keystore.properties locally, environment variables in CI.
// Without either, the release APK is built unsigned.
def keystoreProps = new Properties()
def keystoreFile = rootProject.file('keystore.properties')
if (keystoreFile.exists()) keystoreFile.withInputStream { keystoreProps.load(it) }
def signingValue = { String prop, String env -> keystoreProps.getProperty(prop) ?: System.getenv(env) }
def releaseStore = signingValue('storeFile', 'MUSIKE_KEYSTORE')

android {
    namespace = "app.musike.android"
    compileSdk = rootProject.ext.compileSdkVersion
    defaultConfig {
        applicationId "app.musike.android"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode versionParts[0] * 10000 + versionParts[1] * 100 + versionParts[2]
        versionName appVersion
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        aaptOptions {
             // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
             // Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
            ignoreAssetsPattern = '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
        }
    }
    signingConfigs {
        if (releaseStore) {
            release {
                storeFile rootProject.file(releaseStore)
                storePassword signingValue('storePassword', 'MUSIKE_KEYSTORE_PASSWORD')
                keyAlias signingValue('keyAlias', 'MUSIKE_KEY_ALIAS')
                keyPassword signingValue('keyPassword', 'MUSIKE_KEY_PASSWORD')
            }
        }
    }
    buildTypes {
        release {
            if (releaseStore) signingConfig signingConfigs.release
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    flatDir{
        dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
    implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
    implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
    implementation project(':capacitor-android')
    testImplementation "junit:junit:$junitVersion"
    androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
    androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
    implementation project(':capacitor-cordova-android-plugins')
}

apply from: 'capacitor.build.gradle'

try {
    def servicesJSON = file('google-services.json')
    if (servicesJSON.text) {
        apply plugin: 'com.google.gms.google-services'
    }
} catch(Exception e) {
    logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}