Skip to content

Commit a1064ae

Browse files
committed
ksp milestone 2
1 parent 68d4d38 commit a1064ae

File tree

31 files changed

+289
-232
lines changed

31 files changed

+289
-232
lines changed

application/feature/characters/favorite/impl/build.gradle.kts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ impl(
1111
androidx.paging,
1212
google.material,
1313
google.dagger,
14-
jakewharton.timber,
1514
kotlinx.coroutines_core,
1615
viewbinding.viewpropertydelegate
17-
) + deps(libs.bundles.room) + deps(
16+
) + deps(
17+
libs.jakewharton.timber,
18+
libs.bundles.room
19+
) + deps(
1820
target(":feature:characters:core:api"),
1921
target(":feature:characters:favorite:api"),
2022
target(":feature:characters:favorite:viewbinding"),
Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
impl(
22
packageName = "com.stepango.blockme.feature.characters.list.impl",
3-
dependencies = deps(
4-
androidx.core_ktx,
5-
androidx.appcompat,
6-
androidx.constraintlayout,
7-
androidx.navigation,
8-
androidx.viewmodel,
9-
androidx.recyclerview,
10-
androidx.swiperefreshlayout,
11-
androidx.paging,
12-
google.material,
13-
google.dagger,
14-
jakewharton.timber,
15-
kotlinx.coroutines_core,
16-
viewbinding.viewpropertydelegate,
17-
) + deps(
18-
target(":feature:characters:core:api"),
19-
target(":feature:characters:list:api"),
20-
target(":feature:characters:list:viewbinding"),
21-
22-
target(":core:di:library"),
23-
target(":core:theme:android-util"),
24-
target(":core:mvvm:library"),
25-
target(":core:network:library"),
26-
target(":core:navigation:library"),
27-
28-
target(":common:util"),
29-
target(":common:extensions:android-util"),
30-
target(":common:recyclerview:widget")
31-
)
32-
)
3+
dependencies =
4+
deps(
5+
androidx.core_ktx,
6+
androidx.appcompat,
7+
androidx.constraintlayout,
8+
androidx.navigation,
9+
androidx.viewmodel,
10+
androidx.recyclerview,
11+
androidx.swiperefreshlayout,
12+
androidx.paging,
13+
google.material,
14+
google.dagger,
15+
kotlinx.coroutines_core,
16+
viewbinding.viewpropertydelegate,
17+
) +
18+
deps(libs.jakewharton.timber) +
19+
deps(
20+
target(":feature:characters:core:api"),
21+
target(":feature:characters:list:api"),
22+
target(":feature:characters:list:viewbinding"),
23+
target(":core:di:library"),
24+
target(":core:theme:android-util"),
25+
target(":core:mvvm:library"),
26+
target(":core:network:library"),
27+
target(":core:navigation:library"),
28+
target(":common:util"),
29+
target(":common:extensions:android-util"),
30+
target(":common:recyclerview:widget")
31+
)
32+
)
Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
impl(
22
packageName = "com.stepango.blockme.feature.home.impl",
3-
dependencies = deps(
4-
androidx.core_ktx,
5-
androidx.appcompat,
6-
androidx.constraintlayout,
7-
androidx.navigation,
8-
google.material,
9-
google.dagger,
10-
jakewharton.timber,
11-
viewbinding.viewpropertydelegate
12-
) + deps(
13-
target(":toggle-widget"),
14-
15-
target(":feature:home:api"),
16-
target(":feature:home:viewbinding"),
17-
18-
target(":core:di:library"),
19-
target(":core:theme:android-util"),
20-
target(":core:mvvm:library"),
21-
target(":core:navigation:library"),
22-
23-
target(":common:extensions:android-util"),
24-
)
25-
)
3+
dependencies =
4+
deps(
5+
androidx.core_ktx,
6+
androidx.appcompat,
7+
androidx.constraintlayout,
8+
androidx.navigation,
9+
google.material,
10+
google.dagger,
11+
viewbinding.viewpropertydelegate
12+
) +
13+
deps(libs.jakewharton.timber) +
14+
deps(
15+
target(":toggle-widget"),
16+
target(":feature:home:api"),
17+
target(":feature:home:viewbinding"),
18+
target(":core:di:library"),
19+
target(":core:theme:android-util"),
20+
target(":core:mvvm:library"),
21+
target(":core:navigation:library"),
22+
target(":common:extensions:android-util"),
23+
)
24+
)
Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,31 @@
1-
/**
2-
* This project meant to be self containing root library
3-
*/
1+
/** This project meant to be self containing root library */
42
androidApp(
53
packageName = "com.stepango.blockme.root.library",
64
owner = Teams.core,
7-
dependencies = deps(
8-
androidx.core_ktx,
9-
androidx.appcompat,
10-
androidx.navigation,
11-
androidx.vectordrawable,
12-
google.material,
13-
// Kapt enabled based on provided dep
14-
google.dagger,
15-
google.play,
16-
jakewharton.timber
17-
18-
) + deps(
19-
target(":root-res"),
20-
21-
target(":feature:characters:core:api"),
22-
target(":feature:characters:core:impl"),
23-
target(":feature:characters:favorite:api"),
24-
target(":feature:characters:favorite:impl"),
25-
26-
target(":core:di:library"),
27-
target(":core:navigation:library"),
28-
target(":core:theme:android-util"),
29-
target(":core:network:library"),
30-
target(":common:util")
31-
),
32-
testDependencies = deps(
33-
test.unit
34-
),
35-
androidTestDependencies = deps(
36-
test.ui
37-
)
5+
dependencies =
6+
deps(
7+
androidx.core_ktx,
8+
androidx.appcompat,
9+
androidx.navigation,
10+
androidx.vectordrawable,
11+
google.material,
12+
// Kapt enabled based on provided dep
13+
google.dagger,
14+
google.play,
15+
) +
16+
deps(libs.jakewharton.timber) +
17+
deps(
18+
target(":root-res"),
19+
target(":feature:characters:core:api"),
20+
target(":feature:characters:core:impl"),
21+
target(":feature:characters:favorite:api"),
22+
target(":feature:characters:favorite:impl"),
23+
target(":core:di:library"),
24+
target(":core:navigation:library"),
25+
target(":core:theme:android-util"),
26+
target(":core:network:library"),
27+
target(":common:util")
28+
),
29+
testDependencies = deps(test.unit),
30+
androidTestDependencies = deps(test.ui)
3831
)

application/settings.gradle.kts

Lines changed: 46 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
import org.gradle.api.internal.artifacts.dependencies.DefaultDependencyConstraint.strictly
2+
13
pluginManagement {
2-
apply(from = "../build-settings/conventions/src/main/kotlin/convention-plugins.settings.gradle.kts")
4+
apply(
5+
from =
6+
"../build-settings/conventions/src/main/kotlin/convention-plugins.settings.gradle.kts"
7+
)
38
includeBuild("../build-settings")
49
includeBuild("../plugins")
510
includeBuild("../includer")
@@ -16,7 +21,19 @@ plugins {
1621

1722
rootProject.name = "application"
1823

19-
val filteredTokens = listOf("com", "io", "net", "org", "gradle")
24+
val filteredTokens =
25+
listOf(
26+
"com",
27+
"io",
28+
"net",
29+
"org",
30+
"gradle",
31+
"android",
32+
"androidx",
33+
"kotlin",
34+
"kotlinx",
35+
"google"
36+
)
2037
val coilVersion = "2.1.0"
2138
val sqliteVersion = "2.2.0"
2239
val roomVersion = "2.5.1"
@@ -25,7 +42,11 @@ dependencyResolutionManagement {
2542
versionCatalogs {
2643
create("libs") {
2744
addLibrary("com.jakewharton.timber:timber:4.7.1")
28-
addBundle(name = "coil", "io.coil-kt:coil:$coilVersion", "io.coil-kt:coil-base:$coilVersion")
45+
addBundle(
46+
name = "coil",
47+
"io.coil-kt:coil:$coilVersion",
48+
"io.coil-kt:coil-base:$coilVersion"
49+
)
2950
addBundle(
3051
name = "room",
3152
"androidx.sqlite:sqlite:$sqliteVersion",
@@ -34,21 +55,27 @@ dependencyResolutionManagement {
3455
"androidx.room:room-ktx:$roomVersion",
3556
"androidx.room:room-common:$roomVersion",
3657
)
37-
addPlugin("tools.forma.demo:dependencies:0.0.1")
38-
addPlugin("com.google.devtools.ksp:symbol-processing-gradle-plugin:1.8.10-1.0.9", "androidx.room:room-compiler:$roomVersion")
58+
addPlugin("tools.forma.demo:dependencies", "0.0.1")
59+
addPlugin(
60+
"com.google.devtools.ksp",
61+
"1.8.10-1.0.9",
62+
"androidx.room:room-compiler:$roomVersion"
63+
)
3964
}
4065
}
4166
}
4267

4368
fun VersionCatalogBuilder.addPlugin(
44-
groupArtifactVersion: String,
69+
notation: String,
70+
version: String,
4571
vararg dependencies: String,
46-
nameGenerator: (String) -> String = ::defaultNameGenerator
72+
nameGenerator: (String) -> String = ::pluginNameGenerator
4773
) {
48-
val (group, artifact, version) = groupArtifactVersion.split(":")
49-
plugin(nameGenerator(groupArtifactVersion), "$group:$artifact").version { strictly(version) }
74+
val name = nameGenerator(notation)
75+
plugin(name, notation).version { strictly(version) }
5076
}
5177

78+
// todo split lib name and version
5279
fun VersionCatalogBuilder.addBundle(
5380
name: String,
5481
vararg groupArtifactVersion: String,
@@ -57,6 +84,7 @@ fun VersionCatalogBuilder.addBundle(
5784
bundle(name, groupArtifactVersion.map { addLibrary(it, nameGenerator) })
5885
}
5986

87+
// todo split lib name and version
6088
fun VersionCatalogBuilder.addLibrary(
6189
groupArtifactVersion: String,
6290
nameGenerator: (String) -> String = ::defaultNameGenerator
@@ -67,6 +95,15 @@ fun VersionCatalogBuilder.addLibrary(
6795
}
6896
}
6997

98+
fun pluginNameGenerator(groupArtifactVersion: String) =
99+
groupArtifactVersion
100+
.split(":")
101+
.fold(emptyList<String>()) { acc, s -> acc + s.split(".", "-") }
102+
.filter { it !in filteredTokens }
103+
.distinct()
104+
.joinToString(".")
105+
.also { println("Generated name $it for $groupArtifactVersion") }
106+
70107
fun defaultNameGenerator(groupArtifactVersion: String) =
71108
groupArtifactVersion
72109
.split(":")

build-dependencies/dependencies/src/main/kotlin/Jakewharton.kt

Lines changed: 0 additions & 3 deletions
This file was deleted.

build-dependencies/dependencies/src/main/kotlin/Tools.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
@file:Suppress("ClassName", "MemberVisibilityCanBePrivate")
22

3-
import tools.forma.config.FormaConfigurationStore
3+
import tools.forma.config.FormaSettingsStore
44

5-
val configuration = FormaConfigurationStore.configuration
5+
val configuration = FormaSettingsStore.settings
66

77
object dataBinding {
88
val viewBinding = transitiveDeps(

build-dependencies/dependencies/src/main/kotlin/Versions.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ object versions {
4848
const val gson = "2.8.6"
4949
}
5050

51-
object jakewharton {
52-
const val timber = "4.7.1"
53-
}
54-
5551
object test {
5652
const val espresso = "3.2.0"
5753
const val junit = "4.12"

plugins/android/src/main/java/androidApp.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fun Project.androidApp(
5252
applyDependencies(
5353
validator = EmptyValidator,
5454
dependencies = dependencies,
55-
repositoriesConfiguration = Forma.configuration.repositories,
55+
repositoriesConfiguration = Forma.settings.repositories,
5656
testDependencies = testDependencies,
5757
androidTestDependencies = androidTestDependencies,
5858
configurationFeatures = kaptConfigurationFeature()

plugins/android/src/main/java/androidBinary.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fun Project.androidBinary(
5858
applyDependencies(
5959
validator = EmptyValidator,
6060
dependencies = dependencies,
61-
repositoriesConfiguration = Forma.configuration.repositories
61+
repositoriesConfiguration = Forma.settings.repositories
6262
)
6363

6464
return TargetBuilder(this)

0 commit comments

Comments
 (0)