Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Optimize kts logic #18

Merged
merged 18 commits into from
Jan 30, 2022
Merged

Optimize kts logic #18

merged 18 commits into from
Jan 30, 2022

Conversation

Goooler
Copy link
Owner

@Goooler Goooler commented Jan 30, 2022

According to Unresolved reference: isShrinkResources, isShrinkResources was re-added from AGP 7.0 beta 1.

@@ -1,6 +1,6 @@
import com.android.build.gradle.LibraryExtension

setupBase<LibraryExtension>()
setupBase<LibraryExtension>(LibModule.Base)
Copy link
Owner Author

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.

Comment on lines +3 to +6
// TODO: Make Module sealed
interface Module {
val tag: String
}
Copy link
Owner Author

@Goooler Goooler Jan 30, 2022

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.

Comment on lines +22 to +24
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")
Copy link
Owner Author

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.

Comment on lines +27 to +31
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/")
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bundle keys and values.

Comment on lines -80 to -85
fun VariantDimension.putBuildConfigStringField(name: String, value: String?) {
buildConfigField("String", name, "\"$value\"")
}

fun VariantDimension.putBuildConfigIntField(name: String, value: Int) {
buildConfigField("Integer", name, value.toString())
Copy link
Owner Author

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.

Comment on lines -240 to -259
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
Copy link
Owner Author

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.

@Goooler Goooler added this to the 1.5.0 milestone Jan 30, 2022
@Goooler Goooler added build enhancement New feature or request and removed enhancement New feature or request labels Jan 30, 2022
@Goooler Goooler merged commit 2527830 into kotlin Jan 30, 2022
@Goooler Goooler deleted the kts branch January 30, 2022 16:32
@Goooler Goooler mentioned this pull request Feb 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant