File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change 1- import org.apache.tools.ant.filters.ReplaceTokens
2-
3-
41plugins {
52 id(" org.jabref.gradle.module" )
63 id(" application" )
@@ -152,6 +149,24 @@ tasks.named<JavaExec>("run") {
152149 enableAssertions = true
153150}
154151
152+ // region: Generate JabRef-post-image.wsf based on template
153+ val processedText: Provider <String > =
154+ providers.fileContents(layout.projectDirectory.file(" ${projectDir} /buildres/windows/JabRef-post-image.wsf" ))
155+ .asText
156+ .map { it.replace(" @jabRefRoot@" , " $projectDir " ).replace(' \\ ' , ' /' ) }
157+
158+ abstract class WriteTinyFile : DefaultTask () {
159+ @get:Input abstract val content: Property <String >
160+ @get:OutputFile abstract val outputFile: RegularFileProperty
161+ @TaskAction fun run () = outputFile.get().asFile.writeText(content.get())
162+ }
163+
164+ val genPostImageWsf = tasks.register<WriteTinyFile >(" genPostImageWsf" ) {
165+ content.set(processedText)
166+ outputFile.set(layout.buildDirectory.file(" generated/JabRef-post-image.wsf" ))
167+ }
168+ // endregion
169+
155170// Below should eventually replace the 'jlink {}' and doLast-copy configurations above
156171javaModulePackaging {
157172 applicationName = " JabRef"
@@ -174,6 +189,7 @@ javaModulePackaging {
174189 include(" JabRefHost.bat" )
175190 include(" JabRefHost.ps1" )
176191 })
192+ targetResources.from(genPostImageWsf.flatMap { it.outputFile })
177193 }
178194 targetsWithOs(" linux" ) {
179195 options.addAll(
You can’t perform that action at this time.
0 commit comments