RFR: 8286850: [macos] Add support for signing user provided app image
Alexey Semenyuk
asemenyuk at openjdk.java.net
Thu Jun 2 18:13:37 UTC 2022
On Thu, 2 Jun 2022 05:17:25 GMT, Alexander Matveev <almatvee at openjdk.org> wrote:
> - Added support for signing predefined application image.
> - Following command can be used to sign predefined application images: jpackage --type app-image --app-image Test.app --mac-sign [additional signing options]
> - Main class and if --mac-app-store was specified will be saved in .jpackage.xml. Both values are required for signing. Main class is to generate default identity and --mac-app-store to do correct signing for App Store.
> - Signing is done exactly same as when generating app bundle. Unsigned, signed or partially signed app images are supported. App image will be completely unsigned before signing.
Changes requested by asemenyuk (Reviewer).
test/jdk/tools/jpackage/helpers/jdk/jpackage/test/JPackageCommand.java line 672:
> 670: return this;
> 671: }
> 672:
I guess the idea of this method is to prevent deletion of "." directory in `execute()` method when `--dest` argument of jpackage command is not set. We don't want "." directory deleted in any case. So instead of adding `noCleanupBeforeExec()` that makes sense only if `--dest` argument of jpackage command is not set, I'd rework the logic of `execute()` method and delete the output directory only when `--dest` argument is set.
test/jdk/tools/jpackage/macosx/SigningAppImageTwoStepsTest.java line 102:
> 100: .removeArgumentWithValue("--name")
> 101: .removeArgumentWithValue("--main-jar")
> 102: .removeArgumentWithValue("--main-class")
There is no point in calling `JPackageCommand.helloAppImage()` if later all arguments added by this call get deleted. Simply call JPackageCommand ctor instead.
test/jdk/tools/jpackage/share/jdk/jpackage/tests/PredefinedAppImageErrorTest.java line 59:
> 57: * --jpt-run=jdk.jpackage.tests.PredefinedAppImageErrorTest
> 58: * --jpt-before-run=jdk.jpackage.test.JPackageCommand.useToolProviderByDefault
> 59: */
There is no need to duplicate the whole jtreg test declaration, it supports multiple @run comments:
/*
* @test
* @summary Test jpackage output for erroneous input with --type "app-image" and --app-image
* @library ../../../../helpers
* @build jdk.jpackage.test.*
* @modules jdk.jpackage/jdk.jpackage.internal
* @compile PredefinedAppImageErrorTest.java
*
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
* --jpt-run=jdk.jpackage.tests.PredefinedAppImageErrorTest
* --jpt-before-run=jdk.jpackage.test.JPackageCommand.useToolProviderByDefault
*
* @run main/othervm/timeout=360 -Xmx512m jdk.jpackage.test.Main
* --jpt-run=jdk.jpackage.tests.PredefinedAppImageErrorTest
* --jpt-before-run=jdk.jpackage.test.JPackageCommand.useExecutableByDefault
*/
test/jdk/tools/jpackage/share/jdk/jpackage/tests/PredefinedAppImageErrorTest.java line 116:
> 114: Path dummyAppFolder
> 115: = TKit.workDir().resolve("DummyAppImage").toAbsolutePath();
> 116: Files.createDirectory(dummyAppFolder);
Please use `TKit.createTempDirectory()` instead of `Files.createDirectory()` for the same reason as in `SigningAppImageTwoStepsTest.test()`
-------------
PR: https://git.openjdk.java.net/jdk/pull/8987
More information about the core-libs-dev
mailing list