< prev index next >

jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/ExcludeVMPlugin.java

Print this page

        

*** 1,7 **** /* ! * 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 --- 1,7 ---- /* ! * Copyright (c) 2015, 2017, 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
*** 33,42 **** --- 33,44 ---- import java.util.List; import java.util.Map; import java.util.TreeSet; import java.util.function.Predicate; import java.util.stream.Collectors; + + import jdk.tools.jlink.internal.Platform; import jdk.tools.jlink.plugin.Plugin; import jdk.tools.jlink.plugin.ResourcePool; import jdk.tools.jlink.plugin.ResourcePoolBuilder; import jdk.tools.jlink.plugin.ResourcePoolModule; import jdk.tools.jlink.plugin.ResourcePoolEntry;
*** 113,123 **** } @Override public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) { ResourcePoolModule javaBase = in.moduleView().findModule("java.base").get(); ! String[] jvmlibs = jvmlibs(javaBase.osName()); TreeSet<Jvm> existing = new TreeSet<>(new JvmComparator()); TreeSet<Jvm> removed = new TreeSet<>(new JvmComparator()); if (!keepAll) { // First retrieve all available VM names and removed VM List<ResourcePoolEntry> jvms = getVMs(javaBase, jvmlibs); --- 115,125 ---- } @Override public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) { ResourcePoolModule javaBase = in.moduleView().findModule("java.base").get(); ! String[] jvmlibs = jvmlibs(javaBase); TreeSet<Jvm> existing = new TreeSet<>(new JvmComparator()); TreeSet<Jvm> removed = new TreeSet<>(new JvmComparator()); if (!keepAll) { // First retrieve all available VM names and removed VM List<ResourcePoolEntry> jvms = getVMs(javaBase, jvmlibs);
*** 255,277 **** byte[] content = builder.toString().getBytes(StandardCharsets.UTF_8); return orig.copyWithContent(content); } ! private static String[] jvmlibs(String osName) { ! if (isWindows(osName)) { return new String[] { "jvm.dll" }; ! } else if (isMac(osName)) { return new String[] { "libjvm.dylib", "libjvm.a" }; ! } else { return new String[] { "libjvm.so", "libjvm.a" }; } } - - private static boolean isWindows(String osName) { - return osName.startsWith("Windows"); - } - - private static boolean isMac(String osName) { - return osName.startsWith("Mac OS") || osName.startsWith("Darwin"); - } } --- 257,273 ---- byte[] content = builder.toString().getBytes(StandardCharsets.UTF_8); return orig.copyWithContent(content); } ! private static String[] jvmlibs(ResourcePoolModule module) { ! Platform platform = Platform.getTargetPlatform(module); ! switch (platform) { ! case WINDOWS: return new String[] { "jvm.dll" }; ! case MACOS: return new String[] { "libjvm.dylib", "libjvm.a" }; ! default: return new String[] { "libjvm.so", "libjvm.a" }; } } }
< prev index next >