Skip to content
This repository was archived by the owner on Jul 16, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ setupApp(AppModule.App)
dependencies {
implementations(
// projects
project(LibModule.Login.moduleName),
project(LibModule.Main.moduleName),
project(LibModule.Web.moduleName)
project(LibModule.Login),
project(LibModule.Main),
project(LibModule.Web)
)
debugImplementations(Libs.leakCanary)
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Enums.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ enum class LibModule(override val tag: String) : Module {

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")
Test("app", "Test", "io.goooler.demoapp.test")
}

enum class BuildConfigField(val key: String, val value: Any) {
Expand Down
14 changes: 7 additions & 7 deletions buildSrc/src/main/kotlin/Extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fun DependencyHandler.androidTestImplementations(vararg names: Any): Array<Depen
fun DependencyHandler.testImplementations(vararg names: Any): Array<Dependency?> =
config("testImplementation", *names)

inline val Module.moduleName: String get() = ":${tag}"
fun Project.project(module: Module): Project = project(":${module.tag}")

fun PluginAware.applyPlugins(vararg names: String) {
apply {
Expand Down Expand Up @@ -152,7 +152,10 @@ inline fun <reified T : BaseExtension> Project.setupBase(
fun Project.setupLib(
module: LibModule,
block: LibraryExtension.() -> Unit = {}
) = setupCommon(module, block)
) = setupCommon<LibraryExtension>(module) {
dependencies.implementations(project(LibModule.Common))
block()
}

fun Project.setupApp(
module: AppModule,
Expand All @@ -163,7 +166,6 @@ fun Project.setupApp(
targetSdk = 32
versionCode = appVersionCode
versionName = appVersionName
manifestPlaceholders += mapOf("appName" to module.appName)
Copy link
Owner Author

Choose a reason for hiding this comment

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

Remove this, add it back if needed later.

resourceConfigurations += setOf("en", "zh-rCN", "xxhdpi")
}
signingConfigs.create("release") {
Expand Down Expand Up @@ -198,10 +200,11 @@ fun Project.setupApp(
"${module.appName}_${versionName}_${versionCode}_${flavorName}_${buildType.name}.apk"
}
}
dependencies.implementations(project(LibModule.Common))
block()
}

private inline fun <reified T : BaseExtension> Project.setupCommon(
inline fun <reified T : BaseExtension> Project.setupCommon(
module: Module,
crossinline block: T.() -> Unit = {}
) = setupBase<T>(module) {
Expand All @@ -217,9 +220,6 @@ private inline fun <reified T : BaseExtension> Project.setupCommon(
}
}
dependencies {
if (module != LibModule.Common) {
implementations(project(LibModule.Common.moduleName))
}
Comment on lines -220 to -222
Copy link
Owner Author

Choose a reason for hiding this comment

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

Remove check module, impl common module in setupLib & setupApp.

implementations(
Libs.arouter,
*Libs.hilt,
Expand Down
8 changes: 5 additions & 3 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
setupLib(LibModule.Common) {
import com.android.build.gradle.LibraryExtension

setupCommon<LibraryExtension>(LibModule.Common) {
buildFeatures.buildConfig = true
productFlavors.all {
buildConfigField(BuildConfigField.VersionCode)
Expand All @@ -11,8 +13,8 @@ setupLib(LibModule.Common) {
dependencies {
apis(
// project
project(LibModule.Base.moduleName),
project(LibModule.Adapter.moduleName),
project(LibModule.Base),
project(LibModule.Adapter),
// UI
Libs.constraintLayout,
Libs.cardView,
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<!--7.0 以上行为变更,不可直接 Uri.fromFile()-->
<provider
android:name=".provider.CommonProvider"
android:authorities="${applicationId}.common.content.CommonProvider"
android:authorities="${applicationId}.CommonProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
Expand All @@ -32,4 +32,4 @@

</application>

</manifest>
</manifest>