jdk/test/tools/lib/tests/Helper.java
author lana
Thu, 28 Apr 2016 08:26:43 -0700
changeset 37731 55198b0e17d5
parent 36511 9d0388c6b336
child 40261 86a49ba76f52
permissions -rw-r--r--
Added tag jdk-9+116 for changeset 973b1c28c6d2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36511
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     1
/*
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
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
        // JPRT not yet ready for jmods
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
    71
        if (!Files.exists(jdkHome.resolve("jmods"))) {
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() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   139
        return stdjmods.toAbsolutePath().toString() + File.pathSeparator
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   140
                + jmods.toAbsolutePath().toString() + File.pathSeparator
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   141
                + jars.toAbsolutePath().toString() + File.pathSeparator
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   142
                + explodedmodsclasses.toAbsolutePath().toString();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   143
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   144
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   145
    public Path generateModuleCompiledClasses(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   146
            Path src, Path classes, String moduleName, String... dependencies) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   147
        return generateModuleCompiledClasses(src, classes, moduleName, getDefaultClasses(moduleName), dependencies);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   148
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   149
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   150
    public Path generateModuleCompiledClasses(
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   151
            Path src, Path classes, String moduleName,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   152
            List<String> classNames, String... dependencies) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   153
        if (classNames == null) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   154
            classNames = getDefaultClasses(moduleName);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   155
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   156
        putAppClasses(moduleName, classNames);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   157
        moduleDependencies.put(moduleName, Arrays.asList(dependencies));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   158
        String modulePath = defaultModulePath();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   159
        JImageGenerator.generateSourcesFromTemplate(src, moduleName, classNames.toArray(new String[classNames.size()]));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   160
        List<String> packages = classNames.stream()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   161
                .map(JImageGenerator::getPackageName)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   162
                .distinct()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   163
                .collect(Collectors.toList());
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   164
        Path srcMod = src.resolve(moduleName);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   165
        JImageGenerator.generateModuleInfo(srcMod, packages, dependencies);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   166
        Path destination = classes.resolve(moduleName);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   167
        if (!JImageGenerator.compile(srcMod, destination, "-modulepath", modulePath, "-g")) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   168
            throw new AssertionError("Compilation failure");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   169
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   170
        return destination;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   171
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   172
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   173
    public Result generateDefaultJModule(String moduleName, String... dependencies) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   174
        return generateDefaultJModule(moduleName, getDefaultClasses(moduleName), dependencies);
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, List<String> classNames,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   178
                                             String... dependencies) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   179
        generateModuleCompiledClasses(jmodssrc, jmodsclasses, moduleName, classNames, dependencies);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   180
        generateGarbage(jmodsclasses.resolve(moduleName));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   181
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   182
        Path jmodFile = jmods.resolve(moduleName + ".jmod");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   183
        JModTask task = JImageGenerator.getJModTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   184
                .jmod(jmodFile)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   185
                .addJmods(stdjmods)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   186
                .addJmods(jmods.toAbsolutePath())
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   187
                .addJars(jars.toAbsolutePath())
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   188
                .addClassPath(jmodsclasses.resolve(moduleName));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   189
        if (!classNames.isEmpty()) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   190
            task.mainClass(classNames.get(0));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   191
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   192
        return task.create();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   193
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   194
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   195
    public Result generateDefaultJarModule(String moduleName, String... dependencies) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   196
        return generateDefaultJarModule(moduleName, getDefaultClasses(moduleName), dependencies);
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, List<String> classNames,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   200
                                         String... dependencies) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   201
        generateModuleCompiledClasses(jarssrc, jarsclasses, moduleName, classNames, dependencies);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   202
        generateGarbage(jarsclasses.resolve(moduleName));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   203
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   204
        Path jarFile = jars.resolve(moduleName + ".jar");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   205
        JImageGenerator.createJarFile(jarFile, jarsclasses.resolve(moduleName));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   206
        return new Result(0, "", jarFile);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   207
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   208
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   209
    public Result generateDefaultExplodedModule(String moduleName, String... dependencies) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   210
        return generateDefaultExplodedModule(moduleName, getDefaultClasses(moduleName), dependencies);
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, List<String> classNames,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   214
            String... dependencies) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   215
        generateModuleCompiledClasses(explodedmodssrc, explodedmodsclasses,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   216
                moduleName, classNames, dependencies);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   217
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   218
        Path dir = explodedmods.resolve(moduleName);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   219
        return new Result(0, "", dir);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   220
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   221
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   222
    private void generateGarbage(Path compiled) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   223
        Path metaInf = compiled.resolve("META-INF").resolve("services");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   224
        Files.createDirectories(metaInf);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   225
        Path provider = metaInf.resolve("MyProvider");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   226
        Files.createFile(provider);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   227
        Files.createFile(compiled.resolve("toto.jcov"));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   228
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   229
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   230
    public static Path createNewFile(Path root, String pathName, String extension) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   231
        Path out = root.resolve(pathName + extension);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   232
        int i = 1;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   233
        while (Files.exists(out)) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   234
            out = root.resolve(pathName + "-" + (++i) + extension);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   235
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   236
        return out;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   237
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   238
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   239
    public Result generateDefaultImage(String module) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   240
        return generateDefaultImage(new String[0], module);
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[] options, String module) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   244
        Path output = createNewFile(images, module, ".image");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   245
        JLinkTask jLinkTask = JImageGenerator.getJLinkTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   246
                .modulePath(defaultModulePath())
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   247
                .output(output)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   248
                .addMods(module)
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   249
                .limitMods(module);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   250
        for (String option : options) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   251
            jLinkTask.option(option);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   252
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   253
        return jLinkTask.call();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   254
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   255
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   256
    public Result postProcessImage(Path root, String[] options) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   257
        JLinkTask jLinkTask = JImageGenerator.getJLinkTask()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   258
                .existing(root);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   259
        for (String option : options) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   260
            jLinkTask.option(option);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   261
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   262
        return jLinkTask.callPostProcess();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   263
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   264
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   265
    private List<String> getDefaultClasses(String module) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   266
        return Arrays.asList(module + ".Main", module + ".com.foo.bar.X");
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 void putAppClasses(String module, List<String> classes) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   270
        List<String> appClasses = toLocation(module, classes).stream().collect(Collectors.toList());
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   271
        appClasses.add(toLocation(module, "module-info"));
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   272
        moduleClassDependencies.put(module, appClasses);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   273
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   274
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   275
    private static String toLocation(String module, String className) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   276
        return "/" + module + "/" + className.replaceAll("\\.", "/") + ".class";
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
    public static List<String> toLocation(String module, List<String> classNames) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   280
        return classNames.stream()
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   281
                .map(clazz -> toLocation(module, clazz))
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   282
                .collect(Collectors.toList());
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   283
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   284
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   285
    public void checkImage(Path imageDir, String module, String[] paths, String[] files) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   286
        checkImage(imageDir, module, paths, files, null);
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, String[] expectedFiles) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   290
        List<String> unexpectedPaths = new ArrayList<>();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   291
        if (paths != null) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   292
            Collections.addAll(unexpectedPaths, paths);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   293
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   294
        List<String> unexpectedFiles = new ArrayList<>();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   295
        if (files != null) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   296
            Collections.addAll(unexpectedFiles, files);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   297
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   298
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   299
        JImageValidator validator = new JImageValidator(module, gatherExpectedLocations(module),
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   300
                imageDir.toFile(),
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   301
                unexpectedPaths,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   302
                unexpectedFiles,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   303
                expectedFiles);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   304
        System.out.println("*** Validate Image " + module);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   305
        validator.validate();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   306
        long moduleExecutionTime = validator.getModuleLauncherExecutionTime();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   307
        if (moduleExecutionTime != 0) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   308
            System.out.println("Module launcher execution time " + moduleExecutionTime);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   309
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   310
        System.out.println("Java launcher execution time "
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   311
                + validator.getJavaLauncherExecutionTime());
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   312
        System.out.println("***");
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   313
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   314
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   315
    private List<String> gatherExpectedLocations(String module) throws IOException {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   316
        List<String> expectedLocations = new ArrayList<>();
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   317
        expectedLocations.addAll(bootClasses);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   318
        List<String> modules = moduleDependencies.get(module);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   319
        for (String dep : modules) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   320
            Path path = fs.getPath("/modules/" + dep);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   321
            if (Files.exists(path)) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   322
                List<String> locations = Files.find(path, Integer.MAX_VALUE,
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   323
                        (p, attrs) -> Files.isRegularFile(p) && p.toString().endsWith(".class")
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   324
                                && !p.toString().endsWith("module-info.class"))
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   325
                        .map(p -> p.toString().substring("/modules".length()))
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   326
                        .collect(Collectors.toList());
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   327
                expectedLocations.addAll(locations);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   328
            }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   329
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   330
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   331
        List<String> appClasses = moduleClassDependencies.get(module);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   332
        if (appClasses != null) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   333
            expectedLocations.addAll(appClasses);
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   334
        }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   335
        return expectedLocations;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   336
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   337
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   338
    public static String getDebugSymbolsExtension() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   339
        return ".diz";
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 Path createNewImageDir(String moduleName) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   343
        return createNewFile(getImageDir(), moduleName, ".image");
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 createNewExtractedDir(String name) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   347
        return createNewFile(getExtractedDir(), name, ".extracted");
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 createNewRecreatedDir(String name) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   351
        return createNewFile(getRecreatedDir(), name, ".jimage");
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 createNewJmodFile(String moduleName) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   355
        return createNewFile(getJmodDir(), moduleName, ".jmod");
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 createNewJarFile(String moduleName) {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   359
        return createNewFile(getJarDir(), moduleName, ".jar");
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 getJmodSrcDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   363
        return jmodssrc;
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 getJarSrcDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   367
        return jarssrc;
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 getJmodClassesDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   371
        return jmodsclasses;
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 getJarClassesDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   375
        return jarsclasses;
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 getJmodDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   379
        return jmods;
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 getExplodedModsDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   383
        return explodedmods;
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 getJarDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   387
        return jars;
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 getImageDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   391
        return images;
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 getStdJmodsDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   395
        return stdjmods;
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 getExtractedDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   399
        return extracted;
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 getRecreatedDir() {
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   403
        return recreated;
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   404
    }
9d0388c6b336 8142968: Module System implementation
alanb
parents:
diff changeset
   405
}