File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,24 @@ tasks.named<JavaExec>("run") {
152152 enableAssertions = true
153153}
154154
155+ // region: Generate JabRef-post-image.wsf based on template
156+ val processedText: Provider <String > =
157+ providers.fileContents(layout.projectDirectory.file(" ${projectDir} /buildres/windows/JabRef-post-image.wsf" ))
158+ .asText
159+ .map { it.replace(" @jabRefRoot@" , " $projectDir " ).replace(' \\ ' , ' /' ) }
160+
161+ abstract class WriteTinyFile : DefaultTask () {
162+ @get:Input abstract val content: Property <String >
163+ @get:OutputFile abstract val outputFile: RegularFileProperty
164+ @TaskAction fun run () = outputFile.get().asFile.writeText(content.get())
165+ }
166+
167+ val genPostImageWsf = tasks.register<WriteTinyFile >(" genPostImageWsf" ) {
168+ content.set(processedText)
169+ outputFile.set(layout.buildDirectory.file(" generated/JabRef-post-image.wsf" ))
170+ }
171+ // endregion
172+
155173// Below should eventually replace the 'jlink {}' and doLast-copy configurations above
156174javaModulePackaging {
157175 applicationName = " JabRef"
@@ -174,6 +192,7 @@ javaModulePackaging {
174192 include(" JabRefHost.bat" )
175193 include(" JabRefHost.ps1" )
176194 })
195+ targetResources.from(genPostImageWsf.flatMap { it.outputFile })
177196 }
178197 targetsWithOs(" linux" ) {
179198 options.addAll(
You can’t perform that action at this time.
0 commit comments