Skip to content

Commit 1fd8040

Browse files
Add MacPackage to the model
1 parent 287c6d8 commit 1fd8040

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacDmgPackageBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import jdk.jpackage.internal.model.MacDmgPackage;
3333
import jdk.jpackage.internal.model.MacApplication;
3434
import jdk.jpackage.internal.model.MacDmgPackageMixin;
35+
import jdk.jpackage.internal.model.MacPackage;
3536

3637
final class MacDmgPackageBuilder {
3738

@@ -54,7 +55,7 @@ List<Path> validatedDmgContent() {
5455
}
5556

5657
MacDmgPackage create() throws ConfigException {
57-
final var pkg = pkgBuilder.create();
58+
final var pkg = MacPackage.create(pkgBuilder.create());
5859

5960
return MacDmgPackage.create(pkg, new MacDmgPackageMixin.Stub(
6061
Optional.ofNullable(icon).or(((MacApplication)pkg.app())::icon),

src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacPkgPackageBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.util.Objects;
2828
import java.util.Optional;
2929
import jdk.jpackage.internal.model.ConfigException;
30+
import jdk.jpackage.internal.model.MacPackage;
3031
import jdk.jpackage.internal.model.MacPkgPackage;
3132
import jdk.jpackage.internal.model.MacPkgPackageMixin;
3233
import jdk.jpackage.internal.model.SigningConfig;
@@ -43,7 +44,7 @@ MacPkgPackageBuilder signingBuilder(SigningConfigBuilder v) {
4344
}
4445

4546
MacPkgPackage create() throws ConfigException {
46-
return MacPkgPackage.create(pkgBuilder.create(),
47+
return MacPkgPackage.create(MacPackage.create(pkgBuilder.create()),
4748
new MacPkgPackageMixin.Stub(createSigningConfig()));
4849
}
4950

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
package jdk.jpackage.internal.model;
26+
27+
import java.nio.file.Path;
28+
import jdk.jpackage.internal.util.CompositeProxy;
29+
30+
public interface MacPackage extends Package {
31+
32+
@Override
33+
default AppImageLayout appImageLayout() {
34+
if (isRuntimeInstaller()) {
35+
return RUNTIME_PACKAGE_LAYOUT;
36+
} else {
37+
return Package.super.appImageLayout();
38+
}
39+
}
40+
41+
public static MacPackage create(Package pkg) {
42+
return CompositeProxy.create(MacPackage.class, pkg);
43+
}
44+
45+
public final static RuntimeLayout RUNTIME_PACKAGE_LAYOUT = RuntimeLayout.create(Path.of("Contents/Home"));
46+
}

0 commit comments

Comments
 (0)