test/jdk/tools/lib/tests/Helper.java
author lancea
Thu, 14 Nov 2019 10:54:32 -0500
changeset 59083 3e4d8b5856f3
parent 51994 7577686cc9bd
permissions -rw-r--r--
8234080: jdk/nio/zipfs/CRCWriteTest.java fails Reviewed-by: clanger, amlu
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     1
/*
51994
7577686cc9bd 8211350: Remove jprt support
mikael
parents: 48223
diff changeset
     2
 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     4
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     8
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    13
 * accompanied this code).
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    14
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    18
 *
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    21
 * questions.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    22
 */
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    23
package tests;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    24
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    25
import java.io.File;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    26
import java.io.IOException;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    27
import java.net.URI;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    28
import java.nio.file.FileSystem;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    29
import java.nio.file.FileSystems;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    30
import java.nio.file.Files;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    31
import java.nio.file.Path;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    32
import java.nio.file.Paths;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    33
import java.util.ArrayList;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    34
import java.util.Arrays;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    35
import java.util.Collections;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    36
import java.util.HashMap;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    37
import java.util.List;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    38
import java.util.Map;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    39
import java.util.stream.Collectors;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    40
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    41
import tests.JImageGenerator.JLinkTask;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    42
import tests.JImageGenerator.JModTask;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    43
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    44
/**
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    45
 * JLink tests helper.
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    46
 */
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    47
public class Helper {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    48
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    49
    private final Path explodedmodssrc;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    50
    private final Path jmodssrc;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    51
    private final Path jarssrc;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    52
    private final Path explodedmodsclasses;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    53
    private final Path jmodsclasses;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    54
    private final Path jarsclasses;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    55
    private final Path jmods;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    56
    private final Path jars;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    57
    private final Path images;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    58
    private final Path explodedmods;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    59
    private final Path stdjmods;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    60
    private final Path extracted;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    61
    private final Path recreated;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    62
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    63
    private final Map<String, List<String>> moduleClassDependencies = new HashMap<>();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    64
    private final Map<String, List<String>> moduleDependencies = new HashMap<>();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    65
    private final List<String> bootClasses;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    66
    private final FileSystem fs;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    67
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    68
    public static Helper newHelper() throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    69
        Path jdkHome = Paths.get(System.getProperty("test.jdk"));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    70
        if (!Files.exists(jdkHome.resolve("jmods"))) {
51994
7577686cc9bd 8211350: Remove jprt support
mikael
parents: 48223
diff changeset
    71
            // Skip test if the jmods directory is missing (e.g. exploded image)
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    72
            System.err.println("Test not run, NO jmods directory");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    73
            return null;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    74
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    75
        return new Helper(jdkHome);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    76
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    77
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    78
    private Helper(Path jdkHome) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    79
        this.stdjmods = jdkHome.resolve("jmods").normalize();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    80
        if (!Files.exists(stdjmods)) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    81
            throw new IOException("Standard jMods do not exist.");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    82
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    83
        this.fs = FileSystems.getFileSystem(URI.create("jrt:/"));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    84
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    85
        Path javabase = fs.getPath("/modules/java.base");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    86
        this.bootClasses = Files.find(javabase, Integer.MAX_VALUE,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    87
                (file, attrs) -> file.toString().endsWith(".class"))
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    88
                .map(Object::toString)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    89
                .map(s -> s.substring("/modules".length()))
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    90
                .collect(Collectors.toList());
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    91
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    92
        if (bootClasses.isEmpty()) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    93
            throw new AssertionError("No boot class to check against");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    94
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    95
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    96
        this.jmods = Paths.get("jmods").toAbsolutePath();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    97
        Files.createDirectories(jmods);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    98
        this.jars = Paths.get("jars").toAbsolutePath();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    99
        Files.createDirectories(jars);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   100
        this.explodedmods = Paths.get("explodedmods").toAbsolutePath();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   101
        Files.createDirectories(explodedmods);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   102
        this.explodedmodssrc = explodedmods.resolve("src");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   103
        Files.createDirectories(explodedmodssrc);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   104
        this.jarssrc = jars.resolve("src");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   105
        Files.createDirectories(jarssrc);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   106
        this.jmodssrc = jmods.resolve("src");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   107
        Files.createDirectories(jmodssrc);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   108
        this.explodedmodsclasses = explodedmods.resolve("classes");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   109
        Files.createDirectories(explodedmodsclasses);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   110
        this.jmodsclasses = jmods.resolve("classes");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   111
        Files.createDirectories(jmodsclasses);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   112
        this.jarsclasses = jars.resolve("classes");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   113
        Files.createDirectories(jarsclasses);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   114
        this.images = Paths.get("images").toAbsolutePath();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   115
        Files.createDirectories(images);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   116
        this.extracted = Paths.get("extracted").toAbsolutePath();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   117
        Files.createDirectories(extracted);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   118
        this.recreated = Paths.get("recreated").toAbsolutePath();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   119
        Files.createDirectories(recreated);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   120
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   121
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   122
    public void generateDefaultModules() throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   123
        generateDefaultJModule("leaf1");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   124
        generateDefaultJModule("leaf2");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   125
        generateDefaultJModule("leaf3");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   126
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   127
        generateDefaultJarModule("leaf4");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   128
        generateDefaultJarModule("leaf5");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   129
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   130
        generateDefaultExplodedModule("leaf6");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   131
        generateDefaultExplodedModule("leaf7");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   132
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   133
        generateDefaultJarModule("composite1", "leaf1", "leaf2", "leaf4", "leaf6");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   134
        generateDefaultJModule("composite2", "composite1", "leaf3", "leaf5", "leaf7",
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   135
                "java.management");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   136
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   137
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   138
    public String defaultModulePath() {
47464
36de9c637393 8189777: jlink --module-path default value and automatic addition of $JAVA_HOME/jmods if java.base is missing
sundar
parents: 47216
diff changeset
   139
        return defaultModulePath(true);
36de9c637393 8189777: jlink --module-path default value and automatic addition of $JAVA_HOME/jmods if java.base is missing
sundar
parents: 47216
diff changeset
   140
    }
36de9c637393 8189777: jlink --module-path default value and automatic addition of $JAVA_HOME/jmods if java.base is missing
sundar
parents: 47216
diff changeset
   141
36de9c637393 8189777: jlink --module-path default value and automatic addition of $JAVA_HOME/jmods if java.base is missing
sundar
parents: 47216
diff changeset
   142
    public String defaultModulePath(boolean includeStdMods) {
36de9c637393 8189777: jlink --module-path default value and automatic addition of $JAVA_HOME/jmods if java.base is missing
sundar
parents: 47216
diff changeset
   143
        return (includeStdMods? stdjmods.toAbsolutePath().toString() : "") + File.pathSeparator
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   144
                + jmods.toAbsolutePath().toString() + File.pathSeparator
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   145
                + jars.toAbsolutePath().toString() + File.pathSeparator
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   146
                + explodedmodsclasses.toAbsolutePath().toString();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   147
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   148
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   149
    public Path generateModuleCompiledClasses(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   150
            Path src, Path classes, String moduleName, String... dependencies) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   151
        return generateModuleCompiledClasses(src, classes, moduleName, getDefaultClasses(moduleName), dependencies);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   152
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   153
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   154
    public Path generateModuleCompiledClasses(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   155
            Path src, Path classes, String moduleName,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   156
            List<String> classNames, String... dependencies) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   157
        if (classNames == null) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   158
            classNames = getDefaultClasses(moduleName);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   159
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   160
        putAppClasses(moduleName, classNames);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   161
        moduleDependencies.put(moduleName, Arrays.asList(dependencies));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   162
        String modulePath = defaultModulePath();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   163
        JImageGenerator.generateSourcesFromTemplate(src, moduleName, classNames.toArray(new String[classNames.size()]));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   164
        List<String> packages = classNames.stream()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   165
                .map(JImageGenerator::getPackageName)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   166
                .distinct()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   167
                .collect(Collectors.toList());
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   168
        Path srcMod = src.resolve(moduleName);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   169
        JImageGenerator.generateModuleInfo(srcMod, packages, dependencies);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   170
        Path destination = classes.resolve(moduleName);
40261
86a49ba76f52 8136930: Simplify use of module-system options by custom launchers
mchung
parents: 36511
diff changeset
   171
        if (!JImageGenerator.compile(srcMod, destination, "--module-path", modulePath, "-g")) {
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   172
            throw new AssertionError("Compilation failure");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   173
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   174
        return destination;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   175
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   176
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   177
    public Result generateDefaultJModule(String moduleName, String... dependencies) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   178
        return generateDefaultJModule(moduleName, getDefaultClasses(moduleName), dependencies);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   179
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   180
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   181
    public Result generateDefaultJModule(String moduleName, List<String> classNames,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   182
                                             String... dependencies) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   183
        generateModuleCompiledClasses(jmodssrc, jmodsclasses, moduleName, classNames, dependencies);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   184
        generateGarbage(jmodsclasses.resolve(moduleName));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   185
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   186
        Path jmodFile = jmods.resolve(moduleName + ".jmod");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   187
        JModTask task = JImageGenerator.getJModTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   188
                .jmod(jmodFile)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   189
                .addJmods(stdjmods)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   190
                .addJmods(jmods.toAbsolutePath())
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   191
                .addJars(jars.toAbsolutePath())
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   192
                .addClassPath(jmodsclasses.resolve(moduleName));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   193
        if (!classNames.isEmpty()) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   194
            task.mainClass(classNames.get(0));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   195
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   196
        return task.create();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   197
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   198
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   199
    public Result generateDefaultJarModule(String moduleName, String... dependencies) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   200
        return generateDefaultJarModule(moduleName, getDefaultClasses(moduleName), dependencies);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   201
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   202
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   203
    public Result generateDefaultJarModule(String moduleName, List<String> classNames,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   204
                                         String... dependencies) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   205
        generateModuleCompiledClasses(jarssrc, jarsclasses, moduleName, classNames, dependencies);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   206
        generateGarbage(jarsclasses.resolve(moduleName));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   207
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   208
        Path jarFile = jars.resolve(moduleName + ".jar");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   209
        JImageGenerator.createJarFile(jarFile, jarsclasses.resolve(moduleName));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   210
        return new Result(0, "", jarFile);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   211
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   212
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   213
    public Result generateDefaultExplodedModule(String moduleName, String... dependencies) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   214
        return generateDefaultExplodedModule(moduleName, getDefaultClasses(moduleName), dependencies);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   215
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   216
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   217
    public Result generateDefaultExplodedModule(String moduleName, List<String> classNames,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   218
            String... dependencies) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   219
        generateModuleCompiledClasses(explodedmodssrc, explodedmodsclasses,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   220
                moduleName, classNames, dependencies);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   221
48223
962b4324320c 8192986: Inconsistent handling of exploded modules in jlink
sundar
parents: 47464
diff changeset
   222
        Path dir = explodedmods.resolve("classes").resolve(moduleName);
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   223
        return new Result(0, "", dir);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   224
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   225
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   226
    private void generateGarbage(Path compiled) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   227
        Path metaInf = compiled.resolve("META-INF").resolve("services");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   228
        Files.createDirectories(metaInf);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   229
        Path provider = metaInf.resolve("MyProvider");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   230
        Files.createFile(provider);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   231
        Files.createFile(compiled.resolve("toto.jcov"));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   232
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   233
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   234
    public static Path createNewFile(Path root, String pathName, String extension) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   235
        Path out = root.resolve(pathName + extension);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   236
        int i = 1;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   237
        while (Files.exists(out)) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   238
            out = root.resolve(pathName + "-" + (++i) + extension);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   239
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   240
        return out;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   241
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   242
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   243
    public Result generateDefaultImage(String module) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   244
        return generateDefaultImage(new String[0], module);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   245
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   246
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   247
    public Result generateDefaultImage(String[] options, String module) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   248
        Path output = createNewFile(images, module, ".image");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   249
        JLinkTask jLinkTask = JImageGenerator.getJLinkTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   250
                .modulePath(defaultModulePath())
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   251
                .output(output)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   252
                .addMods(module)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   253
                .limitMods(module);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   254
        for (String option : options) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   255
            jLinkTask.option(option);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   256
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   257
        return jLinkTask.call();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   258
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   259
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   260
    public Result postProcessImage(Path root, String[] options) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   261
        JLinkTask jLinkTask = JImageGenerator.getJLinkTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   262
                .existing(root);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   263
        for (String option : options) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   264
            jLinkTask.option(option);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   265
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   266
        return jLinkTask.callPostProcess();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   267
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   268
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   269
    private List<String> getDefaultClasses(String module) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   270
        return Arrays.asList(module + ".Main", module + ".com.foo.bar.X");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   271
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   272
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   273
    private void putAppClasses(String module, List<String> classes) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   274
        List<String> appClasses = toLocation(module, classes).stream().collect(Collectors.toList());
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   275
        appClasses.add(toLocation(module, "module-info"));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   276
        moduleClassDependencies.put(module, appClasses);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   277
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   278
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   279
    private static String toLocation(String module, String className) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   280
        return "/" + module + "/" + className.replaceAll("\\.", "/") + ".class";
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   281
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   282
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   283
    public static List<String> toLocation(String module, List<String> classNames) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   284
        return classNames.stream()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   285
                .map(clazz -> toLocation(module, clazz))
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   286
                .collect(Collectors.toList());
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   287
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   288
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   289
    public void checkImage(Path imageDir, String module, String[] paths, String[] files) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   290
        checkImage(imageDir, module, paths, files, null);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   291
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   292
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   293
    public void checkImage(Path imageDir, String module, String[] paths, String[] files, String[] expectedFiles) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   294
        List<String> unexpectedPaths = new ArrayList<>();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   295
        if (paths != null) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   296
            Collections.addAll(unexpectedPaths, paths);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   297
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   298
        List<String> unexpectedFiles = new ArrayList<>();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   299
        if (files != null) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   300
            Collections.addAll(unexpectedFiles, files);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   301
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   302
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   303
        JImageValidator validator = new JImageValidator(module, gatherExpectedLocations(module),
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   304
                imageDir.toFile(),
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   305
                unexpectedPaths,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   306
                unexpectedFiles,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   307
                expectedFiles);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   308
        System.out.println("*** Validate Image " + module);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   309
        validator.validate();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   310
        long moduleExecutionTime = validator.getModuleLauncherExecutionTime();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   311
        if (moduleExecutionTime != 0) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   312
            System.out.println("Module launcher execution time " + moduleExecutionTime);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   313
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   314
        System.out.println("Java launcher execution time "
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   315
                + validator.getJavaLauncherExecutionTime());
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   316
        System.out.println("***");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   317
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   318
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   319
    private List<String> gatherExpectedLocations(String module) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   320
        List<String> expectedLocations = new ArrayList<>();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   321
        expectedLocations.addAll(bootClasses);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   322
        List<String> modules = moduleDependencies.get(module);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   323
        for (String dep : modules) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   324
            Path path = fs.getPath("/modules/" + dep);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   325
            if (Files.exists(path)) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   326
                List<String> locations = Files.find(path, Integer.MAX_VALUE,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   327
                        (p, attrs) -> Files.isRegularFile(p) && p.toString().endsWith(".class")
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   328
                                && !p.toString().endsWith("module-info.class"))
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   329
                        .map(p -> p.toString().substring("/modules".length()))
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   330
                        .collect(Collectors.toList());
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   331
                expectedLocations.addAll(locations);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   332
            }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   333
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   334
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   335
        List<String> appClasses = moduleClassDependencies.get(module);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   336
        if (appClasses != null) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   337
            expectedLocations.addAll(appClasses);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   338
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   339
        return expectedLocations;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   340
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   341
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   342
    public static String getDebugSymbolsExtension() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   343
        return ".diz";
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   344
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   345
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   346
    public Path createNewImageDir(String moduleName) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   347
        return createNewFile(getImageDir(), moduleName, ".image");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   348
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   349
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   350
    public Path createNewExtractedDir(String name) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   351
        return createNewFile(getExtractedDir(), name, ".extracted");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   352
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   353
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   354
    public Path createNewRecreatedDir(String name) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   355
        return createNewFile(getRecreatedDir(), name, ".jimage");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   356
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   357
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   358
    public Path createNewJmodFile(String moduleName) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   359
        return createNewFile(getJmodDir(), moduleName, ".jmod");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   360
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   361
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   362
    public Path createNewJarFile(String moduleName) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   363
        return createNewFile(getJarDir(), moduleName, ".jar");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   364
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   365
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   366
    public Path getJmodSrcDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   367
        return jmodssrc;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   368
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   369
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   370
    public Path getJarSrcDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   371
        return jarssrc;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   372
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   373
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   374
    public Path getJmodClassesDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   375
        return jmodsclasses;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   376
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   377
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   378
    public Path getJarClassesDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   379
        return jarsclasses;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   380
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   381
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   382
    public Path getJmodDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   383
        return jmods;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   384
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   385
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   386
    public Path getExplodedModsDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   387
        return explodedmods;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   388
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   389
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   390
    public Path getJarDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   391
        return jars;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   392
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   393
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   394
    public Path getImageDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   395
        return images;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   396
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   397
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   398
    public Path getStdJmodsDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   399
        return stdjmods;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   400
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   401
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   402
    public Path getExtractedDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   403
        return extracted;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   404
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   405
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   406
    public Path getRecreatedDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   407
        return recreated;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   408
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   409
}