Skip to content

Improve JabRef-post-image.wsf ("post-image" script for jpackage) #13034

@alexeysemenyukoracle

Description

@alexeysemenyukoracle

As a maintainer of the jpackage JDK tool I noticed buildres/windows/JabRef-post-image.wsf has a couple of issues:

  1. A path to the "config" directory is derived from the current process directory. This logic is fragile and redundant. jpackage runs a copy of the "post-image" script from the "config" directory, so the path to the "config" directory is the parent folder of the script:
var installerConfig = fileSystem.GetFile(WScript.ScriptFullName).ParentFolder;
  1. The script relies on the assumption that jpackage will create the "config" directory and the "image" directory within JabRef project directory tree. This is needed to obtain a path to the root directory of the project at JabRef-post-image.wsf:12. To ensure this, '--temp', "$buildDir/installer" is passed as an argument to jpackage in build.gradle:936. This will fall off if Gradle build directory is created outside of the project tree, which is not an uncommon configuration.

Unfortunately, issue n2 doesn't have a trivial solution like issue n1 because jpackage doesn't provide sufficient context to the post-image script. As a workaround, I'd embed a path to JabRef project root in the post-image script source. This will make it agnostic to the location of the project build directory and eliminate the need for '--temp', "$buildDir/installer" in the build.gradle. To embed a path to JabRef project root in the JabRef-post-image.wsf file, I'd add a Gradle task transforming it in the build.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions