Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/tools/jpackage/share/RuntimeImageTest.java
41149 views
1
/*
2
* Copyright (c) 2018, 2020, 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.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
import java.io.IOException;
25
import java.nio.file.Files;
26
import java.nio.file.Path;
27
import java.util.HashSet;
28
import java.util.Optional;
29
import java.util.Set;
30
import java.util.stream.Collectors;
31
import jdk.jpackage.test.TKit;
32
import jdk.jpackage.test.PackageTest;
33
import jdk.jpackage.test.PackageType;
34
import jdk.jpackage.test.Functional;
35
import jdk.jpackage.test.Annotations.Test;
36
import jdk.jpackage.test.Annotations.Parameter;
37
import jdk.jpackage.test.PackageTest;
38
import jdk.jpackage.test.JPackageCommand;
39
import jdk.jpackage.test.JavaTool;
40
import jdk.jpackage.test.Executor;
41
42
/*
43
* @test
44
* @summary jpackage with --runtime-image
45
* @library ../helpers
46
* @key jpackagePlatformPackage
47
* @build jdk.jpackage.test.*
48
* @modules jdk.incubator.jpackage/jdk.incubator.jpackage.internal
49
* @compile RuntimeImageTest.java
50
* @run main/othervm/timeout=1400 -Xmx512m jdk.jpackage.test.Main
51
* --jpt-run=RuntimeImageTest
52
*/
53
54
public class RuntimeImageTest {
55
56
@Test
57
@Parameter("0")
58
@Parameter("1")
59
@Parameter("2")
60
public static void test(String compression) throws Exception {
61
final Path workDir = TKit.createTempDirectory("runtime").resolve("data");
62
final Path jlinkOutputDir = workDir.resolve("temp.runtime");
63
Files.createDirectories(jlinkOutputDir.getParent());
64
65
new Executor()
66
.setToolProvider(JavaTool.JLINK)
67
.dumpOutput()
68
.addArguments(
69
"--output", jlinkOutputDir.toString(),
70
"--compress=" + compression,
71
"--add-modules", "ALL-MODULE-PATH",
72
"--strip-debug",
73
"--no-header-files",
74
"--no-man-pages",
75
"--strip-native-commands")
76
.execute();
77
78
JPackageCommand cmd = JPackageCommand.helloAppImage()
79
.setArgumentValue("--runtime-image", jlinkOutputDir.toString());
80
81
cmd.executeAndAssertHelloAppImageCreated();
82
}
83
84
}
85
86