final VERSION_CODE_DIFFERENCE_BETWEEN_APP_AND_AUTOMOTIVE = 50000 def secretProperties = loadPropertiesFromFile(file("$rootDir/secret.properties") ) def versionProperties = loadPropertiesFromFile(file("${rootDir}/version.properties")) static def loadPropertiesFromFile(inputFile) { def properties = new Properties() if (inputFile.exists()) { inputFile.withInputStream { stream -> properties.load(stream) } } return properties } // Unfortunately we currently need to rely on a property to separate the version code between app & automotive builds. // This is mainly because the library modules use the version code information from BuildConfig directly instead // of receiving from the clients. // // On the bright side, the difference between the app & automotive modules is a static number, so even if there is // an issue and the wrong version code information is used, it'd be easy to identify it. // // The long term solution is to move the version information out of the `base.gradle` and into the specific // app & automotive modules and pass this information to the modules that require it. def isAutomotiveBuild = (project.findProperty("IS_AUTOMOTIVE_BUILD") ?: false).toBoolean() def getVersionCode = { def appVersionCode = versionProperties.getProperty("versionCode", null).toInteger() if (isAutomotiveBuild) { return appVersionCode + VERSION_CODE_DIFFERENCE_BETWEEN_APP_AND_AUTOMOTIVE } return appVersionCode } def getVersionName = { def versionName = versionProperties.getProperty("versionName", null) if (isAutomotiveBuild) { return "${versionName}a" } return versionName } project.ext { // Application applicationId = 'au.com.shiftyjelly.pocketcasts' versionName = getVersionName() versionCode = getVersionCode() // Android minSdkVersion = 23 minSdkVersionWear = 23 targetSdkVersion = 33 compileSdkVersion = 33 testInstrumentationRunner = 'androidx.test.runner.AndroidJUnitRunner' // App Signing storeFile = file("$rootDir/${secretProperties.getProperty("signingKeyStoreFile", null)}") if (storeFile.exists()) { // Use secret properties storePassword = secretProperties.getProperty("signingKeyStorePassword", null) keyAlias = secretProperties.getProperty("signingKeyAlias", null) keyPassword = secretProperties.getProperty("signingKeyPassword", null) } else { // Check local gradle properties def keystoreFilePropertyKey = "pocketcastsKeyStoreFile" if (project.hasProperty(keystoreFilePropertyKey)) { storeFile = file(project.getProperty(keystoreFilePropertyKey)) storePassword = project.getProperty("pocketcastsKeyStorePassword") keyAlias = project.getProperty("pocketcastsKeyStoreAlias") keyPassword = project.getProperty("pocketcastsKeyStoreAliasPassword") } } canSignRelease = storeFile.exists() // Secrets settingsEncryptSecret = secretProperties.getProperty("pocketcastsSettingsEncryptSecret", "") sharingServerSecret = secretProperties.getProperty("pocketcastsSharingServerSecret", "") pocketcastsSentryDsn = secretProperties.getProperty("pocketcastsSentryDsn", "") // Library versions versionBillingClient = '5.0.0' versionCompose = '1.2.1' versionComposeCompiler = '1.3.0' versionDagger = '2.41' versionEspresso = '3.4.0' versionExoplayer = '2.16.1' versionGlide = '4.13.2' versionHilt = '2.43.2' versionKotlinCoroutines = '1.6.4' versionLifecycle = '2.5.1' versionMoshi = '1.13.0' versionNavigation = '2.5.1' versionPaging = '3.1.1' versionRetrofit = '2.9.0' versionRoom = '2.4.3' versionTest = '1.4.0' versionWork = '2.7.1' // Automattic library versions versionTracks = 'trunk-b3655d42123501a1d9a304789b738610ab4403c8' androidLibs = [ appCompat: "androidx.appcompat:appcompat:1.5.0", mediarouter: "androidx.mediarouter:mediarouter:1.3.1", palette: "androidx.palette:palette:1.0.0", recyclerview: "androidx.recyclerview:recyclerview:1.2.1", swipeToRefresh: "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0", design: "com.google.android.material:material:1.5.0", cardview: "androidx.cardview:cardview:1.0.0", browser: "androidx.browser:browser:1.4.0", percent: "androidx.percentlayout:percentlayout:1.0.0-rc02", preference: "androidx.preference:preference:1.2.0", cast: "com.google.android.gms:play-services-cast-framework:21.1.0", desugarJdk: "com.android.tools:desugar_jdk_libs:1.1.5", // Firebase BoM (Bill of Materials enables you to manage all your Firebase library versions by specifying only one version) firebaseBom: "com.google.firebase:firebase-bom:30.5.0", firebaseAnalytics: "com.google.firebase:firebase-analytics-ktx", firebaseConfig: "com.google.firebase:firebase-config-ktx", constraintLayout: "androidx.constraintlayout:constraintlayout:2.1.4", ktx: "androidx.core:core-ktx:1.8.0", ktxFragment: "androidx.fragment:fragment-ktx:1.5.2", ktxPreference: "androidx.preference:preference-ktx:1.2.0", annotations: "androidx.annotation:annotation:1.3.0", liveDataReactiveStreams: "androidx.lifecycle:lifecycle-reactivestreams-ktx:$versionLifecycle", lifecycleViewModel: "androidx.lifecycle:lifecycle-viewmodel-ktx:$versionLifecycle", lifecycleScope: "androidx.lifecycle:lifecycle-runtime-ktx:$versionLifecycle", lifecycleLiveData: "androidx.lifecycle:lifecycle-livedata-ktx:$versionLifecycle", lifecycleProcess: "androidx.lifecycle:lifecycle-process:$versionLifecycle", billing: "com.android.billingclient:billing:$versionBillingClient", billingKtx: "com.android.billingclient:billing-ktx:$versionBillingClient", openSource: 'com.google.android.gms:play-services-oss-licenses:17.0.0', browserHelper: 'com.google.androidbrowserhelper:androidbrowserhelper:2.3.0', flexbox: 'com.google.android.flexbox:flexbox:3.0.0', androidTestCore: "androidx.test:core:$versionTest", room: "androidx.room:room-runtime:$versionRoom", roomRx: "androidx.room:room-rxjava2:$versionRoom", roomKtx: "androidx.room:room-ktx:$versionRoom", roomCompile: "androidx.room:room-compiler:$versionRoom", roomTest: "androidx.room:room-testing:$versionRoom", paging: "androidx.paging:paging-runtime:$versionPaging", pagingRx: "androidx.paging:paging-rxjava2:$versionPaging", testRunner: "androidx.test:runner:$versionTest", testRules: "androidx.test:rules:$versionTest", testEspressoCore: "androidx.test.espresso:espresso-core:$versionEspresso", testEspressoContrib: "androidx.test.espresso:espresso-contrib:$versionEspresso", testExpressoWeb: "androidx.test.espresso:espresso-web:$versionEspresso", testExpressoIdlingConcurrent: "androidx.test.espresso.idling:idling-concurrent:$versionEspresso", testExpressoIdlingResouce: "androidx.test.espresso:espresso-idling-resource:$versionEspresso", testUiautomator: "androidx.test.uiautomator:uiautomator:2.2.0", junitExt: "androidx.test.ext:junit:1.1.3", workManager: "androidx.work:work-runtime-ktx:$versionWork", workManagerRx: "androidx.work:work-rxjava2:$versionWork", workManagerTest: "androidx.work:work-testing:$versionWork", navigationFragment: "androidx.navigation:navigation-fragment-ktx:$versionNavigation", navigationUi: "androidx.navigation:navigation-ui-ktx:$versionNavigation", viewPager: "androidx.viewpager2:viewpager2:1.0.0", composeActivity: "androidx.activity:activity-compose:1.5.1", composeUi: "androidx.compose.ui:ui:$versionCompose", composeUiTestManifest: "androidx.compose.ui:ui-test-manifest:$versionCompose", composeUiTestJunit: "androidx.compose.ui:ui-test-junit4:$versionCompose", composeUiTooling: "androidx.compose.ui:ui-tooling:$versionCompose", composeUiToolingPreview: "androidx.compose.ui:ui-tooling-preview:$versionCompose", composeMaterial: "androidx.compose.material:material:$versionCompose", composeAnimation: "androidx.compose.animation:animation:$versionCompose", composeLiveData: "androidx.compose.runtime:runtime-livedata:$versionCompose", composeNavigation: "androidx.navigation:navigation-compose:$versionNavigation", composeRx: "androidx.compose.runtime:runtime-rxjava2:$versionCompose", composeViewModel: "androidx.lifecycle:lifecycle-viewmodel-compose:$versionLifecycle", guava: 'com.google.guava:guava:27.1-android' // Required to fix conflict between versions in exoplayer and workmanager ] libs = [ kotlin: "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version", kotlinCoroutines: "org.jetbrains.kotlinx:kotlinx-coroutines-core:$versionKotlinCoroutines", kotlinCoroutinesAndroid: "org.jetbrains.kotlinx:kotlinx-coroutines-android:$versionKotlinCoroutines", kotlinCoroutinesRx: "org.jetbrains.kotlinx:kotlinx-coroutines-rx2:$versionKotlinCoroutines", kotlinCoroutinesTest: "org.jetbrains.kotlinx:kotlinx-coroutines-test:$versionKotlinCoroutines", // Retrofit retrofit: "com.squareup.retrofit2:retrofit:$versionRetrofit", retrofitMoshi: "com.squareup.retrofit2:converter-moshi:$versionRetrofit", retrofitRxJava: "com.squareup.retrofit2:adapter-rxjava2:$versionRetrofit", moshi: "com.squareup.moshi:moshi:$versionMoshi", moshiKotlinCompile: "com.squareup.moshi:moshi-kotlin-codegen:$versionMoshi", moshiAdapters: "com.squareup.moshi:moshi-adapters:$versionMoshi", // Timber (logging) - https://github.com/JakeWharton/timber timber: "com.jakewharton.timber:timber:5.0.1", // Android device names for debug email - https://bintray.com/bintray/jcenter/com.jaredrummler%3Aandroid-device-names deviceNames: "com.jaredrummler:android-device-names:2.1.0", // ExoPlayer, replacement for MediaPlayer from Google exoplayerCore: "com.google.android.exoplayer:exoplayer-core:$versionExoplayer", exoplayerUi: "com.google.android.exoplayer:exoplayer-ui:$versionExoplayer", exoplayerMediaSession: "com.google.android.exoplayer:extension-mediasession:$versionExoplayer", exoplayerCast: "com.google.android.exoplayer:extension-cast:$versionExoplayer", // Material Dialog - https://github.com/afollestad/material-dialogs materialDialog: "com.afollestad.material-dialogs:core:3.3.0", // Glide (image loading) - https://github.com/bumptech/glide glide: "com.github.bumptech.glide:glide:$versionGlide", glideOkHttp: "com.github.bumptech.glide:okhttp3-integration:$versionGlide", glideCompile: "com.github.bumptech.glide:compiler:$versionGlide", coil: "io.coil-kt:coil:2.2.1", coilCompose: "io.coil-kt:coil-compose:2.2.1", // OkHttp (http client) - https://github.com/square/okhttp okHttp: "com.squareup.okhttp3:okhttp:4.9.3", okHttpLogging: "com.squareup.okhttp3:logging-interceptor:4.9.3", // RxJava - https://github.com/ReactiveX/RxAndroid/releases rxAndroid: "io.reactivex.rxjava2:rxandroid:2.1.1", rxJava: "io.reactivex.rxjava2:rxjava:2.2.21", rxRelay: "com.jakewharton.rxrelay2:rxrelay:2.1.1", // RxKotlin rxKoltin: "io.reactivex.rxjava2:rxkotlin:2.4.0", // Hilt hiltAndroid: "com.google.dagger:hilt-android:$versionHilt", hiltDaggerCompiler: "com.google.dagger:hilt-compiler:$versionHilt", hiltCompiler: "androidx.hilt:hilt-compiler:1.0.0", hiltWorkManager: "androidx.hilt:hilt-work:1.0.0", // Lottie lottie: "com.airbnb.android:lottie:5.2.0", // JUnit junit: "junit:junit:4.13.2", // Mockito testMockitoAndroid: "org.mockito:mockito-android:4.6.1", testMokitoKotlin: "org.mockito.kotlin:mockito-kotlin:4.0.0", testMokitoKotlinInline: 'org.mockito:mockito-inline:4.4.0', // MaterialProgressBar materialProgressBar: "me.zhanghai.android.materialprogressbar:library:1.6.1", // JSONassert - https://github.com/skyscreamer/JSONassert jsonAssert: 'org.skyscreamer:jsonassert:1.5.0', mockWebServer: "com.squareup.okhttp3:mockwebserver:4.9.3", barista: "com.adevinta.android:barista:4.2.0", // Accompanist - https://google.github.io/accompanist/ accompanistFlowLayout: "com.google.accompanist:accompanist-flowlayout:0.25.1", // Automattic Tracks automatticTracks: "com.automattic:Automattic-Tracks-Android:$versionTracks", // Sentry sentryBom: 'io.sentry:sentry-bom:6.4.2', sentry: 'io.sentry:sentry-android', sentryFragment: 'io.sentry:sentry-android-fragment', sentryTimber: 'io.sentry:sentry-android-timber', // AboutLibraries - https://github.com/mikepenz/AboutLibraries aboutLibrariesCore: 'com.mikepenz:aboutlibraries-core:10.5.0', aboutLibrariesCompose: 'com.mikepenz:aboutlibraries-compose:10.5.0' ] }