Skip to content

Commit

Permalink
Only create generated dirs when it has specs
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzo committed Jan 3, 2024
1 parent a21a8b9 commit c0a7e62
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Nested
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import java.io.File

@CacheableTask
abstract class BuildConfigTask : DefaultTask() {
Expand All @@ -24,9 +25,9 @@ abstract class BuildConfigTask : DefaultTask() {
abstract val outputDir: DirectoryProperty

@TaskAction
fun generateBuildConfigFile() = outputDir.get().asFile.let { dir ->
fun generateBuildConfigFile() {
val dir = outputDir.get().asFile
dir.deleteRecursively()
dir.mkdirs()

val generator = generator.get()

Expand All @@ -52,7 +53,7 @@ abstract class BuildConfigTask : DefaultTask() {
else -> cmp
}
},
outputDir = dir
outputDir = dir.also(File::mkdirs)
)
)
}
Expand Down

0 comments on commit c0a7e62

Please sign in to comment.