-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8356218: [macos] Document --app-content #26848
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?
Conversation
👋 Welcome back almatvee! A progress list of the required criteria for merging this PR into |
@sashamatveev This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 71 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
@sashamatveev The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
if (!CONTENTS_SUB_DIRS.stream() | ||
.anyMatch(subDir -> contentDir.getFileName().toString() | ||
.equalsIgnoreCase(subDir))) { | ||
Log.info(MessageFormat.format(I18N.getString( |
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.
Can be simplified down to:
Log.info(I18N.format("warning.non.standard.contents.sub.dir", contentDir));
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.
Fixed. I copy-paste this code. We have many places with MessageFormat.format(I18N.getString())
. Should I file follow up bug to clean-up it?
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.
Up to you. I think it is sufficient merely not add new MessageFormat.format()
calls and use I18N.format()
instead.
@@ -85,3 +85,4 @@ message.codesign.failed.reason.app.content="codesign" failed and additional appl | |||
message.codesign.failed.reason.xcode.tools=Possible reason for "codesign" failure is missing Xcode with command line developer tools. Install Xcode with command line developer tools to see if it resolves the problem. | |||
warning.unsigned.app.image=Warning: Using unsigned app-image to build signed {0}. | |||
warning.per.user.app.image.signed=Warning: Support for per-user configuration of the installed application will not be supported due to missing "{0}" in predefined signed application image. | |||
warning.non.standard.contents.sub.dir=Warning: --app-content value "{0}" points to the non-standard subdirectory in the "Contents" directory of the application bundle. |
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 warning is not particularly helpful:
- It doesn't provide details;
- It is misleading. The value of the
--app-content
cli option specifies directories and files that will be copied into the application bundle, not those in the bundle.
I'd issue a warning for every unexpected directory/file found in the value of the --app-content
option.
I suggest we have two warning messages:
Warning: The file name of the directory "{0}" specified for the --app-content option is not a standard subdirectory name in the "Contents" directory of the application bundle. The result application bundle may fail notarization.
Warning: The value "{0}" of the --app-content option is not a directory. The result application bundle may fail notarization.
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.
Updated as suggested.
for (var contentDir : app.contentDirs()) { | ||
if (!CONTENTS_SUB_DIRS.stream() | ||
.anyMatch(subDir -> contentDir.getFileName().toString() | ||
.equalsIgnoreCase(subDir))) { |
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.
Why case-insensitive path name comparison on Unix?
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.
By default macOS is case-insensitive. If I rename MacOS
to macos
in application bundle, such bundle will still works. I assumed that Resources
and resources
are same thing. After thinking more about it I think it should be case sensitive comparison. Will change it.
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.
Changed to case sensitive comparison.
@@ -123,6 +125,17 @@ private static void validateAppVersion(Application app) throws ConfigException { | |||
} | |||
} | |||
|
|||
private static void validateAppContentDirs(Application app) { | |||
for (var contentDir : app.contentDirs()) { | |||
if (!CONTENTS_SUB_DIRS.stream() |
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.
You could replace CONTENTS_SUB_DIRS
with a Set<String>
, and the inspection with CONTENTS_SUB_DIRS.contains(contentDir.getFileName().toString())
.
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.
Updated as suggested.
8356218: [macos] Document --app-content [v3]
|
public JPackageCommand setIgnoreExitCode(boolean v) { | ||
ignoreExitCode = v; | ||
return this; | ||
} |
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 is bad. It makes unclear semantics of the JPackageCommand.execute(int expectedExitCode)
function.
I suggest adding JPackageCommand.executeIgnoreExitCode()
function instead in the following way:
public Executor.Result executeIgnoreExitCode() {
return execute(Optional.empty());
}
public Executor.Result execute(int expectedExitCode) {
return execute(Optional.of(expectedExitCode));
}
private Executor.Result execute(Optional expectedExitCode) {
// Here goes the implementation of the current execute(int expectedExitCode) function adjusted accordingly
}
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.
Fixed.
@Test(ifOS = MACOS) | ||
@Parameter({TEST_DIR, "warning.non.standard.contents.sub.dir"}) | ||
@Parameter({TEST_DUKE, "warning.app.content.is.not.dir"}) | ||
public void testWarnings(String... args) throws Exception { |
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.
String... args
-> String testPath, String warningId
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.
Fixed.
8356218: [macos] Document --app-content [v4]
|
--app-content
on macOS to help and man page:The value should be a directory with the "Resources" subdirectory (or any other directory that is valid in the "Contents" directory of the application bundle). Otherwise, jpackage may produce invalid application bundle which may fail code signing and/or notarization.
--app-content
if it points to non-standard subdirectory in "Contents" directory.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26848/head:pull/26848
$ git checkout pull/26848
Update a local copy of the PR:
$ git checkout pull/26848
$ git pull https://git.openjdk.org/jdk.git pull/26848/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 26848
View PR using the GUI difftool:
$ git pr show -t 26848
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26848.diff
Using Webrev
Link to Webrev Comment