mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-09 23:50:22 +00:00
8378873: jpackage: remove macOS-specific code from jdk.jpackage.internal.ModuleInfo
Reviewed-by: almatvee
This commit is contained in:
parent
c13fdc044d
commit
a6db3f8702
@ -49,6 +49,7 @@ import java.nio.file.Path;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiFunction;
|
||||
@ -149,6 +150,13 @@ final class FromOptions {
|
||||
ApplicationLayout appLayout, RuntimeLayout runtimeLayout,
|
||||
Optional<RuntimeLayout> predefinedRuntimeLayout) {
|
||||
|
||||
Objects.requireNonNull(options);
|
||||
Objects.requireNonNull(launcherCtor);
|
||||
Objects.requireNonNull(launcherOverrideCtor);
|
||||
Objects.requireNonNull(appLayout);
|
||||
Objects.requireNonNull(runtimeLayout);
|
||||
Objects.requireNonNull(predefinedRuntimeLayout);
|
||||
|
||||
final var appBuilder = new ApplicationBuilder();
|
||||
|
||||
final var isRuntimeInstaller = isRuntimeInstaller(options);
|
||||
@ -185,7 +193,15 @@ final class FromOptions {
|
||||
} else {
|
||||
appBuilder.appImageLayout(appLayout);
|
||||
|
||||
final var launchers = createLaunchers(options, launcherCtor);
|
||||
// Adjust the value of the PREDEFINED_RUNTIME_IMAGE option to make it reference
|
||||
// a directory with the standard Java runtime structure.
|
||||
final var launcherOptions = predefinedRuntimeDirectory.filter(v -> {
|
||||
return !predefinedRuntimeImage.get().equals(v);
|
||||
}).map(v -> {
|
||||
return Options.of(Map.of(PREDEFINED_RUNTIME_IMAGE, v)).copyWithParent(options);
|
||||
}).orElse(options);
|
||||
|
||||
final var launchers = createLaunchers(launcherOptions, launcherCtor);
|
||||
|
||||
if (PREDEFINED_APP_IMAGE.containsIn(options)) {
|
||||
appBuilder.launchers(launchers);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -35,7 +35,6 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Properties;
|
||||
import jdk.internal.util.OperatingSystem;
|
||||
|
||||
record ModuleInfo(String name, Optional<String> version, Optional<String> mainClass, Optional<URI> location) {
|
||||
|
||||
@ -61,17 +60,7 @@ record ModuleInfo(String name, Optional<String> version, Optional<String> mainCl
|
||||
// is linked in the runtime by simply analysing the data
|
||||
// of `release` file.
|
||||
|
||||
final Path releaseFile;
|
||||
if (!OperatingSystem.isMacOS()) {
|
||||
releaseFile = cookedRuntime.resolve("release");
|
||||
} else {
|
||||
// On Mac `cookedRuntime` can be runtime root or runtime home.
|
||||
Path runtimeHome = cookedRuntime.resolve("Contents/Home");
|
||||
if (!Files.isDirectory(runtimeHome)) {
|
||||
runtimeHome = cookedRuntime;
|
||||
}
|
||||
releaseFile = runtimeHome.resolve("release");
|
||||
}
|
||||
final Path releaseFile = cookedRuntime.resolve("release");
|
||||
|
||||
try (Reader reader = Files.newBufferedReader(releaseFile)) {
|
||||
Properties props = new Properties();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user