Skip to content

Commit 21c1282

Browse files
author
Alexey Semenyuk
committed
8333664: Decouple command line parsing and package building in jpackage
Reviewed-by: almatvee
1 parent b63ec0a commit 21c1282

File tree

193 files changed

+18051
-6602
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

193 files changed

+18051
-6602
lines changed

src/jdk.jpackage/linux/classes/jdk/jpackage/internal/DesktopIntegration.java

Lines changed: 138 additions & 208 deletions
Large diffs are not rendered by default.

src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppBundler.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,13 @@
2727

2828
public class LinuxAppBundler extends AppImageBundler {
2929
public LinuxAppBundler() {
30-
setAppImageSupplier(LinuxAppImageBuilder::new);
30+
setAppImageSupplier((params, output) -> {
31+
// Order is important!
32+
var app = LinuxFromParams.APPLICATION.fetchFrom(params);
33+
var env = BuildEnvFromParams.BUILD_ENV.fetchFrom(params);
34+
LinuxPackagingPipeline.build()
35+
.excludeDirFromCopying(output.getParent())
36+
.create().execute(BuildEnv.withAppImageDir(env, output), app);
37+
});
3138
}
3239
}

src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxAppImageBuilder.java

Lines changed: 0 additions & 138 deletions
This file was deleted.
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;
26+
27+
import static jdk.jpackage.internal.util.PathUtils.resolveNullablePath;
28+
29+
import java.nio.file.Path;
30+
import jdk.jpackage.internal.model.ApplicationLayout;
31+
import jdk.jpackage.internal.util.CompositeProxy;
32+
33+
interface LinuxApplicationLayout extends ApplicationLayout, LinuxApplicationLayoutMixin {
34+
35+
static LinuxApplicationLayout create(ApplicationLayout layout, Path libAppLauncher) {
36+
return CompositeProxy.build()
37+
.invokeTunnel(CompositeProxyTunnel.INSTANCE)
38+
.create(LinuxApplicationLayout.class, layout, new LinuxApplicationLayoutMixin.Stub(libAppLauncher));
39+
}
40+
41+
@Override
42+
default LinuxApplicationLayout resolveAt(Path root) {
43+
return create(ApplicationLayout.super.resolveAt(root),
44+
resolveNullablePath(root, libAppLauncher()));
45+
}
46+
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,30 +26,13 @@
2626

2727
import java.nio.file.Path;
2828

29-
/**
30-
*
31-
* Platform package of an application.
32-
*/
33-
interface PlatformPackage {
34-
35-
/**
36-
* Platform-specific package name.
37-
*/
38-
String name();
29+
// Must be publc to allow access from AppImageLayout.toPathGroup()
30+
public interface LinuxApplicationLayoutMixin {
3931

4032
/**
41-
* Root directory where sources for packaging tool should be stored. On Unix
42-
* systems contents of this directory will be installed in "/" directory.
33+
* Path to "libapplauncher.so".
4334
*/
44-
Path sourceRoot();
35+
Path libAppLauncher();
4536

46-
/**
47-
* Source application layout from which to build the package.
48-
*/
49-
ApplicationLayout sourceApplicationLayout();
50-
51-
/**
52-
* Application layout of the installed package.
53-
*/
54-
ApplicationLayout installedApplicationLayout();
37+
record Stub(Path libAppLauncher) implements LinuxApplicationLayoutMixin {}
5538
}

0 commit comments

Comments
 (0)