Skip to content

Commit b501e3f

Browse files
ilgonmicdkrasnoff
authored andcommitted
Fix variant-aware configurations for Gradle
1 parent 3b6b687 commit b501e3f

File tree

3 files changed

+33
-13
lines changed

3 files changed

+33
-13
lines changed

build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ val kotlinComposeWasmIcLocalCache: Configuration by configurations.creating {
4444
isCanBeResolved = true
4545
isCanBeConsumed = false
4646
attributes {
47+
attribute(
48+
Category.CATEGORY_ATTRIBUTE,
49+
objects.categoryComposeCache
50+
)
4751
attribute(
4852
CacheAttribute.cacheAttribute,
4953
CacheAttribute.LOCAL
@@ -56,6 +60,10 @@ val kotlinComposeWasmIcLambdaCache: Configuration by configurations.creating {
5660
isCanBeResolved = true
5761
isCanBeConsumed = false
5862
attributes {
63+
attribute(
64+
Category.CATEGORY_ATTRIBUTE,
65+
objects.categoryComposeCache
66+
)
5967
attribute(
6068
CacheAttribute.cacheAttribute,
6169
CacheAttribute.LAMBDA
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import org.gradle.api.attributes.Category
2+
import org.gradle.api.model.ObjectFactory
3+
4+
val ObjectFactory.categoryComposeCache
5+
get() = named(Category::class.java, "compose-cache")

cache-maker/build.gradle.kts

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,35 +50,42 @@ val buildCacheForLambda by tasks.registering(Exec::class) {
5050
}
5151
}
5252

53-
val kotlinComposeWasmIcLocalCache: Configuration by configurations.creating {
53+
val kotlinComposeWasmIc: Configuration by configurations.creating {
5454
isTransitive = false
5555
isCanBeResolved = false
5656
isCanBeConsumed = true
57+
attributes {
58+
attribute(
59+
Category.CATEGORY_ATTRIBUTE,
60+
objects.categoryComposeCache
61+
)
62+
}
63+
}
64+
65+
kotlinComposeWasmIc.outgoing.variants.create("local") {
5766
attributes {
5867
attribute(
5968
CacheAttribute.cacheAttribute,
6069
CacheAttribute.LOCAL
6170
)
6271
}
72+
73+
artifact(cachesComposeWasmFolder) {
74+
type = "directory"
75+
builtBy(runTask)
76+
}
6377
}
6478

65-
val kotlinComposeWasmIcLambdaCache: Configuration by configurations.creating {
66-
isTransitive = false
67-
isCanBeResolved = false
68-
isCanBeConsumed = true
79+
kotlinComposeWasmIc.outgoing.variants.create("lambda") {
6980
attributes {
7081
attribute(
7182
CacheAttribute.cacheAttribute,
7283
CacheAttribute.LAMBDA
7384
)
7485
}
75-
}
7686

77-
artifacts.add(kotlinComposeWasmIcLocalCache.name, cachesComposeWasmFolder) {
78-
builtBy(runTask)
79-
}
80-
81-
artifacts.add(kotlinComposeWasmIcLambdaCache.name, outputLambdaCacheDir) {
82-
builtBy(buildCacheForLambda)
87+
artifact(outputLambdaCacheDir) {
88+
type = "directory"
89+
builtBy(buildCacheForLambda)
90+
}
8391
}
84-

0 commit comments

Comments
 (0)