Skip to content

Commit 4abf678

Browse files
authored
dataconnect: demo: make codegen gradle task cacheable (#6571)
1 parent 11403df commit 4abf678

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

firebase-dataconnect/demo/build.gradle.kts

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,12 @@ spotless {
108108
}
109109
}
110110

111-
@DisableCachingByDefault(because = "Code generation is very fast and not worth caching")
111+
@CacheableTask
112112
abstract class DataConnectGenerateSourcesTask : DefaultTask() {
113113

114-
@get:InputDirectory abstract val inputDirectory: Property<DirectoryTree>
114+
@get:InputDirectory
115+
@get:PathSensitive(PathSensitivity.RELATIVE)
116+
abstract val inputDirectory: Property<DirectoryTree>
115117

116118
@get:Input abstract val firebaseToolsVersion: Property<String>
117119

@@ -270,22 +272,19 @@ run {
270272

271273
val path = providers.environmentVariable("PATH")
272274
firebaseToolsVersion =
273-
providers.provider {
274-
providers
275-
.exec {
276-
DataConnectGenerateSourcesTask.configureFirebaseCommand(
277-
this,
278-
firebaseCommand = firebaseCommand.get(),
279-
nodeExecutableDirectory = nodeExecutableDirectory.orNull,
280-
path = path.orNull,
281-
)
282-
args("--version")
283-
}
284-
.standardOutput
285-
.asText
286-
.get()
287-
.trim()
288-
}
275+
providers
276+
.exec {
277+
DataConnectGenerateSourcesTask.configureFirebaseCommand(
278+
this,
279+
firebaseCommand = firebaseCommand.get(),
280+
nodeExecutableDirectory = nodeExecutableDirectory.orNull,
281+
path = path.orNull,
282+
)
283+
args("--version")
284+
}
285+
.standardOutput
286+
.asText
287+
.map { it.trim() }
289288

290289
workDirectory = layout.buildDirectory.dir(name)
291290
}

0 commit comments

Comments
 (0)