mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-09 23:50:22 +00:00
8378867: jpackage references non-existing "message.app-image-requires-identifier" l10n key
Reviewed-by: almatvee
This commit is contained in:
parent
0b183bf2d6
commit
297812eec1
@ -32,7 +32,6 @@ import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import jdk.jpackage.internal.util.RootedPath;
|
||||
import java.util.stream.Stream;
|
||||
import jdk.jpackage.internal.model.AppImageLayout;
|
||||
import jdk.jpackage.internal.model.AppImageSigningConfig;
|
||||
@ -40,6 +39,8 @@ import jdk.jpackage.internal.model.Application;
|
||||
import jdk.jpackage.internal.model.Launcher;
|
||||
import jdk.jpackage.internal.model.MacApplication;
|
||||
import jdk.jpackage.internal.model.MacApplicationMixin;
|
||||
import jdk.jpackage.internal.model.JPackageException;
|
||||
import jdk.jpackage.internal.util.RootedPath;
|
||||
|
||||
final class MacApplicationBuilder {
|
||||
|
||||
@ -183,10 +184,8 @@ final class MacApplicationBuilder {
|
||||
} catch (IOException ex) {
|
||||
throw new UncheckedIOException(ex);
|
||||
} catch (Exception ex) {
|
||||
throw I18N.buildConfigException("message.app-image-requires-identifier")
|
||||
.advice("message.app-image-requires-identifier.advice")
|
||||
.cause(ex)
|
||||
.create();
|
||||
throw new JPackageException(
|
||||
I18N.format("error.invalid-app-image-plist-file", externalInfoPlistFile), ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -31,6 +31,8 @@ error.app-image.mac-sign.required=--mac-sign option is required with predefined
|
||||
error.invalid-runtime-image-missing-file=Runtime image "{0}" is missing "{1}" file
|
||||
error.invalid-runtime-image-bin-dir=Runtime image "{0}" should not contain "bin" folder
|
||||
error.invalid-runtime-image-bin-dir.advice=Use --strip-native-commands jlink option when generating runtime image used with {0} option
|
||||
error.invalid-app-image-plist-file=Invalid "{0}" file in the predefined application image
|
||||
|
||||
resource.app-info-plist=Application Info.plist
|
||||
resource.app-runtime-info-plist=Embedded Java Runtime Info.plist
|
||||
resource.runtime-info-plist=Java Runtime Info.plist
|
||||
|
||||
@ -23,6 +23,7 @@ ErrorTest.test(NATIVE; app-desc=Hello; args-add=[--mac-app-store, --runtime-imag
|
||||
ErrorTest.test(NATIVE; app-desc=Hello; args-add=[--runtime-image, @@EMPTY_DIR@@]; errors=[message.error-header+[error.invalid-runtime-image-missing-file, @@EMPTY_DIR@@, lib/**/libjli.dylib]])
|
||||
ErrorTest.test(NATIVE; app-desc=Hello; args-add=[--runtime-image, @@INVALID_MAC_RUNTIME_BUNDLE@@]; errors=[message.error-header+[error.invalid-runtime-image-missing-file, @@INVALID_MAC_RUNTIME_BUNDLE@@, Contents/Home/lib/**/libjli.dylib]])
|
||||
ErrorTest.test(NATIVE; app-desc=Hello; args-add=[--runtime-image, @@INVALID_MAC_RUNTIME_IMAGE@@]; errors=[message.error-header+[error.invalid-runtime-image-missing-file, @@INVALID_MAC_RUNTIME_IMAGE@@, lib/**/libjli.dylib]])
|
||||
ErrorTest.test(NATIVE; args-add=[--app-image, @@MAC_APP_IMAGE_INVALID_INFO_PLIST@@]; errors=[message.error-header+[error.invalid-app-image-plist-file, @@MAC_APP_IMAGE_INVALID_INFO_PLIST@@]])
|
||||
ErrorTest.test(NATIVE; args-add=[--runtime-image, @@EMPTY_DIR@@]; errors=[message.error-header+[error.invalid-runtime-image-missing-file, @@EMPTY_DIR@@, lib/**/libjli.dylib]])
|
||||
ErrorTest.test(NATIVE; args-add=[--runtime-image, @@INVALID_MAC_RUNTIME_BUNDLE@@]; errors=[message.error-header+[error.invalid-runtime-image-missing-file, @@INVALID_MAC_RUNTIME_BUNDLE@@, Contents/Home/lib/**/libjli.dylib]])
|
||||
ErrorTest.test(NATIVE; args-add=[--runtime-image, @@INVALID_MAC_RUNTIME_IMAGE@@]; errors=[message.error-header+[error.invalid-runtime-image-missing-file, @@INVALID_MAC_RUNTIME_IMAGE@@, lib/**/libjli.dylib]])
|
||||
|
||||
@ -26,6 +26,11 @@ import static java.util.stream.Collectors.toMap;
|
||||
import static jdk.internal.util.OperatingSystem.LINUX;
|
||||
import static jdk.internal.util.OperatingSystem.MACOS;
|
||||
import static jdk.internal.util.OperatingSystem.WINDOWS;
|
||||
import static jdk.jpackage.internal.util.PListWriter.writeDict;
|
||||
import static jdk.jpackage.internal.util.PListWriter.writePList;
|
||||
import static jdk.jpackage.internal.util.XmlUtils.createXml;
|
||||
import static jdk.jpackage.internal.util.XmlUtils.toXmlConsumer;
|
||||
import static jdk.jpackage.internal.util.function.ThrowingFunction.toFunction;
|
||||
import static jdk.jpackage.internal.util.function.ThrowingSupplier.toSupplier;
|
||||
import static jdk.jpackage.test.JPackageCommand.makeAdvice;
|
||||
import static jdk.jpackage.test.JPackageCommand.makeError;
|
||||
@ -46,6 +51,7 @@ import java.util.regex.Pattern;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.stream.Stream;
|
||||
import jdk.internal.util.OperatingSystem;
|
||||
import jdk.jpackage.internal.util.MacBundle;
|
||||
import jdk.jpackage.internal.util.TokenReplace;
|
||||
import jdk.jpackage.test.Annotations.Parameter;
|
||||
import jdk.jpackage.test.Annotations.ParameterSupplier;
|
||||
@ -54,6 +60,7 @@ import jdk.jpackage.test.CannedArgument;
|
||||
import jdk.jpackage.test.CannedFormattedString;
|
||||
import jdk.jpackage.test.JPackageCommand;
|
||||
import jdk.jpackage.test.JPackageOutputValidator;
|
||||
import jdk.jpackage.test.JavaTool;
|
||||
import jdk.jpackage.test.MacSign;
|
||||
import jdk.jpackage.test.MacSign.CertificateRequest;
|
||||
import jdk.jpackage.test.MacSign.CertificateType;
|
||||
@ -105,6 +112,11 @@ public final class ErrorTest {
|
||||
final var appImageRoot = TKit.createTempDirectory("appimage");
|
||||
|
||||
final var appImageCmd = JPackageCommand.helloAppImage()
|
||||
// Use the default jpackage tool provider to create an application image.
|
||||
// The ErrorTest is used from the OptionsValidationFailTest unit tests that override
|
||||
// the default jpackage tool provider with the implementation that doesn't do packaging
|
||||
// and can not create a valid application image.
|
||||
.useToolProvider(JavaTool.JPACKAGE.asToolProvider())
|
||||
.setFakeRuntime().setArgumentValue("--dest", appImageRoot);
|
||||
|
||||
appImageCmd.execute();
|
||||
@ -124,6 +136,19 @@ public final class ErrorTest {
|
||||
|
||||
return appImageCmd.outputBundle();
|
||||
}),
|
||||
MAC_APP_IMAGE_INVALID_INFO_PLIST(toFunction(cmd -> {
|
||||
var appImageDir = (Path)APP_IMAGE.expand(cmd).orElseThrow();
|
||||
// Replace the default Info.plist file with an empty one.
|
||||
var plistFile = new MacBundle(appImageDir).infoPlistFile();
|
||||
TKit.trace(String.format("Create invalid plist file in [%s]", plistFile));
|
||||
createXml(plistFile, xml -> {
|
||||
writePList(xml, toXmlConsumer(() -> {
|
||||
writeDict(xml, toXmlConsumer(() -> {
|
||||
}));
|
||||
}));
|
||||
});
|
||||
return appImageDir;
|
||||
})),
|
||||
INVALID_MAC_RUNTIME_BUNDLE(toSupplier(() -> {
|
||||
// Has "Contents/MacOS/libjli.dylib", but missing "Contents/Home/lib/libjli.dylib".
|
||||
final Path root = TKit.createTempDirectory("mac-invalid-runtime-bundle");
|
||||
@ -963,7 +988,11 @@ public final class ErrorTest {
|
||||
testSpec().noAppDesc().nativeType().addArgs("--app-image", Token.EMPTY_DIR.token())
|
||||
.error("error.parameter-not-mac-bundle", JPackageCommand.cannedArgument(cmd -> {
|
||||
return Path.of(cmd.getArgumentValue("--app-image"));
|
||||
}, Token.EMPTY_DIR.token()), "--app-image")
|
||||
}, Token.EMPTY_DIR.token()), "--app-image"),
|
||||
testSpec().nativeType().noAppDesc().addArgs("--app-image", Token.MAC_APP_IMAGE_INVALID_INFO_PLIST.token())
|
||||
.error("error.invalid-app-image-plist-file", JPackageCommand.cannedArgument(cmd -> {
|
||||
return new MacBundle(Path.of(cmd.getArgumentValue("--app-image"))).infoPlistFile();
|
||||
}, Token.MAC_APP_IMAGE_INVALID_INFO_PLIST.token()))
|
||||
).map(TestSpec.Builder::create).toList());
|
||||
|
||||
macInvalidRuntime(testCases::add);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user