-
Notifications
You must be signed in to change notification settings - Fork 11
Optimize kts logic #18
Conversation
@@ -1,6 +1,6 @@ | |||
import com.android.build.gradle.LibraryExtension | |||
|
|||
setupBase<LibraryExtension>() | |||
setupBase<LibraryExtension>(LibModule.Base) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inject module name now in setupBase
.
// TODO: Make Module sealed | ||
interface Module { | ||
val tag: String | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems issues in buildSrc
module make Kotlin lang level is 1.4.
enum class AppModule(override val tag: String, val appName: String, val appId: String) : Module { | ||
App("app", "Demo", "io.goooler.demoapp"), | ||
Test("app", "Test", "io.goooler.test") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate app modules to new enum classes.
enum class BuildConfigField(val key: String, val value: Any) { | ||
VersionCode("VERSION_CODE", appVersionCode), | ||
VersionName("VERSION_NAME", appVersionName), | ||
CdnPrefix("CDN_PREFIX", "https://raw.githubusercontent.com/"), | ||
ApiHost("API_HOST", "https://api.github.com/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bundle keys and values.
fun VariantDimension.putBuildConfigStringField(name: String, value: String?) { | ||
buildConfigField("String", name, "\"$value\"") | ||
} | ||
|
||
fun VariantDimension.putBuildConfigIntField(name: String, value: Int) { | ||
buildConfigField("Integer", name, value.toString()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge two functions to a new one.
project(Module.Base.moduleName), | ||
project(Module.Adapter.moduleName), | ||
|
||
// router | ||
Libs.arouter, | ||
|
||
// UI | ||
Libs.constraintLayout, | ||
Libs.cardView, | ||
Libs.material, | ||
*Libs.smartRefreshLayout, | ||
Libs.photoView, | ||
|
||
// utils | ||
*Libs.hilt, | ||
*Libs.room, | ||
*Libs.rx, | ||
*Libs.moshi, | ||
Libs.collection, | ||
Libs.utils |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move unnecessary deps into common
module.
According to Unresolved reference: isShrinkResources,
isShrinkResources
was re-added fromAGP 7.0 beta 1
.