Skip to content

Commit

Permalink
dataconnect: demo: make codegen gradle task cacheable (#6571)
Browse files Browse the repository at this point in the history
  • Loading branch information
dconeybe authored Dec 7, 2024
1 parent 11403df commit 4abf678
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions firebase-dataconnect/demo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ spotless {
}
}

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

@get:InputDirectory abstract val inputDirectory: Property<DirectoryTree>
@get:InputDirectory
@get:PathSensitive(PathSensitivity.RELATIVE)
abstract val inputDirectory: Property<DirectoryTree>

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

Expand Down Expand Up @@ -270,22 +272,19 @@ run {

val path = providers.environmentVariable("PATH")
firebaseToolsVersion =
providers.provider {
providers
.exec {
DataConnectGenerateSourcesTask.configureFirebaseCommand(
this,
firebaseCommand = firebaseCommand.get(),
nodeExecutableDirectory = nodeExecutableDirectory.orNull,
path = path.orNull,
)
args("--version")
}
.standardOutput
.asText
.get()
.trim()
}
providers
.exec {
DataConnectGenerateSourcesTask.configureFirebaseCommand(
this,
firebaseCommand = firebaseCommand.get(),
nodeExecutableDirectory = nodeExecutableDirectory.orNull,
path = path.orNull,
)
args("--version")
}
.standardOutput
.asText
.map { it.trim() }

workDirectory = layout.buildDirectory.dir(name)
}
Expand Down

0 comments on commit 4abf678

Please sign in to comment.