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 compileSdk = 29
const val minSdk = 16 const val minSdk = 16
const val targetSdk = 29 const val targetSdk = 29

View File

@ -1,8 +1,8 @@
apply plugin: 'org.jmailen.kotlinter' apply plugin: 'org.jmailen.kotlinter'
android { android {
compileSdkVersion AndroidConfig.compileSdk compileSdkVersion Config.compileSdk
buildToolsVersion AndroidConfig.buildTools buildToolsVersion Config.buildTools
buildTypes { buildTypes {
release { release {
@ -12,27 +12,21 @@ android {
sourceSets { sourceSets {
main { main {
manifest.srcFile "$rootDir/AndroidManifest.xml" manifest.srcFile "$rootDir/src/AndroidManifest.xml"
java.srcDirs = ['src'] java.srcDirs = ['src']
resources.srcDirs = ['src'] res.srcDirs = ['res']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ["$rootDir/res"]
assets.srcDirs = ['assets']
} }
release { release {
res.srcDirs = ['res']
manifest.srcFile "AndroidManifest.xml" manifest.srcFile "AndroidManifest.xml"
} }
debug { debug {
res.srcDirs = ['res']
manifest.srcFile "AndroidManifest.xml" manifest.srcFile "AndroidManifest.xml"
} }
} }
defaultConfig { defaultConfig {
minSdkVersion AndroidConfig.minSdk minSdkVersion Config.minSdk
targetSdkVersion AndroidConfig.targetSdk targetSdkVersion Config.targetSdk
applicationIdSuffix pkgNameSuffix applicationIdSuffix pkgNameSuffix
versionCode extVersionCode versionCode extVersionCode
versionName "$libVersion.$extVersionCode" versionName "$libVersion.$extVersionCode"
@ -64,6 +58,7 @@ repositories {
dependencies { dependencies {
implementation project(":annotations") implementation project(":annotations")
implementation project(":defaultRes")
// Lib 1.2, but using specific commit so we don't need to bump up the version // Lib 1.2, but using specific commit so we don't need to bump up the version
compileOnly "com.github.tachiyomiorg:extensions-lib:a596412" 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 { android {
compileSdkVersion(AndroidConfig.compileSdk) compileSdkVersion(Config.compileSdk)
buildToolsVersion(AndroidConfig.buildTools) buildToolsVersion(Config.buildTools)
defaultConfig { defaultConfig {
minSdkVersion(AndroidConfig.minSdk) minSdkVersion(Config.minSdk)
targetSdkVersion(AndroidConfig.targetSdk) targetSdkVersion(Config.targetSdk)
} }
} }

View File

@ -4,12 +4,12 @@ plugins {
} }
android { android {
compileSdkVersion(AndroidConfig.compileSdk) compileSdkVersion(Config.compileSdk)
buildToolsVersion(AndroidConfig.buildTools) buildToolsVersion(Config.buildTools)
defaultConfig { defaultConfig {
minSdkVersion(AndroidConfig.minSdk) minSdkVersion(Config.minSdk)
targetSdkVersion(AndroidConfig.targetSdk) targetSdkVersion(Config.targetSdk)
} }
} }

View File

@ -1,4 +1,5 @@
include(":annotations") include(":annotations")
include(":defaultRes")
include(":lib-ratelimit") include(":lib-ratelimit")
project(":lib-ratelimit").projectDir = File("lib/ratelimit") project(":lib-ratelimit").projectDir = File("lib/ratelimit")
@ -9,6 +10,7 @@ project(":duktape-stub").projectDir = File("lib/duktape-stub")
include(":lib-dataimage") include(":lib-dataimage")
project(":lib-dataimage").projectDir = File("lib/dataimage") project(":lib-dataimage").projectDir = File("lib/dataimage")
// Loads all extensions
File(rootDir, "src").eachDir { dir -> File(rootDir, "src").eachDir { dir ->
dir.eachDir { subdir -> dir.eachDir { subdir ->
val name = ":${dir.name}-${subdir.name}" 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) { inline fun File.eachDir(block: (File) -> Unit) {
listFiles()?.filter { it.isDirectory }?.forEach { block(it) } listFiles()?.filter { it.isDirectory }?.forEach { block(it) }
} }