diff --git a/buildSrc/src/main/kotlin/AndroidConfig.kt b/buildSrc/src/main/kotlin/Config.kt similarity index 84% rename from buildSrc/src/main/kotlin/AndroidConfig.kt rename to buildSrc/src/main/kotlin/Config.kt index f24c7eb0f..4a296469a 100644 --- a/buildSrc/src/main/kotlin/AndroidConfig.kt +++ b/buildSrc/src/main/kotlin/Config.kt @@ -1,4 +1,4 @@ -object AndroidConfig { +object Config { const val compileSdk = 29 const val minSdk = 16 const val targetSdk = 29 diff --git a/common.gradle b/common.gradle index 9f4dfe25a..dbad91708 100644 --- a/common.gradle +++ b/common.gradle @@ -1,8 +1,8 @@ apply plugin: 'org.jmailen.kotlinter' android { - compileSdkVersion AndroidConfig.compileSdk - buildToolsVersion AndroidConfig.buildTools + compileSdkVersion Config.compileSdk + buildToolsVersion Config.buildTools buildTypes { release { @@ -12,27 +12,21 @@ android { sourceSets { main { - manifest.srcFile "$rootDir/AndroidManifest.xml" + manifest.srcFile "$rootDir/src/AndroidManifest.xml" java.srcDirs = ['src'] - resources.srcDirs = ['src'] - aidl.srcDirs = ['src'] - renderscript.srcDirs = ['src'] - res.srcDirs = ["$rootDir/res"] - assets.srcDirs = ['assets'] + res.srcDirs = ['res'] } release { - res.srcDirs = ['res'] manifest.srcFile "AndroidManifest.xml" } debug { - res.srcDirs = ['res'] manifest.srcFile "AndroidManifest.xml" } } defaultConfig { - minSdkVersion AndroidConfig.minSdk - targetSdkVersion AndroidConfig.targetSdk + minSdkVersion Config.minSdk + targetSdkVersion Config.targetSdk applicationIdSuffix pkgNameSuffix versionCode extVersionCode versionName "$libVersion.$extVersionCode" @@ -64,6 +58,7 @@ repositories { dependencies { implementation project(":annotations") + implementation project(":defaultRes") // Lib 1.2, but using specific commit so we don't need to bump up the version compileOnly "com.github.tachiyomiorg:extensions-lib:a596412" diff --git a/defaultRes/AndroidManifest.xml b/defaultRes/AndroidManifest.xml new file mode 100644 index 000000000..88c2be03f --- /dev/null +++ b/defaultRes/AndroidManifest.xml @@ -0,0 +1 @@ + diff --git a/defaultRes/build.gradle.kts b/defaultRes/build.gradle.kts new file mode 100644 index 000000000..ac4e9ea6b --- /dev/null +++ b/defaultRes/build.gradle.kts @@ -0,0 +1,24 @@ +plugins { + id("com.android.library") +} + +android { + compileSdkVersion(Config.compileSdk) + + defaultConfig { + minSdkVersion(Config.minSdk) + } + + sourceSets { + named("main") { + manifest.srcFile("AndroidManifest.xml") + res.setSrcDirs(listOf("res")) + } + } + + libraryVariants.all { + generateBuildConfigProvider?.configure { + enabled = false + } + } +} diff --git a/res/mipmap-hdpi/ic_launcher.png b/defaultRes/res/mipmap-hdpi/ic_launcher.png similarity index 100% rename from res/mipmap-hdpi/ic_launcher.png rename to defaultRes/res/mipmap-hdpi/ic_launcher.png diff --git a/res/mipmap-mdpi/ic_launcher.png b/defaultRes/res/mipmap-mdpi/ic_launcher.png similarity index 100% rename from res/mipmap-mdpi/ic_launcher.png rename to defaultRes/res/mipmap-mdpi/ic_launcher.png diff --git a/res/mipmap-xhdpi/ic_launcher.png b/defaultRes/res/mipmap-xhdpi/ic_launcher.png similarity index 100% rename from res/mipmap-xhdpi/ic_launcher.png rename to defaultRes/res/mipmap-xhdpi/ic_launcher.png diff --git a/res/mipmap-xxhdpi/ic_launcher.png b/defaultRes/res/mipmap-xxhdpi/ic_launcher.png similarity index 100% rename from res/mipmap-xxhdpi/ic_launcher.png rename to defaultRes/res/mipmap-xxhdpi/ic_launcher.png diff --git a/res/mipmap-xxxhdpi/ic_launcher.png b/defaultRes/res/mipmap-xxxhdpi/ic_launcher.png similarity index 100% rename from res/mipmap-xxxhdpi/ic_launcher.png rename to defaultRes/res/mipmap-xxxhdpi/ic_launcher.png diff --git a/lib/dataimage/build.gradle.kts b/lib/dataimage/build.gradle.kts index daaf6620e..a283c2fa3 100644 --- a/lib/dataimage/build.gradle.kts +++ b/lib/dataimage/build.gradle.kts @@ -4,12 +4,12 @@ plugins { } android { - compileSdkVersion(AndroidConfig.compileSdk) - buildToolsVersion(AndroidConfig.buildTools) + compileSdkVersion(Config.compileSdk) + buildToolsVersion(Config.buildTools) defaultConfig { - minSdkVersion(AndroidConfig.minSdk) - targetSdkVersion(AndroidConfig.targetSdk) + minSdkVersion(Config.minSdk) + targetSdkVersion(Config.targetSdk) } } diff --git a/lib/ratelimit/build.gradle.kts b/lib/ratelimit/build.gradle.kts index 6d467bbd0..5dfcf0f41 100644 --- a/lib/ratelimit/build.gradle.kts +++ b/lib/ratelimit/build.gradle.kts @@ -4,12 +4,12 @@ plugins { } android { - compileSdkVersion(AndroidConfig.compileSdk) - buildToolsVersion(AndroidConfig.buildTools) + compileSdkVersion(Config.compileSdk) + buildToolsVersion(Config.buildTools) defaultConfig { - minSdkVersion(AndroidConfig.minSdk) - targetSdkVersion(AndroidConfig.targetSdk) + minSdkVersion(Config.minSdk) + targetSdkVersion(Config.targetSdk) } } diff --git a/settings.gradle.kts b/settings.gradle.kts index c39aecb94..ac95f724b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,4 +1,5 @@ include(":annotations") +include(":defaultRes") include(":lib-ratelimit") project(":lib-ratelimit").projectDir = File("lib/ratelimit") @@ -9,6 +10,7 @@ project(":duktape-stub").projectDir = File("lib/duktape-stub") include(":lib-dataimage") project(":lib-dataimage").projectDir = File("lib/dataimage") +// Loads all extensions File(rootDir, "src").eachDir { dir -> dir.eachDir { subdir -> val name = ":${dir.name}-${subdir.name}" @@ -17,6 +19,12 @@ File(rootDir, "src").eachDir { dir -> } } +// Use this to load a single extension during development +// val lang = "all" +// val name = "mmrcms" +// include(":${lang}-${name}") +// project(":${lang}-${name}").projectDir = File("src/${lang}/${name}") + inline fun File.eachDir(block: (File) -> Unit) { listFiles()?.filter { it.isDirectory }?.forEach { block(it) } } diff --git a/AndroidManifest.xml b/src/AndroidManifest.xml similarity index 100% rename from AndroidManifest.xml rename to src/AndroidManifest.xml