|
1 | 1 | import com.sourcegraph.buildlogic.JavacInternals |
| 2 | +import com.sourcegraph.buildlogic.registerGeneratedFile |
2 | 3 | import com.sourcegraph.buildlogic.shadowJarArtifact |
3 | 4 |
|
4 | 5 | plugins { |
@@ -62,32 +63,18 @@ tasks.named<Jar>("jar") { |
62 | 63 | } |
63 | 64 | } |
64 | 65 |
|
65 | | -val generateDistributionVersion = tasks.register("generateDistributionVersion") { |
66 | | - val output = layout.buildDirectory.file("generated/distribution/VERSION") |
67 | | - val version = project.version.toString() |
68 | | - inputs.property("version", version) |
69 | | - outputs.file(output) |
70 | | - doLast { |
71 | | - val file = output.get().asFile |
72 | | - file.parentFile.mkdirs() |
73 | | - file.writeText("version:=$version\n") |
74 | | - } |
75 | | -} |
| 66 | +val generateDistributionVersion = |
| 67 | + registerGeneratedFile("generateDistributionVersion", "distribution/VERSION", "version:=${project.version}") |
76 | 68 |
|
77 | 69 | // Emit the javac --add-exports flags as a ready-to-use, space-separated string |
78 | 70 | // so the Docker wrapper script can read them with a plain `cat`, keeping |
79 | 71 | // gradle/javac-internals.properties the single source of truth. |
80 | | -val generateJavacJvmOptions = tasks.register("generateJavacJvmOptions") { |
81 | | - val output = layout.buildDirectory.file("generated/distribution/javac-jvm-options") |
82 | | - val options = JavacInternals.jvmOptions(rootDir).joinToString(" ") |
83 | | - inputs.property("options", options) |
84 | | - outputs.file(output) |
85 | | - doLast { |
86 | | - val file = output.get().asFile |
87 | | - file.parentFile.mkdirs() |
88 | | - file.writeText("$options\n") |
89 | | - } |
90 | | -} |
| 72 | +val generateJavacJvmOptions = |
| 73 | + registerGeneratedFile( |
| 74 | + "generateJavacJvmOptions", |
| 75 | + "distribution/javac-jvm-options", |
| 76 | + JavacInternals.jvmOptions(rootDir).joinToString(" "), |
| 77 | + ) |
91 | 78 |
|
92 | 79 | distributions { |
93 | 80 | named("main") { |
|
0 commit comments