-   Notifications  
You must be signed in to change notification settings  - Fork 6.1k
 
8363980: [macos] Add JDK specific keys/values to Info.plist of embedded runtime #28033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
a5f4cba ca63e69 535c442 f3721a3 04c9a0e File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|      |  @@ -360,25 +360,38 @@ private static void writeRuntimeInfoPlist( | |
|   |  ||
| final var app = env.app(); | ||
|   |  ||
| // We should use full runtime info plist for standalone runtime and for | ||
| // embedded runtime if it contains "bin" folder, so embedded runtime | ||
| // can act as standalone runtime. | ||
| final var useRuntimeInfoPlist = | ||
| Files.isDirectory(env.resolvedLayout().runtimeDirectory().resolve("bin")) || | ||
| app.isRuntime(); | ||
|   |  ||
|    Comment on lines  +366  to  +369    There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The  The plist template should be selected at the configuration phase, not the bundling phase. However, this will require knowing/guessing if jlink will create native commands in the "bin" directory from its command line. It is straightforward if it boils down to testing whether it has the "--strip-native-commands" option. This is what we do when we test if jlink options are correct for the Apple App Store, right? Test for "--strip-native-commands" in DeployParams.java I'd suggest adding  Alternatively, you may add the   |  ||
| Map<String, String> data = new HashMap<>(); | ||
| data.put("CF_BUNDLE_IDENTIFIER", app.bundleIdentifier()); | ||
| data.put("CF_BUNDLE_NAME", app.bundleName()); | ||
| data.put("CF_BUNDLE_VERSION", app.version()); | ||
| data.put("CF_BUNDLE_SHORT_VERSION_STRING", app.shortVersion().toString()); | ||
| if (app.isRuntime()) { | ||
| if (useRuntimeInfoPlist) { | ||
| data.put("CF_BUNDLE_VENDOR", app.vendor()); | ||
| } | ||
|   |  ||
| final String template; | ||
| final String publicName; | ||
| final String category; | ||
|   |  ||
| if (app.isRuntime()) { | ||
| if (useRuntimeInfoPlist) { | ||
| template = "Runtime-Info.plist.template"; | ||
| } else { | ||
| template = "ApplicationRuntime-Info.plist.template"; | ||
| } | ||
|   |  ||
| // Public name and category should be based on standalone runtime vs | ||
| // embedded runtime. | ||
| if (app.isRuntime()) { | ||
| publicName = "Info.plist"; | ||
| category = "resource.runtime-info-plist"; | ||
| } else { | ||
| template = "ApplicationRuntime-Info.plist.template"; | ||
| publicName = "Runtime-Info.plist"; | ||
| category = "resource.app-runtime-info-plist"; | ||
| } | ||
|      |  ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
|      |  @@ -289,6 +289,10 @@ public JPackageCommand setInputToEmptyDirectory() { | |
| } | ||
|   |  ||
| public JPackageCommand setFakeRuntime() { | ||
| return setFakeRuntime(false); | ||
| } | ||
|   |  ||
| public JPackageCommand setFakeRuntime(boolean includeBin) { | ||
| verifyMutable(); | ||
|   |  ||
| ThrowingConsumer<Path> createBulkFile = path -> { | ||
|      |  @@ -308,10 +312,11 @@ public JPackageCommand setFakeRuntime() { | |
|   |  ||
| Files.createDirectories(fakeRuntimeDir); | ||
|   |  ||
| if (TKit.isLinux()) { | ||
| if (TKit.isLinux() || includeBin) { | ||
| // Need to make the code in rpm spec happy as it assumes there is | ||
| // always something in application image. | ||
| fakeRuntimeDir.resolve("bin").toFile().mkdir(); | ||
| createBulkFile.accept(fakeRuntimeDir.resolve(Path.of("bin", "bulk"))); | ||
|   There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change makes the above  construction is redundant and can be replaced with: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We still need to add file to "bin" for Linux. I will change it to: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 
 I simplified the body of the  And ran Windows and Linux tests that use it. All passed. WinOSConditionTest: AppAboutUrlTest.testDefaults (DEB): AppAboutUrlTest.testDefaults (RPM): There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The diff:  |  ||
| } | ||
|   |  ||
| if (TKit.isOSX()) { | ||
|      |  @@ -323,7 +328,7 @@ public JPackageCommand setFakeRuntime() { | |
| // Mak sure fake runtime takes some disk space. | ||
| // Package bundles with 0KB size are unexpected and considered | ||
| // an error by PackageTest. | ||
| createBulkFile.accept(fakeRuntimeDir.resolve(Path.of("bin", "bulk"))); | ||
| createBulkFile.accept(fakeRuntimeDir.resolve(Path.of("lib", "bulk"))); | ||
|   |  ||
| cmd.setArgumentValue("--runtime-image", fakeRuntimeDir); | ||
| }); | ||
|      |  ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the comment explains why jpackage should use the same info plist template for a runtime if it has the "bin" subdirectory. But what is the "full" runtime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"full" runtime info plist -> refers to info plist from standalone runtime. I will re-write it to:
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can imply many things. I suggest more specific wording:
If the embedded runtime contains executable(s) in the "bin" subdirectory, we should use the standalone runtime info plist template. Otherwise, the user may be unable to run the "java" or other executables in the "bin" subdirectory of the embedded runtime.