-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add ConfUtils.kt - Mod LibsUtils.kt - Mod XXXConfigure.kt files
- Loading branch information
Showing
7 changed files
with
99 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 18 additions & 12 deletions
30
build-logic/convention/src/main/java/com/example/convention/configure/ComposeConfigure.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,33 @@ | ||
package com.example.convention.configure | ||
|
||
import com.example.convention.util.libs | ||
import com.example.convention.util.androidTestImplementation | ||
import com.example.convention.util.bundle | ||
import com.example.convention.util.debugImplementation | ||
import com.example.convention.util.implementation | ||
import com.example.convention.util.library | ||
import com.example.convention.util.testImplementation | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.dependencies | ||
|
||
internal fun Project.composeConfigure() { | ||
dependencies { | ||
// Jetpack Compose | ||
val composeBom = platform(libs.findLibrary("compose-bom").get()) | ||
add("implementation", composeBom) | ||
add("implementation", libs.findBundle("compose").get()) | ||
add("implementation", libs.findBundle("compose-lifecycle").get()) | ||
val composeBom = platform(library("compose-bom")) | ||
|
||
add("androidTestImplementation", composeBom) | ||
add("androidTestImplementation", libs.findLibrary("compose-ui-junit4").get()) | ||
add("debugImplementation", libs.findBundle("compose-debug").get()) | ||
implementation(composeBom) | ||
implementation(bundle("compose")) | ||
implementation(bundle("compose-lifecycle")) | ||
|
||
androidTestImplementation(composeBom) | ||
androidTestImplementation(library("compose-ui-junit4")) | ||
debugImplementation(bundle("compose-debug")) | ||
|
||
// landscapist-glide | ||
add("implementation", libs.findLibrary("landscapist-glide").get()) | ||
implementation(library("landscapist-glide")) | ||
|
||
// Android Test | ||
add("testImplementation", libs.findLibrary("junit").get()) | ||
add("androidTestImplementation", libs.findLibrary("androidx-junit").get()) | ||
add("androidTestImplementation", libs.findLibrary("androidx-test-espresso").get()) | ||
testImplementation(library("junit")) | ||
androidTestImplementation(library("androidx-junit")) | ||
androidTestImplementation(library("androidx-test-espresso")) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
build-logic/convention/src/main/java/com/example/convention/util/ConfUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.example.convention.util | ||
|
||
import org.gradle.api.artifacts.Dependency | ||
import org.gradle.kotlin.dsl.support.delegates.DependencyHandlerDelegate | ||
|
||
internal fun DependencyHandlerDelegate.implementation(library: Any): Dependency? { | ||
return add("implementation", library) | ||
} | ||
|
||
internal fun DependencyHandlerDelegate.debugImplementation(library: Any): Dependency? { | ||
return add("debugImplementation", library) | ||
} | ||
|
||
internal fun DependencyHandlerDelegate.testImplementation(library: Any): Dependency? { | ||
return add("testImplementation", library) | ||
} | ||
|
||
internal fun DependencyHandlerDelegate.androidTestImplementation(library: Any): Dependency? { | ||
return add("androidTestImplementation", library) | ||
} | ||
|
||
internal fun DependencyHandlerDelegate.ksp(library: Any): Dependency? { | ||
return add("ksp", library) | ||
} |
10 changes: 0 additions & 10 deletions
10
build-logic/convention/src/main/java/com/example/convention/util/LibsUtil.kt
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
build-logic/convention/src/main/java/com/example/convention/util/LibsUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.example.convention.util | ||
|
||
import org.gradle.api.Project | ||
import org.gradle.api.artifacts.ExternalModuleDependencyBundle | ||
import org.gradle.api.artifacts.MinimalExternalModuleDependency | ||
import org.gradle.api.artifacts.VersionCatalogsExtension | ||
import org.gradle.api.artifacts.VersionConstraint | ||
import org.gradle.api.provider.Provider | ||
import org.gradle.kotlin.dsl.getByType | ||
import org.gradle.plugin.use.PluginDependency | ||
|
||
internal val Project.libs | ||
get() = extensions.getByType<VersionCatalogsExtension>().named("libs") | ||
|
||
internal fun Project.version(alias: String): VersionConstraint { | ||
return libs.findVersion(alias).get() | ||
} | ||
|
||
internal fun Project.plugin(alias: String): Provider<PluginDependency> { | ||
return libs.findPlugin(alias).get() | ||
} | ||
|
||
internal fun Project.library(alias: String): Provider<MinimalExternalModuleDependency> { | ||
return libs.findLibrary(alias).get() | ||
} | ||
|
||
internal fun Project.bundle(alias: String): Provider<ExternalModuleDependencyBundle> { | ||
return libs.findBundle(alias).get() | ||
} |