8160641: PostProcessingPlugin and ExecutableImage should not be part of plugin API
Reviewed-by: jlaskey, mchung
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/Jlink.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/Jlink.java Thu Jun 30 22:24:01 2016 +0530
@@ -32,10 +32,10 @@
import java.util.Map;
import java.util.Objects;
import java.util.Set;
+import jdk.tools.jlink.internal.ExecutableImage;
import jdk.tools.jlink.internal.JlinkTask;
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.ExecutableImage;
import jdk.tools.jlink.builder.ImageBuilder;
import jdk.tools.jlink.internal.PluginRepository;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/DefaultImageBuilder.java Thu Jun 30 22:24:01 2016 +0530
@@ -57,7 +57,7 @@
import jdk.tools.jlink.internal.BasicImageWriter;
import jdk.tools.jlink.internal.plugins.FileCopierPlugin;
import jdk.tools.jlink.internal.plugins.FileCopierPlugin.SymImageFile;
-import jdk.tools.jlink.plugin.ExecutableImage;
+import jdk.tools.jlink.internal.ExecutableImage;
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.PluginException;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/ImageBuilder.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/builder/ImageBuilder.java Thu Jun 30 22:24:01 2016 +0530
@@ -27,7 +27,7 @@
import java.io.DataOutputStream;
import java.util.Properties;
-import jdk.tools.jlink.plugin.ExecutableImage;
+import jdk.tools.jlink.internal.ExecutableImage;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModulePool;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ExecutableImage.java Thu Jun 30 22:24:01 2016 +0530
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.tools.jlink.internal;
+
+import java.nio.file.Path;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * An executable runtime image. Contains the information about the executable
+ * image created.
+ */
+public interface ExecutableImage {
+
+ /**
+ * Image home directory,
+ *
+ * @return The home directory.
+ */
+ public Path getHome();
+
+ /**
+ * The names of the modules located in the image.
+ *
+ * @return The set of modules.
+ */
+ public Set<String> getModules();
+
+ /**
+ * The list of arguments required to execute the image.
+ *
+ * @return The list of arguments.
+ */
+ public List<String> getExecutionArgs();
+
+ /**
+ * Store new arguments required to execute the image.
+ *
+ * @param args Additional arguments
+ */
+ public void storeLaunchArgs(List<String> args);
+}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImageFileCreator.java Thu Jun 30 22:24:01 2016 +0530
@@ -43,7 +43,6 @@
import jdk.tools.jlink.internal.Archive.Entry;
import jdk.tools.jlink.internal.Archive.Entry.EntryType;
import jdk.tools.jlink.internal.ModulePoolImpl.CompressedModuleData;
-import jdk.tools.jlink.plugin.ExecutableImage;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModuleEntry;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginConfiguration.java Thu Jun 30 22:24:01 2016 +0530
@@ -32,15 +32,12 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
-import jdk.tools.jlink.plugin.ExecutableImage;
import jdk.tools.jlink.builder.ImageBuilder;
import jdk.tools.jlink.Jlink;
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.Plugin.Category;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.PostProcessorPlugin;
-import jdk.tools.jlink.plugin.TransformerPlugin;
/**
* Plugins configuration.
@@ -85,7 +82,7 @@
+ " added more than once to stack ");
}
seen.add(plug.getName());
- Category category = Utils.getCategory(plug);
+ Category category = plug.getType();
if (category == null) {
throw new PluginException("Invalid category for "
+ plug.getName());
@@ -94,26 +91,13 @@
lst.add(plug);
}
- List<TransformerPlugin> transformerPlugins = new ArrayList<>();
- List<PostProcessorPlugin> postProcessingPlugins = new ArrayList<>();
+ List<Plugin> orderedPlugins = new ArrayList<>();
plugins.entrySet().stream().forEach((entry) -> {
// Sort according to plugin constraints
- List<Plugin> orderedPlugins = PluginOrderingGraph.sort(entry.getValue());
- Category category = entry.getKey();
- orderedPlugins.stream().forEach((p) -> {
- if (category.isPostProcessor()) {
- @SuppressWarnings("unchecked")
- PostProcessorPlugin pp = (PostProcessorPlugin) p;
- postProcessingPlugins.add(pp);
- } else {
- @SuppressWarnings("unchecked")
- TransformerPlugin trans = (TransformerPlugin) p;
- transformerPlugins.add(trans);
- }
- });
+ orderedPlugins.addAll(PluginOrderingGraph.sort(entry.getValue()));
});
Plugin lastSorter = null;
- for (Plugin plugin : transformerPlugins) {
+ for (Plugin plugin : orderedPlugins) {
if (plugin.getName().equals(pluginsConfiguration.getLastSorterPluginName())) {
lastSorter = plugin;
break;
@@ -145,7 +129,6 @@
};
}
- return new ImagePluginStack(builder, transformerPlugins,
- lastSorter, postProcessingPlugins);
+ return new ImagePluginStack(builder, orderedPlugins, lastSorter);
}
}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/ImagePluginStack.java Thu Jun 30 22:24:01 2016 +0530
@@ -44,14 +44,11 @@
import jdk.internal.jimage.decompressor.Decompressor;
import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.ExecutableImage;
import jdk.tools.jlink.builder.ImageBuilder;
-import jdk.tools.jlink.plugin.TransformerPlugin;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.plugin.LinkModule;
import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.PostProcessorPlugin;
/**
* Plugins Stack. Plugins entry point to apply transformations onto resources
@@ -161,42 +158,34 @@
private final ImageBuilder imageBuilder;
private final Plugin lastSorter;
- private final List<TransformerPlugin> contentPlugins = new ArrayList<>();
- private final List<PostProcessorPlugin> postProcessingPlugins = new ArrayList<>();
+ private final List<Plugin> plugins = new ArrayList<>();
private final List<ResourcePrevisitor> resourcePrevisitors = new ArrayList<>();
public ImagePluginStack() {
- this(null, Collections.emptyList(), null,
- Collections.emptyList());
+ this(null, Collections.emptyList(), null);
}
public ImagePluginStack(ImageBuilder imageBuilder,
- List<TransformerPlugin> contentPlugins,
- Plugin lastSorter,
- List<PostProcessorPlugin> postprocessingPlugins) {
+ List<Plugin> plugins,
+ Plugin lastSorter) {
this.imageBuilder = Objects.requireNonNull(imageBuilder);
this.lastSorter = lastSorter;
- Objects.requireNonNull(contentPlugins);
- Objects.requireNonNull(postprocessingPlugins);
- contentPlugins.stream().forEach((p) -> {
+ this.plugins.addAll(Objects.requireNonNull(plugins));
+ plugins.stream().forEach((p) -> {
Objects.requireNonNull(p);
if (p instanceof ResourcePrevisitor) {
resourcePrevisitors.add((ResourcePrevisitor) p);
}
- this.contentPlugins.add(p);
- });
- postprocessingPlugins.stream().forEach((p) -> {
- Objects.requireNonNull(p);
- this.postProcessingPlugins.add(p);
});
}
public void operate(ImageProvider provider) throws Exception {
ExecutableImage img = provider.retrieve(this);
List<String> arguments = new ArrayList<>();
- postProcessingPlugins.stream()
- .map((plugin) -> plugin.process(img))
+ plugins.stream()
+ .filter(PostProcessor.class::isInstance)
+ .map((plugin) -> ((PostProcessor)plugin).process(img))
.filter((lst) -> (lst != null))
.forEach((lst) -> {
arguments.addAll(lst);
@@ -241,7 +230,7 @@
ModulePoolImpl current = resources;
List<ModuleEntry> frozenOrder = null;
- for (TransformerPlugin p : contentPlugins) {
+ for (Plugin p : plugins) {
current.setReadOnly();
ModulePoolImpl output = null;
if (p == lastSorter) {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java Thu Jun 30 22:24:01 2016 +0530
@@ -49,7 +49,6 @@
import jdk.tools.jlink.internal.TaskHelper.Option;
import jdk.tools.jlink.internal.TaskHelper.OptionsHelper;
import jdk.tools.jlink.internal.ImagePluginStack.ImageProvider;
-import jdk.tools.jlink.plugin.ExecutableImage;
import jdk.tools.jlink.Jlink.JlinkConfiguration;
import jdk.tools.jlink.Jlink.PluginsConfiguration;
import jdk.tools.jlink.plugin.PluginException;
@@ -184,8 +183,8 @@
optionsHelper.showHelp(PROGNAME);
return EXIT_OK;
}
- if (optionsHelper.listPlugins()) {
- optionsHelper.listPlugins(true);
+ if (optionsHelper.shouldListPlugins()) {
+ optionsHelper.listPlugins();
return EXIT_OK;
}
if (options.version || options.fullVersion) {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginRepository.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PluginRepository.java Thu Jun 30 22:24:01 2016 +0530
@@ -34,8 +34,6 @@
import java.util.ServiceLoader;
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.PluginException;
-import jdk.tools.jlink.plugin.PostProcessorPlugin;
-import jdk.tools.jlink.plugin.TransformerPlugin;
/**
*
@@ -59,17 +57,7 @@
*/
public static Plugin getPlugin(String name,
Layer pluginsLayer) {
- Plugin tp = getPlugin(TransformerPlugin.class, name, pluginsLayer);
- Plugin ppp = getPlugin(PostProcessorPlugin.class, name, pluginsLayer);
-
- // We should not have a transformer plugin and a post processor plugin
- // of the same name. That kind of duplicate is detected here.
- if (tp != null && ppp != null) {
- throw new PluginException("Multiple plugin "
- + "for the name " + name);
- }
-
- return tp != null? tp : ppp;
+ return getPlugin(Plugin.class, name, pluginsLayer);
}
/**
@@ -112,10 +100,7 @@
}
public static List<Plugin> getPlugins(Layer pluginsLayer) {
- List<Plugin> plugins = new ArrayList<>();
- plugins.addAll(getPlugins(TransformerPlugin.class, pluginsLayer));
- plugins.addAll(getPlugins(PostProcessorPlugin.class, pluginsLayer));
- return plugins;
+ return getPlugins(Plugin.class, pluginsLayer);
}
private static <T extends Plugin> T getPlugin(Class<T> clazz, String name,
@@ -138,10 +123,10 @@
}
/**
- * The post processors accessible in the current context.
+ * The plugins accessible in the current context.
*
* @param pluginsLayer
- * @return The list of post processors.
+ * @return The list of plugins.
*/
private static <T extends Plugin> List<T> getPlugins(Class<T> clazz, Layer pluginsLayer) {
Objects.requireNonNull(pluginsLayer);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/PostProcessor.java Thu Jun 30 22:24:01 2016 +0530
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.tools.jlink.internal;
+
+import java.util.List;
+
+/**
+ * Plugin wishing to post-proces must implement this interface. PostProcessors
+ * are called once the image has been generated and is executable.
+ **/
+public interface PostProcessor {
+
+ /**
+ * Post process an image.
+ *
+ * @param image The executable image.
+ * @return The list of arguments to add to launchers (if any).
+ */
+ public List<String> process(ExecutableImage image);
+}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java Thu Jun 30 22:24:01 2016 +0530
@@ -428,7 +428,7 @@
return opt.hasArg;
}
- public boolean listPlugins() {
+ public boolean shouldListPlugins() {
return pluginOptions.listPlugins;
}
@@ -570,26 +570,19 @@
log.println(bundleHelper.getMessage("main.command.files"));
}
- public void listPlugins(boolean showsImageBuilder) {
+ public void listPlugins() {
log.println("\n" + bundleHelper.getMessage("main.extended.help"));
List<Plugin> pluginList = PluginRepository.
getPlugins(pluginOptions.pluginsLayer);
- for (Plugin plugin : Utils.
- getSortedPreProcessors(pluginList)) {
- showPlugin(plugin, log, showsImageBuilder);
- }
-
- if (showsImageBuilder) {
- for (Plugin plugin : Utils.getSortedPostProcessors(pluginList)) {
- showPlugin(plugin, log, showsImageBuilder);
- }
+ for (Plugin plugin : Utils.getSortedPlugins(pluginList)) {
+ showPlugin(plugin, log);
}
log.println("\n" + bundleHelper.getMessage("main.extended.help.footer"));
}
- private void showPlugin(Plugin plugin, PrintWriter log, boolean showsImageBuilder) {
- if (showsPlugin(plugin, showsImageBuilder)) {
+ private void showPlugin(Plugin plugin, PrintWriter log) {
+ if (showsPlugin(plugin)) {
log.println("\n" + bundleHelper.getMessage("main.plugin.name")
+ ": " + plugin.getName());
@@ -599,7 +592,7 @@
+ ": " + plugin.getClass().getName());
log.println(bundleHelper.getMessage("main.plugin.module")
+ ": " + plugin.getClass().getModule().getName());
- Category category = Utils.getCategory(plugin);
+ Category category = plugin.getType();
log.println(bundleHelper.getMessage("main.plugin.category")
+ ": " + category.getName());
log.println(bundleHelper.getMessage("main.plugin.state")
@@ -722,14 +715,8 @@
}
}
- // Display all plugins or pre processors only.
- private static boolean showsPlugin(Plugin plugin, boolean showsImageBuilder) {
- if (!Utils.isDisabled(plugin) && plugin.getOption() != null) {
- if (Utils.isPostProcessor(plugin) && !showsImageBuilder) {
- return false;
- }
- return true;
- }
- return false;
+ // Display all plugins
+ private static boolean showsPlugin(Plugin plugin) {
+ return (!Utils.isDisabled(plugin) && plugin.getOption() != null);
}
}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/Utils.java Thu Jun 30 22:24:01 2016 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -55,51 +55,10 @@
.collect(Collectors.toList());
}
- public static boolean isPostProcessor(Plugin provider) {
- return provider.getType().isPostProcessor();
- }
- public static boolean isPreProcessor(Plugin provider) {
- return !isPostProcessor(provider);
- }
-
- public static Category getCategory(Plugin provider) {
- return provider.getType();
- }
-
- public static List<Plugin> getPreProcessors(List<Plugin> plugins) {
+ public static List<Plugin> getSortedPlugins(List<Plugin> plugins) {
List<Plugin> res = new ArrayList<>();
- for (Plugin p : plugins) {
- if (isPreProcessor(p)) {
- res.add(p);
- }
- }
- return res;
- }
-
- public static List<Plugin> getPostProcessors(List<Plugin> plugins) {
- List<Plugin> res = new ArrayList<>();
- for (Plugin p : plugins) {
- if (isPostProcessor(p)) {
- res.add(p);
- }
- }
- return res;
- }
-
- public static List<Plugin> getSortedPostProcessors(List<Plugin> plugins) {
- List<Plugin> res = getPostProcessors(plugins);
- res.sort(new Comparator<Plugin>() {
- @Override
- public int compare(Plugin o1, Plugin o2) {
- return o1.getName().compareTo(o2.getName());
- }
- });
- return res;
- }
-
- public static List<Plugin> getSortedPreProcessors(List<Plugin> plugins) {
- List<Plugin> res = getPreProcessors(plugins);
+ res.addAll(plugins);
res.sort(new Comparator<Plugin>() {
@Override
public int compare(Plugin o1, Plugin o2) {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultCompressPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultCompressPlugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -28,7 +28,7 @@
import jdk.tools.jlink.internal.ModulePoolImpl;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.internal.ImagePluginStack;
import jdk.tools.jlink.internal.ResourcePrevisitor;
import jdk.tools.jlink.internal.StringTable;
@@ -37,7 +37,7 @@
*
* ZIP and String Sharing compression plugin
*/
-public final class DefaultCompressPlugin implements TransformerPlugin, ResourcePrevisitor {
+public final class DefaultCompressPlugin implements Plugin, ResourcePrevisitor {
public static final String NAME = "compress";
public static final String FILTER = "filter";
public static final String LEVEL_0 = "0";
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeFilesPlugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -26,7 +26,7 @@
import java.util.Map;
import java.util.function.Predicate;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.plugin.ModuleEntry;
@@ -34,7 +34,7 @@
*
* Exclude files plugin
*/
-public final class ExcludeFilesPlugin implements TransformerPlugin {
+public final class ExcludeFilesPlugin implements Plugin {
public static final String NAME = "exclude-files";
private Predicate<String> predicate;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludePlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludePlugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -26,7 +26,7 @@
import java.util.Map;
import java.util.function.Predicate;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
@@ -34,7 +34,7 @@
*
* Exclude resources plugin
*/
-public final class ExcludePlugin implements TransformerPlugin {
+public final class ExcludePlugin implements Plugin {
public static final String NAME = "exclude-resources";
private Predicate<String> predicate;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -35,7 +35,7 @@
import java.util.TreeSet;
import java.util.function.Predicate;
import java.util.stream.Collectors;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.PluginException;
@@ -44,7 +44,7 @@
*
* Exclude VM plugin
*/
-public final class ExcludeVMPlugin implements TransformerPlugin {
+public final class ExcludeVMPlugin implements Plugin {
private static final class JvmComparator implements Comparator<Jvm> {
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/FileCopierPlugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -41,14 +41,14 @@
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.internal.Utils;
/**
*
* Copy files to image from various locations.
*/
-public class FileCopierPlugin implements TransformerPlugin {
+public class FileCopierPlugin implements Plugin {
public static final String NAME = "copy-files";
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -34,12 +34,12 @@
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
/**
* Plugin to generate java.lang.invoke classes.
*/
-public final class GenerateJLIClassesPlugin implements TransformerPlugin {
+public final class GenerateJLIClassesPlugin implements Plugin {
private static final String NAME = "generate-jli-classes";
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/IncludeLocalesPlugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -44,7 +44,7 @@
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
/**
* Plugin to explicitly specify the locale data included in jdk.localedata
@@ -68,7 +68,7 @@
* start with at least one white space character, e.g., " ar ar-EG ..."
* ^
*/
-public final class IncludeLocalesPlugin implements TransformerPlugin, ResourcePrevisitor {
+public final class IncludeLocalesPlugin implements Plugin, ResourcePrevisitor {
public static final String NAME = "include-locales";
private static final String MODULENAME = "jdk.localedata";
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -37,14 +37,14 @@
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.internal.Utils;
/**
*
* Order Resources plugin
*/
-public final class OrderResourcesPlugin implements TransformerPlugin {
+public final class OrderResourcesPlugin implements Plugin {
public static final String NAME = "order-resources";
private static final FileSystem JRT_FILE_SYSTEM = Utils.jrtFileSystem();
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ReleaseInfoPlugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -36,12 +36,12 @@
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.plugin.Plugin.Category;
import jdk.tools.jlink.plugin.Plugin.State;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
/**
* This plugin adds/deletes information for 'release' file.
*/
-public final class ReleaseInfoPlugin implements TransformerPlugin {
+public final class ReleaseInfoPlugin implements Plugin {
// option name
public static final String NAME = "release-info";
public static final String KEYS = "keys";
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StringSharingPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StringSharingPlugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -56,7 +56,7 @@
import jdk.internal.jimage.decompressor.SignatureParser;
import jdk.internal.jimage.decompressor.StringSharingDecompressor;
import jdk.tools.jlink.internal.ModulePoolImpl;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
@@ -68,7 +68,7 @@
* A Plugin that stores the image classes constant pool UTF_8 entries into the
* Image StringsTable.
*/
-public class StringSharingPlugin implements TransformerPlugin, ResourcePrevisitor {
+public class StringSharingPlugin implements Plugin, ResourcePrevisitor {
public static final String NAME = "compact-cp";
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripDebugPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripDebugPlugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -29,13 +29,13 @@
import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
/**
*
* Strip debug attributes plugin
*/
-public final class StripDebugPlugin implements TransformerPlugin {
+public final class StripDebugPlugin implements Plugin {
public static final String NAME = "strip-debug";
private final Predicate<String> predicate;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripNativeCommandsPlugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -26,13 +26,13 @@
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
/**
*
* Strip Native Commands plugin
*/
-public final class StripNativeCommandsPlugin implements TransformerPlugin {
+public final class StripNativeCommandsPlugin implements Plugin {
public static final String NAME = "strip-native-commands";
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModuleDescriptorPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/SystemModuleDescriptorPlugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -52,7 +52,7 @@
import static jdk.internal.org.objectweb.asm.Opcodes.*;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.internal.plugins.SystemModuleDescriptorPlugin.Builder.*;
import jdk.tools.jlink.plugin.ModuleEntry;
@@ -67,7 +67,7 @@
* @see java.lang.module.SystemModuleFinder
* @see SystemModules
*/
-public final class SystemModuleDescriptorPlugin implements TransformerPlugin {
+public final class SystemModuleDescriptorPlugin implements Plugin {
private static final JavaLangModuleAccess JLMA = SharedSecrets.getJavaLangModuleAccess();
// TODO: packager has the dependency on the plugin name
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ZipPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ZipPlugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -34,13 +34,13 @@
import jdk.tools.jlink.internal.ModulePoolImpl;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
/**
*
* ZIP Compression plugin
*/
-public final class ZipPlugin implements TransformerPlugin {
+public final class ZipPlugin implements Plugin {
public static final String NAME = "zip";
private Predicate<String> predicate;
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/asm/AsmPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/asm/AsmPlugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -25,7 +25,7 @@
package jdk.tools.jlink.internal.plugins.asm;
import java.util.Objects;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.internal.ModulePoolImpl;
@@ -35,7 +35,7 @@
* resources.
*
*/
-public abstract class AsmPlugin implements TransformerPlugin {
+public abstract class AsmPlugin implements Plugin {
public AsmPlugin() {
}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/ExecutableImage.java Thu Jun 30 07:14:56 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jdk.tools.jlink.plugin;
-
-import java.nio.file.Path;
-import java.util.List;
-import java.util.Set;
-
-/**
- * An executable runtime image. Contains the information about the executable
- * image created.
- */
-public interface ExecutableImage {
-
- /**
- * Image home directory,
- *
- * @return The home directory.
- */
- public Path getHome();
-
- /**
- * The names of the modules located in the image.
- *
- * @return The set of modules.
- */
- public Set<String> getModules();
-
- /**
- * The list of arguments required to execute the image.
- *
- * @return The list of arguments.
- */
- public List<String> getExecutionArgs();
-
- /**
- * Store new arguments required to execute the image.
- *
- * @param args Additional arguments
- */
- public void storeLaunchArgs(List<String> args);
-}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/Plugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -57,29 +57,19 @@
SORTER("SORTER"),
COMPRESSOR("COMPRESSOR"),
METAINFO_ADDER("METAINFO_ADDER"),
- VERIFIER("VERIFIER", true),
- PROCESSOR("PROCESSOR", true),
- PACKAGER("PACKAGER", true);
+ VERIFIER("VERIFIER"),
+ PROCESSOR("PROCESSOR"),
+ PACKAGER("PACKAGER");
private final String name;
- private final boolean postProcessor;
-
- Category(String name, boolean postProcessor) {
- this.name = name;
- this.postProcessor = postProcessor;
- }
Category(String name) {
- this(name, false);
+ this.name = name;
}
public String getName() {
return name;
}
-
- public boolean isPostProcessor() {
- return postProcessor;
- }
}
/**
@@ -209,4 +199,15 @@
*/
public default void configure(Map<String, String> config) {
}
+
+ /**
+ * Visit the content of the modules that are composing the image.
+ *
+ * @param in Read only content.
+ * @param out The pool to fill with content. This pool must contain
+ * the result of the visit.
+ *
+ * @throws PluginException
+ */
+ public void visit(ModulePool in, ModulePool out);
}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/PostProcessorPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jdk.tools.jlink.plugin;
-
-import java.util.List;
-
-/**
- * Implement this interface to develop a PostProcessor plugin.
- * PostProcessor plugins are called once the image has been generated and is executable.
- **/
-public interface PostProcessorPlugin extends Plugin {
-
- /**
- * Post process an image.
- *
- * @param image The executable image.
- * @return The list of arguments to add to launchers (if any).
- */
- public List<String> process(ExecutableImage image);
-}
--- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/plugin/TransformerPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jdk.tools.jlink.plugin;
-
-
-/**
- * Implement this interface to develop a Transformer plugin.
- * TransformerPlugin are called during image creation. This kind of plugin aims to
- * modify the content of the runtime image.
- */
-public interface TransformerPlugin extends Plugin {
- /**
- * Visit the content of the modules that are composing the image.
- *
- * @param in Read only content.
- * @param out The pool to fill with content. This pool must contain
- * the result of the visit.
- *
- * @throws PluginException
- */
- public void visit(ModulePool in, ModulePool out);
-}
--- a/jdk/src/jdk.jlink/share/classes/module-info.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/src/jdk.jlink/share/classes/module-info.java Thu Jun 30 22:24:01 2016 +0530
@@ -29,20 +29,19 @@
requires jdk.internal.opt;
requires jdk.jdeps;
- uses jdk.tools.jlink.plugin.TransformerPlugin;
- uses jdk.tools.jlink.plugin.PostProcessorPlugin;
+ uses jdk.tools.jlink.plugin.Plugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.FileCopierPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.StripDebugPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.ExcludePlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.ExcludeFilesPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.SystemModuleDescriptorPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.StripNativeCommandsPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.OrderResourcesPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.DefaultCompressPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.OptimizationPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.ExcludeVMPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.IncludeLocalesPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.GenerateJLIClassesPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with jdk.tools.jlink.internal.plugins.ReleaseInfoPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.FileCopierPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.StripDebugPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.ExcludePlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.ExcludeFilesPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.SystemModuleDescriptorPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.StripNativeCommandsPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.OrderResourcesPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.DefaultCompressPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.OptimizationPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.ExcludeVMPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.IncludeLocalesPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.GenerateJLIClassesPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with jdk.tools.jlink.internal.plugins.ReleaseInfoPlugin;
}
--- a/jdk/test/tools/jlink/DefaultProviderTest.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/DefaultProviderTest.java Thu Jun 30 22:24:01 2016 +0530
@@ -33,7 +33,6 @@
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.PluginException;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
import tests.Helper;
/*
@@ -60,7 +59,7 @@
expectedOptions.put("option2", "value2");
}
- private static class Custom implements TransformerPlugin {
+ private static class Custom implements Plugin {
private boolean enabled = true;
@Override
--- a/jdk/test/tools/jlink/ImageFileCreatorTest.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/ImageFileCreatorTest.java Thu Jun 30 22:24:01 2016 +0530
@@ -37,7 +37,7 @@
import jdk.tools.jlink.internal.Archive;
import jdk.tools.jlink.internal.ImageFileCreator;
import jdk.tools.jlink.internal.ImagePluginStack;
-import jdk.tools.jlink.plugin.ExecutableImage;
+import jdk.tools.jlink.internal.ExecutableImage;
import jdk.tools.jlink.builder.ImageBuilder;
import jdk.tools.jlink.plugin.ModulePool;
@@ -220,7 +220,7 @@
};
ImagePluginStack stack = new ImagePluginStack(noopBuilder, Collections.emptyList(),
- null, Collections.emptyList());
+ null);
ImageFileCreator.create(archives, ByteOrder.nativeOrder(), stack);
}
--- a/jdk/test/tools/jlink/IntegrationTest.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/IntegrationTest.java Thu Jun 30 22:24:01 2016 +0530
@@ -34,17 +34,17 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.function.Function;
import jdk.tools.jlink.Jlink;
import jdk.tools.jlink.Jlink.JlinkConfiguration;
import jdk.tools.jlink.Jlink.PluginsConfiguration;
import jdk.tools.jlink.builder.DefaultImageBuilder;
-import jdk.tools.jlink.plugin.ExecutableImage;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.PostProcessorPlugin;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
+import jdk.tools.jlink.internal.ExecutableImage;
+import jdk.tools.jlink.internal.PostProcessor;
import jdk.tools.jlink.internal.plugins.DefaultCompressPlugin;
import jdk.tools.jlink.internal.plugins.StripDebugPlugin;
-import jdk.tools.jlink.plugin.Plugin;
import tests.Helper;
import tests.JImageGenerator;
@@ -70,7 +70,7 @@
private static final List<Integer> ordered = new ArrayList<>();
- public static class MyPostProcessor implements PostProcessorPlugin {
+ public static class MyPostProcessor implements PostProcessor, Plugin {
public static final String NAME = "mypostprocessor";
@@ -98,9 +98,14 @@
public void configure(Map<String, String> config) {
throw new UnsupportedOperationException("Shouldn't be called");
}
+
+ @Override
+ public void visit(ModulePool in, ModulePool out) {
+ in.transformAndCopy(Function.identity(), out);
+ }
}
- public static class MyPlugin1 implements TransformerPlugin {
+ public static class MyPlugin1 implements Plugin {
Integer index;
Set<String> after;
--- a/jdk/test/tools/jlink/JLinkOptionsTest.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/JLinkOptionsTest.java Thu Jun 30 22:24:01 2016 +0530
@@ -26,7 +26,7 @@
import java.util.Set;
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.internal.PluginRepository;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import tests.Helper;
@@ -46,7 +46,7 @@
*/
public class JLinkOptionsTest {
- private static class TestPlugin implements TransformerPlugin {
+ private static class TestPlugin implements Plugin {
private final String name;
private final String option;
--- a/jdk/test/tools/jlink/JLinkPostProcessingTest.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/JLinkPostProcessingTest.java Thu Jun 30 22:24:01 2016 +0530
@@ -28,10 +28,13 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.function.Function;
+import jdk.tools.jlink.plugin.Plugin;
+import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.internal.PluginRepository;
-import jdk.tools.jlink.plugin.ExecutableImage;
-import jdk.tools.jlink.plugin.PostProcessorPlugin;
+import jdk.tools.jlink.internal.PostProcessor;
+import jdk.tools.jlink.internal.ExecutableImage;
import tests.Helper;
/*
@@ -50,7 +53,7 @@
*/
public class JLinkPostProcessingTest {
- private static class PPPlugin implements PostProcessorPlugin {
+ private static class PPPlugin implements PostProcessor, Plugin {
private static ExecutableImage called;
private static final String NAME = "pp";
@@ -68,6 +71,11 @@
}
@Override
+ public void visit(ModulePool in, ModulePool out) {
+ in.transformAndCopy(Function.identity(), out);
+ }
+
+ @Override
public String getName() {
return NAME;
}
--- a/jdk/test/tools/jlink/JLinkTest.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/JLinkTest.java Thu Jun 30 22:24:01 2016 +0530
@@ -35,7 +35,6 @@
import java.util.stream.Stream;
import jdk.tools.jlink.plugin.Plugin;
-import jdk.tools.jlink.plugin.TransformerPlugin;
import jdk.tools.jlink.internal.PluginRepository;
import tests.Helper;
import tests.JImageGenerator;
@@ -60,7 +59,7 @@
private static int getNumJlinkPlugins() {
ModuleDescriptor desc = Plugin.class.getModule().getDescriptor();
return desc.provides().
- get(TransformerPlugin.class.getName()).
+ get(Plugin.class.getName()).
providers().size();
}
--- a/jdk/test/tools/jlink/customplugin/module-info.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/customplugin/module-info.java Thu Jun 30 22:24:01 2016 +0530
@@ -23,6 +23,6 @@
module customplugin {
requires jdk.jlink;
- provides jdk.tools.jlink.plugin.TransformerPlugin with plugin.HelloPlugin;
- provides jdk.tools.jlink.plugin.TransformerPlugin with plugin.CustomPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with plugin.HelloPlugin;
+ provides jdk.tools.jlink.plugin.Plugin with plugin.CustomPlugin;
}
--- a/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/customplugin/plugin/CustomPlugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -27,9 +27,9 @@
import java.util.function.Function;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
-public class CustomPlugin implements TransformerPlugin {
+public class CustomPlugin implements Plugin {
private final static String NAME = "custom-plugin";
--- a/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/customplugin/plugin/HelloPlugin.java Thu Jun 30 22:24:01 2016 +0530
@@ -29,12 +29,12 @@
import java.util.Map;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
/**
* Custom plugin
*/
-public final class HelloPlugin implements TransformerPlugin {
+public final class HelloPlugin implements Plugin {
private static final String OUTPUT_FILE = "customplugin.txt";
public static final String NAME = "hello";
--- a/jdk/test/tools/jlink/plugins/CompressorPluginTest.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/CompressorPluginTest.java Thu Jun 30 22:24:01 2016 +0530
@@ -61,7 +61,6 @@
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
public class CompressorPluginTest {
@@ -279,9 +278,8 @@
ModulePoolImpl inputResources,
ModuleEntry res,
List<Pattern> includesPatterns) {
- TransformerPlugin compressor = (TransformerPlugin) plugin;
ModulePool compressedModulePool = new ModulePoolImpl(ByteOrder.nativeOrder(), inputResources.getStringTable());
- compressor.visit(inputResources, compressedModulePool);
+ plugin.visit(inputResources, compressedModulePool);
String path = res.getPath();
ModuleEntry compressed = compressedModulePool.findEntry(path).get();
CompressedResourceHeader header
--- a/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/ExcludeFilesPluginTest.java Thu Jun 30 22:24:01 2016 +0530
@@ -40,7 +40,6 @@
import jdk.tools.jlink.internal.plugins.ExcludeFilesPlugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
public class ExcludeFilesPluginTest {
public static void main(String[] args) throws Exception {
--- a/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/ExcludeVMPluginTest.java Thu Jun 30 22:24:01 2016 +0530
@@ -38,7 +38,6 @@
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModulePool;
import jdk.tools.jlink.plugin.ModuleEntry;
-import jdk.tools.jlink.plugin.TransformerPlugin;
public class ExcludeVMPluginTest {
@@ -173,7 +172,7 @@
}
ModulePool out = new ModulePoolImpl();
- TransformerPlugin p = new ExcludeVMPlugin();
+ Plugin p = new ExcludeVMPlugin();
Map<String, String> config = new HashMap<>();
if (vm != null) {
config.put(ExcludeVMPlugin.NAME, vm);
--- a/jdk/test/tools/jlink/plugins/LastSorterTest.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/LastSorterTest.java Thu Jun 30 22:24:01 2016 +0530
@@ -45,7 +45,6 @@
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
public class LastSorterTest {
@@ -167,7 +166,7 @@
}
}
- public static class SorterPlugin implements TransformerPlugin {
+ public static class SorterPlugin implements Plugin {
private final String name;
private String starts;
--- a/jdk/test/tools/jlink/plugins/OrderResourcesPluginTest.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/OrderResourcesPluginTest.java Thu Jun 30 22:24:01 2016 +0530
@@ -42,7 +42,7 @@
import jdk.tools.jlink.internal.plugins.OrderResourcesPlugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
public class OrderResourcesPluginTest {
@@ -93,7 +93,7 @@
ModulePool out = new ModulePoolImpl();
Map<String, String> config = new HashMap<>();
config.put(OrderResourcesPlugin.NAME, "/zazou/**,**/module-info.class");
- TransformerPlugin p = new OrderResourcesPlugin();
+ Plugin p = new OrderResourcesPlugin();
p.configure(config);
p.visit(resources, out);
check(out.entries().collect(Collectors.toList()), sorted);
@@ -116,7 +116,7 @@
ModulePool out = new ModulePoolImpl();
Map<String, String> config = new HashMap<>();
config.put(OrderResourcesPlugin.NAME, "@" + order.getAbsolutePath());
- TransformerPlugin p = new OrderResourcesPlugin();
+ Plugin p = new OrderResourcesPlugin();
p.configure(config);
p.visit(resources, out);
check(out.entries().collect(Collectors.toList()), sorted2);
--- a/jdk/test/tools/jlink/plugins/PluginOrderTest.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/PluginOrderTest.java Thu Jun 30 22:24:01 2016 +0530
@@ -46,7 +46,6 @@
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.Plugin.Category;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
public class PluginOrderTest {
@@ -225,7 +224,7 @@
PluginOrderingGraph.sort(plugins);
}
- private static class Plug implements TransformerPlugin {
+ private static class Plug implements Plugin {
private final Set<String> isBefore;
private final Set<String> isAfter;
--- a/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/PluginsNegativeTest.java Thu Jun 30 22:24:01 2016 +0530
@@ -44,7 +44,6 @@
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
public class PluginsNegativeTest {
@@ -117,7 +116,7 @@
}
}
- public static class CustomPlugin implements TransformerPlugin {
+ public static class CustomPlugin implements Plugin {
private final String name;
--- a/jdk/test/tools/jlink/plugins/PrevisitorTest.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/PrevisitorTest.java Thu Jun 30 22:24:01 2016 +0530
@@ -49,7 +49,6 @@
import jdk.tools.jlink.plugin.Plugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
public class PrevisitorTest {
@@ -107,7 +106,7 @@
}
}
- private static class CustomPlugin implements TransformerPlugin, ResourcePrevisitor {
+ private static class CustomPlugin implements Plugin, ResourcePrevisitor {
private static String NAME = "plugin";
--- a/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/StringSharingPluginTest.java Thu Jun 30 22:24:01 2016 +0530
@@ -57,7 +57,7 @@
import jdk.tools.jlink.internal.plugins.StringSharingPlugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import tests.Helper;
import tests.JImageValidator;
@@ -119,7 +119,7 @@
try (java.util.stream.Stream<Path> stream = Files.walk(compiledClasses)) {
stream.forEach(c);
}
- TransformerPlugin plugin = new StringSharingPlugin();
+ Plugin plugin = new StringSharingPlugin();
ModulePoolImpl result = new ModulePoolImpl(resources.getByteOrder(), resources.getStringTable());
plugin.visit(resources, result);
--- a/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java Thu Jun 30 07:14:56 2016 -0700
+++ b/jdk/test/tools/jlink/plugins/StripDebugPluginTest.java Thu Jun 30 22:24:01 2016 +0530
@@ -58,7 +58,7 @@
import jdk.tools.jlink.internal.plugins.StripDebugPlugin;
import jdk.tools.jlink.plugin.ModuleEntry;
import jdk.tools.jlink.plugin.ModulePool;
-import jdk.tools.jlink.plugin.TransformerPlugin;
+import jdk.tools.jlink.plugin.Plugin;
import tests.Helper;
public class StripDebugPluginTest {
@@ -124,7 +124,7 @@
checkDebugAttributes(result1.getBytes());
}
- private ModuleEntry stripDebug(TransformerPlugin debug, ModuleEntry classResource,
+ private ModuleEntry stripDebug(Plugin debug, ModuleEntry classResource,
String path, String infoPath, byte[] moduleInfo) throws Exception {
ModulePool resources = new ModulePoolImpl();
resources.add(classResource);