Project reorganization (#5096)

* Rename AndroidConfig to Config

* Move base AndroidManifest.xml

* Make fallback icons into an Android module

* Add example of how to only load a single extension in Gradle project
This commit is contained in:
arkon 2020-12-11 09:41:48 -05:00 committed by GitHub
parent 0c39ab336b
commit d84a4c90b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 49 additions and 21 deletions

View File

@ -1,4 +1,4 @@
object AndroidConfig {
object Config {
const val compileSdk = 29
const val minSdk = 16
const val targetSdk = 29

View File

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

View File

@ -0,0 +1 @@
<manifest package="eu.kanade.tachiyomi.extension.defaultres" />

View File

@ -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
}
}
}

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

View File

@ -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)
}
}

View File

@ -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)
}
}

View File

@ -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) }
}