mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Merge pull request #2 from sampottinger/java11
Moves to Java11 and OpenJDK via AdoptOpenJDK
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
*.iml
|
||||
._*
|
||||
*~
|
||||
/build/shared/reference.zip
|
||||
|
||||
+11
-14
@@ -13,14 +13,14 @@
|
||||
<fail unless="core-built" message="Please build the core library first and make sure it is located at ../core/library/core.jar" />
|
||||
|
||||
<mkdir dir="bin" />
|
||||
|
||||
|
||||
<!-- copy languages files -->
|
||||
<copy todir="bin">
|
||||
<fileset dir="src">
|
||||
<include name="processing/app/languages/*.properties" />
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
|
||||
<!-- in some cases, pde.jar was not getting built
|
||||
https://github.com/processing/processing/issues/1792 -->
|
||||
<delete file="pde.jar" />
|
||||
@@ -30,22 +30,19 @@
|
||||
|
||||
<javac source="1.8"
|
||||
target="1.8"
|
||||
destdir="bin"
|
||||
excludes="**/tools/format/**"
|
||||
encoding="UTF-8"
|
||||
includeAntRuntime="false"
|
||||
classpath="../core/library/core.jar;
|
||||
../core/apple.jar;
|
||||
lib/ant.jar;
|
||||
lib/ant-launcher.jar;
|
||||
destdir="bin"
|
||||
excludes="**/tools/format/**"
|
||||
encoding="UTF-8"
|
||||
includeAntRuntime="false"
|
||||
classpath="../core/library/core.jar;
|
||||
../core/apple.jar;
|
||||
lib/ant.jar;
|
||||
lib/ant-launcher.jar;
|
||||
lib/jna.jar;
|
||||
lib/jna-platform.jar"
|
||||
debug="on"
|
||||
nowarn="true"
|
||||
compiler="org.eclipse.jdt.core.JDTCompilerAdapter">
|
||||
nowarn="true">
|
||||
<src path="src" />
|
||||
<compilerclasspath path="../java/mode/org.eclipse.jdt.core.jar;
|
||||
../java/mode/jdtCompilerAdapter.jar" />
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -339,10 +339,10 @@ public class Platform {
|
||||
File[] plugins = getContentFile("../PlugIns").listFiles(new FilenameFilter() {
|
||||
public boolean accept(File dir, String name) {
|
||||
return dir.isDirectory() &&
|
||||
name.endsWith(".jdk") && !name.startsWith(".");
|
||||
name.contains("jdk") && !name.startsWith(".");
|
||||
}
|
||||
});
|
||||
return new File(plugins[0], "Contents/Home/jre");
|
||||
return new File(plugins[0], "Contents/Home");
|
||||
}
|
||||
// On all other platforms, it's the 'java' folder adjacent to Processing
|
||||
return getContentFile("java");
|
||||
@@ -412,4 +412,4 @@ public class Platform {
|
||||
static public int getSystemDPI() {
|
||||
return inst.getSystemDPI();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,20 +40,6 @@ public class LinuxPlatform extends DefaultPlatform {
|
||||
public void initBase(Base base) {
|
||||
super.initBase(base);
|
||||
|
||||
String javaVendor = System.getProperty("java.vendor");
|
||||
String javaVM = System.getProperty("java.vm.name");
|
||||
if (javaVendor == null ||
|
||||
(!javaVendor.contains("Sun") && !javaVendor.contains("Oracle")) ||
|
||||
javaVM == null || !javaVM.contains("Java")) {
|
||||
Messages.showWarning("Not fond of this Java VM",
|
||||
"Processing requires Java 8 from Oracle.\n" +
|
||||
"Other versions such as OpenJDK, IcedTea,\n" +
|
||||
"and GCJ are strongly discouraged. Among other things, you're\n" +
|
||||
"likely to run into problems with sketch window size and\n" +
|
||||
"placement. For more background, please read the wiki:\n" +
|
||||
"https://github.com/processing/processing/wiki/Supported-Platforms#linux", null);
|
||||
}
|
||||
|
||||
// Set x11 WM_CLASS property which is used as the application
|
||||
// name by Gnome3 and other window managers.
|
||||
// https://github.com/processing/processing/issues/2534
|
||||
|
||||
@@ -24,11 +24,15 @@ package processing.app.platform;
|
||||
|
||||
import java.awt.event.*;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import com.apple.eawt.*;
|
||||
import com.apple.eawt.AppEvent.*;
|
||||
import com.apple.eawt.Application;
|
||||
|
||||
import processing.app.*;
|
||||
import processing.app.ui.About;
|
||||
@@ -65,44 +69,40 @@ public class ThinkDifferent {
|
||||
if (adapter == null) {
|
||||
adapter = new ThinkDifferent(); //base);
|
||||
}
|
||||
|
||||
application.setAboutHandler(new AboutHandler() {
|
||||
public void handleAbout(AboutEvent ae) {
|
||||
new About(null);
|
||||
}
|
||||
});
|
||||
|
||||
application.setPreferencesHandler(new PreferencesHandler() {
|
||||
public void handlePreferences(PreferencesEvent arg0) {
|
||||
base.handlePrefs();
|
||||
}
|
||||
|
||||
setHandler(application, "setAboutHandler", (proxy, method, args) -> {
|
||||
new About(null);
|
||||
return null;
|
||||
});
|
||||
|
||||
application.setOpenFileHandler(new OpenFilesHandler() {
|
||||
public void openFiles(OpenFilesEvent event) {
|
||||
for (File file : event.getFiles()) {
|
||||
base.handleOpen(file.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
application.setPrintFileHandler(new PrintFilesHandler() {
|
||||
public void printFiles(PrintFilesEvent event) {
|
||||
// TODO not yet implemented
|
||||
}
|
||||
});
|
||||
|
||||
application.setQuitHandler(new QuitHandler() {
|
||||
public void handleQuitRequestWith(QuitEvent event, QuitResponse response) {
|
||||
if (base.handleQuit()) {
|
||||
response.performQuit();
|
||||
} else {
|
||||
response.cancelQuit();
|
||||
}
|
||||
}
|
||||
setHandler(application, "setPreferencesHandler", (proxy, method, args) -> {
|
||||
base.handlePrefs();
|
||||
return null;
|
||||
});
|
||||
|
||||
// Set the menubar to be used when nothing else is open.
|
||||
setHandler(application, "setOpenFileHandler", (proxy, method, args) -> {
|
||||
Method m = args[0].getClass().getMethod("getFiles");
|
||||
for (File file : (List<File>) m.invoke(args[0])) {
|
||||
base.handleOpen(file.getAbsolutePath());
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
setHandler(application, "setPrintFileHandler", (proxy, method, args) -> {
|
||||
// TODO not yet implemented
|
||||
return null;
|
||||
});
|
||||
|
||||
setHandler(application, "setQuitHandler", (proxy, method, args) -> {
|
||||
if (base.handleQuit()) {
|
||||
args[1].getClass().getMethod("performQuit").invoke(args[1]);
|
||||
} else {
|
||||
args[1].getClass().getMethod("cancelQuit").invoke(args[1]);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
// Set the menubar to be used when nothing else is open.
|
||||
JMenuBar defaultMenuBar = new JMenuBar();
|
||||
JMenu fileMenu = buildFileMenu(base);
|
||||
defaultMenuBar.add(fileMenu);
|
||||
@@ -117,12 +117,12 @@ public class ThinkDifferent {
|
||||
e.printStackTrace(); // oh well, never mind
|
||||
}
|
||||
// } else {
|
||||
// // The douchebags at Oracle didn't feel that a working f*king menubar
|
||||
// // on OS X was important enough to make it into the 7u40 release.
|
||||
// // The douchebags at Oracle didn't feel that a working f*king menubar
|
||||
// // on OS X was important enough to make it into the 7u40 release.
|
||||
// //http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8007267
|
||||
// // It languished in the JDK 8 source and has been backported for 7u60:
|
||||
// //http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8022667
|
||||
//
|
||||
//
|
||||
// JFrame offscreen = new JFrame();
|
||||
// offscreen.setUndecorated(true);
|
||||
// offscreen.setJMenuBar(defaultMenuBar);
|
||||
@@ -131,12 +131,51 @@ public class ThinkDifferent {
|
||||
// offscreen.setVisible(true);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
// public ThinkDifferent(Base base) {
|
||||
// this.base = base;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Sets a handler on an instance of {@link Application}, taking into account JVM version
|
||||
* differences.
|
||||
*
|
||||
* @param app an instance of {@link Application}
|
||||
* @param name the "set handler" method name
|
||||
* @param handler the handler
|
||||
*/
|
||||
private static void setHandler(Application app, String name, InvocationHandler handler) {
|
||||
// Determine which version of com.apple.eawt.Application to use and pass it a handler of the
|
||||
// appropriate type
|
||||
Method[] methods = app.getClass().getMethods();
|
||||
for (Method m : methods) {
|
||||
if (!name.equals(m.getName())) {
|
||||
continue;
|
||||
}
|
||||
if (m.getParameterCount() != 1) {
|
||||
continue;
|
||||
}
|
||||
Class paramType = m.getParameterTypes()[0];
|
||||
try {
|
||||
// Allow a null handler
|
||||
Object proxy = null;
|
||||
if (handler != null) {
|
||||
proxy = Proxy.newProxyInstance(
|
||||
paramType.getClassLoader(), new Class<?>[] { paramType }, handler);
|
||||
}
|
||||
m.invoke(app, proxy);
|
||||
} catch (IllegalArgumentException ex) {
|
||||
// TODO: Print error?: method doesn't take an interface, etc.
|
||||
} catch (IllegalAccessException ex) {
|
||||
// TODO: Print error?: Other method invocation problem
|
||||
} catch (InvocationTargetException ex) {
|
||||
ex.getCause().printStackTrace();
|
||||
// TODO: Print ex.getCause() a different way?
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gimpy file menu to be used on OS X when no sketches are open.
|
||||
@@ -162,7 +201,7 @@ public class ThinkDifferent {
|
||||
fileMenu.add(item);
|
||||
|
||||
item = Toolkit.newJMenuItemShift(Language.text("menu.file.sketchbook"), 'K');
|
||||
item.addActionListener(new ActionListener() {
|
||||
item.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
base.getNextMode().showSketchbookFrame();
|
||||
|
||||
@@ -64,10 +64,16 @@ public class WindowsPlatform extends DefaultPlatform {
|
||||
"\\" + APP_NAME.toLowerCase() + ".exe \"%1\"";
|
||||
static final String REG_DOC = APP_NAME + ".Document";
|
||||
|
||||
// Starting with Java 9, the scaling is done automatically. If DPI is
|
||||
// used to scaling within the application, one ends up with 2x the
|
||||
// expected scale. See JEP 263.
|
||||
private static final int WINDOWS_NATIVE_DPI = 96;
|
||||
|
||||
public void initBase(Base base) {
|
||||
super.initBase(base);
|
||||
|
||||
checkAssociations();
|
||||
|
||||
//checkQuickTime();
|
||||
checkPath();
|
||||
|
||||
@@ -627,56 +633,9 @@ public class WindowsPlatform extends DefaultPlatform {
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
// Need to extend com.sun.jna.platform.win32.User32 to access
|
||||
// Win32 function GetDpiForSystem()
|
||||
interface ExtUser32 extends StdCallLibrary, com.sun.jna.platform.win32.User32 {
|
||||
ExtUser32 INSTANCE = (ExtUser32) Native.loadLibrary("user32", ExtUser32.class, W32APIOptions.DEFAULT_OPTIONS);
|
||||
|
||||
public int GetDpiForSystem();
|
||||
|
||||
public int SetProcessDpiAwareness(int value);
|
||||
|
||||
public final int DPI_AWARENESS_INVALID = -1;
|
||||
public final int DPI_AWARENESS_UNAWARE = 0;
|
||||
public final int DPI_AWARENESS_SYSTEM_AWARE = 1;
|
||||
public final int DPI_AWARENESS_PER_MONITOR_AWARE = 2;
|
||||
|
||||
public Pointer SetThreadDpiAwarenessContext(Pointer dpiContext);
|
||||
|
||||
public final Pointer DPI_AWARENESS_CONTEXT_UNAWARE = new Pointer(-1);
|
||||
public final Pointer DPI_AWARENESS_CONTEXT_SYSTEM_AWARE = new Pointer(-2);
|
||||
public final Pointer DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE = new Pointer(-3);
|
||||
}
|
||||
|
||||
|
||||
static private int detected = detectSystemDPI();
|
||||
|
||||
|
||||
public int getSystemDPI() {
|
||||
if (detected == -1) {
|
||||
return super.getSystemDPI();
|
||||
}
|
||||
return detected;
|
||||
// Note that this is supported "natively" within Java - See JEP 263.
|
||||
return WINDOWS_NATIVE_DPI;
|
||||
}
|
||||
|
||||
|
||||
public static int detectSystemDPI() {
|
||||
try {
|
||||
ExtUser32.INSTANCE.SetProcessDpiAwareness(ExtUser32.DPI_AWARENESS_SYSTEM_AWARE);
|
||||
} catch (Throwable e) {
|
||||
// Ignore error
|
||||
}
|
||||
try {
|
||||
ExtUser32.INSTANCE.SetThreadDpiAwarenessContext(ExtUser32.DPI_AWARENESS_CONTEXT_SYSTEM_AWARE);
|
||||
} catch (Throwable e) {
|
||||
// Ignore error (call valid only on Windows 10)
|
||||
}
|
||||
try {
|
||||
return ExtUser32.INSTANCE.GetDpiForSystem();
|
||||
} catch (Throwable e) {
|
||||
// DPI detection failed, fall back with default
|
||||
System.out.println("DPI detection failed, fallback to 96 dpi");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,12 +76,17 @@ public class JEditTextArea extends JComponent
|
||||
/** The size of the offset between the leftmost padding and the code */
|
||||
public static final int leftHandGutter = 6;
|
||||
|
||||
private final Segment TEST_SEGMENT;
|
||||
|
||||
private InputMethodSupport inputMethodSupport;
|
||||
|
||||
private TextAreaDefaults defaults;
|
||||
|
||||
private Brackets bracketHelper = new Brackets();
|
||||
|
||||
private FontMetrics cachedPartialPixelWidthFont;
|
||||
private float partialPixelWidth;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new JEditTextArea with the specified settings.
|
||||
@@ -90,6 +95,9 @@ public class JEditTextArea extends JComponent
|
||||
public JEditTextArea(TextAreaDefaults defaults, InputHandler inputHandler) {
|
||||
this.defaults = defaults;
|
||||
|
||||
char[] testSegmentContents = {'w'};
|
||||
TEST_SEGMENT = new Segment(testSegmentContents, 0, 1);
|
||||
|
||||
// Enable the necessary events
|
||||
enableEvents(AWTEvent.KEY_EVENT_MASK);
|
||||
|
||||
@@ -113,6 +121,8 @@ public class JEditTextArea extends JComponent
|
||||
lineSegment = new Segment();
|
||||
bracketLine = bracketPosition = -1;
|
||||
blink = true;
|
||||
cachedPartialPixelWidthFont = null;
|
||||
partialPixelWidth = 0;
|
||||
|
||||
// Initialize the GUI
|
||||
setLayout(new ScrollLayout());
|
||||
@@ -632,7 +642,7 @@ public class JEditTextArea extends JComponent
|
||||
// If syntax coloring is disabled, do simple translation
|
||||
if (tokenMarker == null) {
|
||||
lineSegment.count = offset;
|
||||
return x + Utilities.getTabbedTextWidth(lineSegment, fm, x, painter, 0);
|
||||
return x + getTabbedTextWidth(lineSegment, fm, x, painter, 0);
|
||||
|
||||
} else {
|
||||
// If syntax coloring is enabled, we have to do this
|
||||
@@ -664,10 +674,10 @@ public class JEditTextArea extends JComponent
|
||||
int length = tokens.length;
|
||||
if (offset + segmentOffset < lineSegment.offset + length) {
|
||||
lineSegment.count = offset - (lineSegment.offset - segmentOffset);
|
||||
return x + Utilities.getTabbedTextWidth(lineSegment, fm, x, painter, 0);
|
||||
return x + getTabbedTextWidth(lineSegment, fm, x, painter, 0);
|
||||
} else {
|
||||
lineSegment.count = length;
|
||||
x += Utilities.getTabbedTextWidth(lineSegment, fm, x, painter, 0);
|
||||
x += getTabbedTextWidth(lineSegment, fm, x, painter, 0);
|
||||
lineSegment.offset += length;
|
||||
}
|
||||
tokens = tokens.next;
|
||||
@@ -1310,6 +1320,72 @@ public class JEditTextArea extends JComponent
|
||||
return CharacterKinds.Other;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the width in pixels of a segment of text within the IDE.
|
||||
*
|
||||
* <p>
|
||||
* Fractional-font aware implementation of Utilities.getTabbedTextWidth that determines if there
|
||||
* are fractional character widths present in a font in order to return a more accurate pixel
|
||||
* width for an input segment.
|
||||
* </p>
|
||||
*
|
||||
* @param s The segment of text for which a pixel width should be returned.
|
||||
* @param metrics The metrics for the font in which the given segment will be drawn.
|
||||
* @param x The x origin.
|
||||
* @param expander The strategy for converting tabs into characters.
|
||||
* @param startOffset The offset to apply before the text will be drawn.
|
||||
* @return The width of the input segment in pixels with fractional character widths considered.
|
||||
*/
|
||||
private int getTabbedTextWidth(Segment s, FontMetrics metrics, float x, TabExpander expander,
|
||||
int startOffset) {
|
||||
|
||||
float additionalOffset = getPartialPixelWidth(metrics, x, expander, startOffset) * s.length();
|
||||
|
||||
return (int) Math.round(
|
||||
Utilities.getTabbedTextWidth(s, metrics, x, expander, startOffset) + additionalOffset
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get any partial widths applied within a font.
|
||||
*
|
||||
* <p>
|
||||
* Get any partial widths applied within a font, caching results for the latest requested font
|
||||
* (as identified via a FontMetrics object). Note that this is calculated for a sample character
|
||||
* and is only valid for extrapolation in a monospaced font (that one might want to use in an
|
||||
* IDE).
|
||||
* </p>
|
||||
*
|
||||
* @param candidateMetrics The FontMetrics for which partial character pixel widths should be
|
||||
* returned.
|
||||
* @param x The x origin.
|
||||
* @param expander The strategy for converting tabs into characters.
|
||||
* @param startOffset The offset to apply before the text will be drawn.
|
||||
* @return The partial width of a sample character within a font.
|
||||
*/
|
||||
private float getPartialPixelWidth(FontMetrics candidateMetrics, float x, TabExpander expander,
|
||||
int startOffset) {
|
||||
|
||||
// See https://github.com/sampottinger/processing/issues/103
|
||||
// Requires reference not object equality check
|
||||
if (candidateMetrics != cachedPartialPixelWidthFont) {
|
||||
float withFractional = Utilities.getTabbedTextWidth(
|
||||
TEST_SEGMENT,
|
||||
candidateMetrics,
|
||||
x,
|
||||
expander,
|
||||
startOffset
|
||||
);
|
||||
|
||||
int withoutFractional = (int) withFractional;
|
||||
|
||||
partialPixelWidth = withFractional - withoutFractional;
|
||||
cachedPartialPixelWidthFont = candidateMetrics;
|
||||
}
|
||||
|
||||
return partialPixelWidth;
|
||||
}
|
||||
|
||||
protected void setNewSelectionWord( int line, int offset )
|
||||
{
|
||||
if (getLineLength(line) == 0) {
|
||||
|
||||
+493
-169
@@ -1,6 +1,14 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="Processing" default="build">
|
||||
|
||||
<property environment="env"/>
|
||||
|
||||
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
|
||||
<classpath>
|
||||
<pathelement location="library/ant-contrib-0.6.jar"/>
|
||||
</classpath>
|
||||
</taskdef>
|
||||
|
||||
<!-- Sets properties for macosx/windows/linux depending on current system -->
|
||||
<condition property="platform" value="macosx">
|
||||
<os family="mac" />
|
||||
@@ -27,52 +35,66 @@
|
||||
<!-- detetect Raspberry Pi and friends -->
|
||||
<condition property="linux-arm32" value="linux-arm32">
|
||||
<and>
|
||||
<equals arg1="${platform}" arg2="linux" />
|
||||
<equals arg1="${target-platform}" arg2="linux" />
|
||||
<equals arg1="${os.arch}" arg2="arm" />
|
||||
<equals arg1="${sun.arch.data.model}" arg2="32" />
|
||||
<equals arg1="${jdk.data.model}" arg2="32" />
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="linux-arm64" value="linux-arm64">
|
||||
<and>
|
||||
<equals arg1="${platform}" arg2="linux" />
|
||||
<equals arg1="${target-platform}" arg2="linux" />
|
||||
<equals arg1="${os.arch}" arg2="aarch64" />
|
||||
<equals arg1="${sun.arch.data.model}" arg2="64" />
|
||||
<equals arg1="${jdk.data.model}" arg2="64" />
|
||||
</and>
|
||||
</condition>
|
||||
|
||||
<!-- there is currently no JRE available for ARM -->
|
||||
<target name="check-linux-arm32" if="linux-arm32">
|
||||
<property name="jre.download.jdk" value="true" />
|
||||
<property name="jre.downloader" value="linux-arm32-vfp-hflt.tar.gz" />
|
||||
<property name="jdk.download.jdk" value="true" />
|
||||
<property name="jdk.downloader" value="linux-arm32-vfp-hflt.tar.gz" />
|
||||
<property name="linux.dist" value="linux/processing-${version}-linux-armv6hf.tgz" />
|
||||
<property name="launch4j.variant" value="linux-armv6hf" />
|
||||
</target>
|
||||
<target name="check-linux-arm64" if="linux-arm64">
|
||||
<property name="jre.download.jdk" value="true" />
|
||||
<property name="jre.downloader" value="linux-arm64-vfp-hflt.tar.gz" />
|
||||
<property name="jdk.download.jdk" value="true" />
|
||||
<property name="jdk.downloader" value="linux-arm64-vfp-hflt.tar.gz" />
|
||||
<property name="linux.dist" value="linux/processing-${version}-linux-arm64.tgz" />
|
||||
</target>
|
||||
|
||||
<!-- Require Java 8 everywhere. -->
|
||||
<fail message="Unsupported Java version: ${java.version}. To build, make sure that Java 8 (aka Java 1.8) is installed.">
|
||||
<!-- Require Java 11 everywhere. -->
|
||||
<fail message="Unsupported Java version: ${java.version}. To build, make sure that Java 11 is installed.">
|
||||
<condition>
|
||||
<not>
|
||||
<or>
|
||||
<contains string="${java.version}" substring="1.8" />
|
||||
<contains string="${java.version}" substring="11." />
|
||||
</or>
|
||||
</not>
|
||||
</condition>
|
||||
</fail>
|
||||
|
||||
<!-- JavaFX got removed from the Oracle's JDK for arm and Java 11 -->
|
||||
<condition property="jfx.available" value="true">
|
||||
<and>
|
||||
<not><equals arg1="${os.arch}" arg2="arm" /></not>
|
||||
</and>
|
||||
</condition>
|
||||
|
||||
<!-- could prompt here to download the necessary JRE
|
||||
(Windows/Linux) or JDK (on Mac OS X) -->
|
||||
|
||||
<property name="examples.dir"
|
||||
value="../../processing-docs/content/examples" />
|
||||
|
||||
<property name="jdk.version" value="8" />
|
||||
<property name="jdk.update" value="202" />
|
||||
<property name="jdk.build" value="08" />
|
||||
<property name="jdk.train" value="11" />
|
||||
<property name="jdk.version" value="0" />
|
||||
<property name="jdk.update" value="4" />
|
||||
<property name="jdk.build" value="11" />
|
||||
|
||||
<property name="jfx.train" value="11" />
|
||||
<property name="jfx.version" value="0" />
|
||||
<property name="jfx.update" value="2" />
|
||||
<property name="jfx.build" value="0" />
|
||||
|
||||
<!-- See https://gist.github.com/P7h/9741922
|
||||
or http://stackoverflow.com/q/10268583 -->
|
||||
<property name="jdk.hash" value="1961070e4c9b4e26a04e7f5a083f551e" />
|
||||
@@ -84,71 +106,89 @@
|
||||
-->
|
||||
|
||||
<property name="jdk.short" value="${jdk.version}u${jdk.update}" />
|
||||
<property name="jdk.esoteric" value="1.${jdk.version}.0_${jdk.update}" />
|
||||
|
||||
<property name="jdk.prefix" value="jdk" />
|
||||
<property name="jdk.separator" value="-" />
|
||||
<property name="jdk.esoteric" value="${jdk.train}.${jdk.version}.${jdk.update}" />
|
||||
|
||||
<property name="jfx.name" value="${jfx.train}.${jfx.version}.${jfx.update}" />
|
||||
|
||||
|
||||
<!-- Figure out the JRE download location for Linux and Windows. -->
|
||||
<!--
|
||||
<condition property="jre.file"
|
||||
value="jre-${jdk.short}-${platform}-i586.tar.gz">
|
||||
<equals arg1="${sun.arch.data.model}" arg2="32" />
|
||||
<condition property="jdk.file"
|
||||
value="jdk-${jdk.short}-${target-platform}-i586.tar.gz">
|
||||
<equals arg1="${jdk.data.model}" arg2="32" />
|
||||
</condition>
|
||||
<condition property="jre.file"
|
||||
value="jre-${jdk.short}-${platform}-x64.tar.gz">
|
||||
<equals arg1="${sun.arch.data.model}" arg2="64" />
|
||||
<condition property="jdk.file"
|
||||
value="jdk-${jdk.short}-${target-platform}-x64.tar.gz">
|
||||
<equals arg1="${jdk.data.model}" arg2="64" />
|
||||
</condition>
|
||||
-->
|
||||
|
||||
<!-- JDK location for Mac OS X -->
|
||||
<!--
|
||||
<condition property="jdk.file" value="jdk-${jdk.short}-macosx-x64.dmg">
|
||||
<equals arg1="${platform}" arg2="macosx" />
|
||||
<equals arg1="${target-platform}" arg2="macosx" />
|
||||
</condition>
|
||||
-->
|
||||
|
||||
<!-- These lists haven't been updated since Java 6. The new list:
|
||||
http://www.oracle.com/technetwork/java/javase/jre-8-readme-2095710.html
|
||||
http://www.oracle.com/technetwork/java/javase/jdk-8-readme-2095710.html
|
||||
Please help: https://github.com/processing/processing/issues/3288 -->
|
||||
|
||||
<fileset dir="windows/work/java" id="jre-optional-windows">
|
||||
<include name="lib/ext/dnsns.jar" />
|
||||
|
||||
<include name="bin/dtplugin" />
|
||||
<include name="bin/plugin2" />
|
||||
|
||||
<include name="bin/kinit.exe" />
|
||||
<include name="bin/klist.exe" />
|
||||
<include name="bin/ktab.exe" />
|
||||
|
||||
<include name="bin/keytool" /> <!-- needed for Android -->
|
||||
<include name="bin/orbd" />
|
||||
<include name="bin/policytool" />
|
||||
<include name="bin/rmid" />
|
||||
<include name="bin/rmiregistry" />
|
||||
<include name="bin/servertool" />
|
||||
<include name="bin/tnameserv" />
|
||||
|
||||
<include name="bin/javaws.exe" />
|
||||
<include name="lib/javaws.jar" />
|
||||
|
||||
<include name="lib/cmm/PYCC.pf" />
|
||||
<fileset dir="macosx/work/Processing.app/Contents" id="jdk-optional-macosx">
|
||||
<include name="Java/core/library/libjfxwebkit.dylib" />
|
||||
</fileset>
|
||||
|
||||
<fileset dir="linux/work/java" id="jre-optional-linux">
|
||||
<include name="bin/keytool" /> <!-- needed for Android -->
|
||||
<fileset dir="windows/work" id="jdk-optional-windows">
|
||||
<include name="java/lib/ext/dnsns.jar" />
|
||||
|
||||
<include name="lib/ext/dnsns.jar" />
|
||||
<include name="java/bin/dtplugin" />
|
||||
<include name="java/bin/plugin2" />
|
||||
|
||||
<include name="bin/orbd" />
|
||||
<include name="bin/policytool" />
|
||||
<include name="bin/rmid" />
|
||||
<include name="bin/rmiregistry" />
|
||||
<include name="bin/servertool" />
|
||||
<include name="bin/tnameserv" />
|
||||
<include name="java/bin/kinit.exe" />
|
||||
<include name="java/bin/klist.exe" />
|
||||
<include name="java/bin/ktab.exe" />
|
||||
|
||||
<include name="bin/javaws" />
|
||||
<include name="lib/javaws.jar" />
|
||||
<include name="java/bin/keytool" /> <!-- needed for Android -->
|
||||
<include name="java/bin/orbd" />
|
||||
<include name="java/bin/policytool" />
|
||||
<include name="java/bin/rmid" />
|
||||
<include name="java/bin/rmiregistry" />
|
||||
<include name="java/bin/servertool" />
|
||||
<include name="java/bin/tnameserv" />
|
||||
|
||||
<include name="lib/cmm/PYCC.pf" />
|
||||
<include name="java/bin/javaws.exe" />
|
||||
<include name="java/lib/javaws.jar" />
|
||||
|
||||
<include name="java/lib/cmm/PYCC.pf" />
|
||||
|
||||
<include name="java/lib/src.zip" />
|
||||
|
||||
<include name="core/library/jfxwebkit.dll" />
|
||||
</fileset>
|
||||
|
||||
<fileset dir="linux/work" id="jdk-optional-linux">
|
||||
<include name="java/bin/keytool" /> <!-- needed for Android -->
|
||||
|
||||
<include name="java/lib/ext/dnsns.jar" />
|
||||
|
||||
<include name="java/bin/orbd" />
|
||||
<include name="java/bin/policytool" />
|
||||
<include name="java/bin/rmid" />
|
||||
<include name="java/bin/rmiregistry" />
|
||||
<include name="java/bin/servertool" />
|
||||
<include name="java/bin/tnameserv" />
|
||||
|
||||
<include name="java/bin/javaws" />
|
||||
<include name="java/lib/javaws.jar" />
|
||||
|
||||
<include name="java/lib/src.zip" />
|
||||
|
||||
<include name="core/library/libjfxwebkit.so" />
|
||||
|
||||
<include name="java/lib/cmm/PYCC.pf" />
|
||||
</fileset>
|
||||
|
||||
<!-- Unused JavaFX files that can be removed from the JRE on Windows
|
||||
@@ -157,7 +197,7 @@
|
||||
However, we're now looking into using JavaFX as the default 2D
|
||||
renderer for 3.0. So in 3.0a8, we're no longer removing javafx. -->
|
||||
|
||||
<fileset dir="${platform}/work/java" id="javafx-basics">
|
||||
<fileset dir="${target-platform}/work/java" id="javafx-basics">
|
||||
<include name="THIRDPARTYLICENSEREADME-JAVAFX.txt" />
|
||||
<include name="lib/javafx.properties" />
|
||||
<include name="lib/jfxrt.jar" />
|
||||
@@ -210,16 +250,108 @@
|
||||
<echo message="${java.class.path}" />
|
||||
-->
|
||||
|
||||
<!-- Set a property named macosx, linux, or windows.
|
||||
The 'value' chosen is arbitrary. -->
|
||||
<property name="${platform}" value="${platform}" />
|
||||
<!-- Macro to help set the platform ant vars appropriately -->
|
||||
<macrodef name="settarget">
|
||||
<attribute name="platform"/>
|
||||
<attribute name="datamodel"/>
|
||||
<sequential>
|
||||
|
||||
<property environment="env" />
|
||||
<property name="host-platform" value="${platform}" />
|
||||
|
||||
<property name="jre.tgz.path" value="${platform}/jre-${jdk.short}.tgz" />
|
||||
<!-- Set a property named macosx, linux, or windows.
|
||||
The 'value' chosen is arbitrary. -->
|
||||
<property name="target-platform" value="@{platform}" />
|
||||
<property name="${target-platform}" value="${target-platform}" />
|
||||
|
||||
<target name="jre-check">
|
||||
<available file="${jre.tgz.path}" property="jre.tgz.downloaded" />
|
||||
<property name="jdk.tgz.path" value="${target-platform}/jdk-${jdk.short}.tgz" />
|
||||
|
||||
<property name="jdk.data.model" value="@{datamodel}" />
|
||||
|
||||
<property name="jfx.path.zip" value="${target-platform}/jfx-${jfx.name}.zip" />
|
||||
|
||||
<property name="jfx.path.dist" value="${target-platform}/javafx-sdk-${jfx.name}" />
|
||||
|
||||
<property name="jfx.path.lib" value="${jfx.path.dist}/lib" />
|
||||
|
||||
<condition property="jdk.tgz.path" value="${target-platform}/jdk-${jdk.short}.tgz">
|
||||
<not>
|
||||
<equals arg1="${target-platform}" arg2="windows" />
|
||||
</not>
|
||||
</condition>
|
||||
|
||||
<condition property="jdk.tgz.path" value="${target-platform}/jdk-${jdk.short}.zip">
|
||||
<equals arg1="${target-platform}" arg2="windows" />
|
||||
</condition>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="preparejfx">
|
||||
<sequential>
|
||||
<if>
|
||||
<equals arg1="${jfx.available}" arg2="true" />
|
||||
<then>
|
||||
<!-- Extract JFX -->
|
||||
<echo message="Target jfx: ${jfx.path.zip}"/>
|
||||
<unzip dest="${target-platform}" src="${jfx.path.zip}" overwrite="true"/>
|
||||
</then>
|
||||
</if>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<macrodef name="nativecopy">
|
||||
<attribute name="src"/>
|
||||
<attribute name="dest"/>
|
||||
<sequential>
|
||||
|
||||
<local name="src-abs"/>
|
||||
<local name="dest-abs"/>
|
||||
<local name="src-local"/>
|
||||
<local name="dest-local"/>
|
||||
|
||||
<property name="src-abs" value="${basedir}/@{src}"/>
|
||||
<property name="dest-abs" value="${basedir}/@{dest}"/>
|
||||
|
||||
<if>
|
||||
<equals arg1="${host-platform}" arg2="windows" />
|
||||
<then>
|
||||
<propertyregex property="src-local"
|
||||
input="${src-abs}"
|
||||
regexp="/"
|
||||
replace="\\\\"
|
||||
global="true" />
|
||||
<propertyregex property="dest-local"
|
||||
input="${dest-abs}"
|
||||
regexp="/"
|
||||
replace="\\\\"
|
||||
global="true" />
|
||||
|
||||
<echo message="Native copy of ${src-local} to ${dest-local}" />
|
||||
<exec executable="cmd">
|
||||
<arg line="/C xcopy /s/Y ${src-local} ${dest-local}" />
|
||||
</exec>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<if>
|
||||
<not><equals arg1="${host-platform}" arg2="windows" /></not>
|
||||
<then>
|
||||
<echo message="Native copy of ${src-abs} to ${dest-abs}" />
|
||||
<exec executable="sh">
|
||||
<arg line="-c 'cp ${src-abs} ${dest-abs}'"/>
|
||||
</exec>
|
||||
</then>
|
||||
</if>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<target name="jdk-check">
|
||||
<echo message="Checking for ${jdk.tgz.path}" />
|
||||
<available file="${jdk.tgz.path}" property="jdk.tgz.downloaded" />
|
||||
<echo message="Result: ${jdk.tgz.downloaded}" />
|
||||
</target>
|
||||
|
||||
<target name="jfx-check">
|
||||
<available file="${jfx.path.zip}" property="jfx.zip.downloaded" />
|
||||
</target>
|
||||
|
||||
<target name="downloader-setup">
|
||||
@@ -232,37 +364,47 @@
|
||||
classpath="jre/downloader.jar" />
|
||||
</target>
|
||||
|
||||
<target name="jre-download" depends="jre-check, downloader-setup"
|
||||
unless="jre.tgz.downloaded">
|
||||
<target name="jdk-download" depends="jdk-check, downloader-setup"
|
||||
unless="jdk.tgz.downloaded">
|
||||
|
||||
<!-- we normally download a JRE, except on arm -->
|
||||
<property name="jre.download.jdk" value="false" />
|
||||
<property name="jdk.download.jdk" value="true" />
|
||||
|
||||
<condition property="jre.downloader"
|
||||
value="${platform}-i586.tar.gz">
|
||||
<equals arg1="${sun.arch.data.model}" arg2="32" />
|
||||
<condition property="jdk.downloader"
|
||||
value="${target-platform}-i586.tar.gz">
|
||||
<equals arg1="${jdk.data.model}" arg2="32" />
|
||||
</condition>
|
||||
<condition property="jre.downloader"
|
||||
value="${platform}-x64.tar.gz">
|
||||
<equals arg1="${sun.arch.data.model}" arg2="64" />
|
||||
<condition property="jdk.downloader"
|
||||
value="${target-platform}-x64.tar.gz">
|
||||
<equals arg1="${jdk.data.model}" arg2="64" />
|
||||
</condition>
|
||||
|
||||
<downloader version="${jdk.version}"
|
||||
<downloader train="${jdk.train}"
|
||||
version="${jdk.version}"
|
||||
openJdk="true"
|
||||
platform="${target-platform}${jdk.data.model}"
|
||||
update="${jdk.update}"
|
||||
build="${jdk.build}"
|
||||
hash="${jdk.hash}"
|
||||
jdk="${jre.download.jdk}"
|
||||
flavor="${jre.downloader}"
|
||||
path="${jre.tgz.path}" />
|
||||
component="JDK"
|
||||
flavor="${jdk.downloader}"
|
||||
path="${jdk.tgz.path}" />
|
||||
</target>
|
||||
|
||||
<target name="download-jdk-macosx" depends="downloader-setup">
|
||||
<downloader version="${jdk.version}"
|
||||
update="${jdk.update}"
|
||||
build="${jdk.build}"
|
||||
hash="${jdk.hash}"
|
||||
jdk="true"
|
||||
flavor="macosx-x64.dmg"
|
||||
path="${env.HOME}/Desktop/jdk-${jdk.short}.dmg" />
|
||||
<target name="jfx-download" depends="jfx-check, downloader-setup"
|
||||
unless="jfx.zip.downloaded">
|
||||
|
||||
<downloader train="${jfx.train}"
|
||||
version="${jfx.version}"
|
||||
openJdk="true"
|
||||
platform="${target-platform}${jdk.data.model}"
|
||||
update="${jfx.update}"
|
||||
build="1"
|
||||
hash="${jfx.hash}"
|
||||
component="JFX"
|
||||
flavor="${target-platform}${jdk.data.model}.zip"
|
||||
path="${jfx.path.zip}" />
|
||||
|
||||
</target>
|
||||
|
||||
<!-- code signing hack, turns on code signing during dist -->
|
||||
@@ -271,8 +413,7 @@
|
||||
</condition>
|
||||
|
||||
<!-- Set the version of Java that must be present to build. -->
|
||||
<property name="jdk.path.macosx"
|
||||
value="/Library/Java/JavaVirtualMachines/jdk${jdk.esoteric}.jdk" />
|
||||
<property name="jdk.path.macosx" value="macosx/jdk-${jdk.esoteric}+${jdk.build}" />
|
||||
|
||||
<available file="${jdk.path.macosx}" property="macosx_jdk_found" />
|
||||
|
||||
@@ -307,18 +448,40 @@
|
||||
</fileset>
|
||||
|
||||
<target name="build" description="Build Processing.">
|
||||
<antcall target="${platform}-build" />
|
||||
<settarget platform="${platform}" datamodel="${sun.arch.data.model}" />
|
||||
<antcall target="${target-platform}-build" />
|
||||
</target>
|
||||
|
||||
<target name="cross-build-macosx" description="Build Processing.">
|
||||
<settarget platform="macosx" datamodel="64" />
|
||||
<antcall target="macosx-build" />
|
||||
</target>
|
||||
|
||||
<target name="cross-build-linux-x64" description="Build Processing.">
|
||||
<settarget platform="linux" datamodel="64" />
|
||||
<antcall target="linux-build" />
|
||||
</target>
|
||||
|
||||
<target name="cross-build-linux-aarch64" description="Build Processing.">
|
||||
<settarget platform="linux" datamodel="Arm" />
|
||||
<antcall target="linux-build" />
|
||||
</target>
|
||||
|
||||
<target name="cross-build-windows" description="Build Processing.">
|
||||
<settarget platform="windows" datamodel="64" />
|
||||
<antcall target="windows-build" />
|
||||
</target>
|
||||
|
||||
<target name="run" description="Run Processing.">
|
||||
<antcall target="${platform}-run" />
|
||||
<settarget platform="${platform}" datamodel="${sun.arch.data.model}" />
|
||||
<antcall target="${target-platform}-run" />
|
||||
</target>
|
||||
|
||||
<!-- Run the app in a more "native" manner, i.e. no additional
|
||||
console for debugging. Ensures that double-clicking shortcuts
|
||||
and other desktop integration features work properly. -->
|
||||
<target name="app" description="Run Processing w/o console.">
|
||||
<antcall target="${platform}-run-app" />
|
||||
<antcall target="${target-platform}-run-app" />
|
||||
</target>
|
||||
|
||||
<target name="dist" depends="revision-check"
|
||||
@@ -335,7 +498,7 @@
|
||||
<arg line="pull" />
|
||||
</exec>
|
||||
|
||||
<antcall target="${platform}-dist" />
|
||||
<antcall target="${target-platform}-dist" />
|
||||
</target>
|
||||
|
||||
<!-- "§$§$&, ant doesn't have a built-in help target :( -->
|
||||
@@ -506,27 +669,51 @@
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target name="macosx-check-os" unless="macosx">
|
||||
<echo>
|
||||
=======================================================
|
||||
Processing for Mac OS X can only be built on Mac OS X.
|
||||
<target name="macosx-check-os">
|
||||
<if>
|
||||
<equals arg1="${host-platform}" arg2="windows" />
|
||||
<then>
|
||||
<echo>
|
||||
=======================================================
|
||||
Processing for Mac can only be built on *nix systems.
|
||||
|
||||
Bye.
|
||||
=======================================================
|
||||
</echo>
|
||||
<fail message="wrong platform (${os.name})" />
|
||||
Bye.
|
||||
=======================================================
|
||||
</echo>
|
||||
|
||||
<fail message="wrong platform (${os.name})" />
|
||||
</then>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<target name="macosx-build" if="macosx" depends="revision-check, macosx-check-os, subprojects-build" description="Build Mac OS X version">
|
||||
|
||||
<!-- Require that a JDK be installed, but call this on build, so that
|
||||
the download-jdk-macosx target can be called. -->
|
||||
<fail unless="macosx_jdk_found"
|
||||
message="JDK ${jdk.short} required.${line.separator}To build on OS X, you must install Oracle's JDK ${jdk.short} from${line.separator}http://www.oracle.com/technetwork/java/javase/downloads${line.separator}Or... type 'ant download-jdk-macosx' to download it to your Desktop.${line.separator}Note that only ${jdk.short} (not a later or earlier version) will work. ${line.separator}And it must be the JDK, not the JRE. And do not try to defy me again." />
|
||||
|
||||
<target name="macosx-build" depends="revision-check, macosx-check-os, subprojects-build, jdk-download, jfx-download" description="Build Mac OS X version">
|
||||
<mkdir dir="macosx/work" />
|
||||
|
||||
<!-- app bundler for OS X and Java 1.7 -->
|
||||
<!-- Extract JDK -->
|
||||
<echo message="Target jdk: ${jdk.tgz.path}"/>
|
||||
<exec executable="tar" dir="macosx">
|
||||
<!-- Change directory -->
|
||||
<!--
|
||||
<arg value="-C" />
|
||||
<arg value="linux/work" />
|
||||
<arg value="-xzpf" />
|
||||
-->
|
||||
<arg value="xfz" />
|
||||
<arg value="../${jdk.tgz.path}"/>
|
||||
</exec>
|
||||
|
||||
<condition property="jdk.dir" value="macosx/work/jdk-${jdk.esoteric}+${jdk.build}.jdk">
|
||||
<equals arg1="${jdk.train}" arg2="1" />
|
||||
</condition>
|
||||
|
||||
<!-- Force full JDK when not on train 1 (starts with java 11) -->
|
||||
<condition property="jdk.dir" value="macosx/work/jdk-${jdk.esoteric}+${jdk.build}.jdk/">
|
||||
<not>
|
||||
<equals arg1="${jdk.train}" arg2="1" />
|
||||
</not>
|
||||
</condition>
|
||||
|
||||
<!-- app bundler for OS X and Java -->
|
||||
<taskdef name="bundleapp"
|
||||
classname="com.oracle.appbundler.AppBundlerTask"
|
||||
classpath="macosx/appbundler.jar" />
|
||||
@@ -539,20 +726,17 @@
|
||||
signature="Pde3"
|
||||
icon="macosx/processing.icns"
|
||||
copyright="© The Processing Foundation"
|
||||
getInfo="${version}, Copyright © The Processing Foundation"
|
||||
shortVersion="${version}"
|
||||
version="${revision}"
|
||||
javafx="true"
|
||||
minimumSystem="10.8.5"
|
||||
mainClassName="processing.app.BaseSplash">
|
||||
|
||||
<!-- The appbundler task needs a couple files (the Info.plist and
|
||||
anything else outside /jre) from the full JDK, even though
|
||||
anything else outside /jdk) from the full JDK, even though
|
||||
it's primarily copying over the JRE folder. -->
|
||||
<runtime dir="${jdk.path.macosx}/Contents/Home" />
|
||||
<!-- Eventually we'll want to load the JRE directly from
|
||||
the .tgz on the Oracle site, though it's in a folder called
|
||||
jre1.7.0_40.jre, so we'll need to strip that out. -->
|
||||
jdk1.7.0_40.jdk, so we'll need to strip that out. -->
|
||||
|
||||
<!-- Same as runtime.jars, seen above; plus core.jar. -->
|
||||
<classpath file="../app/pde.jar" />
|
||||
@@ -599,7 +783,7 @@
|
||||
<option value="-Djna.nosys=true" />
|
||||
|
||||
<!-- deal with jokers who install JOGL, ANTLR, etc system-wide -->
|
||||
<option value="-Djava.ext.dirs=$APP_ROOT/Contents/PlugIns/jdk${jdk.esoteric}.jdk/Contents/Home/jre/lib/ext" />
|
||||
<!--<option value="-Djava.ext.dirs=$APP_ROOT/Contents/PlugIns/adoptopenjdk-11.0.1.jdk/Contents/Home/lib/ext" />-->
|
||||
|
||||
<option value="-Dapple.laf.useScreenMenuBar=true" />
|
||||
<option value="-Dcom.apple.macos.use-file-dialog-packages=true" />
|
||||
@@ -627,6 +811,8 @@
|
||||
-->
|
||||
</bundleapp>
|
||||
|
||||
<mkdir dir="macosx/work/Processing.app/Contents/Java/Classes" />
|
||||
|
||||
<!-- Temporary fix until new appbundler is included again after solving
|
||||
https://github.com/processing/processing/issues/3359
|
||||
https://github.com/processing/processing/issues/3360
|
||||
@@ -636,7 +822,23 @@
|
||||
Also, because Ant's copy task does not retain file permissions on
|
||||
Unix systems, we need to use <exec executable="cp" ... > instead -->
|
||||
<exec executable="cp">
|
||||
<arg line="${jdk.path.macosx}/Contents/Home/bin/keytool macosx/work/Processing.app/Contents/PlugIns/jdk${jdk.esoteric}.jdk/Contents/Home/jre/bin"/>
|
||||
<arg value="-r"/>
|
||||
<arg line="${jdk.path.macosx}/Contents/Home/bin macosx/work/Processing.app/Contents/PlugIns/${jdk.prefix}-${jdk.esoteric}+${jdk.build}/Contents/Home/bin"/>
|
||||
</exec>
|
||||
|
||||
<exec executable="cp">
|
||||
<arg value="-r"/>
|
||||
<arg line="${jdk.path.macosx}/Contents/Home/jmods macosx/work/Processing.app/Contents/PlugIns/${jdk.prefix}-${jdk.esoteric}+${jdk.build}/Contents/Home/jmods"/>
|
||||
</exec>
|
||||
|
||||
<exec executable="cp">
|
||||
<arg value="-r"/>
|
||||
<arg line="${jdk.path.macosx}/Contents/Home/legal macosx/work/Processing.app/Contents/PlugIns/${jdk.prefix}-${jdk.esoteric}+${jdk.build}/Contents/Home/legal"/>
|
||||
</exec>
|
||||
|
||||
<exec executable="cp">
|
||||
<arg value="-r"/>
|
||||
<arg line="${jdk.path.macosx}/Contents/Home/conf macosx/work/Processing.app/Contents/PlugIns/${jdk.prefix}-${jdk.esoteric}+${jdk.build}/Contents/Home/conf"/>
|
||||
</exec>
|
||||
|
||||
<property name="contents.dir"
|
||||
@@ -644,10 +846,10 @@
|
||||
|
||||
<!-- Replace libjli.dylib symlink with actual file.
|
||||
Deals with code signing issues on OS X 10.9.5+ -->
|
||||
<property name="jli.path" value="${contents.dir}/PlugIns/jdk${jdk.esoteric}.jdk/Contents/MacOS/libjli.dylib" />
|
||||
<property name="jli.path" value="${contents.dir}/PlugIns/${jdk.prefix}-${jdk.esoteric}+${jdk.build}/Contents/MacOS/libjli.dylib" />
|
||||
<delete file="${jli.path}" />
|
||||
<exec executable="cp">
|
||||
<arg line="${jdk.path.macosx}/Contents/Home/jre/lib/jli/libjli.dylib ${jli.path}"/>
|
||||
<arg line="${jdk.path.macosx}/Contents/Home/lib/jli/libjli.dylib ${jli.path}"/>
|
||||
</exec>
|
||||
|
||||
<copy todir="${contents.dir}/Java" preservelastmodified="true">
|
||||
@@ -657,6 +859,27 @@
|
||||
<fileset file="shared/revisions.txt" />
|
||||
</copy>
|
||||
|
||||
<preparejfx />
|
||||
|
||||
<!-- Pull in OpenJFX (separated from mainline Java in JDK 11). -->
|
||||
<if>
|
||||
<equals arg1="${jfx.available}" arg2="true" />
|
||||
<then>
|
||||
|
||||
<copy todir="macosx/work/Processing.app/Contents/Java/core/library" overwrite="true">
|
||||
<fileset dir="${jfx.path.lib}" includes="*.jar"/>
|
||||
<fileset dir="${jfx.path.lib}" includes="*.dylib"/>
|
||||
</copy>
|
||||
|
||||
<mkdir dir="macosx/work/Processing.app/Contents/PlugIns/${jdk.prefix}-${jdk.esoteric}+${jdk.build}/Contents/Home/legal/openjfx" />
|
||||
|
||||
<copy todir="macosx/work/Processing.app/Contents/PlugIns/${jdk.prefix}-${jdk.esoteric}+${jdk.build}/Contents/Home/legal/openjfx" overwrite="true">
|
||||
<fileset dir="${jfx.path.dist}/legal" includes="**"/>
|
||||
</copy>
|
||||
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<!-- Use the Processing executable as the stub for exported apps.
|
||||
This works b/c everything app-specific is in Info.plist. -->
|
||||
<property name="app.stub" value="${contents.dir}/Java/modes/java/application/mac-app-stub" />
|
||||
@@ -671,6 +894,10 @@
|
||||
<param name="target.path" value="${contents.dir}/Java" />
|
||||
</antcall>
|
||||
|
||||
<delete failonerror="true">
|
||||
<fileset refid="jdk-optional-macosx" />
|
||||
</delete>
|
||||
|
||||
<exec executable="macosx/language_gen.py" />
|
||||
|
||||
<property name="launch4j.dir" value="${contents.dir}/Java/modes/java/application/launch4j" />
|
||||
@@ -690,6 +917,7 @@
|
||||
<fileset dir="${launch4j.dir}/bin" includes="ld-*" />
|
||||
<fileset dir="${launch4j.dir}/bin" includes="windres-*" />
|
||||
</delete>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="macosx-run" depends="macosx-build"
|
||||
@@ -723,7 +951,7 @@
|
||||
<arg value="--force" />
|
||||
<arg value="--sign" />
|
||||
<arg value="Developer ID Application" />
|
||||
<arg value="Processing.app/Contents/PlugIns/jdk${jdk.esoteric}.jdk" />
|
||||
<arg value="Processing.app/Contents/PlugIns/jdk-${jdk.esoteric}+${jdk.build}" />
|
||||
</exec>
|
||||
|
||||
<exec executable="/usr/bin/codesign" dir="macosx/work">
|
||||
@@ -777,19 +1005,24 @@
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target name="linux-check-os" unless="linux">
|
||||
<echo>
|
||||
=======================================================
|
||||
Processing for Linux can only be built on *nix systems.
|
||||
<target name="linux-check-os">
|
||||
<if>
|
||||
<equals arg1="${host-platform}" arg2="windows" />
|
||||
<then>
|
||||
<echo>
|
||||
=======================================================
|
||||
Processing for Linux can only be built on *nix systems.
|
||||
|
||||
Bye.
|
||||
=======================================================
|
||||
</echo>
|
||||
Bye.
|
||||
=======================================================
|
||||
</echo>
|
||||
|
||||
<fail message="wrong platform (${os.name})" />
|
||||
<fail message="wrong platform (${os.name})" />
|
||||
</then>
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<target name="linux-build" depends="ignore-tools, check-linux-arm32, check-linux-arm64, revision-check, linux-check-os, jre-download, subprojects-build, subprojects-build-linux-arm32, subprojects-build-linux-arm64" description="Build Linux version">
|
||||
<target name="linux-build" depends="ignore-tools, check-linux-arm32, check-linux-arm64, revision-check, linux-check-os, jdk-download, jfx-download, subprojects-build, subprojects-build-linux-arm32, subprojects-build-linux-arm64" description="Build Linux version">
|
||||
<mkdir dir="linux/work" />
|
||||
|
||||
<copy todir="linux/work" preservelastmodified="true">
|
||||
@@ -829,6 +1062,25 @@
|
||||
<fileset refid="runtime.jars" />
|
||||
</copy>
|
||||
|
||||
<preparejfx />
|
||||
|
||||
<!-- Pull in OpenJFX (separated from mainline Java in JDK 11). -->
|
||||
<if>
|
||||
<equals arg1="${jfx.available}" arg2="true" />
|
||||
<then>
|
||||
<copy todir="linux/work/core/library" overwrite="true">
|
||||
<fileset dir="${jfx.path.lib}" includes="*.jar"/>
|
||||
<fileset dir="${jfx.path.lib}" includes="*.so"/>
|
||||
</copy>
|
||||
|
||||
<mkdir dir="linux/work/core/java/legal/openjfx" />
|
||||
|
||||
<copy todir="linux/work/core/java/legal/openjfx" overwrite="true">
|
||||
<fileset dir="${jfx.path.dist}/legal" includes="**"/>
|
||||
</copy>
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<copy file="linux/processing" todir="linux/work" />
|
||||
<chmod perm="ugo+x" file="linux/work/processing" />
|
||||
|
||||
@@ -860,7 +1112,7 @@
|
||||
Cannot use ant version of tar because it doesn't preserve properties.
|
||||
<untar compression="gzip"
|
||||
dest="linux/work"
|
||||
src="linux/jre.tgz"
|
||||
src="linux/jdk.tgz"
|
||||
overwrite="false"/>
|
||||
-->
|
||||
|
||||
@@ -875,37 +1127,52 @@
|
||||
<arg value="-xzpf" />
|
||||
-->
|
||||
<arg value="xfz" />
|
||||
<arg value="../${jre.tgz.path}"/>
|
||||
<arg value="../${jdk.tgz.path}"/>
|
||||
</exec>
|
||||
|
||||
<!-- use the jre subfolder when having downloaded a JDK file -->
|
||||
<condition property="jre.dir" value="jdk${jdk.esoteric}/jre">
|
||||
<!-- use the jdk subfolder when having downloaded a JDK file -->
|
||||
<condition property="jdk.dir" value="jdk${jdk.esoteric}">
|
||||
<!-- property might not be set, but it is for arm -->
|
||||
<equals arg1="${jre.download.jdk}" arg2="true" />
|
||||
<and>
|
||||
<equals arg1="${jdk.download.jdk}" arg2="true" />
|
||||
<equals arg1="${jdk.train}" arg2="1" />
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="jre.dir" value="jre${jdk.esoteric}">
|
||||
|
||||
<!-- use top level JRE otherwise -->
|
||||
<condition property="jdk.dir" value="jdk${jdk.esoteric}">
|
||||
<and>
|
||||
<not>
|
||||
<equals arg1="${jdk.download.jdk}" arg2="true" />
|
||||
</not>
|
||||
<equals arg1="${jdk.train}" arg2="1" />
|
||||
</and>
|
||||
</condition>
|
||||
|
||||
<!-- Force full JDK when not on train 1 (starts with java 11) -->
|
||||
<condition property="jdk.dir" value="jdk-${jdk.esoteric}+${jdk.build}/">
|
||||
<not>
|
||||
<equals arg1="${jre.download.jdk}" arg2="true" />
|
||||
<equals arg1="${jdk.train}" arg2="1" />
|
||||
</not>
|
||||
</condition>
|
||||
|
||||
<exec executable="rsync" dir="linux">
|
||||
<arg value="-a" />
|
||||
<arg value="--delete" />
|
||||
<arg value="${jre.dir}/" />
|
||||
<arg value="${jdk.dir}" />
|
||||
<arg value="work/java/" />
|
||||
</exec>
|
||||
|
||||
<delete dir="linux/jre${jdk.esoteric}" failonerror="false" />
|
||||
<delete dir="linux/jdk${jdk.esoteric}" failonerror="false" />
|
||||
<delete dir="linux/jdk${jdk.esoteric}" failonerror="false" />
|
||||
|
||||
<!-- Remove unused JRE bloat. -->
|
||||
<delete failonerror="true">
|
||||
<!--
|
||||
<fileset refid="javafx-basics" />
|
||||
<fileset refid="javafx-linux-${sun.arch.data.model}" />
|
||||
<fileset refid="javafx-linux-${jdk.data.model}" />
|
||||
-->
|
||||
<fileset refid="jre-optional-linux" />
|
||||
<fileset refid="jdk-optional-linux" />
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
@@ -926,7 +1193,7 @@
|
||||
<!-- rename the work folder temporarily -->
|
||||
<move file="linux/work" tofile="linux/processing-${version}" />
|
||||
|
||||
<property name="linux.dist" value="linux/processing-${version}-linux${sun.arch.data.model}.tgz" />
|
||||
<property name="linux.dist" value="linux/processing-${version}-linux${jdk.data.model}.tgz" />
|
||||
|
||||
<exec executable="tar">
|
||||
<arg value="--directory=linux" />
|
||||
@@ -985,7 +1252,7 @@
|
||||
<condition property="linux.deb" value="linux/processing-${version}-linux-arm64.deb">
|
||||
<equals arg1="${linux-arm64}" arg2="linux-arm64" />
|
||||
</condition>
|
||||
<property name="linux.deb" value="linux/processing-${version}-linux${sun.arch.data.model}.deb" />
|
||||
<property name="linux.deb" value="linux/processing-${version}-linux${jdk.data.model}.deb" />
|
||||
|
||||
<!-- Raspbian seems to borrow armhf for armv6hf, so this works -->
|
||||
<condition property="deb.arch" value="armhf">
|
||||
@@ -995,10 +1262,10 @@
|
||||
<equals arg1="${linux-arm64}" arg2="linux-arm64" />
|
||||
</condition>
|
||||
<condition property="deb.arch" value="i386">
|
||||
<equals arg1="${sun.arch.data.model}" arg2="32" />
|
||||
<equals arg1="${jdk.data.model}" arg2="32" />
|
||||
</condition>
|
||||
<condition property="deb.arch" value="amd64">
|
||||
<equals arg1="${sun.arch.data.model}" arg2="64" />
|
||||
<equals arg1="${jdk.data.model}" arg2="64" />
|
||||
</condition>
|
||||
|
||||
<length property="deb.bsize" >
|
||||
@@ -1064,18 +1331,10 @@
|
||||
</target>
|
||||
|
||||
<target name="windows-check-os" unless="windows">
|
||||
<echo>
|
||||
=======================================================
|
||||
Processing for Windows can only be built on windows.
|
||||
|
||||
Bye.
|
||||
=======================================================
|
||||
</echo>
|
||||
|
||||
<fail message="wrong platform (${os.name})" />
|
||||
<!-- Left for consistency. Windows can be built on mac, linux, or windows. -->
|
||||
</target>
|
||||
|
||||
<target name="windows-build" depends="ignore-tools, revision-check, windows-check-os, jre-download, subprojects-build" description="Build Windows version">
|
||||
<target name="windows-build" depends="ignore-tools, revision-check, windows-check-os, jdk-download, jfx-download, subprojects-build" description="Build Windows version">
|
||||
<mkdir dir="windows/work" />
|
||||
|
||||
<!-- assemble the pde -->
|
||||
@@ -1088,10 +1347,10 @@
|
||||
https://github.com/processing/processing/issues/3624 -->
|
||||
|
||||
<condition property="jna.subfolder" value="win32-x86">
|
||||
<equals arg1="${sun.arch.data.model}" arg2="32" />
|
||||
<equals arg1="${jdk.data.model}" arg2="32" />
|
||||
</condition>
|
||||
<condition property="jna.subfolder" value="win32-x86-64">
|
||||
<equals arg1="${sun.arch.data.model}" arg2="64" />
|
||||
<equals arg1="${jdk.data.model}" arg2="64" />
|
||||
</condition>
|
||||
|
||||
<unzip src="../app/lib/jna.jar" dest="windows/work/lib">
|
||||
@@ -1109,6 +1368,34 @@
|
||||
<fileset file="shared/revisions.txt" />
|
||||
</copy>
|
||||
|
||||
<preparejfx />
|
||||
|
||||
<!-- Pull in OpenJFX (separated from mainline Java in JDK 11). -->
|
||||
<if>
|
||||
<equals arg1="${jfx.available}" arg2="true" />
|
||||
<then>
|
||||
|
||||
<!-- Use native copy command due to binary file corruption. See
|
||||
https://ant.apache.org/manual/Tasks/copy.html#encoding. Extraneous
|
||||
files removed later. -->
|
||||
|
||||
<nativecopy
|
||||
src="${jfx.path.lib}/*.jar"
|
||||
dest="windows/work/core/library" />
|
||||
|
||||
<nativecopy
|
||||
src="${jfx.path.dist}/bin/*.dll"
|
||||
dest="windows/work/core/library" />
|
||||
|
||||
<mkdir dir="windows/work/java/legal/openjfx" />
|
||||
|
||||
<copy todir="windows/work/java/legal/openjfx" overwrite="true">
|
||||
<fileset dir="${jfx.path.dist}/legal" includes="**"/>
|
||||
</copy>
|
||||
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<fixcrlf file="windows/work/revisions.txt" eol="crlf" encoding="UTF-8" />
|
||||
|
||||
<antcall target="assemble">
|
||||
@@ -1123,12 +1410,31 @@
|
||||
<move file="${launch4j.dir}/bin/ld-windows.exe"
|
||||
tofile="${launch4j.dir}/bin/ld.exe" />
|
||||
|
||||
<!-- remove the others -->
|
||||
<delete failonerror="true">
|
||||
<fileset dir="${launch4j.dir}/bin" includes="ld-*" />
|
||||
<fileset dir="${launch4j.dir}/bin" includes="windres-*" />
|
||||
</delete>
|
||||
<!-- check for cross-build -->
|
||||
<if>
|
||||
<not><equals arg1="${host-platform}" arg2="windows" /></not>
|
||||
<then>
|
||||
|
||||
<move file="${launch4j.dir}/bin/windres-${host-platform}"
|
||||
tofile="${launch4j.dir}/bin/windres" />
|
||||
|
||||
<move file="${launch4j.dir}/bin/ld-${host-platform}"
|
||||
tofile="${launch4j.dir}/bin/ld" />
|
||||
|
||||
<exec executable="chmod">
|
||||
<arg value="+x"/>
|
||||
<arg line="${launch4j.dir}/bin/windres"/>
|
||||
</exec>
|
||||
|
||||
<exec executable="chmod">
|
||||
<arg value="+x"/>
|
||||
<arg line="${launch4j.dir}/bin/ld"/>
|
||||
</exec>
|
||||
|
||||
</then>
|
||||
</if>
|
||||
|
||||
<!-- Execute launch4j task -->
|
||||
<taskdef name="launch4j"
|
||||
classname="net.sf.launch4j.ant.Launch4jTask"
|
||||
classpath="${launch4j.dir}/launch4j.jar; ${launch4j.dir}/lib/xstream.jar" />
|
||||
@@ -1138,6 +1444,14 @@
|
||||
<launch4j configFile="windows/config.xml" />
|
||||
<launch4j configFile="windows/config-cmd.xml" />
|
||||
|
||||
<!-- remove the other launch4j executables -->
|
||||
<delete failonerror="true">
|
||||
<fileset dir="${launch4j.dir}/bin" includes="ld-*" />
|
||||
<fileset dir="${launch4j.dir}/bin" includes="windres-*" />
|
||||
<fileset dir="${launch4j.dir}/bin" includes="windres" />
|
||||
<fileset dir="${launch4j.dir}/bin" includes="ld" />
|
||||
</delete>
|
||||
|
||||
<!-- cygwin requires html, dll, and exe to have the +x flag -->
|
||||
<chmod perm="ugo+x">
|
||||
<fileset dir="windows/work" includes="**/*.html, **/*.dll, **/*.exe" />
|
||||
@@ -1145,22 +1459,32 @@
|
||||
|
||||
<!-- starting with 2.0a7, require the local JRE + tools.jar -->
|
||||
<!--
|
||||
<get src="http://download.processing.org/java/${jre.file}"
|
||||
dest="windows/jre.tgz"
|
||||
<get src="http://download.processing.org/java/${jdk.file}"
|
||||
dest="windows/jdk.tgz"
|
||||
usetimestamp="true" />
|
||||
-->
|
||||
|
||||
<!--
|
||||
<unzip dest="windows/work" src="windows/jre.zip" overwrite="false"/>
|
||||
<unzip dest="windows/work" src="windows/jdk.zip" overwrite="false"/>
|
||||
-->
|
||||
<!-- Hopefully this is OK with the permissions (unlike Linux),
|
||||
since those shouldn't matter on Windows. -->
|
||||
<untar compression="gzip"
|
||||
dest="windows/work"
|
||||
src="${jre.tgz.path}"
|
||||
<unzip dest="windows/work"
|
||||
src="${jdk.tgz.path}"
|
||||
overwrite="false" />
|
||||
<move file="windows/work/jre${jdk.esoteric}"
|
||||
tofile="windows/work/java" />
|
||||
|
||||
<condition property="jdk.dir" value="windows/work/jdk${jdk.esoteric}">
|
||||
<equals arg1="${jdk.train}" arg2="1" />
|
||||
</condition>
|
||||
|
||||
<!-- Force full JDK when not on train 1 (starts with java 11) -->
|
||||
<condition property="jdk.dir" value="windows/work/jdk-${jdk.esoteric}+${jdk.build}/">
|
||||
<not>
|
||||
<equals arg1="${jdk.train}" arg2="1" />
|
||||
</not>
|
||||
</condition>
|
||||
|
||||
<move file="${jdk.dir}" tofile="windows/work/java" />
|
||||
|
||||
<!-- Remove unused JRE bloat. -->
|
||||
<delete failonerror="true">
|
||||
@@ -1168,7 +1492,7 @@
|
||||
<fileset refid="javafx-basics" />
|
||||
<fileset refid="javafx-windows" />
|
||||
-->
|
||||
<fileset refid="jre-optional-windows" />
|
||||
<fileset refid="jdk-optional-windows" />
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
@@ -1190,7 +1514,7 @@
|
||||
excludes="java/**" />
|
||||
-->
|
||||
|
||||
<property name="windows.dist" value="windows/processing-${version}-windows${sun.arch.data.model}.zip" />
|
||||
<property name="windows.dist" value="windows/processing-${version}-windows${jdk.data.model}.zip" />
|
||||
|
||||
<zip destfile="${windows.dist}">
|
||||
<zipfileset dir="windows/work"
|
||||
|
||||
+53
-31
@@ -1,49 +1,71 @@
|
||||
<project name="downloader" default="dist">
|
||||
|
||||
<target name="compile">
|
||||
<mkdir dir="bin" />
|
||||
<path id="classpath.base">
|
||||
<!-- kinda gross, but if not using the JDT, this just ignored anyway -->
|
||||
<pathelement location="${jdt.jar};" />
|
||||
<pathelement location="${java.mode}/jdtCompilerAdapter.jar" />
|
||||
</path>
|
||||
|
||||
<!-- Where can I expect to find Java Mode JARs? -->
|
||||
<property name="java.mode" value="../../java/mode/" />
|
||||
|
||||
<!-- Check for JDT compiler, since this is likely a PDE build. Using
|
||||
it allows us to build the PDE with only a JRE on Windows and Linux.
|
||||
So that the core can be built independently of the PDE,
|
||||
use javac (the "modern" compiler) if ecj is not present. -->
|
||||
<property name="jdt.jar" value="${java.mode}/org.eclipse.jdt.core.jar" />
|
||||
<condition property="build.compiler"
|
||||
value="org.eclipse.jdt.core.JDTCompilerAdapter"
|
||||
else="modern">
|
||||
<available file="${jdt.jar}" />
|
||||
</condition>
|
||||
<!--<echo message="compiler is ${build.compiler}" />-->
|
||||
<path id="classpath.test">
|
||||
<pathelement location="../../core/library-test/junit-4.8.1.jar" />
|
||||
<pathelement location = "bin-test" />
|
||||
<path refid="classpath.base" />
|
||||
</path>
|
||||
|
||||
<javac source="1.8"
|
||||
target="1.8"
|
||||
srcdir="src"
|
||||
destdir="bin"
|
||||
debug="true"
|
||||
includeantruntime="true"
|
||||
nowarn="true">
|
||||
<!-- kinda gross, but if not using the JDT, this just ignored anyway -->
|
||||
<compilerclasspath path="${jdt.jar}; ${java.mode}/jdtCompilerAdapter.jar" />
|
||||
</javac>
|
||||
<macrodef name="compilecommon">
|
||||
<attribute name="destdir"/>
|
||||
<attribute name="srcdir"/>
|
||||
<attribute name="classpath"/>
|
||||
<sequential>
|
||||
<mkdir dir="@{destdir}" />
|
||||
|
||||
<!-- Where can I expect to find Java Mode JARs? -->
|
||||
<property name="java.mode" value="../../java/mode/" />
|
||||
|
||||
<javac source="1.8"
|
||||
target="1.8"
|
||||
srcdir="@{srcdir}"
|
||||
destdir="@{destdir}"
|
||||
debug="true"
|
||||
includeantruntime="true"
|
||||
nowarn="true">
|
||||
<classpath refid="@{classpath}"/>
|
||||
</javac>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<target name="test-compile">
|
||||
<compilecommon srcdir="src; test" destdir="bin-test" classpath="classpath.test" />
|
||||
</target>
|
||||
|
||||
|
||||
<target name="test" depends="test-compile">
|
||||
<junit haltonfailure="true">
|
||||
<classpath refid="classpath.test" />
|
||||
<formatter type="brief" usefile="false" />
|
||||
<test name="AdoptOpenJdkDownloadUrlGeneratorTest" />
|
||||
<test name="OracleDownloadUrlGeneratorTest" />
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
<target name="compile" depends="test">
|
||||
<compilecommon srcdir="src" destdir="bin" classpath="classpath.base" />
|
||||
</target>
|
||||
|
||||
<target name="dist" depends="compile">
|
||||
<jar basedir="bin" destfile="downloader.jar" />
|
||||
</target>
|
||||
|
||||
|
||||
<target name="demo" depends="dist">
|
||||
<taskdef name="downloader"
|
||||
<taskdef name="downloader"
|
||||
classname="Downloader"
|
||||
classpath="downloader.jar" />
|
||||
<downloader version="8" update="31" build="13"
|
||||
<downloader version="8" update="31" build="13"
|
||||
jdk="true" flavor="macosx-x64.dmg" />
|
||||
</target>
|
||||
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="bin" />
|
||||
<delete dir="bin-test" />
|
||||
<delete file="downloader.jar" />
|
||||
</target>
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2019 The Processing Foundation
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2, as published by the Free Software Foundation.
|
||||
|
||||
This program 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* Utility to generate download URLs from AdoptOpenJDK.
|
||||
*/
|
||||
public class AdoptOpenJdkDownloadUrlGenerator extends DownloadUrlGenerator {
|
||||
|
||||
private static final String BASE_URL = "https://github.com/AdoptOpenJDK/openjdk%d-binaries/releases/download/jdk-%d.%d.%d%%2B%d/OpenJDK%dU-%s_%d.%d.%d_%d.%s";
|
||||
|
||||
@Override
|
||||
public String buildUrl(String platform, String component, int train, int version, int update,
|
||||
int build, String flavor, String hash) {
|
||||
|
||||
if (!component.equalsIgnoreCase("jdk")) {
|
||||
throw new RuntimeException("Can only generate JDK download URLs for AdoptOpenJDK.");
|
||||
}
|
||||
|
||||
String filename = buildDownloadRemoteFilename(platform);
|
||||
String fileExtension = buildFileExtension(platform);
|
||||
return String.format(
|
||||
BASE_URL,
|
||||
train,
|
||||
train,
|
||||
version,
|
||||
update,
|
||||
build,
|
||||
train,
|
||||
filename,
|
||||
train,
|
||||
version,
|
||||
update,
|
||||
build,
|
||||
fileExtension
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a the filename (the "flavor") that is expected on AdoptOpenJDK.
|
||||
*
|
||||
* @param downloadPlatform The platform for which the download URL is being generated like
|
||||
* "macos" or "linux64".
|
||||
* @return The artifact name without extension like "jdk_x64_mac_hotspot".
|
||||
*/
|
||||
private String buildDownloadRemoteFilename(String downloadPlatform) {
|
||||
switch (downloadPlatform.toLowerCase()) {
|
||||
case "windows32": return "jdk_x86-32_windows_hotspot";
|
||||
case "windows64": return "jdk_x64_windows_hotspot";
|
||||
case "macosx64": return "jdk_x64_mac_hotspot";
|
||||
case "linux32": throw new RuntimeException("Linux32 not supported by AdoptOpenJDK.");
|
||||
case "linux64": return "jdk_x64_linux_hotspot";
|
||||
case "linuxarm": return "jdk_aarch64_linux_hotspot";
|
||||
default: throw new RuntimeException("Unknown platform: " + downloadPlatform);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the download file extension.
|
||||
*
|
||||
* @param downloadPlatform The platform for which the download URL is being generated like
|
||||
* "macos" or "linux64".
|
||||
* @return The file extension without leading period like "zip" or "tar.gz".
|
||||
*/
|
||||
private String buildFileExtension(String downloadPlatform) {
|
||||
return downloadPlatform.startsWith("windows") ? "zip" : "tar.gz";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2014-19 The Processing Foundation
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2, as published by the Free Software Foundation.
|
||||
|
||||
This program 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
/**
|
||||
* Data structure describing an item to be downloaded as part the Processing build.
|
||||
*/
|
||||
public class DownloadItem {
|
||||
|
||||
private String url;
|
||||
private String localPath;
|
||||
private Optional<String> cookie;
|
||||
|
||||
/**
|
||||
* Create a new download item.
|
||||
*
|
||||
* @param newUrl The remote URL at which the download can be found (via GET).
|
||||
* @param newLocalPath The local path to which the file should be written.
|
||||
* @param newCookie Optional cookie that, if present, should be given to the server along with the
|
||||
* GET request for the download contents.
|
||||
*/
|
||||
public DownloadItem(String newUrl, String newLocalPath, Optional<String> newCookie) {
|
||||
url = newUrl;
|
||||
localPath = newLocalPath;
|
||||
cookie = newCookie;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine where the download can be requested.
|
||||
*
|
||||
* @return The remote URL at which the download can be found (via GET).
|
||||
*/
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine to where the download should be saved.
|
||||
*
|
||||
* @return The local path to which the file should be written.
|
||||
*/
|
||||
public String getLocalPath() {
|
||||
return localPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if and what cookie should be given as part of the download request.
|
||||
*
|
||||
* @return Optional cookie that, if present, should be given to the server along with the
|
||||
* GET request for the download contents. Should be ignored otherwise.
|
||||
*/
|
||||
public Optional<String> getCookie() {
|
||||
return cookie;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2014-19 The Processing Foundation
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2, as published by the Free Software Foundation.
|
||||
|
||||
This program 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Abstract base class for strategy to generate download URLs.
|
||||
*/
|
||||
public abstract class DownloadUrlGenerator {
|
||||
|
||||
/**
|
||||
* Determine the URL at which the artifact can be downloaded.
|
||||
*
|
||||
* @param platform The platform for which the download URL is being generated like "macos" or
|
||||
* "linux64".
|
||||
* @param component The component to download like "JDK", "JRE", or "JFX".
|
||||
* @param train The JDK train (like 1 or 11).
|
||||
* @param version The JDK version (like 8 or 1).
|
||||
* @param update The update (like 13).
|
||||
* @param build The build number (like 133).
|
||||
* @param flavor The flavor like "macosx-x64.dmg".
|
||||
* @param hash The hash like "d54c1d3a095b4ff2b6607d096fa80163".
|
||||
*/
|
||||
public abstract String buildUrl(String platform, String component, int train, int version,
|
||||
int update, int build, String flavor, String hash);
|
||||
|
||||
/**
|
||||
* Get the cookie that should be used in downloading the target component.
|
||||
*
|
||||
* @return Optional that is empty if no cookie should be used or optional with the string cookie
|
||||
* value if one should be used.
|
||||
*/
|
||||
public Optional<String> getCookie() {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the name of the file to which the remote file should be saved.
|
||||
*
|
||||
* @param downloadPlatform The platform for which the download URL is being generated like
|
||||
* "macos" or "linux64".
|
||||
* @param component The component to download like "JDK", "JRE", or "JFX".
|
||||
* @param train The JDK train (like 1 or 11).
|
||||
* @param version The JDK version (like 8 or 1).
|
||||
* @param update The update (like 13).
|
||||
* @param build The build number (like 133).
|
||||
* @param flavor The flavor like "macosx-x64.dmg".
|
||||
* @param hash The hash like "d54c1d3a095b4ff2b6607d096fa80163".
|
||||
*/
|
||||
public String getLocalFilename(String downloadPlatform, String component, int train, int version,
|
||||
int update, int build, String flavor, String hash) {
|
||||
|
||||
String baseFilename = component.toLowerCase();
|
||||
|
||||
String versionStr;
|
||||
if (update == 0) {
|
||||
versionStr = String.format("-%d-%s", version, flavor);
|
||||
} else {
|
||||
versionStr = String.format("-%du%d-%s", version, update, flavor);
|
||||
}
|
||||
|
||||
return baseFilename + versionStr;
|
||||
}
|
||||
|
||||
}
|
||||
+231
-42
@@ -1,3 +1,24 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2014-19 The Processing Foundation
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2, as published by the Free Software Foundation.
|
||||
|
||||
This program 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.*;
|
||||
@@ -7,66 +28,134 @@ import org.apache.tools.ant.Task;
|
||||
|
||||
|
||||
/**
|
||||
* Ant Task for downloading the latest JRE or JDK from Oracle.
|
||||
* Ant Task for downloading the latest JRE, JDK, or OpenJFX release.
|
||||
*/
|
||||
public class Downloader extends Task {
|
||||
static final String COOKIE =
|
||||
"oraclelicense=accept-securebackup-cookie";
|
||||
private static final boolean PRINT_LOGGING = true;
|
||||
|
||||
private int version; // Java 8
|
||||
private boolean openJdk; // If using openJDK.
|
||||
private String platform; // macos
|
||||
private int train; // Java 11 (was 1 through Java 8)
|
||||
private int version; // 0 (was 8 prior to Java 9)
|
||||
private int update; // Update 131
|
||||
private int build; // Build 11
|
||||
// https://gist.github.com/P7h/9741922
|
||||
// http://stackoverflow.com/q/10268583
|
||||
private String hash; // d54c1d3a095b4ff2b6607d096fa80163
|
||||
|
||||
private boolean jdk; // false if JRE
|
||||
private String component; // "JRE", "JDK", or "JFX"
|
||||
|
||||
private String flavor;
|
||||
private String flavor; // Like "zip"
|
||||
|
||||
private String path; // target path
|
||||
|
||||
|
||||
/**
|
||||
* Create a new downloader without tag attributes filled in.
|
||||
**/
|
||||
public Downloader() { }
|
||||
|
||||
/**
|
||||
* Set the platform being used.
|
||||
*
|
||||
* @param platform The platfom for which files are being downloaded like macosx.
|
||||
*/
|
||||
public void setPlatform(String platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate if the OpenJDK is being used.
|
||||
*
|
||||
* @param openJdk True if OpenJDK is being used. False if Oracle JDK is being used.
|
||||
*/
|
||||
public void setOpenJdk(boolean openJdk) {
|
||||
this.openJdk = openJdk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the build train being used.
|
||||
*
|
||||
* @param train The build train like 1 (Java 8 and before) or 11 (Java 11).
|
||||
*/
|
||||
public void setTrain(int train) {
|
||||
this.train = train;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the version to download within the given build train.
|
||||
*
|
||||
* @param version The version within the train to use like 0 for "11.0.1_13".
|
||||
*/
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the update number to download within the given build train.
|
||||
*
|
||||
* @param update The update within the version to use like 1 for "11.0.1_13".
|
||||
*/
|
||||
public void setUpdate(int update) {
|
||||
this.update = update;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the build number to download.
|
||||
*
|
||||
* @param build The build number to use within the build train like 13 for "11.0.1_13".
|
||||
*/
|
||||
public void setBuild(int build) {
|
||||
this.build = build;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the expected hash of the download.
|
||||
*
|
||||
* @param hash The hash set.
|
||||
*/
|
||||
public void setHash(String hash) {
|
||||
this.hash = hash;
|
||||
}
|
||||
|
||||
|
||||
public void setJDK(boolean jdk) {
|
||||
this.jdk = jdk;
|
||||
/**
|
||||
* Indicate what component or release type of Java is being downloaded.
|
||||
*
|
||||
* @param component The component to download like "JDK", "JRE", or "OpenJFX".
|
||||
*/
|
||||
public void setComponent(String component) {
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Indicate the file flavor to be downloaded.
|
||||
*
|
||||
* @param flavor The flavor of file (dependent on platform) to be downloaded. Like "-x64.tar.gz".
|
||||
*/
|
||||
public void setFlavor(String flavor) {
|
||||
this.flavor = flavor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the path to which the file should be downloaded.
|
||||
*
|
||||
* @param path The path to which the file should be downloaded.
|
||||
*/
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Download the JDK or JRE.
|
||||
*/
|
||||
public void execute() throws BuildException {
|
||||
if (version == 0) {
|
||||
if (train == 0) {
|
||||
// 1 if prior to Java 9
|
||||
throw new BuildException("Train (i.e. 1 or 11) must be set");
|
||||
}
|
||||
|
||||
boolean isJava11 = train == 11;
|
||||
if (!isJava11 && version == 0) {
|
||||
throw new BuildException("Version (i.e. 7 or 8) must be set");
|
||||
}
|
||||
|
||||
@@ -90,33 +179,38 @@ public class Downloader extends Task {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Download the package from AdoptOpenJDK or Oracle.
|
||||
*/
|
||||
void download() throws IOException {
|
||||
String filename = (jdk ? "jdk" : "jre") +
|
||||
(update == 0 ?
|
||||
String.format("-%d-%s", version, flavor) :
|
||||
String.format("-%du%d-%s", version, update, flavor));
|
||||
DownloadItem downloadItem;
|
||||
|
||||
// Determine url generator for task
|
||||
Optional<DownloadItem> downloadItemMaybe = getDownloadItem();
|
||||
if (downloadItemMaybe.isEmpty()) {
|
||||
return; // There is nothing to do.
|
||||
} else {
|
||||
downloadItem = downloadItemMaybe.get();
|
||||
}
|
||||
|
||||
// Build URL and path
|
||||
if (path == null) {
|
||||
path = filename;
|
||||
path = downloadItem.getLocalPath();
|
||||
}
|
||||
|
||||
String url = "http://download.oracle.com/otn-pub/java/jdk/" +
|
||||
(update == 0 ?
|
||||
String.format("%d-b%02d/", version, build) :
|
||||
String.format("%du%d-b%02d/", version, update, build));
|
||||
String url = downloadItem.getUrl();
|
||||
|
||||
// URL format changed starting with 8u121
|
||||
if (update >= 121) {
|
||||
url += hash + "/";
|
||||
}
|
||||
|
||||
// Finally, add the filename to the end
|
||||
url += filename;
|
||||
// Downlaod
|
||||
println("Attempting download at " + url);
|
||||
|
||||
HttpURLConnection conn =
|
||||
(HttpURLConnection) new URL(url).openConnection();
|
||||
conn.setRequestProperty("Cookie", COOKIE);
|
||||
|
||||
Optional<String> cookieMaybe = downloadItem.getCookie();
|
||||
|
||||
if (cookieMaybe.isPresent()) {
|
||||
conn.setRequestProperty("Cookie", cookieMaybe.get());
|
||||
}
|
||||
|
||||
//printHeaders(conn);
|
||||
//conn.connect();
|
||||
@@ -125,7 +219,7 @@ public class Downloader extends Task {
|
||||
List<String> location = headers.get("Location");
|
||||
if (location.size() == 1) {
|
||||
url = location.get(0);
|
||||
System.out.println("Redirecting to " + url);
|
||||
println("Redirecting to " + url);
|
||||
} else {
|
||||
throw new BuildException("Got " + location.size() + " locations.");
|
||||
}
|
||||
@@ -136,7 +230,11 @@ public class Downloader extends Task {
|
||||
conn.setRequestProperty("Cookie", cookie);
|
||||
}
|
||||
}
|
||||
conn.setRequestProperty("Cookie", COOKIE);
|
||||
|
||||
if (cookieMaybe.isPresent()) {
|
||||
conn.setRequestProperty("Cookie", cookieMaybe.get());
|
||||
}
|
||||
|
||||
conn.connect();
|
||||
}
|
||||
|
||||
@@ -144,7 +242,10 @@ public class Downloader extends Task {
|
||||
InputStream input = conn.getInputStream();
|
||||
BufferedInputStream bis = new BufferedInputStream(input);
|
||||
File outputFile = new File(path); //folder, filename);
|
||||
System.out.format("Downloading %s from %s%n", outputFile.getAbsolutePath(), url);
|
||||
|
||||
String msg = String.format("Downloading %s from %s%n", outputFile.getAbsolutePath(), url);
|
||||
println(msg);
|
||||
|
||||
// Write to a temp file so that we don't have an incomplete download
|
||||
// masquerading as a good archive.
|
||||
File tempFile = File.createTempFile("download", "", outputFile.getParentFile());
|
||||
@@ -175,19 +276,107 @@ public class Downloader extends Task {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print the headers used for {URLConnection}.
|
||||
*/
|
||||
static void printHeaders(URLConnection conn) {
|
||||
Map<String, List<String>> headers = conn.getHeaderFields();
|
||||
Set<Map.Entry<String, List<String>>> entrySet = headers.entrySet();
|
||||
for (Map.Entry<String, List<String>> entry : entrySet) {
|
||||
String headerName = entry.getKey();
|
||||
System.out.println("Header Name:" + headerName);
|
||||
println("Header Name:" + headerName);
|
||||
List<String> headerValues = entry.getValue();
|
||||
for (String value : headerValues) {
|
||||
System.out.print("Header value:" + value);
|
||||
print("Header value:" + value);
|
||||
}
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
printEmptyLine();
|
||||
printEmptyLine();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item to be downloaded for this task.
|
||||
*
|
||||
* @return The to be downloaded or empty if there is no download required.
|
||||
*/
|
||||
private Optional<DownloadItem> getDownloadItem() {
|
||||
// Determine download type
|
||||
boolean isJavaDownload = component.equalsIgnoreCase("jdk");
|
||||
isJavaDownload = isJavaDownload || component.equalsIgnoreCase("jre");
|
||||
|
||||
boolean isJfxDownload = component.equalsIgnoreCase("jfx");
|
||||
|
||||
DownloadUrlGenerator downloadUrlGenerator;
|
||||
|
||||
// Determine url generator
|
||||
if (isJavaDownload) {
|
||||
if (openJdk) {
|
||||
downloadUrlGenerator = new AdoptOpenJdkDownloadUrlGenerator();
|
||||
} else {
|
||||
downloadUrlGenerator = new OracleDownloadUrlGenerator();
|
||||
}
|
||||
} else if (isJfxDownload) {
|
||||
if (openJdk) {
|
||||
downloadUrlGenerator = new GluonHqDownloadUrlGenerator();
|
||||
} else {
|
||||
return Optional.empty(); // Nothing to download
|
||||
}
|
||||
} else {
|
||||
throw new RuntimeException("Do not know how to download: " + component);
|
||||
}
|
||||
|
||||
// Build download item
|
||||
String path = downloadUrlGenerator.getLocalFilename(
|
||||
platform,
|
||||
component,
|
||||
train,
|
||||
version,
|
||||
update,
|
||||
build,
|
||||
flavor,
|
||||
hash
|
||||
);
|
||||
|
||||
String url = downloadUrlGenerator.buildUrl(
|
||||
platform,
|
||||
component,
|
||||
train,
|
||||
version,
|
||||
update,
|
||||
build,
|
||||
flavor,
|
||||
hash
|
||||
);
|
||||
|
||||
return Optional.of(new DownloadItem(url, path, downloadUrlGenerator.getCookie()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a line out to console if logging is enabled.
|
||||
*
|
||||
* @param message The message to be printed.
|
||||
*/
|
||||
private static void println(String message) {
|
||||
if (PRINT_LOGGING) {
|
||||
System.out.println(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print a line out to console if logging is enabled without a newline.
|
||||
*
|
||||
* @param message The message to be printed.
|
||||
*/
|
||||
private static void print(String message) {
|
||||
if (PRINT_LOGGING) {
|
||||
System.out.print(message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print an empty line to the system.out.
|
||||
*/
|
||||
private static void printEmptyLine() {
|
||||
println("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2014-19 The Processing Foundation
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2, as published by the Free Software Foundation.
|
||||
|
||||
This program 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* URL generator for downloading JFX directly from OpenJFX's sponsor Gluon.
|
||||
*/
|
||||
public class GluonHqDownloadUrlGenerator extends DownloadUrlGenerator {
|
||||
|
||||
private static final String TEMPLATE_URL = "http://gluonhq.com/download/javafx-%d-%d-%d-sdk-%s/";
|
||||
|
||||
@Override
|
||||
public String buildUrl(String platform, String component, int train, int version, int update,
|
||||
int build, String flavor, String hash) {
|
||||
|
||||
String platformLower = platform.toLowerCase();
|
||||
|
||||
String platformShort;
|
||||
if (platformLower.contains("linux")) {
|
||||
platformShort = "linux";
|
||||
} else if (platformLower.contains("mac")) {
|
||||
platformShort = "mac";
|
||||
} else if (platformLower.contains("windows")) {
|
||||
platformShort = "windows";
|
||||
} else {
|
||||
throw new RuntimeException("Unsupported platform for JFX: " + platform);
|
||||
}
|
||||
|
||||
return String.format(TEMPLATE_URL, train, version, update, platformShort);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2014-19 The Processing Foundation
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2, as published by the Free Software Foundation.
|
||||
|
||||
This program 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Utility to generate the download URL from Oracle.
|
||||
*/
|
||||
public class OracleDownloadUrlGenerator extends DownloadUrlGenerator {
|
||||
private static final String COOKIE =
|
||||
"oraclelicense=accept-securebackup-cookie";
|
||||
|
||||
|
||||
@Override
|
||||
public String buildUrl(String platform, String component, int train, int version, int update,
|
||||
int build, String flavor, String hash) {
|
||||
|
||||
if (!component.equalsIgnoreCase("jdk")) {
|
||||
throw new RuntimeException("Can only generate JDK download URLs for Oracle.");
|
||||
}
|
||||
|
||||
String filename = getLocalFilename(
|
||||
platform,
|
||||
component,
|
||||
train,
|
||||
version,
|
||||
update,
|
||||
build,
|
||||
flavor,
|
||||
hash
|
||||
);
|
||||
|
||||
String url = "http://download.oracle.com/otn-pub/java/jdk/" +
|
||||
(update == 0 ?
|
||||
String.format("%d-b%02d/", version, build) :
|
||||
String.format("%du%d-b%02d/", version, update, build));
|
||||
|
||||
// URL format changed starting with 8u121
|
||||
if (update >= 121) {
|
||||
url += hash + "/";
|
||||
}
|
||||
|
||||
// Finally, add the filename to the end
|
||||
url += filename;
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
public Optional<String> getCookie() {
|
||||
return Optional.of(COOKIE);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2012-19 The Processing Foundation
|
||||
Copyright (c) 2004-12 Ben Fry and Casey Reas
|
||||
Copyright (c) 2001-04 Massachusetts Institute of Technology
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2, as published by the Free Software Foundation.
|
||||
|
||||
This program 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class AdoptOpenJdkDownloadUrlGeneratorTest {
|
||||
|
||||
private static final String EXPECTED_WIN64_URL = "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.1%2B13/OpenJDK11U-jdk_x64_windows_hotspot_11.0.1_13.zip";
|
||||
private static final String EXPECTED_MAC_URL = "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.1%2B13/OpenJDK11U-jdk_x64_mac_hotspot_11.0.1_13.tar.gz";
|
||||
private static final String EXPECTED_LINUX_URL = "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.1%2B13/OpenJDK11U-jdk_x64_linux_hotspot_11.0.1_13.tar.gz";
|
||||
private static final String EXPECTED_LINUX_URL_ARM = "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.1%2B13/OpenJDK11U-jdk_aarch64_linux_hotspot_11.0.1_13.tar.gz";
|
||||
|
||||
private static final String COMPONENT = "jdk";
|
||||
private static final int TRAIN = 11;
|
||||
private static final int VERSION = 0;
|
||||
private static final int UPDATE = 1;
|
||||
private static final int BUILD = 13;
|
||||
private static final String FLAVOR_SUFFIX = "-x64.tar.gz";
|
||||
private static final String HASH = "";
|
||||
|
||||
private AdoptOpenJdkDownloadUrlGenerator urlGenerator;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
urlGenerator = new AdoptOpenJdkDownloadUrlGenerator();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildUrlWindows() {
|
||||
String url = urlGenerator.buildUrl(
|
||||
"windows64",
|
||||
COMPONENT,
|
||||
TRAIN,
|
||||
VERSION,
|
||||
UPDATE,
|
||||
BUILD,
|
||||
"windows" + FLAVOR_SUFFIX,
|
||||
HASH
|
||||
);
|
||||
|
||||
assertEquals(
|
||||
EXPECTED_WIN64_URL,
|
||||
url
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildUrlMac() {
|
||||
String url = urlGenerator.buildUrl(
|
||||
"macosx64",
|
||||
COMPONENT,
|
||||
TRAIN,
|
||||
VERSION,
|
||||
UPDATE,
|
||||
BUILD,
|
||||
"mac" + FLAVOR_SUFFIX,
|
||||
HASH
|
||||
);
|
||||
|
||||
assertEquals(
|
||||
EXPECTED_MAC_URL,
|
||||
url
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildUrlLinux64() {
|
||||
String url = urlGenerator.buildUrl(
|
||||
"linux64",
|
||||
COMPONENT,
|
||||
TRAIN,
|
||||
VERSION,
|
||||
UPDATE,
|
||||
BUILD,
|
||||
"linux64" + FLAVOR_SUFFIX,
|
||||
HASH
|
||||
);
|
||||
|
||||
assertEquals(
|
||||
EXPECTED_LINUX_URL,
|
||||
url
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildUrlLinuxArm() {
|
||||
String url = urlGenerator.buildUrl(
|
||||
"linuxArm",
|
||||
COMPONENT,
|
||||
TRAIN,
|
||||
VERSION,
|
||||
UPDATE,
|
||||
BUILD,
|
||||
"linuxArm" + FLAVOR_SUFFIX,
|
||||
HASH
|
||||
);
|
||||
|
||||
assertEquals(
|
||||
EXPECTED_LINUX_URL_ARM,
|
||||
url
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2012-19 The Processing Foundation
|
||||
Copyright (c) 2004-12 Ben Fry and Casey Reas
|
||||
Copyright (c) 2001-04 Massachusetts Institute of Technology
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2, as published by the Free Software Foundation.
|
||||
|
||||
This program 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class GluonHqDownloadUrlGeneratorTest {
|
||||
|
||||
private static final String EXPECTED_WIN64_URL = "http://gluonhq.com/download/javafx-11-0-2-sdk-windows/";
|
||||
private static final String EXPECTED_MAC_URL = "http://gluonhq.com/download/javafx-11-0-2-sdk-mac";
|
||||
private static final String EXPECTED_LINUX_URL = "http://gluonhq.com/download/javafx-11-0-2-sdk-linux/";
|
||||
|
||||
private static final String COMPONENT = "jfx";
|
||||
private static final int TRAIN = 11;
|
||||
private static final int VERSION = 0;
|
||||
private static final int UPDATE = 2;
|
||||
private static final int BUILD = 0;
|
||||
private static final String FLAVOR_SUFFIX = ".zip";
|
||||
private static final String HASH = "";
|
||||
|
||||
private AdoptOpenJdkDownloadUrlGenerator urlGenerator;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
urlGenerator = new AdoptOpenJdkDownloadUrlGenerator();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildUrlWindows() {
|
||||
String url = urlGenerator.buildUrl(
|
||||
"windows64",
|
||||
COMPONENT,
|
||||
TRAIN,
|
||||
VERSION,
|
||||
UPDATE,
|
||||
BUILD,
|
||||
"windows" + FLAVOR_SUFFIX,
|
||||
HASH
|
||||
);
|
||||
|
||||
assertEquals(
|
||||
EXPECTED_WIN64_URL,
|
||||
url
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildUrlMac() {
|
||||
String url = urlGenerator.buildUrl(
|
||||
"macosx64",
|
||||
COMPONENT,
|
||||
TRAIN,
|
||||
VERSION,
|
||||
UPDATE,
|
||||
BUILD,
|
||||
"mac" + FLAVOR_SUFFIX,
|
||||
HASH
|
||||
);
|
||||
|
||||
assertEquals(
|
||||
EXPECTED_MAC_URL,
|
||||
url
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildUrlLinux() {
|
||||
String url = urlGenerator.buildUrl(
|
||||
"linux64",
|
||||
COMPONENT,
|
||||
TRAIN,
|
||||
VERSION,
|
||||
UPDATE,
|
||||
BUILD,
|
||||
"linux64" + FLAVOR_SUFFIX,
|
||||
HASH
|
||||
);
|
||||
|
||||
assertEquals(
|
||||
EXPECTED_LINUX_URL,
|
||||
url
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2012-19 The Processing Foundation
|
||||
Copyright (c) 2004-12 Ben Fry and Casey Reas
|
||||
Copyright (c) 2001-04 Massachusetts Institute of Technology
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
version 2, as published by the Free Software Foundation.
|
||||
|
||||
This program 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.Ignore;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class OracleDownloadUrlGeneratorTest {
|
||||
|
||||
private static final String EXPECTED_URL = "http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-macosx-x64.dmg";
|
||||
|
||||
private OracleDownloadUrlGenerator urlGenerator;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
urlGenerator = new OracleDownloadUrlGenerator();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildUrl() {
|
||||
String url = urlGenerator.buildUrl(
|
||||
"macos",
|
||||
"jdk",
|
||||
1,
|
||||
8,
|
||||
131,
|
||||
11,
|
||||
"macosx-x64.dmg",
|
||||
"d54c1d3a095b4ff2b6607d096fa80163"
|
||||
);
|
||||
|
||||
assertEquals(
|
||||
EXPECTED_URL,
|
||||
url
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2001-2003 Ant-Contrib project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The end-user documentation included with the redistribution, if
|
||||
* any, must include the following acknowlegement:
|
||||
* "This product includes software developed by the
|
||||
* Ant-Contrib project (http://sourceforge.net/projects/ant-contrib)."
|
||||
* Alternately, this acknowlegement may appear in the software itself,
|
||||
* if and wherever such third-party acknowlegements normally appear.
|
||||
*
|
||||
* 4. The name Ant-Contrib must not be used to endorse or promote products
|
||||
* derived from this software without prior written permission. For
|
||||
* written permission, please contact
|
||||
* ant-contrib-developers@lists.sourceforge.net.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "Ant-Contrib"
|
||||
* nor may "Ant-Contrib" appear in their names without prior written
|
||||
* permission of the Ant-Contrib project.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE ANT-CONTRIB PROJECT OR ITS
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*/
|
||||
@@ -1,11 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script runs Processing, using the JRE in the Processing
|
||||
# This script runs Processing, using the JRE in the Processing
|
||||
# installation directory.
|
||||
|
||||
# If your system needs a different version of Java than what's included
|
||||
# in the download, replace the 'java' folder with the contents of a new
|
||||
# Oracle JRE (Java 8 only), or create a symlink named "java" in the
|
||||
# Oracle JRE (Java 8 only), or create a symlink named "java" in the
|
||||
# Processing installation directory that points to the JRE home directory.
|
||||
# This must be a Sun/Oracle JDK. For more details, see here:
|
||||
# https://github.com/processing/processing/wiki/Supported-Platforms
|
||||
@@ -104,7 +104,7 @@ cmd_name='processing-java'
|
||||
|
||||
if [ $current_name = $cmd_name ]
|
||||
then
|
||||
java -Djna.nosys=true -Djava.ext.dirs="$APPDIR"/java/lib/ext -Xmx256m processing.mode.java.Commander "$@"
|
||||
java -Djna.nosys=true -Xmx256m processing.mode.java.Commander "$@"
|
||||
exit $?
|
||||
else
|
||||
# Start Processing in the same directory as this script
|
||||
@@ -115,5 +115,5 @@ else
|
||||
fi
|
||||
cd "$APPDIR"
|
||||
|
||||
java -splash:lib/about-1x.png -Djna.nosys=true -Djava.ext.dirs="$APPDIR"/java/lib/ext -Xmx256m processing.app.Base "$SKETCH" &
|
||||
java -splash:lib/about-1x.png -Djna.nosys=true -Xmx256m processing.app.Base "$SKETCH" &
|
||||
fi
|
||||
|
||||
Binary file not shown.
@@ -73,8 +73,7 @@ questions.
|
||||
</copy>
|
||||
|
||||
<exec executable="${cc}">
|
||||
<!-- <arg line="${arch64} ${arch32}"/> -->
|
||||
<arg line="${arch64}"/>
|
||||
<arg line="${arch64}"/> <!-- ${arch32} not supported -->
|
||||
<arg value="-I"/>
|
||||
<arg value="${env.JAVA_HOME}/include"/>
|
||||
<arg value="-I"/>
|
||||
@@ -90,7 +89,7 @@ questions.
|
||||
<arg value="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk"/>
|
||||
<arg value="-mmacosx-version-min=10.7"/>
|
||||
-->
|
||||
<arg value="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"/>
|
||||
<arg value="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk"/>
|
||||
<arg value="-mmacosx-version-min=10.8"/>
|
||||
<arg value="native/main.m"/>
|
||||
</exec>
|
||||
|
||||
@@ -73,6 +73,13 @@ questions.
|
||||
Corresponds to the <code>CFBundleIconFile</code> key in the <tt>Info.plist</tt> file.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">hideDockIcon</td>
|
||||
<td valign="top">Set to true to prevent display of the application icon on the Mac OS X dock.
|
||||
Corresponds to the <code>LSUIElement</code> key in the <tt>Info.plist</tt> file.
|
||||
(<a href="https://developer.apple.com/library/mac/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/20001431-108256">Details</a>)</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">shortversion</td>
|
||||
<td valign="top">The release version number string for the application.
|
||||
@@ -100,10 +107,86 @@ questions.
|
||||
file.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">privileged</td>
|
||||
<td valign="top">Bool value if the bundled application is to be launched as privileged.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">mainclassname</td>
|
||||
<td valign="top">The name of the bundled application's main class.</td>
|
||||
<td align="center" valign="top">Yes, alternative to <code>jnlplaunchername</code></td>
|
||||
<td align="center" valign="top">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">plistClassPaths</td>
|
||||
<td valign="top">A comma-separated list of classpath-elements which are used for the java application.
|
||||
<tt>$APP_ROOT</tt> is replaced by the path of the <tt>.app</tt>-bundle. Required only if not
|
||||
the libraries specified by the <tt>classpath</tt> and <tt>librarypath</tt> should be used.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">jvmRequired</td>
|
||||
<td valign="top">Specifies the required Java virtual machine version.</td>
|
||||
<td align="center" valign="top">No (defaults to <tt>1.7</tt>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">jrePreferred</td>
|
||||
<td valign="top">If set to <tt>true</tt>, a Java Runtime Edition is required for execution. If both <tt>jrePreferred</tt> and <tt>jdkPreferred</tt> are set <tt>true</tt>, then a JRE is preferred but a JDK ia also accepted.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">jdkPreferred</td>
|
||||
<td valign="top">If set to <tt>true</tt>, a Java Development Kit is required for execution. If both <tt>jrePreferred</tt> and <tt>jdkPreferred</tt> are set <tt>true</tt>, then a JRE is preferred but a JDK ia also accepted.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">minimumSystemVersion</td>
|
||||
<td valign="top">Indicates the minimum version of OS X required for this app to run.
|
||||
Corresponds to the <code>LSMinimumSystemVersion</code> key in the <tt>Info.plist</tt>
|
||||
file.</td>
|
||||
(<a href="https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/20001431-113253">Details</a>)</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">jnlplaunchername</td>
|
||||
<td valign="top">The name of the bundled applications's jnlp file. The file has to be be copied to the <code>Contents/Java</code> folder. It has to be present during execution of the application. This serves as option to deliver signed applications based upon JNLP files. The application can then be signed and the signature won't break when modifying the JNLP file.</td>
|
||||
<td align="center" valign="top">No, alternative to <code>mainclassname</code></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">workingdirectory</td>
|
||||
<td valign="top">Specifies the working directory of the application.
|
||||
<tt>$APP_ROOT</tt> is replaced by the path of the <tt>.app</tt>-bundle.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">privileged</td>
|
||||
<td valign="top">If set, the application is started with administrator privileges.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">highResolutionCapable</td>
|
||||
<td valign="top">Sets the <i>High Resolution Capable</i> flag.
|
||||
Corresponds to the <code>NSHighResolutionCapable</code> key in the <tt>Info.plist</tt>
|
||||
file.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">supportsAutomaticGraphicsSwitching</td>
|
||||
<td valign="top">Allow OpenGL applications to utilize the integrated GPU.
|
||||
Corresponds to the <code>NSSupportsAutomaticGraphicsSwitching</code> key in the <tt>Info.plist</tt>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">ignorePSN</td>
|
||||
<td valign="top">If set to <tt>true</tt>, the <tt>-psn...</tt> arguments passed by the OS
|
||||
to the application is filtered out.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">isDebug</td>
|
||||
<td valign="top">If set to <tt>true</tt>, additiona console output will be produced during startup.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -137,6 +220,23 @@ Entries will be copied to the <tt>Contents/MacOS/</tt> folder of the generated b
|
||||
|
||||
<h4>option</h4>
|
||||
<p>Specifies a command-line option to be passed to the JVM at startup.</p>
|
||||
<p>Options may be named, which allows the bundled Java program
|
||||
itself to override the option (e.g. to adjust heap settings). Changes will take effect upon restart of the
|
||||
application. Assuming your <tt>CFBundleIdentifier</tt> (settable via the attribute <tt>identifier</tt>)
|
||||
is <tt>com.oracle.appbundler</tt>. Then you can override a named option by calling
|
||||
<xmp> import java.util.prefs.Preferences;
|
||||
[...]
|
||||
Preferences jvmOptions = Preferences.userRoot().node("/com/oracle/appbundler/JVMOptions");
|
||||
jvmOptions.put("name", "value"); // use option name and desired value here
|
||||
jvmOptions.flush();</xmp>
|
||||
The corresponding entries will be stored in a file called
|
||||
<tt>~/Library/Preferences/com.oracle.appbundler.plist</tt>. To manipulate the file
|
||||
without Java's <tt>Preferences</tt> from the command line, you should use the tool
|
||||
<a href="https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/defaults.1.html">defaults</a>.
|
||||
For example, to add an entry via the command line, use:
|
||||
<xmp> defaults write com.oracle.appbundler /com/oracle/appbundler/ -dict-add JVMOptions/ '{"name"="value";}'</xmp>
|
||||
Of named options, only the value is passed to the JVM, not the name. The name merely serves as identifier.
|
||||
</p>
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
@@ -148,6 +248,11 @@ Entries will be copied to the <tt>Contents/MacOS/</tt> folder of the generated b
|
||||
<td valign="top">The option value.</td>
|
||||
<td align="center" valign="top">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">name</td>
|
||||
<td valign="top">The option name.</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h4>argument</h4>
|
||||
@@ -165,6 +270,218 @@ Entries will be copied to the <tt>Contents/MacOS/</tt> folder of the generated b
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h4>environment</h4>
|
||||
<p>Specifies an environment variable set via LSEnvironment entry in the <tt>Info.plist</tt> file. See the
|
||||
<a href="https://developer.apple.com/library/prerelease/mac/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/20001431-106825">Apple Documentation</a> for details.</p>
|
||||
<p>The string <tt>$APP_ROOT</tt> will be replaced by the application bundle path in all environment variables on runtime.</p>
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">name</td>
|
||||
<td valign="top">The variable name.</td>
|
||||
<td align="center" valign="top">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">value</td>
|
||||
<td valign="top">The variable value.</td>
|
||||
<td align="center" valign="top">Yes</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h4>architecture</h4>
|
||||
<p>Specifies the elements of the <tt>LSArchitecturePriority</tt> array in <tt>Info.plist</tt>.
|
||||
(<a href="https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-106825-TPXREF124">Details</a>)</p>
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">name</td>
|
||||
<td valign="top">The architecture name.</td>
|
||||
<td align="center" valign="top">Yes</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h4>plistentry</h4>
|
||||
<p>Adds an arbitrary entry to the generated <tt>Info.plist</tt>.</p>
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">key</td>
|
||||
<td valign="top">The entry's key.</td>
|
||||
<td align="center" valign="top">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">value</td>
|
||||
<td valign="top">The entry's value.</td>
|
||||
<td align="center" valign="top">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">type</td>
|
||||
<td valign="top">The entry's type.</td>
|
||||
<td align="center" valign="top">No (defaults to <tt>String</tt>)</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<h4>scheme</h4>
|
||||
<p>Specifies a protocol for which the bundled application should be registered as a handler.</p>
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">value</td>
|
||||
<td valign="top">The protocol scheme.</td>
|
||||
<td align="center" valign="top">Yes</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h4 id="bundledocument">bundledocument</h4>
|
||||
<p>Describes a document associated with your application.</p>
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td valign="top"><b>Corresponding <tt>CFBundleDocumentTypes</tt> key</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">contentTypes</td>
|
||||
<td valign="top">A comma-separated list of <a href="https://developer.apple.com/library/mac/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_intro/understand_utis_intro.html#//apple_ref/doc/uid/TP40001319">Uniform Type Identifiers</a> defining each a supported file type.
|
||||
If you reference custom filetypes, declare them using a <a href="#typedeclaration">typedeclaration</a>.
|
||||
If set, <i>extensions</i> and <i>isPackage</i> are ignored. See the <a href="https://developer.apple.com/library/mac/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html">UTI reference</a> for a list of default UTIs.</td>
|
||||
<td valign="top"><tt>LSItemContentTypes</tt></td>
|
||||
<td align="center" valign="top">Yes (or <i>extensions</i>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">extensions</td>
|
||||
<td valign="top">A comma-separated list of filename extensions (minus the leading period) to map to this document type.</td>
|
||||
<td valign="top"><tt>CFBundleTypeExtensions</tt></td>
|
||||
<td align="center" valign="top">Yes (or <i>contentTypes</i>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">icon</td>
|
||||
<td valign="top">The name of the icon file (.icns) to associate with this OS X document type.</td>
|
||||
<td valign="top"><tt>CFBundleTypeIconFile</tt></td>
|
||||
<td align="center" valign="top">No (But recommended)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">name</td>
|
||||
<td valign="top">The abstract name for the document type.</td>
|
||||
<td valign="top"><tt>CFBundleTypeName</tt></td>
|
||||
<td align="center" valign="top">No (But recommended)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">role</td>
|
||||
<td valign="top">This key specifies the app's role with respect to the type. The value can be <tt>Editor</tt>, <tt>Viewer</tt>, <tt>Shell</tt>, or <tt>None</tt>.</td>
|
||||
<td valign="top"><tt>CFBundleTypeRole</tt></td>
|
||||
<td align="center" valign="top">No (default: <tt>Editor</tt>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">handlerRank</td>
|
||||
<td valign="top">Determines how Launch Services ranks this app among the apps that declare themselves editors or viewers of files of this type. The possible values are: <tt>Owner</tt> (this app is the creator of files of this type), <tt>Alternate</tt> (this app is a secondary viewer of files of this type), <tt>None</tt> (this app must never be used to open files of this type, but it accepts drops of files of this type), <tt>Default</tt> (default; this app doesn't accept drops of files of this type). </td>
|
||||
<td valign="top"><tt>LSHandlerRank</tt></td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">isPackage</td>
|
||||
<td valign="top">Specifies whether the document is distributed as a bundle. If set to true, the bundle directory is treated as a file.</td>
|
||||
<td valign="top"><tt>LSTypeIsPackage</tt></td>
|
||||
<td align="center" valign="top">No (default: <tt>false</tt>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">exportableTypes</td>
|
||||
<td valign="top">A comma-separated list of <a href="https://developer.apple.com/library/mac/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_intro/understand_utis_intro.html#//apple_ref/doc/uid/TP40001319">Uniform Type Identifiers</a> defining a supported file type to which this document can export its content.
|
||||
If you reference custom filetypes, declare them using a <a href="#typedeclaration">typedeclaration</a>.
|
||||
See also the <a href="https://developer.apple.com/library/mac/documentation/DataManagement/Conceptual/DocBasedAppProgrammingGuideForOSX/AdvancedTopics/AdvancedTopics.html#//apple_ref/doc/uid/TP40011179-CH7-SW8">Additional Document Type Considerations</a> of the <a href="https://developer.apple.com/library/mac/documentation/DataManagement/Conceptual/DocBasedAppProgrammingGuideForOSX/">Document-Based App Programming Guide for Mac</a>.
|
||||
<td valign="top"><tt>NSExportableTypes</tt></td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h4 id="typedeclaration">typedeclaration</h4>
|
||||
<p>Declares a new <a href="https://developer.apple.com/library/mac/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_intro/understand_utis_intro.html#//apple_ref/doc/uid/TP40001319">Uniform Type Identifier</a>.
|
||||
Required if you reference non-system UTIs in <a href="#bundledocument">bundledocument's</a> <i>contentTypes</i> or <i>exportableTypes</i></p>.
|
||||
<table border="1" cellpadding="2" cellspacing="0">
|
||||
<tr>
|
||||
<td valign="top"><b>Attribute</b></td>
|
||||
<td valign="top"><b>Description</b></td>
|
||||
<td valign="top"><b>Corresponding <tt>UT...TypeDeclarations</tt> key</b></td>
|
||||
<td align="center" valign="top"><b>Required</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">identifier</td>
|
||||
<td valign="top">The unique UTI for the declared type. Following the reverse-DNS format beginning with com.companyName is a simple way to ensure uniqueness.</td>
|
||||
<td valign="top"><tt>UTTypeIdentifier</tt></td>
|
||||
<td align="center" valign="top">Yes</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">description</td>
|
||||
<td valign="top">A user-visible description of this type.</td>
|
||||
<td valign="top"><tt>UTTypeDescription</tt></td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">icon</td>
|
||||
<td valign="top">The name of the icon file (.icns) to associate with this UTI.</td>
|
||||
<td valign="top"><tt>UTTypeIconFile</tt></td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">referenceUrl</td>
|
||||
<td valign="top">The URL of a reference document describing this type.</td>
|
||||
<td valign="top"><tt>UTTypeReferenceURL</tt></td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">conformsTo</td>
|
||||
<td valign="top">A comma-separated list of UTIs to which this identifier conforms.
|
||||
Although a custom UTI can conform to any UTI, <tt>public.data</tt> or <tt>com.apple.package</tt> must be at the root of the conformance hierarchy.</td>
|
||||
<td valign="top"><tt>UTTypeConformsTo</tt></td>
|
||||
<td align="center" valign="top">No (defaults to <tt>public.data</tt>)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">extensions</td>
|
||||
<td valign="top">A comma-separated list of filename extensions (minus the leading period) to map to this UTI.</td>
|
||||
<td valign="top"><tt>UTTypeTagSpecification -> public.filename-extension</tt></td>
|
||||
<td align="center" valign="top">No (but recommended)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">mimeTypes</td>
|
||||
<td valign="top">A comma-separated list of mime types which identify this UTI.</td>
|
||||
<td valign="top"><tt>UTTypeTagSpecification -> public.mime-type</tt></td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">osTypes</td>
|
||||
<td valign="top">Comma-separated list of four-character codes formerly used to identify types.
|
||||
Only specify OSTypes if you really know what you're doing.</td>
|
||||
<td valign="top"><tt>UTTypeTagSpecification -> com.apple.ostype</tt></td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">imported</td>
|
||||
<td valign="top">If set to <tt>true</tt>, the declaration is listed under the <tt>UTImportedTypeDeclarations</tt> key.
|
||||
Otherwise, it is listed under <tt>UTExportedTypeDeclarations</tt>.
|
||||
If your code relies on third-party UTI types that may not be present on the system, you should declare those UTIs as imported types.</td>
|
||||
<td valign="top">-</td>
|
||||
<td align="center" valign="top">No</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h3>Examples</h3>
|
||||
<p>Generate a launcher for the "Swing Set" demo, bundling the JRE defined by the <tt>JAVA_HOME</tt>
|
||||
environment variable with the resulting executable.</p>
|
||||
@@ -187,9 +504,57 @@ environment variable with the resulting executable.</p>
|
||||
<runtime dir="${env.JAVA_HOME}"/>
|
||||
<classpath file="/Library/Java/Demos/JFC/SwingSet2/SwingSet2.jar"/>
|
||||
<option value="-Dapple.laf.useScreenMenuBar=true"/>
|
||||
<scheme value="mailto"/>
|
||||
</bundleapp>
|
||||
</target>
|
||||
</pre>
|
||||
|
||||
<h3>Example 2: JNLP Launcher</h3>
|
||||
<p>Generate a launcher for a JNLP File, copy it into the package and sign the package. You need to have a Developer ID Profile to sign the application.</p>
|
||||
<p>You can now dynamically modify the zip content (only the JNLP file), deliver it with your web service and the application should directly unpack and can be run</p>
|
||||
<pre>
|
||||
<-- Define the appbundler task -->
|
||||
<taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask"/>
|
||||
|
||||
<-- Create the app bundle -->
|
||||
<target name="bundle-swingset" depends="package">
|
||||
|
||||
<mkdir dir="./app">
|
||||
|
||||
<bundleapp outputdirectory="./app"
|
||||
name="SwingSet2"
|
||||
displayname="SwingSet 2"
|
||||
identifier="com.oracle.javax.swing.SwingSet2"
|
||||
shortversion="1.0"
|
||||
icon="icon.icns"
|
||||
applicationCategory="public.app-category.developer-tools"
|
||||
jnlplaunchername="Contents/_CodeSignature/SwingSet2.jnlp">
|
||||
|
||||
<value="-Xdock:icon=Contents/Resources/icon.icns" />
|
||||
<option value="-Dapple.laf.useScreenMenuBar=true"/>
|
||||
</bundleapp>
|
||||
|
||||
<!-- Optionally copy an original file -->
|
||||
<copy todir="./SwingSet2.app/Contents/_CodeSignature" includeemptydirs="true" overwrite="false">
|
||||
<fileset dir=".">
|
||||
<include name="**/*.jnlp" />
|
||||
</fileset>
|
||||
</copy>
|
||||
|
||||
<!-- Sign File -->
|
||||
<exec executable="codesign" os="Mac OS X" failonerror="true">
|
||||
<arg value="-f" />
|
||||
<arg value="--deep" />
|
||||
<arg value="-s" />
|
||||
<arg value="Developer ID Application" />
|
||||
<arg value="./app/SwingSet2.app" />
|
||||
</exec>
|
||||
|
||||
<zip destfile="./SwingSet2.app.zip" basedir="${copyroot}/app"></zip>
|
||||
</target>
|
||||
</pre>
|
||||
<pre>
|
||||
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
||||
"JRELoadError" = "Die Java Laufzeitumgebung konnte nicht geladen werden.";
|
||||
"JRExLoadError" = "Die Java %d Laufzeitumgebung konnte nicht geladen werden.";
|
||||
"JRExLoadFullError" = "Diese Anwendung benötigt die Java %d Laufzeitumgebung oder höher auf Ihrem Computer installiert sein. Bitte installieren Sie die neueste Version von Java von www.java.com und erneut versuchen.";
|
||||
"JDKxLoadFullError" = "Diese Anwendung benötigt die Java %d Laufzeitumgebung oder höher auf Ihrem Computer installiert sein. Bitte installieren Sie die neueste JDK von Oracle.com und erneut versuchen.";
|
||||
"MainClassNameRequired" = "Hauptklassenname ist erforderlich.";
|
||||
"JavaDirectoryNotFound" = "Das Java Verzeichnis ist nicht vorhanden.";
|
||||
"BundlePathContainsColon" = "Kann nicht vom einem Ordner aus starten, der \"/\" in seinem Namen enthält.";
|
||||
@@ -1,3 +1,7 @@
|
||||
"JRELoadError" = "Unable to load Java Runtime Environment.";
|
||||
"JRExLoadError" = "Unable to load a Java %d Runtime Environment.";
|
||||
"JRExLoadFullError" = "This application requires that Java %d or later be installed on your computer. Please download and install the latest version of Java from www.java.com and try again.";
|
||||
"JDKxLoadFullError" = "This application requires that a Java %d JDK or later be installed on your computer. Please download and install the latest Java JDK from Oracle.com and try again.";
|
||||
"MainClassNameRequired" = "Main class name is required.";
|
||||
"JavaDirectoryNotFound" = "Unable to enumerate Java directory contents.";
|
||||
"BundlePathContainsColon" = "Cannot launch from folder that contains a \"/\" in its name.";
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
"JRELoadError" = "Impossible d'utiliser un environnement Java.";
|
||||
"JRExLoadError" = "Impossible d'utiliser un environnement Java %d.";
|
||||
"JRExLoadFullError" = "Ce logiciel nécessite que Java %d ou plus récent être installés sur votre ordinateur. S'il vous plaît télécharger et installer la dernière version de Java à partir de www.java.com et essayez à nouveau.";
|
||||
"JDKxLoadFullError" = "Ce logiciel nécessite que Java %d JDK ou plus récent être installés sur votre ordinateur. S'il vous plaît télécharger et installer le JDK plus récente de Oracle.com et essayez à nouveau.";
|
||||
"MainClassNameRequired" = "Principal nom de classe est nécessaire.";
|
||||
"JavaDirectoryNotFound" = "Impossible d'énumérer répertoire Java contenu.";
|
||||
"BundlePathContainsColon" = "Pas de commencer à partir d'un dossier qui contient un \"/\" dans son nom.";
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,12 +18,14 @@
|
||||
* 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.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
package com.oracle.appbundler;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
|
||||
@@ -31,95 +33,157 @@ import org.apache.tools.ant.BuildException;
|
||||
/**
|
||||
* Represent a CFBundleDocument.
|
||||
*/
|
||||
public class BundleDocument {
|
||||
private String name = "editor";
|
||||
private String role = "";
|
||||
private File icon = null;
|
||||
private String[] extensions;
|
||||
private boolean isPackage = false;
|
||||
public class BundleDocument implements IconContainer {
|
||||
private String name = null;
|
||||
private String role = "Editor";
|
||||
private String icon = null;
|
||||
private String handlerRank = null;
|
||||
private List<String> extensions;
|
||||
private List<String> contentTypes;
|
||||
private List<String> exportableTypes;
|
||||
private boolean isPackage = false;
|
||||
|
||||
|
||||
static private String capitalizeFirst(String string) {
|
||||
char[] stringArray = string.toCharArray();
|
||||
stringArray[0] = Character.toUpperCase(stringArray[0]);
|
||||
return new String(stringArray);
|
||||
}
|
||||
|
||||
|
||||
public void setExtensions(String extensionsList) {
|
||||
if (extensionsList == null) {
|
||||
throw new BuildException("Extensions can't be null");
|
||||
private String capitalizeFirst(String string) {
|
||||
char[] stringArray = string.toCharArray();
|
||||
stringArray[0] = Character.toUpperCase(stringArray[0]);
|
||||
return new String(stringArray);
|
||||
}
|
||||
|
||||
public void setExtensions(String extensionsString) {
|
||||
extensions = getListFromCommaSeparatedString(extensionsString, "Extensions", true);
|
||||
}
|
||||
|
||||
extensions = extensionsList.split(",");
|
||||
for (int i = 0; i < extensions.length; i++) {
|
||||
extensions[i] = extensions[i].trim().toLowerCase();
|
||||
public void setContentTypes(String contentTypesString) {
|
||||
contentTypes = getListFromCommaSeparatedString(contentTypesString, "Content Types");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setIcon(File icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = capitalizeFirst(role);
|
||||
}
|
||||
|
||||
|
||||
public void setIsPackage(String isPackageString) {
|
||||
this.isPackage = isPackageString.trim().equalsIgnoreCase("true");
|
||||
}
|
||||
|
||||
|
||||
public String getIconName() {
|
||||
return icon.getName();
|
||||
}
|
||||
|
||||
|
||||
public File getIconFile() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
|
||||
public String[] getExtensions() {
|
||||
return extensions;
|
||||
}
|
||||
|
||||
|
||||
public boolean hasIcon() {
|
||||
return icon != null;
|
||||
}
|
||||
|
||||
|
||||
public boolean isPackage() {
|
||||
return isPackage;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder s = new StringBuilder(getName());
|
||||
s.append(" ").append(getRole()).append(" ").append(getIconName()).append(" ");
|
||||
for (String extension : extensions) {
|
||||
s.append(extension).append(" ");
|
||||
public void setExportableTypes(String exportableTypesString) {
|
||||
exportableTypes = getListFromCommaSeparatedString(exportableTypesString, "Exportable Types");
|
||||
}
|
||||
|
||||
public static List<String> getListFromCommaSeparatedString(String listAsString,
|
||||
final String attributeName) {
|
||||
return getListFromCommaSeparatedString(listAsString, attributeName, false);
|
||||
}
|
||||
|
||||
public static List<String> getListFromCommaSeparatedString(String listAsString,
|
||||
final String attributeName, final boolean lowercase) {
|
||||
if(listAsString == null) {
|
||||
throw new BuildException(attributeName + " can't be null");
|
||||
}
|
||||
|
||||
String[] splittedListAsString = listAsString.split(",");
|
||||
List<String> stringList = new ArrayList<String>();
|
||||
|
||||
for (String extension : splittedListAsString) {
|
||||
String cleanExtension = extension.trim();
|
||||
if (lowercase) {
|
||||
cleanExtension = cleanExtension.toLowerCase();
|
||||
}
|
||||
if (cleanExtension.length() > 0) {
|
||||
stringList.add(cleanExtension);
|
||||
}
|
||||
}
|
||||
|
||||
if (stringList.size() == 0) {
|
||||
throw new BuildException(attributeName + " list must not be empty");
|
||||
}
|
||||
return stringList;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = capitalizeFirst(role);
|
||||
}
|
||||
|
||||
public void setHandlerRank(String handlerRank) {
|
||||
this.handlerRank = capitalizeFirst(handlerRank);
|
||||
}
|
||||
|
||||
public void setIsPackage(String isPackageString) {
|
||||
if(isPackageString.trim().equalsIgnoreCase("true")) {
|
||||
this.isPackage = true;
|
||||
} else {
|
||||
this.isPackage = false;
|
||||
}
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public String getHandlerRank() {
|
||||
return handlerRank;
|
||||
}
|
||||
|
||||
public List<String> getExtensions() {
|
||||
return extensions;
|
||||
}
|
||||
|
||||
public List<String> getContentTypes() {
|
||||
return contentTypes;
|
||||
}
|
||||
|
||||
public List<String> getExportableTypes() {
|
||||
return exportableTypes;
|
||||
}
|
||||
|
||||
public File getIconFile() {
|
||||
if (icon == null) { return null; }
|
||||
|
||||
File ifile = new File (icon);
|
||||
|
||||
if (! ifile.exists ( ) || ifile.isDirectory ( )) { return null; }
|
||||
|
||||
return ifile;
|
||||
}
|
||||
|
||||
public boolean hasIcon() {
|
||||
return icon != null;
|
||||
}
|
||||
|
||||
public boolean isPackage() {
|
||||
return isPackage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder s = new StringBuilder(getName());
|
||||
s.append(" ").append(getRole())
|
||||
.append(" ").append(getIcon())
|
||||
.append(" ").append(getHandlerRank())
|
||||
.append(" ");
|
||||
if (contentTypes != null) {
|
||||
for(String contentType : contentTypes) {
|
||||
s.append(contentType).append(" ");
|
||||
}
|
||||
}
|
||||
if (extensions != null) {
|
||||
for(String extension : extensions) {
|
||||
s.append(extension).append(" ");
|
||||
}
|
||||
}
|
||||
if (exportableTypes != null) {
|
||||
for(String exportableType : exportableTypes) {
|
||||
s.append(exportableType).append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
return s.toString();
|
||||
}
|
||||
return s.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 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 com.oracle.appbundler;
|
||||
|
||||
public class Environment extends Option {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2015, Quality First Software GmbH 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.oracle.appbundler;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public interface IconContainer {
|
||||
public boolean hasIcon();
|
||||
public String getIcon();
|
||||
public File getIconFile();
|
||||
}
|
||||
@@ -28,9 +28,33 @@ package com.oracle.appbundler;
|
||||
|
||||
/**
|
||||
* Class representing an option that will be passed to the JVM at startup.
|
||||
* The class can optionally be named, which allows the bundled Java program
|
||||
* itself to override the option. Changes will take effect upon restart of the
|
||||
* application.<p>
|
||||
* Assuming your {@code CFBundleIdentifier} (settable via {@link AppBundlerTask#setIdentifier(String)})
|
||||
* is {@code com.oracle.appbundler}. Then you can override a named option by calling
|
||||
* <xmp>
|
||||
* import java.util.prefs.Preferences;
|
||||
* [...]
|
||||
* Preferences jvmOptions = Preferences.userRoot().node("/com/oracle/appbundler/JVMOptions");
|
||||
* jvmOptions.put("name", "value");
|
||||
* jvmOptions.flush();
|
||||
* </xmp>
|
||||
* The corresponding entries will be stored in a file called
|
||||
* {@code ~/Library/Preferences/com.oracle.appbundler.plist}.
|
||||
* To manipulate the file without Java's {@link java.util.prefs.Preferences} from the command line,
|
||||
* you should use the tool
|
||||
* <a href="https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/defaults.1.html">defaults</a>.
|
||||
* For example, to add an entry via the command line, use:
|
||||
* <xmp>
|
||||
* defaults write com.oracle.appbundler /com/oracle/appbundler/ -dict-add JVMOptions/ '{"name"="value";}'
|
||||
* </xmp>
|
||||
*
|
||||
* @author <a href="mailto:hs@tagtraum.com">Hendrik Schreiber</a> (preference related code only)
|
||||
*/
|
||||
public class Option {
|
||||
private String value = null;
|
||||
private String name = null;
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
@@ -40,8 +64,16 @@ public class Option {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
return name == null ? value : name + "=" + value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 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 com.oracle.appbundler;
|
||||
|
||||
public class PlistEntry extends Option {
|
||||
private String type = null;
|
||||
|
||||
public void setKey(String key) {
|
||||
setName(key);
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright 2012, 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 com.oracle.appbundler;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.tools.ant.DirectoryScanner;
|
||||
import org.apache.tools.ant.types.FileSet;
|
||||
|
||||
public class Runtime extends FileSet {
|
||||
|
||||
/* Override to provide canonical path so that runtime can be specified
|
||||
* via a version-agnostic path (relative link, e.g. `current-jre`) while
|
||||
* still preserving the original runtime directory name, e.g. `jre1.8.0_45.jre`.
|
||||
*/
|
||||
@Override
|
||||
public File getDir() {
|
||||
File dir = super.getDir();
|
||||
try {
|
||||
return dir.getCanonicalFile();
|
||||
} catch (IOException e) {
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
|
||||
private void detectType() {
|
||||
boolean isJDK = new File(getDir(), "jre").isDirectory();
|
||||
|
||||
if (isJDK) {
|
||||
appendIncludes(new String[] {
|
||||
"jre/lib/",
|
||||
"jreCOPYRIGHT",
|
||||
"jre/LICENSE",
|
||||
"jre/README",
|
||||
"jre/THIRDPARTYLICENSEREADME-JAVAFX.txt",
|
||||
"jre/THIRDPARTYLICENSEREADME.txt",
|
||||
"jre/Welcome.html"
|
||||
});
|
||||
appendExcludes(new String[] {
|
||||
"jre/lib/deploy/",
|
||||
"jre/lib/deploy.jar",
|
||||
"jre/lib/javaws.jar",
|
||||
"jre/lib/libdeploy.dylib",
|
||||
"jre/lib/libnpjp2.dylib",
|
||||
"jre/lib/plugin.jar",
|
||||
"jre/lib/security/javaws.policy"
|
||||
});
|
||||
} else {
|
||||
appendIncludes(new String[] {
|
||||
"lib/",
|
||||
"COPYRIGHT",
|
||||
"LICENSE",
|
||||
"README",
|
||||
"THIRDPARTYLICENSEREADME-JAVAFX.txt",
|
||||
"THIRDPARTYLICENSEREADME.txt",
|
||||
"Welcome.html"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void copyTo(File targetDir) throws IOException {
|
||||
detectType();
|
||||
|
||||
File runtimeHomeDirectory = getDir();
|
||||
File runtimeContentsDirectory = runtimeHomeDirectory.getParentFile();
|
||||
File runtimeDirectory = runtimeContentsDirectory.getParentFile();
|
||||
|
||||
// Create root plug-in directory
|
||||
File pluginDirectory = new File(targetDir, runtimeDirectory.getName());
|
||||
pluginDirectory.mkdir();
|
||||
|
||||
// Create Contents directory
|
||||
File pluginContentsDirectory = new File(pluginDirectory, runtimeContentsDirectory.getName());
|
||||
pluginContentsDirectory.mkdir();
|
||||
|
||||
// Copy MacOS directory
|
||||
File runtimeMacOSDirectory = new File(runtimeContentsDirectory, "MacOS");
|
||||
AppBundlerTask.copy(runtimeMacOSDirectory, new File(pluginContentsDirectory, runtimeMacOSDirectory.getName()));
|
||||
|
||||
|
||||
// Copy Info.plist file
|
||||
File runtimeInfoPlistFile = new File(runtimeContentsDirectory, "Info.plist");
|
||||
AppBundlerTask.copy(runtimeInfoPlistFile, new File(pluginContentsDirectory, runtimeInfoPlistFile.getName()));
|
||||
|
||||
// Copy included contents of Home directory
|
||||
File pluginHomeDirectory = new File(pluginContentsDirectory, runtimeHomeDirectory.getName());
|
||||
|
||||
DirectoryScanner directoryScanner = getDirectoryScanner(getProject());
|
||||
String[] includedFiles = directoryScanner.getIncludedFiles();
|
||||
|
||||
for (int i = 0; i < includedFiles.length; i++) {
|
||||
String includedFile = includedFiles[i];
|
||||
File source = new File(runtimeHomeDirectory, includedFile);
|
||||
File destination = new File(pluginHomeDirectory, includedFile);
|
||||
AppBundlerTask.copy(source, destination);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Copyright 2015, Quality First Software GmbH 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.oracle.appbundler;
|
||||
|
||||
import static com.oracle.appbundler.BundleDocument.getListFromCommaSeparatedString;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Class representing an UTExportedTypeDeclaration or UTImportedTypeDeclaration in Info.plist
|
||||
*/
|
||||
public class TypeDeclaration implements IconContainer {
|
||||
|
||||
private boolean imported = false;
|
||||
private String identifier = null;
|
||||
private String referenceUrl = null;
|
||||
private String description = null;
|
||||
private String icon = null;
|
||||
private List<String> conformsTo = null;
|
||||
private List<String> osTypes = null;
|
||||
private List<String> mimeTypes = null;
|
||||
private List<String> extensions = null;
|
||||
|
||||
public TypeDeclaration() {
|
||||
this.conformsTo = Arrays.asList(new String[]{"public.data"});
|
||||
}
|
||||
|
||||
public boolean isImported() {
|
||||
return imported;
|
||||
}
|
||||
|
||||
public void setImported(boolean imported) {
|
||||
this.imported = imported;
|
||||
}
|
||||
|
||||
public String getIdentifier() {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
public void setIdentifier(String identifier) {
|
||||
this.identifier = identifier;
|
||||
}
|
||||
|
||||
public String getReferenceUrl() {
|
||||
return referenceUrl;
|
||||
}
|
||||
|
||||
public void setReferenceUrl(String referenceUrl) {
|
||||
this.referenceUrl = referenceUrl;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
||||
public void setIcon(String icon) {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public File getIconFile() {
|
||||
if (icon == null) { return null; }
|
||||
|
||||
File ifile = new File (icon);
|
||||
|
||||
if (! ifile.exists ( ) || ifile.isDirectory ( )) { return null; }
|
||||
|
||||
return ifile;
|
||||
}
|
||||
|
||||
public boolean hasIcon() {
|
||||
return icon != null;
|
||||
}
|
||||
|
||||
public List<String> getConformsTo() {
|
||||
return conformsTo;
|
||||
}
|
||||
|
||||
public void setConformsTo(String conformsToAsString) {
|
||||
this.conformsTo = getListFromCommaSeparatedString(conformsToAsString, "Conforms To");
|
||||
}
|
||||
|
||||
public List<String> getOsTypes() {
|
||||
return osTypes;
|
||||
}
|
||||
|
||||
public void setOsTypes(String osTypesAsString) {
|
||||
this.osTypes = getListFromCommaSeparatedString(osTypesAsString, "OS Types");
|
||||
}
|
||||
|
||||
public List<String> getMimeTypes() {
|
||||
return mimeTypes;
|
||||
}
|
||||
|
||||
public void setMimeTypes(String mimeTypesAsString) {
|
||||
this.mimeTypes = getListFromCommaSeparatedString(mimeTypesAsString, "Mime Types", true);
|
||||
}
|
||||
|
||||
public List<String> getExtensions() {
|
||||
return extensions;
|
||||
}
|
||||
|
||||
public void setExtensions(String extensionsAsString) {
|
||||
this.extensions = getListFromCommaSeparatedString(extensionsAsString, "Extensions", true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "" + imported;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="Movie Maker Tool" default="build">
|
||||
|
||||
|
||||
<target name="clean" description="Clean the build directories">
|
||||
<delete dir="bin" />
|
||||
<delete file="tool/MovieMaker.jar" />
|
||||
</target>
|
||||
|
||||
<target name="compile" description="Compile sources">
|
||||
<target name="compile" description="Compile sources">
|
||||
<mkdir dir="bin" />
|
||||
<javac target="1.8"
|
||||
source="1.8"
|
||||
srcdir="src"
|
||||
destdir="bin"
|
||||
srcdir="src"
|
||||
destdir="bin"
|
||||
encoding="UTF-8"
|
||||
includeAntRuntime="false"
|
||||
classpath="../../../../app/bin"
|
||||
nowarn="true"
|
||||
compiler="org.eclipse.jdt.core.JDTCompilerAdapter">
|
||||
<compilerclasspath path="../../../../java/mode/org.eclipse.jdt.core.jar;
|
||||
classpath="../../../../app/bin"
|
||||
nowarn="true">
|
||||
<compilerclasspath path="../../../../java/mode/org.eclipse.jdt.core.jar;
|
||||
../../../../java/mode/jdtCompilerAdapter.jar" />
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
@@ -30,10 +30,12 @@
|
||||
<jre>
|
||||
<path>java</path>
|
||||
<!-- Deal with jokers who install JOGL, ANTLR, etc system-wide -->
|
||||
<opt>-Djava.ext.dirs="%EXEDIR%\\java\\lib\\ext"</opt>
|
||||
<!-- <opt>-Djava.ext.dirs="%EXEDIR%\\java\\lib\\ext"</opt> -->
|
||||
<!-- Prevent a user-installed JNA from conflicting with our version.
|
||||
https://github.com/processing/processing/issues/2239 -->
|
||||
<opt>-Djna.nosys=true</opt>
|
||||
<!-- No scaling of swing (see #5753) -->
|
||||
<opt>-Dsun.java2d.uiScale=1</opt>
|
||||
<!-- starting in 3.0, require Java 8 -->
|
||||
<minVersion>1.8.0_60</minVersion>
|
||||
<!-- increase available per PDE X request -->
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
<jre>
|
||||
<path>java</path>
|
||||
<!-- Deal with jokers who install JOGL, ANTLR, etc system-wide -->
|
||||
<opt>-Djava.ext.dirs="%EXEDIR%\\java\\lib\\ext"</opt>
|
||||
<!-- <opt>-Djava.ext.dirs="%EXEDIR%\\java\\lib\\ext"</opt> -->
|
||||
<!-- https://github.com/processing/processing/issues/2239 -->
|
||||
<opt>-Djna.nosys=true</opt>
|
||||
<!-- Because nosys is set to true, the DLL in the current working
|
||||
directory won't be considered. And we can't specify the user's
|
||||
<!-- Because nosys is set to true, the DLL in the current working
|
||||
directory won't be considered. And we can't specify the user's
|
||||
directory here because that'll get us into encoding trouble.
|
||||
(See https://github.com/processing/processing/issues/3624)
|
||||
Instead, set this so that Native.loadNativeLibrary() will use
|
||||
@@ -44,6 +44,8 @@
|
||||
<opt>-Dsun.java2d.d3d=false</opt>
|
||||
<opt>-Dsun.java2d.ddoffscreen=false</opt>
|
||||
<opt>-Dsun.java2d.noddraw=true</opt>
|
||||
<!-- No scaling of swing (see #5753) -->
|
||||
<opt>-Dsun.java2d.uiScale=1</opt>
|
||||
<!-- starting in 3.0, require Java 8 -->
|
||||
<minVersion>1.8.0_60</minVersion>
|
||||
<!-- increase available per PDE X request -->
|
||||
|
||||
+6
-1
@@ -1,9 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="library/jogl-all.jar"/>
|
||||
<classpathentry kind="lib" path="library/gluegen-rt.jar"/>
|
||||
<classpathentry kind="lib" path="apple.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JavaFX11"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
+93
-55
@@ -1,8 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="Processing Core" default="build">
|
||||
|
||||
<property environment="env"/>
|
||||
|
||||
<target name="clean" description="Clean out the build directories">
|
||||
<delete dir="bin" />
|
||||
<delete dir="bin-test" />
|
||||
<delete file="library/core.jar" />
|
||||
</target>
|
||||
|
||||
@@ -14,67 +17,102 @@
|
||||
<subant buildpath="methods" target="dist" />
|
||||
</target>
|
||||
|
||||
<target name="compile" description="Compile" depends="methods-build">
|
||||
<taskdef name="methods"
|
||||
classname="PAppletMethods"
|
||||
classpath="methods/methods.jar" />
|
||||
<methods dir="${basedir}/src/processing/core" recorder="true" />
|
||||
<path id="classpath.base">
|
||||
<!-- kinda gross, but if not using the JDT, this just ignored anyway -->
|
||||
<pathelement location="apple.jar" />
|
||||
<pathelement location="library/jogl-all.jar" />
|
||||
<pathelement location="library/gluegen-rt.jar" />
|
||||
<pathelement location="library/javafx-swt.jar" />
|
||||
<pathelement location="library/javafx.base.jar" />
|
||||
<pathelement location="library/javafx.controls.jar" />
|
||||
<pathelement location="library/javafx.fxml.jar" />
|
||||
<pathelement location="library/javafx.graphics.jar" />
|
||||
<pathelement location="library/javafx.media.jar" />
|
||||
<pathelement location="library/javafx.properties" />
|
||||
<pathelement location="library/javafx.swing.jar" />
|
||||
<pathelement location="library/javafx.web.jar" />
|
||||
</path>
|
||||
|
||||
<!-- Where can I expect to find Java Mode JARs? -->
|
||||
<property name="java.mode" value="../java/mode/" />
|
||||
<path id="classpath.test">
|
||||
<pathelement location="library-test/junit-4.8.1.jar" />
|
||||
<pathelement location="library-test/mockito-all-1.10.19.jar" />
|
||||
<pathelement location="bin-test" />
|
||||
<path refid="classpath.base" />
|
||||
</path>
|
||||
|
||||
<!-- Check for JDT compiler, since this is likely a PDE build. Using
|
||||
it allows us to build the PDE with only a JRE on Windows and Linux.
|
||||
So that the core can be built independently of the PDE,
|
||||
use javac (the "modern" compiler) if ecj is not present. -->
|
||||
<property name="jdt.jar" value="${java.mode}/org.eclipse.jdt.core.jar" />
|
||||
<condition property="build.compiler"
|
||||
value="org.eclipse.jdt.core.JDTCompilerAdapter"
|
||||
else="modern">
|
||||
<available file="${jdt.jar}" />
|
||||
</condition>
|
||||
<!--<echo message="compiler is ${build.compiler}" />-->
|
||||
<macrodef name="compilecommon">
|
||||
<attribute name="destdir"/>
|
||||
<attribute name="srcdir"/>
|
||||
<attribute name="classpath"/>
|
||||
<sequential>
|
||||
<taskdef name="methods"
|
||||
classname="PAppletMethods"
|
||||
classpath="methods/methods.jar" />
|
||||
<methods dir="${basedir}/src/processing/core" recorder="true" />
|
||||
|
||||
<!-- JavaFX got removed from the Oracle's JDK for arm -->
|
||||
<condition property="fx.unavailable" value="true">
|
||||
<or>
|
||||
<equals arg1="${os.arch}" arg2="arm" />
|
||||
<equals arg1="${os.arch}" arg2="aarch64" />
|
||||
</or>
|
||||
</condition>
|
||||
<!-- Where can I expect to find Java Mode JARs? -->
|
||||
<property name="java.mode" value="../java/mode/" />
|
||||
|
||||
<!-- link against apple.jar for the ThinkDifferent class -->
|
||||
<mkdir dir="bin" />
|
||||
<javac source="1.8"
|
||||
target="1.8"
|
||||
encoding="UTF-8"
|
||||
includeAntRuntime="false"
|
||||
debug="true"
|
||||
destdir="bin"
|
||||
classpath="apple.jar;
|
||||
library/jogl-all.jar;
|
||||
library/gluegen-rt.jar"
|
||||
nowarn="true">
|
||||
<!-- kinda gross, but if not using the JDT, this just ignored anyway -->
|
||||
<compilerclasspath path="${jdt.jar}; ${java.mode}/jdtCompilerAdapter.jar" />
|
||||
<src path="src" />
|
||||
<include name="processing/**" />
|
||||
<exclude name="processing/javafx/**" if="fx.unavailable" />
|
||||
</javac>
|
||||
<!-- JavaFX got removed from the Oracle's JDK for arm and Java 11 -->
|
||||
<condition property="fx.unavailable" value="true">
|
||||
<or>
|
||||
<equals arg1="${os.arch}" arg2="arm" />
|
||||
<equals arg1="${os.arch}" arg2="aarch64" />
|
||||
</or>
|
||||
</condition>
|
||||
|
||||
<!-- Copy the jnilib to the bin folder so it's included. -->
|
||||
<copy todir="bin/japplemenubar"
|
||||
file="src/japplemenubar/libjAppleMenuBar.jnilib"
|
||||
preservelastmodified="true" />
|
||||
<!-- link against apple.jar for the ThinkDifferent class -->
|
||||
<mkdir dir="@{destdir}" />
|
||||
<javac source="1.8"
|
||||
target="1.8"
|
||||
encoding="UTF-8"
|
||||
includeAntRuntime="false"
|
||||
debug="true"
|
||||
destdir="@{destdir}"
|
||||
nowarn="true">
|
||||
<classpath refid="@{classpath}"/>
|
||||
<src path="@{srcdir}" />
|
||||
<include name="processing/**" />
|
||||
<exclude name="processing/javafx/**" if="fx.unavailable" />
|
||||
</javac>
|
||||
|
||||
<!-- Copy shaders to bin. (Eclipse does this automatically.) -->
|
||||
<copy todir="bin" preservelastmodified="true">
|
||||
<fileset dir="src">
|
||||
<include name="processing/opengl/shaders/*.glsl" />
|
||||
<include name="processing/opengl/cursors/*.png" />
|
||||
<include name="icon/*.png" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<!-- Copy the jnilib to the bin folder so it's included. -->
|
||||
<copy todir="bin/japplemenubar"
|
||||
file="src/japplemenubar/libjAppleMenuBar.jnilib" />
|
||||
|
||||
<!-- Copy shaders to bin. (Eclipse does this automatically.) -->
|
||||
<copy todir="bin">
|
||||
<fileset dir="src">
|
||||
<include name="processing/opengl/shaders/*.glsl" />
|
||||
<include name="processing/opengl/cursors/*.png" />
|
||||
<include name="icon/*.png" />
|
||||
</fileset>
|
||||
</copy>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<target name="test-compile" description="Compile" depends="methods-build">
|
||||
<compilecommon srcdir="src; test" destdir="bin-test" classpath="classpath.test" />
|
||||
</target>
|
||||
|
||||
<target name="clean-pre-test" description="Required step prior to test">
|
||||
<delete dir="resource-test/scratch" />
|
||||
</target>
|
||||
|
||||
<target name="test" depends="test-compile, clean-pre-test">
|
||||
<junit haltonfailure="true">
|
||||
<classpath refid="classpath.test" />
|
||||
<formatter type="brief" usefile="false" />
|
||||
<batchtest>
|
||||
<fileset dir="test">
|
||||
<include name="**/*Test.java" />
|
||||
</fileset>
|
||||
</batchtest>
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
<target name="compile" description="Compile" depends="test">
|
||||
<compilecommon srcdir="src" destdir="bin" classpath="classpath.base" />
|
||||
</target>
|
||||
|
||||
<target name="build" depends="compile" description="Build core library">
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
JUnit under EPL license: https://junit.org/junit4/license.html.
|
||||
Mockito under MIT license: https://github.com/mockito/mockito/blob/master/LICENSE.
|
||||
Binary file not shown.
+16
-10
@@ -1,12 +1,18 @@
|
||||
# If you want to support more platforms, visit jogamp.org to get the
|
||||
# natives libraries for the platform in question (i.e. Solaris).
|
||||
# If you want to support more platforms, visit jogamp.org to get the
|
||||
# natives libraries for the platform in question (i.e. Solaris).
|
||||
|
||||
name = OpenGL
|
||||
name = CoreOpenJFXOpenGL
|
||||
|
||||
application.macosx=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-macosx-universal.jar,gluegen-rt-natives-macosx-universal.jar
|
||||
application.windows32=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-windows-i586.jar,gluegen-rt-natives-windows-i586.jar
|
||||
application.windows64=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-windows-amd64.jar,gluegen-rt-natives-windows-amd64.jar
|
||||
application.linux32=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-i586.jar,gluegen-rt-natives-linux-i586.jar
|
||||
application.linux64=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-amd64.jar,gluegen-rt-natives-linux-amd64.jar
|
||||
application.linux-armv6hf=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-armv6hf.jar,gluegen-rt-natives-linux-armv6hf.jar
|
||||
application.linux-arm64=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-aarch64.jar,gluegen-rt-natives-linux-aarch64.jar
|
||||
application.macosx=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-macosx-universal.jar,gluegen-rt-natives-macosx-universal.jar,javafx-swt.jar,javafx.base.jar,javafx.controls.jar,javafx.fxml.jar,javafx.graphics.jar,javafx.media.jar,javafx.swing.jar,javafx.web.jar,libdecora_sse.dylib,libfxplugins.dylib,libglass.dylib,libglib-lite.dylib,libgstreamer-lite.dylib,libjavafx_font.dylib,libjavafx_iio.dylib,libjfxmedia.dylib,libjfxmedia_avf.dylib,libjfxwebkit.dylib,libprism_common.dylib,libprism_es2.dylib,libprism_sw.dylib
|
||||
|
||||
application.windows32=api-ms-win-core-console-l1-1-0.dll,api-ms-win-core-datetime-l1-1-0.dll,api-ms-win-core-debug-l1-1-0.dll,api-ms-win-core-errorhandling-l1-1-0.dll,api-ms-win-core-file-l1-1-0.dll,api-ms-win-core-file-l1-2-0.dll,api-ms-win-core-file-l2-1-0.dll,api-ms-win-core-handle-l1-1-0.dll,api-ms-win-core-heap-l1-1-0.dll,api-ms-win-core-interlocked-l1-1-0.dll,api-ms-win-core-libraryloader-l1-1-0.dll,api-ms-win-core-localization-l1-2-0.dll,api-ms-win-core-memory-l1-1-0.dll,api-ms-win-core-namedpipe-l1-1-0.dll,api-ms-win-core-processenvironment-l1-1-0.dll,api-ms-win-core-processthreads-l1-1-0.dll,api-ms-win-core-processthreads-l1-1-1.dll,api-ms-win-core-profile-l1-1-0.dll,api-ms-win-core-rtlsupport-l1-1-0.dll,api-ms-win-core-string-l1-1-0.dll,api-ms-win-core-synch-l1-1-0.dll,api-ms-win-core-synch-l1-2-0.dll,api-ms-win-core-sysinfo-l1-1-0.dll,api-ms-win-core-timezone-l1-1-0.dll,api-ms-win-core-util-l1-1-0.dll,api-ms-win-crt-conio-l1-1-0.dll,api-ms-win-crt-convert-l1-1-0.dll,api-ms-win-crt-environment-l1-1-0.dll,api-ms-win-crt-filesystem-l1-1-0.dll,api-ms-win-crt-heap-l1-1-0.dll,api-ms-win-crt-locale-l1-1-0.dll,api-ms-win-crt-math-l1-1-0.dll,api-ms-win-crt-multibyte-l1-1-0.dll,api-ms-win-crt-private-l1-1-0.dll,api-ms-win-crt-process-l1-1-0.dll,api-ms-win-crt-runtime-l1-1-0.dll,api-ms-win-crt-stdio-l1-1-0.dll,api-ms-win-crt-string-l1-1-0.dll,api-ms-win-crt-time-l1-1-0.dll,api-ms-win-crt-utility-l1-1-0.dll,concrt140.dll,core.jar,decora_sse.dll,fxplugins.dll,glass.dll,glib-lite.dll,gluegen-rt-natives-linux-aarch64.jar,gluegen-rt-natives-linux-amd64.jar,gluegen-rt-natives-linux-armv6hf.jar,gluegen-rt-natives-linux-i586.jar,gluegen-rt-natives-macosx-universal.jar,gluegen-rt-natives-windows-amd64.jar,gluegen-rt-natives-windows-i586.jar,gluegen-rt.jar,gstreamer-lite.dll,javafx-swt.jar,javafx.base.jar,javafx.controls.jar,javafx.fxml.jar,javafx.graphics.jar,javafx.media.jar,javafx.properties,javafx.swing.jar,javafx.web.jar,javafx_font.dll,javafx_iio.dll,jfxmedia.dll,jfxwebkit.dll,jogl-all-natives-linux-aarch64.jar,jogl-all-natives-linux-amd64.jar,jogl-all-natives-linux-armv6hf.jar,jogl-all-natives-linux-i586.jar,jogl-all-natives-macosx-universal.jar,jogl-all-natives-windows-amd64.jar,jogl-all-natives-windows-i586.jar,jogl-all.jar,msvcp140.dll,prism_common.dll,prism_d3d.dll,prism_sw.dll,ucrtbase.dll,vcruntime140.dll
|
||||
|
||||
application.windows64=api-ms-win-core-console-l1-1-0.dll,api-ms-win-core-datetime-l1-1-0.dll,api-ms-win-core-debug-l1-1-0.dll,api-ms-win-core-errorhandling-l1-1-0.dll,api-ms-win-core-file-l1-1-0.dll,api-ms-win-core-file-l1-2-0.dll,api-ms-win-core-file-l2-1-0.dll,api-ms-win-core-handle-l1-1-0.dll,api-ms-win-core-heap-l1-1-0.dll,api-ms-win-core-interlocked-l1-1-0.dll,api-ms-win-core-libraryloader-l1-1-0.dll,api-ms-win-core-localization-l1-2-0.dll,api-ms-win-core-memory-l1-1-0.dll,api-ms-win-core-namedpipe-l1-1-0.dll,api-ms-win-core-processenvironment-l1-1-0.dll,api-ms-win-core-processthreads-l1-1-0.dll,api-ms-win-core-processthreads-l1-1-1.dll,api-ms-win-core-profile-l1-1-0.dll,api-ms-win-core-rtlsupport-l1-1-0.dll,api-ms-win-core-string-l1-1-0.dll,api-ms-win-core-synch-l1-1-0.dll,api-ms-win-core-synch-l1-2-0.dll,api-ms-win-core-sysinfo-l1-1-0.dll,api-ms-win-core-timezone-l1-1-0.dll,api-ms-win-core-util-l1-1-0.dll,api-ms-win-crt-conio-l1-1-0.dll,api-ms-win-crt-convert-l1-1-0.dll,api-ms-win-crt-environment-l1-1-0.dll,api-ms-win-crt-filesystem-l1-1-0.dll,api-ms-win-crt-heap-l1-1-0.dll,api-ms-win-crt-locale-l1-1-0.dll,api-ms-win-crt-math-l1-1-0.dll,api-ms-win-crt-multibyte-l1-1-0.dll,api-ms-win-crt-private-l1-1-0.dll,api-ms-win-crt-process-l1-1-0.dll,api-ms-win-crt-runtime-l1-1-0.dll,api-ms-win-crt-stdio-l1-1-0.dll,api-ms-win-crt-string-l1-1-0.dll,api-ms-win-crt-time-l1-1-0.dll,api-ms-win-crt-utility-l1-1-0.dll,concrt140.dll,core.jar,decora_sse.dll,fxplugins.dll,glass.dll,glib-lite.dll,gluegen-rt-natives-linux-aarch64.jar,gluegen-rt-natives-linux-amd64.jar,gluegen-rt-natives-linux-armv6hf.jar,gluegen-rt-natives-linux-i586.jar,gluegen-rt-natives-macosx-universal.jar,gluegen-rt-natives-windows-amd64.jar,gluegen-rt-natives-windows-i586.jar,gluegen-rt.jar,gstreamer-lite.dll,javafx-swt.jar,javafx.base.jar,javafx.controls.jar,javafx.fxml.jar,javafx.graphics.jar,javafx.media.jar,javafx.properties,javafx.swing.jar,javafx.web.jar,javafx_font.dll,javafx_iio.dll,jfxmedia.dll,jfxwebkit.dll,jogl-all-natives-linux-aarch64.jar,jogl-all-natives-linux-amd64.jar,jogl-all-natives-linux-armv6hf.jar,jogl-all-natives-linux-i586.jar,jogl-all-natives-macosx-universal.jar,jogl-all-natives-windows-amd64.jar,jogl-all-natives-windows-i586.jar,jogl-all.jar,msvcp140.dll,prism_common.dll,prism_d3d.dll,prism_sw.dll,ucrtbase.dll,vcruntime140.dll
|
||||
|
||||
application.linux32=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-i586.jar,gluegen-rt-natives-linux-i586.jar,javafx-swt.jar,javafx.base.jar,javafx.controls.jar,javafx.fxml.jar,javafx.graphics.jar,javafx.media.jar,javafx.swing.jar,javafx.web.jar,libavplugin-54.so,libavplugin-56.so,libavplugin-57.so,libavplugin-ffmpeg-56.so,libavplugin-ffmpeg-57.so,libdecora_sse.so,libfxplugins.so,libglass.so,libglassgtk2.so,libglassgtk3.so,libgstreamer-lite.so,libjavafx_font.so,libjavafx_font_freetype.so,libjavafx_font_pango.so,libjavafx_iio.so,libjfxmedia.so,libjfxwebkit.so,libprism_common.so,libprism_es2.so,libprism_sw.so
|
||||
|
||||
application.linux64=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-amd64.jar,gluegen-rt-natives-linux-amd64.jar,javafx-swt.jar,javafx.base.jar,javafx.controls.jar,javafx.fxml.jar,javafx.graphics.jar,javafx.media.jar,javafx.swing.jar,javafx.web.jar,libavplugin-54.so,libavplugin-56.so,libavplugin-57.so,libavplugin-ffmpeg-56.so,libavplugin-ffmpeg-57.so,libdecora_sse.so,libfxplugins.so,libglass.so,libglassgtk2.so,libglassgtk3.so,libgstreamer-lite.so,libjavafx_font.so,libjavafx_font_freetype.so,libjavafx_font_pango.so,libjavafx_iio.so,libjfxmedia.so,libjfxwebkit.so,libprism_common.so,libprism_es2.so,libprism_sw.so
|
||||
|
||||
application.linux-armv6hf=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-armv6hf.jar,gluegen-rt-natives-linux-armv6hf.jar,javafx-swt.jar,javafx.base.jar,javafx.controls.jar,javafx.fxml.jar,javafx.graphics.jar,javafx.media.jar,javafx.swing.jar,javafx.web.jar,libavplugin-54.so,libavplugin-56.so,libavplugin-57.so,libavplugin-ffmpeg-56.so,libavplugin-ffmpeg-57.so,libdecora_sse.so,libfxplugins.so,libglass.so,libglassgtk2.so,libglassgtk3.so,libgstreamer-lite.so,libjavafx_font.so,libjavafx_font_freetype.so,libjavafx_font_pango.so,libjavafx_iio.so,libjfxmedia.so,libjfxwebkit.so,libprism_common.so,libprism_es2.so,libprism_sw.so
|
||||
|
||||
application.linux-arm64=core.jar,jogl-all.jar,gluegen-rt.jar,jogl-all-natives-linux-aarch64.jar,gluegen-rt-natives-linux-aarch64.jar,javafx-swt.jar,javafx.base.jar,javafx.controls.jar,javafx.fxml.jar,javafx.graphics.jar,javafx.media.jar,javafx.swing.jar,javafx.web.jar,libavplugin-54.so,libavplugin-56.so,libavplugin-57.so,libavplugin-ffmpeg-56.so,libavplugin-ffmpeg-57.so,libdecora_sse.so,libfxplugins.so,libglass.so,libglassgtk2.so,libglassgtk3.so,libgstreamer-lite.so,libjavafx_font.so,libjavafx_font_freetype.so,libjavafx_font_pango.so,libjavafx_iio.so,libjfxmedia.so,libjfxwebkit.so,libprism_common.so,libprism_es2.so,libprism_sw.so
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,3 @@
|
||||
javafx.version=11.0.1
|
||||
javafx.runtime.version=11.0.1+1
|
||||
javafx.runtime.build=1
|
||||
Binary file not shown.
Binary file not shown.
+9
-23
@@ -2,36 +2,22 @@
|
||||
|
||||
<target name="compile">
|
||||
|
||||
<!-- Check for JDT compiler, since this is likely a PDE build. Using
|
||||
it allows us to build the PDE with only a JRE on Windows and Linux.
|
||||
So that the core can be built independently of the PDE,
|
||||
use javac (the "modern" compiler) if ecj is not present. -->
|
||||
<property name="jdt.jar" value="../../java/mode/org.eclipse.jdt.core.jar" />
|
||||
<condition property="build.compiler"
|
||||
value="org.eclipse.jdt.core.JDTCompilerAdapter"
|
||||
else="modern">
|
||||
<available file="${jdt.jar}" />
|
||||
</condition>
|
||||
<!--<echo message="compiler is ${build.compiler}" />-->
|
||||
|
||||
<mkdir dir="bin" />
|
||||
<javac source="1.8"
|
||||
target="1.8"
|
||||
srcdir="src"
|
||||
destdir="bin"
|
||||
debug="true"
|
||||
srcdir="src"
|
||||
destdir="bin"
|
||||
debug="true"
|
||||
includeantruntime="true"
|
||||
nowarn="true">
|
||||
<!-- kinda gross, but if not using the JDT, this just ignored anyway -->
|
||||
<compilerclasspath path="${jdt.jar};
|
||||
../../java/mode/jdtCompilerAdapter.jar" />
|
||||
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="dist" depends="compile">
|
||||
<jar basedir="bin" destfile="methods.jar" />
|
||||
</target>
|
||||
|
||||
|
||||
<target name="demo" depends="dist">
|
||||
<mkdir dir="demo" />
|
||||
|
||||
@@ -41,12 +27,12 @@
|
||||
<fileset file="../src/processing/core/PImage.java" />
|
||||
</copy>
|
||||
|
||||
<taskdef name="methods"
|
||||
classname="PAppletMethods"
|
||||
<taskdef name="methods"
|
||||
classname="PAppletMethods"
|
||||
classpath="methods.jar" />
|
||||
<methods dir="demo"/>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="bin" />
|
||||
<delete file="methods.jar" />
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 90 B |
@@ -0,0 +1,2 @@
|
||||
test1
|
||||
test2
|
||||
@@ -281,9 +281,6 @@ public class PApplet implements PConstants {
|
||||
* @see PApplet#get(int, int, int, int)
|
||||
* @see PApplet#set(int, int, int)
|
||||
* @see PImage
|
||||
* @see PApplet#pixelDensity()
|
||||
* @see PApplet#pixelWidth
|
||||
* @see PApplet#pixelHeight
|
||||
*/
|
||||
public int[] pixels;
|
||||
|
||||
@@ -1213,8 +1210,7 @@ public class PApplet implements PConstants {
|
||||
/**
|
||||
* @webref environment
|
||||
* @param density 1 or 2
|
||||
* @see PApplet#pixelWidth
|
||||
* @see PApplet#pixelHeight
|
||||
*
|
||||
*/
|
||||
public void pixelDensity(int density) {
|
||||
//println(density + " " + this.pixelDensity);
|
||||
@@ -2004,9 +2000,6 @@ public class PApplet implements PConstants {
|
||||
* @param height height of the display window in units of pixels
|
||||
* @see PApplet#width
|
||||
* @see PApplet#height
|
||||
* @see PApplet#setup()
|
||||
* @see PApplet#settings()
|
||||
* @see PApplet#fullScreen()
|
||||
*/
|
||||
public void size(int width, int height) {
|
||||
// Check to make sure the width/height have actually changed. It's ok to
|
||||
@@ -12580,17 +12573,17 @@ public class PApplet implements PConstants {
|
||||
* ( begin auto-generated from curvePoint.xml )
|
||||
*
|
||||
* Evalutes the curve at point t for points a, b, c, d. The parameter t
|
||||
* varies between 0 and 1, a and d are the control points, and b and c are
|
||||
* the points on the curve. This can be done once with the x coordinates and a
|
||||
* varies between 0 and 1, a and d are points on the curve, and b and c are
|
||||
* the control points. This can be done once with the x coordinates and a
|
||||
* second time with the y coordinates to get the location of a curve at t.
|
||||
*
|
||||
* ( end auto-generated )
|
||||
*
|
||||
* @webref shape:curves
|
||||
* @param a coordinate of first control point
|
||||
* @param b coordinate of first point on the curve
|
||||
* @param c coordinate of second point on the curve
|
||||
* @param d coordinate of second control point
|
||||
* @param a coordinate of first point on the curve
|
||||
* @param b coordinate of second point on the curve
|
||||
* @param c coordinate of third point on the curve
|
||||
* @param d coordinate of fourth point on the curve
|
||||
* @param t value between 0 and 1
|
||||
* @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float)
|
||||
* @see PGraphics#curveVertex(float, float)
|
||||
@@ -14862,8 +14855,6 @@ public class PApplet implements PConstants {
|
||||
|
||||
/**
|
||||
* gray number specifying value between white and black
|
||||
*
|
||||
* @param gray value between black and white, by default 0 to 255
|
||||
*/
|
||||
public void specular(float gray) {
|
||||
if (recorder != null) recorder.specular(gray);
|
||||
@@ -14929,8 +14920,6 @@ public class PApplet implements PConstants {
|
||||
|
||||
/**
|
||||
* gray number specifying value between white and black
|
||||
*
|
||||
* @param gray value between black and white, by default 0 to 255
|
||||
*/
|
||||
public void emissive(float gray) {
|
||||
if (recorder != null) recorder.emissive(gray);
|
||||
|
||||
@@ -3424,17 +3424,17 @@ public class PGraphics extends PImage implements PConstants {
|
||||
* ( begin auto-generated from curvePoint.xml )
|
||||
*
|
||||
* Evalutes the curve at point t for points a, b, c, d. The parameter t
|
||||
* varies between 0 and 1, a and d are the control points, and b and c are
|
||||
* the points on the curve. This can be done once with the x coordinates and a
|
||||
* varies between 0 and 1, a and d are points on the curve, and b and c are
|
||||
* the control points. This can be done once with the x coordinates and a
|
||||
* second time with the y coordinates to get the location of a curve at t.
|
||||
*
|
||||
* ( end auto-generated )
|
||||
*
|
||||
* @webref shape:curves
|
||||
* @param a coordinate of first control point
|
||||
* @param b coordinate of first point on the curve
|
||||
* @param c coordinate of second point on the curve
|
||||
* @param d coordinate of second control point
|
||||
* @param a coordinate of first point on the curve
|
||||
* @param b coordinate of second point on the curve
|
||||
* @param c coordinate of third point on the curve
|
||||
* @param d coordinate of fourth point on the curve
|
||||
* @param t value between 0 and 1
|
||||
* @see PGraphics#curve(float, float, float, float, float, float, float, float, float, float, float, float)
|
||||
* @see PGraphics#curveVertex(float, float)
|
||||
@@ -6940,8 +6940,6 @@ public class PGraphics extends PImage implements PConstants {
|
||||
|
||||
/**
|
||||
* gray number specifying value between white and black
|
||||
*
|
||||
* @param gray value between black and white, by default 0 to 255
|
||||
*/
|
||||
public void specular(float gray) {
|
||||
colorCalc(gray);
|
||||
@@ -7019,8 +7017,6 @@ public class PGraphics extends PImage implements PConstants {
|
||||
|
||||
/**
|
||||
* gray number specifying value between white and black
|
||||
*
|
||||
* @param gray value between black and white, by default 0 to 255
|
||||
*/
|
||||
public void emissive(float gray) {
|
||||
colorCalc(gray);
|
||||
|
||||
@@ -61,6 +61,17 @@ import javax.imageio.metadata.*;
|
||||
*/
|
||||
public class PImage implements PConstants, Cloneable {
|
||||
|
||||
private static final byte TIFF_HEADER[] = {
|
||||
77, 77, 0, 42, 0, 0, 0, 8, 0, 9, 0, -2, 0, 4, 0, 0, 0, 1, 0, 0,
|
||||
0, 0, 1, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 3, 0, 0, 0, 1,
|
||||
0, 0, 0, 0, 1, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 122, 1, 6, 0, 3, 0,
|
||||
0, 0, 1, 0, 2, 0, 0, 1, 17, 0, 4, 0, 0, 0, 1, 0, 0, 3, 0, 1, 21,
|
||||
0, 3, 0, 0, 0, 1, 0, 3, 0, 0, 1, 22, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0,
|
||||
1, 23, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 8, 0, 8
|
||||
};
|
||||
|
||||
private static final String TIFF_ERROR = "Error: Processing can only read its own TIFF files.";
|
||||
|
||||
/**
|
||||
* Format for this image, one of RGB, ARGB or ALPHA.
|
||||
* note that RGB images still require 0xff in the high byte
|
||||
@@ -90,7 +101,7 @@ public class PImage implements PConstants, Cloneable {
|
||||
*
|
||||
* @webref image:pixels
|
||||
* @usage web_application
|
||||
* @brief Array containing the color of every pixel in the image
|
||||
* @brief Array containing the color of every pixel in the image
|
||||
*/
|
||||
public int[] pixels;
|
||||
|
||||
@@ -286,6 +297,40 @@ public class PImage implements PConstants, Cloneable {
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
public PImage(int width, int height, int[] pixels, boolean requiresCheckAlpha, PApplet parent) {
|
||||
initFromPixels(
|
||||
width,
|
||||
height,
|
||||
pixels,
|
||||
RGB,
|
||||
1
|
||||
);
|
||||
|
||||
this.parent = parent;
|
||||
|
||||
if (requiresCheckAlpha) {
|
||||
checkAlpha();
|
||||
}
|
||||
}
|
||||
|
||||
public PImage(int width, int height, int[] pixels, boolean requiresCheckAlpha, PApplet parent,
|
||||
int format, int factor) {
|
||||
|
||||
initFromPixels(width, height, pixels, format, factor);
|
||||
this.parent = parent;
|
||||
|
||||
if (requiresCheckAlpha) {
|
||||
checkAlpha();
|
||||
}
|
||||
}
|
||||
|
||||
private void initFromPixels(int width, int height, int[] pixels, int format, int factor) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.format = format;
|
||||
this.pixelDensity = factor;
|
||||
this.pixels = pixels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new PImage from a java.awt.Image. This constructor assumes
|
||||
@@ -2947,20 +2992,6 @@ int testFunction(int dst, int src) {
|
||||
|
||||
// FILE I/O
|
||||
|
||||
|
||||
static byte TIFF_HEADER[] = {
|
||||
77, 77, 0, 42, 0, 0, 0, 8, 0, 9, 0, -2, 0, 4, 0, 0, 0, 1, 0, 0,
|
||||
0, 0, 1, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 3, 0, 0, 0, 1,
|
||||
0, 0, 0, 0, 1, 2, 0, 3, 0, 0, 0, 3, 0, 0, 0, 122, 1, 6, 0, 3, 0,
|
||||
0, 0, 1, 0, 2, 0, 0, 1, 17, 0, 4, 0, 0, 0, 1, 0, 0, 3, 0, 1, 21,
|
||||
0, 3, 0, 0, 0, 1, 0, 3, 0, 0, 1, 22, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0,
|
||||
1, 23, 0, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 8, 0, 8
|
||||
};
|
||||
|
||||
|
||||
static final String TIFF_ERROR =
|
||||
"Error: Processing can only read its own TIFF files.";
|
||||
|
||||
static protected PImage loadTIFF(byte tiff[]) {
|
||||
if ((tiff[42] != tiff[102]) || // width/height in both places
|
||||
(tiff[43] != tiff[103])) {
|
||||
@@ -3008,7 +3039,6 @@ int testFunction(int dst, int src) {
|
||||
return outgoing;
|
||||
}
|
||||
|
||||
|
||||
protected boolean saveTIFF(OutputStream output) {
|
||||
// shutting off the warning, people can figure this out themselves
|
||||
/*
|
||||
@@ -3019,7 +3049,13 @@ int testFunction(int dst, int src) {
|
||||
*/
|
||||
try {
|
||||
byte tiff[] = new byte[768];
|
||||
System.arraycopy(TIFF_HEADER, 0, tiff, 0, TIFF_HEADER.length);
|
||||
System.arraycopy(
|
||||
TIFF_HEADER,
|
||||
0,
|
||||
tiff,
|
||||
0,
|
||||
TIFF_HEADER.length
|
||||
);
|
||||
|
||||
tiff[30] = (byte) ((pixelWidth >> 8) & 0xff);
|
||||
tiff[31] = (byte) ((pixelWidth) & 0xff);
|
||||
@@ -3328,10 +3364,10 @@ int testFunction(int dst, int src) {
|
||||
/**
|
||||
* ( begin auto-generated from PImage_save.xml )
|
||||
*
|
||||
* Saves the image into a file. Append a file extension to the name of
|
||||
* the file, to indicate the file format to be used: either TIFF (.tif),
|
||||
* TARGA (.tga), JPEG (.jpg), or PNG (.png). If no extension is included
|
||||
* in the filename, the image will save in TIFF format and .tif will be
|
||||
* Saves the image into a file. Append a file extension to the name of
|
||||
* the file, to indicate the file format to be used: either TIFF (.tif),
|
||||
* TARGA (.tga), JPEG (.jpg), or PNG (.png). If no extension is included
|
||||
* in the filename, the image will save in TIFF format and .tif will be
|
||||
* added to the name. These files are saved to the sketch's folder, which
|
||||
* may be opened by selecting "Show sketch folder" from the "Sketch" menu.
|
||||
* <br /><br />To save an image created within the code, rather
|
||||
@@ -3371,68 +3407,68 @@ int testFunction(int dst, int src) {
|
||||
* @usage application
|
||||
* @param filename a sequence of letters and numbers
|
||||
*/
|
||||
public boolean save(String filename) { // ignore
|
||||
boolean success = false;
|
||||
public boolean save(String filename) { // ignore
|
||||
boolean success = false;
|
||||
|
||||
if (parent != null) {
|
||||
// use savePath(), so that the intermediate directories are created
|
||||
filename = parent.savePath(filename);
|
||||
if (parent != null) {
|
||||
// use savePath(), so that the intermediate directories are created
|
||||
filename = parent.savePath(filename);
|
||||
|
||||
} else {
|
||||
File file = new File(filename);
|
||||
if (file.isAbsolute()) {
|
||||
// make sure that the intermediate folders have been created
|
||||
PApplet.createPath(file);
|
||||
} else {
|
||||
String msg =
|
||||
"PImage.save() requires an absolute path. " +
|
||||
"Use createImage(), or pass savePath() to save().";
|
||||
PGraphics.showException(msg);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
File file = new File(filename);
|
||||
if (file.isAbsolute()) {
|
||||
// make sure that the intermediate folders have been created
|
||||
PApplet.createPath(file);
|
||||
} else {
|
||||
String msg =
|
||||
"PImage.save() requires an absolute path. " +
|
||||
"Use createImage(), or pass savePath() to save().";
|
||||
PGraphics.showException(msg);
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure the pixel data is ready to go
|
||||
loadPixels();
|
||||
// Make sure the pixel data is ready to go
|
||||
loadPixels();
|
||||
|
||||
try {
|
||||
OutputStream os = null;
|
||||
try {
|
||||
OutputStream os = null;
|
||||
|
||||
if (saveImageFormats == null) {
|
||||
saveImageFormats = javax.imageio.ImageIO.getWriterFormatNames();
|
||||
}
|
||||
if (saveImageFormats != null) {
|
||||
for (int i = 0; i < saveImageFormats.length; i++) {
|
||||
if (filename.endsWith("." + saveImageFormats[i])) {
|
||||
if (!saveImageIO(filename)) {
|
||||
System.err.println("Error while saving image.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (saveImageFormats == null) {
|
||||
saveImageFormats = javax.imageio.ImageIO.getWriterFormatNames();
|
||||
}
|
||||
if (saveImageFormats != null) {
|
||||
for (int i = 0; i < saveImageFormats.length; i++) {
|
||||
if (filename.endsWith("." + saveImageFormats[i])) {
|
||||
if (!saveImageIO(filename)) {
|
||||
System.err.println("Error while saving image.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (filename.toLowerCase().endsWith(".tga")) {
|
||||
os = new BufferedOutputStream(new FileOutputStream(filename), 32768);
|
||||
success = saveTGA(os); //, pixels, width, height, format);
|
||||
if (filename.toLowerCase().endsWith(".tga")) {
|
||||
os = new BufferedOutputStream(new FileOutputStream(filename), 32768);
|
||||
success = saveTGA(os); //, pixels, width, height, format);
|
||||
|
||||
} else {
|
||||
if (!filename.toLowerCase().endsWith(".tif") &&
|
||||
!filename.toLowerCase().endsWith(".tiff")) {
|
||||
// if no .tif extension, add it..
|
||||
filename += ".tif";
|
||||
}
|
||||
os = new BufferedOutputStream(new FileOutputStream(filename), 32768);
|
||||
success = saveTIFF(os); //, pixels, width, height);
|
||||
}
|
||||
os.flush();
|
||||
os.close();
|
||||
} else {
|
||||
if (!filename.toLowerCase().endsWith(".tif") &&
|
||||
!filename.toLowerCase().endsWith(".tiff")) {
|
||||
// if no .tif extension, add it..
|
||||
filename += ".tif";
|
||||
}
|
||||
os = new BufferedOutputStream(new FileOutputStream(filename), 32768);
|
||||
success = saveTIFF(os); //, pixels, width, height);
|
||||
}
|
||||
os.flush();
|
||||
os.close();
|
||||
|
||||
} catch (IOException e) {
|
||||
System.err.println("Error while saving image.");
|
||||
e.printStackTrace();
|
||||
success = false;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.err.println("Error while saving image.");
|
||||
e.printStackTrace();
|
||||
success = false;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import java.util.Base64;
|
||||
|
||||
|
||||
/**
|
||||
@@ -1910,16 +1910,29 @@ public class PShape implements PConstants {
|
||||
}
|
||||
}
|
||||
|
||||
private void loadBase64Image(){
|
||||
String[] parts = this.imagePath.split(";base64,");
|
||||
private void loadBase64Image() {
|
||||
PImage loadedImage = parseBase64Image(this.imagePath);
|
||||
if (loadedImage != null) {
|
||||
setTexture(loadedImage);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a base 64 encoded image within an image path.
|
||||
*
|
||||
* @param imagePath The image path containing the base 64 image data.
|
||||
* @return Newly loaded PImage.
|
||||
*/
|
||||
protected static PImage parseBase64Image(String imagePath) {
|
||||
String[] parts = imagePath.split(";base64,");
|
||||
String extension = parts[0].substring(11);
|
||||
String encodedData = parts[1];
|
||||
|
||||
byte[] decodedBytes = DatatypeConverter.parseBase64Binary(encodedData);
|
||||
byte[] decodedBytes = Base64.getDecoder().decode(encodedData);
|
||||
|
||||
if(decodedBytes == null){
|
||||
System.err.println("Decode Error on image: " + imagePath.substring(0, 20));
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
Image awtImage = new ImageIcon(decodedBytes).getImage();
|
||||
@@ -1928,22 +1941,26 @@ public class PShape implements PConstants {
|
||||
BufferedImage buffImage = (BufferedImage) awtImage;
|
||||
int space = buffImage.getColorModel().getColorSpace().getType();
|
||||
if (space == ColorSpace.TYPE_CMYK) {
|
||||
return;
|
||||
System.err.println("Could not load CMYK color space on image: " + imagePath.substring(0, 20));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// if it's a .gif image, test to see if it has transparency
|
||||
boolean requiresCheckAlpha = extension.equals("gif") || extension.equals("png") ||
|
||||
extension.equals("unknown");
|
||||
|
||||
PImage loadedImage = new PImage(awtImage);
|
||||
|
||||
if (requiresCheckAlpha) {
|
||||
loadedImage.checkAlpha();
|
||||
}
|
||||
|
||||
if (loadedImage.width == -1) {
|
||||
// error...
|
||||
}
|
||||
|
||||
// if it's a .gif image, test to see if it has transparency
|
||||
if (extension.equals("gif") || extension.equals("png") ||
|
||||
extension.equals("unknown")) {
|
||||
loadedImage.checkAlpha();
|
||||
}
|
||||
|
||||
setTexture(loadedImage);
|
||||
return loadedImage;
|
||||
}
|
||||
|
||||
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
@@ -2963,16 +2980,12 @@ public class PShape implements PConstants {
|
||||
*/
|
||||
public boolean contains(float x, float y) {
|
||||
if (family == PATH) {
|
||||
PVector p = new PVector(x, y);
|
||||
if (matrix != null) {
|
||||
// apply the inverse transformation matrix to the point coordinates
|
||||
PMatrix inverseCoords = matrix.get();
|
||||
// TODO why is this called twice? [fry 190724]
|
||||
// commit was https://github.com/processing/processing/commit/027fc7a4f8e8d0a435366eae754304eea282512a
|
||||
inverseCoords.invert(); // maybe cache this?
|
||||
inverseCoords.invert(); // maybe cache this?
|
||||
inverseCoords.mult(new PVector(x, y), p);
|
||||
}
|
||||
// apply the inverse transformation matrix to the point coordinates
|
||||
PMatrix inverseCoords = matrix.get();
|
||||
inverseCoords.invert(); // maybe cache this?
|
||||
inverseCoords.invert(); // maybe cache this?
|
||||
PVector p = new PVector();
|
||||
inverseCoords.mult(new PVector(x,y),p);
|
||||
|
||||
// http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
|
||||
boolean c = false;
|
||||
|
||||
@@ -22,75 +22,99 @@
|
||||
|
||||
package processing.core;
|
||||
|
||||
import java.awt.Image;
|
||||
|
||||
import com.apple.eawt.AppEvent.QuitEvent;
|
||||
import com.apple.eawt.Application;
|
||||
import com.apple.eawt.QuitHandler;
|
||||
import com.apple.eawt.QuitResponse;
|
||||
import java.awt.*;
|
||||
|
||||
|
||||
/**
|
||||
* Deal with issues related to thinking differently.
|
||||
* Deal with issues related to Mac OS window behavior.
|
||||
*
|
||||
* We have to register a quit handler to safely shut down the sketch,
|
||||
* otherwise OS X will just kill the sketch when a user hits Cmd-Q.
|
||||
* In addition, we have a method to set the dock icon image so we look more
|
||||
* like a native application.
|
||||
* like a native desktop.
|
||||
*
|
||||
* This is a stripped-down version of what's in processing.app.platform to fix
|
||||
* <a href="https://github.com/processing/processing/issues/3301">3301</a>.
|
||||
*/
|
||||
public class ThinkDifferent {
|
||||
|
||||
// http://developer.apple.com/documentation/Java/Reference/1.4.2/appledoc/api/com/apple/eawt/Application.html
|
||||
private static Application application;
|
||||
private static Desktop desktop;
|
||||
private static Taskbar taskbar;
|
||||
|
||||
// True if user has tried to quit once. Prevents us from canceling the quit
|
||||
// call if the sketch is held up for some reason, like an exception that's
|
||||
// managed to put the sketch in a bad state.
|
||||
static boolean attemptedQuit;
|
||||
|
||||
|
||||
/**
|
||||
* Initialize the sketch with the quit handler.
|
||||
*
|
||||
* Initialize the sketch with the quit handler such that, if there is no known
|
||||
* crash, the application will not exit on its own if this is the first quit
|
||||
* attempt.
|
||||
*
|
||||
* @param sketch The sketch whose quit handler callback should be set.
|
||||
*/
|
||||
static public void init(final PApplet sketch) {
|
||||
if (application == null) {
|
||||
application = Application.getApplication();
|
||||
}
|
||||
getDesktop().setQuitHandler((event, quitResponse) -> {
|
||||
sketch.exit();
|
||||
|
||||
application.setQuitHandler(new QuitHandler() {
|
||||
public void handleQuitRequestWith(QuitEvent event, QuitResponse response) {
|
||||
sketch.exit();
|
||||
if (PApplet.uncaughtThrowable == null && // no known crash
|
||||
!attemptedQuit) { // haven't tried yet
|
||||
response.cancelQuit(); // tell OS X we'll handle this
|
||||
attemptedQuit = true;
|
||||
} else {
|
||||
response.performQuit(); // just force it this time
|
||||
}
|
||||
boolean noKnownCrash = PApplet.uncaughtThrowable == null;
|
||||
|
||||
if (noKnownCrash && !attemptedQuit) { // haven't tried yet
|
||||
quitResponse.cancelQuit(); // tell OS X we'll handle this
|
||||
attemptedQuit = true;
|
||||
} else {
|
||||
quitResponse.performQuit(); // just force it this time
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the quit handler.
|
||||
*/
|
||||
static public void cleanup() {
|
||||
if (application == null) {
|
||||
application = Application.getApplication();
|
||||
}
|
||||
application.setQuitHandler(null);
|
||||
getDesktop().setQuitHandler(null);
|
||||
}
|
||||
|
||||
// Called via reflection from PSurfaceAWT and others
|
||||
/**
|
||||
* Called via reflection from PSurfaceAWT and others, set the dock icon image.
|
||||
*
|
||||
* @param image The image to provide for Processing icon.
|
||||
*/
|
||||
static public void setIconImage(Image image) {
|
||||
// When already set, is a sun.awt.image.MultiResolutionCachedImage on OS X
|
||||
// Image current = application.getDockIconImage();
|
||||
// System.out.println("current dock icon image is " + current);
|
||||
// System.out.println("changing to " + image);
|
||||
getTaskbar().setIconImage(image);
|
||||
}
|
||||
|
||||
application.setDockIconImage(image);
|
||||
/**
|
||||
* Get the taskbar where OS visual settings can be provided.
|
||||
*
|
||||
* @return Cached taskbar singleton instance.
|
||||
*/
|
||||
static private Taskbar getTaskbar() {
|
||||
if (taskbar == null) {
|
||||
taskbar = Taskbar.getTaskbar();
|
||||
}
|
||||
|
||||
return taskbar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the desktop where OS behavior can be provided.
|
||||
*
|
||||
* @return Cached desktop singleton instance.
|
||||
*/
|
||||
static private Desktop getDesktop() {
|
||||
if (desktop == null) {
|
||||
desktop = Desktop.getDesktop();
|
||||
}
|
||||
|
||||
return desktop;
|
||||
}
|
||||
|
||||
|
||||
// Instead, just use Application.getApplication() inside your app
|
||||
// static public Application getApplication() {
|
||||
// return application;
|
||||
// return desktop;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import processing.core.PApplet;
|
||||
/**
|
||||
* A simple table class to use a String as a lookup for an double value.
|
||||
*
|
||||
* @nowebref
|
||||
* @webref data:composite
|
||||
* @see IntDict
|
||||
* @see StringDict
|
||||
*/
|
||||
|
||||
@@ -17,7 +17,7 @@ import processing.core.PApplet;
|
||||
* Functions like sort() and shuffle() always act on the list itself. To get
|
||||
* a sorted copy, use list.copy().sort().
|
||||
*
|
||||
* @nowebref
|
||||
* @webref data:composite
|
||||
* @see IntList
|
||||
* @see StringList
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,7 @@ import processing.core.PApplet;
|
||||
/**
|
||||
* A simple class to use a String as a lookup for an int value.
|
||||
*
|
||||
* @nowebref
|
||||
* @webref data:composite
|
||||
* @see FloatDict
|
||||
* @see StringDict
|
||||
*/
|
||||
|
||||
@@ -22,7 +22,7 @@ import processing.core.PApplet;
|
||||
* Functions like sort() and shuffle() always act on the list itself. To get
|
||||
* a sorted copy, use list.copy().sort().
|
||||
*
|
||||
* @nowebref
|
||||
* @webref data:composite
|
||||
* @see FloatList
|
||||
* @see StringList
|
||||
*/
|
||||
|
||||
@@ -49,8 +49,6 @@ public class StringList implements Iterable<String> {
|
||||
/**
|
||||
* Construct a StringList from a random pile of objects. Null values will
|
||||
* stay null, but all the others will be converted to String values.
|
||||
*
|
||||
* @nowebref
|
||||
*/
|
||||
public StringList(Object... items) {
|
||||
count = items.length;
|
||||
|
||||
@@ -440,7 +440,8 @@ public class XML implements Serializable {
|
||||
/**
|
||||
* Quick accessor for an element at a particular index.
|
||||
*
|
||||
* @nowebref
|
||||
* @webref xml:method
|
||||
* @brief Returns the child element with the specified index value or path
|
||||
*/
|
||||
public XML getChild(int index) {
|
||||
checkChildren();
|
||||
@@ -451,8 +452,6 @@ public class XML implements Serializable {
|
||||
/**
|
||||
* Get a child by its name or path.
|
||||
*
|
||||
* @webref xml:method
|
||||
* @brief Returns the child element with the specified index value or path
|
||||
* @param name element name or path/to/element
|
||||
* @return the first matching element or null if no match
|
||||
*/
|
||||
|
||||
@@ -246,13 +246,14 @@ public class PSurfaceFX implements PSurface {
|
||||
|
||||
PApplet sketch = surface.sketch;
|
||||
|
||||
float renderScale = Screen.getMainScreen().getRenderScale();
|
||||
// See JEP 263
|
||||
float renderScale = Screen.getMainScreen().getRecommendedOutputScaleX();
|
||||
if (PApplet.platform == PConstants.MACOSX) {
|
||||
for (Screen s : Screen.getScreens()) {
|
||||
renderScale = Math.max(renderScale, s.getRenderScale());
|
||||
renderScale = Math.max(renderScale, s.getRecommendedOutputScaleX());
|
||||
}
|
||||
}
|
||||
float uiScale = Screen.getMainScreen().getUIScale();
|
||||
float uiScale = Screen.getMainScreen().getRecommendedOutputScaleX();
|
||||
if (sketch.pixelDensity == 2 && renderScale < 2) {
|
||||
sketch.pixelDensity = 1;
|
||||
sketch.g.pixelDensity = 1;
|
||||
@@ -314,14 +315,14 @@ public class PSurfaceFX implements PSurface {
|
||||
int sketchHeight = sketch.sketchHeight();
|
||||
|
||||
if (fullScreen || spanDisplays) {
|
||||
sketchWidth = (int) (screenRect.getWidth() / uiScale);
|
||||
sketchHeight = (int) (screenRect.getHeight() / uiScale);
|
||||
sketchWidth = (int) screenRect.getWidth();
|
||||
sketchHeight = (int) screenRect.getHeight();
|
||||
|
||||
stage.initStyle(StageStyle.UNDECORATED);
|
||||
stage.setX(screenRect.getMinX() / uiScale);
|
||||
stage.setY(screenRect.getMinY() / uiScale);
|
||||
stage.setWidth(screenRect.getWidth() / uiScale);
|
||||
stage.setHeight(screenRect.getHeight() / uiScale);
|
||||
stage.setX(screenRect.getMinX());
|
||||
stage.setY(screenRect.getMinY());
|
||||
stage.setWidth(screenRect.getWidth());
|
||||
stage.setHeight(screenRect.getHeight());
|
||||
}
|
||||
|
||||
Canvas canvas = surface.canvas;
|
||||
@@ -812,7 +813,7 @@ public class PSurfaceFX implements PSurface {
|
||||
|
||||
|
||||
static Map<EventType<? extends MouseEvent>, Integer> mouseMap =
|
||||
new HashMap<EventType<? extends MouseEvent>, Integer>();
|
||||
new HashMap<>();
|
||||
static {
|
||||
mouseMap.put(MouseEvent.MOUSE_PRESSED, processing.event.MouseEvent.PRESS);
|
||||
mouseMap.put(MouseEvent.MOUSE_RELEASED, processing.event.MouseEvent.RELEASE);
|
||||
@@ -952,7 +953,7 @@ public class PSurfaceFX implements PSurface {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return kc.impl_getCode();
|
||||
return kc.getCode();
|
||||
}
|
||||
|
||||
|
||||
@@ -1051,7 +1052,7 @@ public class PSurfaceFX implements PSurface {
|
||||
if (fxEvent.getEventType() == KeyEvent.KEY_TYPED) {
|
||||
ch = fxEvent.getCharacter();
|
||||
} else {
|
||||
ch = kc.impl_getChar();
|
||||
ch = kc.getChar();
|
||||
}
|
||||
|
||||
if (ch.length() < 1) return PConstants.CODED;
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package processing.core;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import processing.core.PApplet;
|
||||
import processing.core.PImage;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
|
||||
public class Base64StringImageLoadTest {
|
||||
|
||||
// Simple pattern to try loading. Would be part of SVG.
|
||||
private static final String TEST_CONTENT = "data:image/svg;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAFCAMAAAC+RAbqAAAADFBMVEUAAAA0AP67u7v///+votL2AAAAGElEQVR4AWNgYAZBIIIAIJ8RyGGC8WHyAAYpAE9LN1znAAAAAElFTkSuQmCC";
|
||||
|
||||
@Test
|
||||
public void testLoad() {
|
||||
PImage results = PShape.parseBase64Image(TEST_CONTENT);
|
||||
|
||||
// Simply check a few sample pixels from the above pattern
|
||||
Assert.assertEquals(7, results.pixelWidth);
|
||||
Assert.assertEquals(5, results.pixelHeight);
|
||||
Assert.assertEquals(7, results.width);
|
||||
Assert.assertEquals(5, results.height);
|
||||
|
||||
int valueBlack = results.get(0, 0);
|
||||
int valueBlue = results.get(2, 2);
|
||||
|
||||
Assert.assertEquals(Color.BLACK, new Color(valueBlack));
|
||||
Assert.assertEquals(new Color(52, 0, 254), new Color(valueBlue));
|
||||
}
|
||||
|
||||
}
|
||||
+89
-57
@@ -2,14 +2,14 @@
|
||||
<project name="Java Mode" default="build">
|
||||
|
||||
<property name="generated"
|
||||
value="${basedir}/generated/processing/mode/java/preproc" />
|
||||
value="${basedir}/generated/processing/mode/java/preproc" />
|
||||
<mkdir dir="${generated}" />
|
||||
|
||||
<property name="grammars"
|
||||
value="${basedir}/src/processing/mode/java/preproc" />
|
||||
value="${basedir}/src/processing/mode/java/preproc" />
|
||||
|
||||
<property name="antlr_jar"
|
||||
value="${basedir}/mode/antlr.jar" />
|
||||
value="${basedir}/mode/antlr.jar" />
|
||||
|
||||
<property name="mode_jar"
|
||||
value="${basedir}/mode/JavaMode.jar" />
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
<target name="clean" description="Clean the build directories">
|
||||
<delete dir="bin" />
|
||||
<delete dir="bin-test" />
|
||||
<delete file="${mode_jar}" />
|
||||
<delete>
|
||||
<fileset dir="${generated}">
|
||||
@@ -38,8 +39,8 @@
|
||||
<classpath path="${antlr_jar}" />
|
||||
</antlr>
|
||||
<antlr target="${grammars}/pde.g"
|
||||
outputdirectory="${generated}"
|
||||
glib="${grammars}/java15.g">
|
||||
outputdirectory="${generated}"
|
||||
glib="${grammars}/java15.g">
|
||||
<classpath path="${antlr_jar}" />
|
||||
</antlr>
|
||||
|
||||
@@ -71,71 +72,102 @@
|
||||
<!-- end of workaround for old antlr -->
|
||||
</target>
|
||||
|
||||
<target name="compile" depends="preproc" description="Compile sources">
|
||||
<condition property="core-built">
|
||||
<available file="../core/library/core.jar" />
|
||||
</condition>
|
||||
<fail unless="core-built" message="Please first build the core library and make sure it is located at ../core/library/core.jar" />
|
||||
<path id="classpath.base">
|
||||
<pathelement location="../core/library/core.jar" />
|
||||
<pathelement location="../app/pde.jar" />
|
||||
<pathelement location="../app/lib/ant.jar" />
|
||||
<pathelement location="../app/lib/ant-launcher.jar" />
|
||||
<pathelement location="../app/lib/apple.jar" />
|
||||
<pathelement location="../app/lib/jna.jar" />
|
||||
<pathelement location="../app/lib/jna-platform.jar" />
|
||||
<pathelement location="mode/antlr.jar" />
|
||||
<pathelement location="mode/classpath-explorer-1.0.jar" />
|
||||
<pathelement location="mode/jsoup-1.7.1.jar" />
|
||||
<pathelement location="mode/org.netbeans.swing.outline.jar" />
|
||||
<pathelement location="mode/jdi.jar" />
|
||||
<pathelement location="mode/jdimodel.jar" />
|
||||
<pathelement location="mode/com.ibm.icu.jar" />
|
||||
<pathelement location="mode/org.eclipse.core.contenttype.jar" />
|
||||
<pathelement location="mode/org.eclipse.core.jobs.jar" />
|
||||
<pathelement location="mode/org.eclipse.core.resources.jar" />
|
||||
<pathelement location="mode/org.eclipse.core.runtime.jar" />
|
||||
<pathelement location="mode/org.eclipse.equinox.common.jar" />
|
||||
<pathelement location="mode/org.eclipse.equinox.preferences.jar" />
|
||||
<pathelement location="mode/org.eclipse.jdt.compiler.apt.jar" />
|
||||
<pathelement location="mode/org.eclipse.jdt.core.jar" />
|
||||
<pathelement location="mode/org.eclipse.osgi.jar" />
|
||||
<pathelement location="mode/org.eclipse.text.jar" />
|
||||
</path>
|
||||
|
||||
<condition property="app-built">
|
||||
<available file="../app/pde.jar" />
|
||||
</condition>
|
||||
<fail unless="app-built" message="Please build app first and make sure it is located at ../app/pde.jar" />
|
||||
<path id="classpath.test">
|
||||
<pathelement location="../core/library-test/junit-4.8.1.jar" />
|
||||
<pathelement location="../core/library-test/mockito-all-1.10.19.jar" />
|
||||
<pathelement location = "bin-test" />
|
||||
<path refid="classpath.base" />
|
||||
</path>
|
||||
|
||||
<mkdir dir="bin" />
|
||||
<macrodef name="compilecommon">
|
||||
<attribute name="destdir"/>
|
||||
<attribute name="srcdir"/>
|
||||
<attribute name="classpath"/>
|
||||
<sequential>
|
||||
<condition property="core-built">
|
||||
<available file="../core/library/core.jar" />
|
||||
</condition>
|
||||
<fail unless="core-built" message="Please first build the core library and make sure it is located at ../core/library/core.jar" />
|
||||
|
||||
<!-- in some cases, pde.jar was not getting built
|
||||
https://github.com/processing/processing/issues/1792 -->
|
||||
<delete file="${mode_jar}" />
|
||||
<condition property="app-built">
|
||||
<available file="../app/pde.jar" />
|
||||
</condition>
|
||||
<fail unless="app-built" message="Please build app first and make sure it is located at ../app/pde.jar" />
|
||||
|
||||
<!-- env used to set classpath below -->
|
||||
<property environment="env" />
|
||||
<mkdir dir="@{destdir}" />
|
||||
|
||||
<javac source="1.8"
|
||||
target="1.8"
|
||||
destdir="bin"
|
||||
excludes="**/tools/format/**"
|
||||
encoding="UTF-8"
|
||||
includeAntRuntime="false"
|
||||
classpath="../core/library/core.jar;
|
||||
<!-- in some cases, pde.jar was not getting built
|
||||
https://github.com/processing/processing/issues/1792 -->
|
||||
<delete file="${mode_jar}" />
|
||||
|
||||
../app/pde.jar;
|
||||
../app/lib/ant.jar;
|
||||
../app/lib/ant-launcher.jar;
|
||||
../app/lib/apple.jar;
|
||||
../app/lib/jna.jar;
|
||||
../app/lib/jna-platform.jar;
|
||||
<!-- env used to set classpath below -->
|
||||
<property environment="env" />
|
||||
|
||||
mode/antlr.jar;
|
||||
mode/classpath-explorer-1.0.jar;
|
||||
mode/jsoup-1.7.1.jar;
|
||||
mode/org.netbeans.swing.outline.jar;
|
||||
<javac source="1.8"
|
||||
target="1.8"
|
||||
destdir="@{destdir}"
|
||||
excludes="**/tools/format/**"
|
||||
encoding="UTF-8"
|
||||
includeAntRuntime="false"
|
||||
debug="on"
|
||||
nowarn="true"
|
||||
compiler="modern">
|
||||
<src path="@{srcdir}" />
|
||||
<src path="generated" />
|
||||
<classpath refid="@{classpath}"/>
|
||||
</javac>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
mode/jdi.jar;
|
||||
mode/jdimodel.jar;
|
||||
<target name="test-compile" depends="preproc">
|
||||
<compilecommon srcdir="src; test" destdir="bin-test" classpath="classpath.test" />
|
||||
</target>
|
||||
|
||||
mode/com.ibm.icu.jar;
|
||||
<target name="test" depends="test-compile">
|
||||
<junit haltonfailure="true">
|
||||
<classpath refid="classpath.test" />
|
||||
<formatter type="brief" usefile="false" />
|
||||
<batchtest>
|
||||
<fileset dir="test">
|
||||
<include name="**/*Test.java" />
|
||||
</fileset>
|
||||
</batchtest>
|
||||
</junit>
|
||||
</target>
|
||||
|
||||
mode/org.eclipse.core.contenttype.jar;
|
||||
mode/org.eclipse.core.jobs.jar;
|
||||
mode/org.eclipse.core.resources.jar;
|
||||
mode/org.eclipse.core.runtime.jar;
|
||||
mode/org.eclipse.equinox.common.jar;
|
||||
mode/org.eclipse.equinox.preferences.jar;
|
||||
mode/org.eclipse.jdt.core.jar;
|
||||
mode/org.eclipse.osgi.jar;
|
||||
mode/org.eclipse.text.jar"
|
||||
debug="on"
|
||||
nowarn="true"
|
||||
compiler="org.eclipse.jdt.core.JDTCompilerAdapter">
|
||||
<src path="src" />
|
||||
<src path="generated" />
|
||||
<compilerclasspath path="mode/org.eclipse.jdt.core.jar;
|
||||
mode/jdtCompilerAdapter.jar" />
|
||||
</javac>
|
||||
<target name="compile" depends="test" description="Compile sources">
|
||||
<compilecommon srcdir="src" destdir="bin" classpath="classpath.base" />
|
||||
</target>
|
||||
|
||||
<target name="build" depends="compile" description="Build PDE">
|
||||
<jar basedir="bin" destfile="${mode_jar}" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,31 +1,28 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="Processing DXF Library" default="build">
|
||||
|
||||
|
||||
<target name="clean" description="Clean the build directories">
|
||||
<delete dir="bin" />
|
||||
<delete file="library/dxf.jar" />
|
||||
</target>
|
||||
|
||||
|
||||
<target name="compile" description="Compile sources">
|
||||
<condition property="core-built">
|
||||
<available file="../../../core/library/core.jar" />
|
||||
</condition>
|
||||
<fail unless="core-built" message="Please build the core library first and make sure it sits in ../../../core/library/core.jar" />
|
||||
|
||||
|
||||
<mkdir dir="bin" />
|
||||
<javac source="1.8"
|
||||
target="1.8"
|
||||
srcdir="src" destdir="bin"
|
||||
srcdir="src" destdir="bin"
|
||||
encoding="UTF-8"
|
||||
includeAntRuntime="false"
|
||||
classpath="../../../core/library/core.jar"
|
||||
nowarn="true"
|
||||
compiler="org.eclipse.jdt.core.JDTCompilerAdapter">
|
||||
<compilerclasspath path="../../mode/org.eclipse.jdt.core.jar;
|
||||
../../mode/jdtCompilerAdapter.jar" />
|
||||
nowarn="true">
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="build" depends="compile" description="Build DXF library">
|
||||
<jar basedir="bin" destfile="library/dxf.jar" />
|
||||
</target>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="Processing Net Library" default="build">
|
||||
|
||||
|
||||
<target name="clean" description="Clean the build directories">
|
||||
<delete dir="bin" />
|
||||
<delete file="library/net.jar" />
|
||||
@@ -11,18 +11,15 @@
|
||||
<available file="../../../core/library/core.jar" />
|
||||
</condition>
|
||||
<fail unless="core-built" message="Please build the core library first and make sure it sits in ../../../core/library/core.jar" />
|
||||
|
||||
|
||||
<mkdir dir="bin" />
|
||||
<javac source="1.8"
|
||||
target="1.8"
|
||||
srcdir="src" destdir="bin"
|
||||
srcdir="src" destdir="bin"
|
||||
encoding="UTF-8"
|
||||
includeAntRuntime="false"
|
||||
classpath="../../../core/library/core.jar"
|
||||
nowarn="true"
|
||||
compiler="org.eclipse.jdt.core.JDTCompilerAdapter">
|
||||
<compilerclasspath path="../../mode/org.eclipse.jdt.core.jar;
|
||||
../../mode/jdtCompilerAdapter.jar" />
|
||||
nowarn="true">
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
|
||||
@@ -73,6 +73,8 @@ public class Server implements Runnable {
|
||||
|
||||
|
||||
/**
|
||||
* @param parent typically use "this"
|
||||
* @param port port used to transfer data
|
||||
* @param host when multiple NICs are in use, the ip (or name) to bind from
|
||||
*/
|
||||
public Server(PApplet parent, int port, String host) {
|
||||
|
||||
@@ -1,31 +1,28 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="Processing PDF Library" default="build">
|
||||
|
||||
|
||||
<target name="clean" description="Clean the build directories">
|
||||
<delete dir="bin" />
|
||||
<delete file="library/pdf.jar" />
|
||||
</target>
|
||||
|
||||
|
||||
<target name="compile" description="Compile sources">
|
||||
<condition property="core-built">
|
||||
<available file="../../../core/library/core.jar" />
|
||||
</condition>
|
||||
<fail unless="core-built" message="Please build the core library first and make sure it sits in ../../../core/library/core.jar" />
|
||||
|
||||
|
||||
<mkdir dir="bin" />
|
||||
<javac source="1.8"
|
||||
target="1.8"
|
||||
srcdir="src" destdir="bin"
|
||||
srcdir="src" destdir="bin"
|
||||
encoding="UTF-8"
|
||||
includeAntRuntime="false"
|
||||
classpath="../../../core/library/core.jar; library/itext.jar"
|
||||
nowarn="true"
|
||||
compiler="org.eclipse.jdt.core.JDTCompilerAdapter">
|
||||
<compilerclasspath path="../../mode/org.eclipse.jdt.core.jar;
|
||||
../../mode/jdtCompilerAdapter.jar" />
|
||||
nowarn="true">
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="build" depends="compile" description="Build PDF library">
|
||||
<jar basedir="bin" destfile="library/pdf.jar" />
|
||||
</target>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="Processing Serial Library" default="build">
|
||||
|
||||
|
||||
<target name="clean" description="Clean the build directories">
|
||||
<delete dir="bin" />
|
||||
<delete file="library/serial.jar" />
|
||||
@@ -15,17 +15,14 @@
|
||||
<mkdir dir="bin" />
|
||||
<javac source="1.8"
|
||||
target="1.8"
|
||||
srcdir="src" destdir="bin"
|
||||
srcdir="src" destdir="bin"
|
||||
encoding="UTF-8"
|
||||
includeAntRuntime="false"
|
||||
classpath="../../../core/library/core.jar; library/jssc.jar"
|
||||
nowarn="true"
|
||||
compiler="org.eclipse.jdt.core.JDTCompilerAdapter">
|
||||
<compilerclasspath path="../../mode/org.eclipse.jdt.core.jar;
|
||||
../../mode/jdtCompilerAdapter.jar" />
|
||||
nowarn="true">
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="build" depends="compile" description="Build serial library">
|
||||
<jar basedir="bin" destfile="library/serial.jar" />
|
||||
</target>
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="Processing SVG Library" default="build">
|
||||
|
||||
|
||||
<target name="clean" description="Clean the build directories">
|
||||
<delete dir="bin" />
|
||||
<delete file="library/svg.jar" />
|
||||
</target>
|
||||
|
||||
|
||||
<target name="compile" description="Compile sources">
|
||||
<condition property="core-built">
|
||||
<available file="../../../core/library/core.jar" />
|
||||
</condition>
|
||||
<fail unless="core-built" message="Please build the core library first and make sure it sits in ../../../core/library/core.jar" />
|
||||
|
||||
|
||||
<mkdir dir="bin" />
|
||||
<javac source="1.8"
|
||||
target="1.8"
|
||||
srcdir="src" destdir="bin"
|
||||
srcdir="src" destdir="bin"
|
||||
encoding="UTF-8"
|
||||
includeAntRuntime="false"
|
||||
classpath="../../../core/library/core.jar;
|
||||
@@ -25,13 +25,10 @@
|
||||
library/batik-svggen-1.8.jar;
|
||||
library/batik-util-1.8.jar;
|
||||
library/batik-xml-1.8.jar"
|
||||
nowarn="true"
|
||||
compiler="org.eclipse.jdt.core.JDTCompilerAdapter">
|
||||
<compilerclasspath path="../../mode/org.eclipse.jdt.core.jar;
|
||||
../../mode/jdtCompilerAdapter.jar" />
|
||||
nowarn="true">
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
|
||||
<target name="build" depends="compile" description="Build SVG library">
|
||||
<jar basedir="bin" destfile="library/svg.jar" />
|
||||
</target>
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
# Turn on debug tracing for org.eclipse.jdt.core plugin
|
||||
org.eclipse.jdt.core/debug=false
|
||||
|
||||
# Reports buffer manager activity
|
||||
org.eclipse.jdt.core/debug/buffermanager=false
|
||||
|
||||
# Reports java builder activity : nature of build, built state reading, indictment process
|
||||
org.eclipse.jdt.core/debug/builder=false
|
||||
|
||||
# Reports java builder stats
|
||||
org.eclipse.jdt.core/debug/builder/stats=false
|
||||
|
||||
# Reports compiler activity
|
||||
org.eclipse.jdt.core/debug/compiler=false
|
||||
|
||||
# Reports codeassist completion activity : recovered unit, inferred completions
|
||||
org.eclipse.jdt.core/debug/completion=false
|
||||
|
||||
# Reports classpath variable initialization, and classpath container resolution
|
||||
org.eclipse.jdt.core/debug/cpresolution=false
|
||||
|
||||
# Reports internals of classpath variable initialization, and classpath container resolution (to be used on the JDT/Core team request only)
|
||||
org.eclipse.jdt.core/debug/cpresolution/advanced=false
|
||||
|
||||
# Reports failures during classpath variable initialization, and classpath container resolution
|
||||
org.eclipse.jdt.core/debug/cpresolution/failure=false
|
||||
|
||||
# Reports bad node nesting in DOM AST (for interactive usage)
|
||||
org.eclipse.jdt.core/debug/dom/ast=false
|
||||
|
||||
# Throws an exception in case of bad node nesting in DOM AST (enabled in tests)
|
||||
org.eclipse.jdt.core/debug/dom/ast/throw=false
|
||||
|
||||
# Reports type errors when using ASTRewrite (throws exceptions; not enabled by default, since some non-typesafe operations are fine in practice)
|
||||
org.eclipse.jdt.core/debug/dom/rewrite=false
|
||||
|
||||
# Report type hierarchy connections, refreshes and deltas
|
||||
org.eclipse.jdt.core/debug/hierarchy=false
|
||||
|
||||
# Reports background indexer activity: indexing, saving index file, index queries
|
||||
org.eclipse.jdt.core/debug/indexmanager=false
|
||||
|
||||
# Reports internals of indexer activity (to be used on the JDT/Core team request only)
|
||||
org.eclipse.jdt.core/debug/indexmanager/advanced=false
|
||||
|
||||
# Print notified Java element deltas
|
||||
org.eclipse.jdt.core/debug/javadelta=false
|
||||
org.eclipse.jdt.core/debug/javadelta/verbose=false
|
||||
|
||||
# Reports various Java model activities
|
||||
org.eclipse.jdt.core/debug/javamodel=false
|
||||
|
||||
# Reports Java model elements opening/closing
|
||||
org.eclipse.jdt.core/debug/javamodel/cache=false
|
||||
|
||||
# Reports changes in the Java classpath and classpath resolution
|
||||
org.eclipse.jdt.core/debug/javamodel/classpath=false
|
||||
|
||||
# Reports all insertions and removals from the java model cache
|
||||
org.eclipse.jdt.core/debug/javamodel/insertions=false
|
||||
|
||||
# Records information about the invalid archive cache
|
||||
org.eclipse.jdt.core/debug/javamodel/invalid_archives=false
|
||||
|
||||
# Runs self-diagnostics on the free space lists. This is expensive and will slow down indexing.
|
||||
org.eclipse.jdt.core/debug/index/freespacetest=false
|
||||
|
||||
# Controls the amount of memory used by the traceback log, in megabytes (suggested size = 1024).
|
||||
# If nonzero, the index will print out detailed traceback information when corruption is detected.
|
||||
org.eclipse.jdt.core/debug/index/logsizemegs=0
|
||||
|
||||
# Logs every time a page is allocated, flushed, or inserted/removed from the page cache (very verbose)
|
||||
org.eclipse.jdt.core/debug/index/pagecache=false
|
||||
|
||||
# Prints information about when the indexer runs and what files are being indexed
|
||||
org.eclipse.jdt.core/debug/index/indexer=false
|
||||
|
||||
# Prints a line whenever a class is added to or removed from the index
|
||||
org.eclipse.jdt.core/debug/index/insertions=false
|
||||
|
||||
# Prints diagnostic information about index database locks
|
||||
org.eclipse.jdt.core/debug/index/locks=false
|
||||
|
||||
# Prints a message whenever the indexer is scheduled. Useful for tracking race conditions in the unit tests.
|
||||
org.eclipse.jdt.core/debug/index/scheduling=false
|
||||
|
||||
# Prints statistics about database memory usage
|
||||
org.eclipse.jdt.core/debug/index/space=false
|
||||
|
||||
# Performs self-testing during indexing by reading back every class and comparing it with the original .class file
|
||||
org.eclipse.jdt.core/debug/index/selftest=false
|
||||
|
||||
# Prints statistics about indexing time
|
||||
org.eclipse.jdt.core/debug/index/timing=false
|
||||
|
||||
# Reports post actions addition/run
|
||||
org.eclipse.jdt.core/debug/postaction=false
|
||||
|
||||
# Reports name resolution activity
|
||||
org.eclipse.jdt.core/debug/resolution=false
|
||||
|
||||
# Reports java search activity
|
||||
org.eclipse.jdt.core/debug/search=false
|
||||
|
||||
# Reports source mapper activity
|
||||
org.eclipse.jdt.core/debug/sourcemapper=false
|
||||
|
||||
# Reports code formatter activity
|
||||
org.eclipse.jdt.core/debug/formatter=false
|
||||
|
||||
# Reports open on selection activity : recovered unit, inferred selection
|
||||
org.eclipse.jdt.core/debug/selection=false
|
||||
|
||||
# Reports access to zip and jar files through the Java model
|
||||
org.eclipse.jdt.core/debug/zipaccess=false
|
||||
|
||||
# Reports the time to perform code completion.
|
||||
org.eclipse.jdt.core/perf/completion=300
|
||||
|
||||
# Reports the time to perform code selection.
|
||||
org.eclipse.jdt.core/perf/selection=300
|
||||
|
||||
# Reports the time to process a java element delta.
|
||||
org.eclipse.jdt.core/perf/javadeltalistener=500
|
||||
|
||||
# Reports the time to perform an initialization of a classpath variable.
|
||||
org.eclipse.jdt.core/perf/variableinitializer=5000
|
||||
|
||||
# Reports the time to perform an initialization of a classpath container.
|
||||
org.eclipse.jdt.core/perf/containerinitializer=5000
|
||||
|
||||
# Reports the time to perform a reconcile operation.
|
||||
org.eclipse.jdt.core/perf/reconcile=1000
|
||||
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>About</title>
|
||||
</head>
|
||||
<body lang="EN-US">
|
||||
<h2>About This Content</h2>
|
||||
|
||||
<p>November 30, 2017</p>
|
||||
<h3>License</h3>
|
||||
|
||||
<p>
|
||||
The Eclipse Foundation makes available all content in this plug-in
|
||||
("Content"). Unless otherwise indicated below, the Content
|
||||
is provided to you under the terms and conditions of the Eclipse
|
||||
Public License Version 2.0 ("EPL"). A copy of the EPL is
|
||||
available at <a href="http://www.eclipse.org/legal/epl-2.0">http://www.eclipse.org/legal/epl-2.0</a>.
|
||||
For purposes of the EPL, "Program" will mean the Content.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If you did not receive this Content directly from the Eclipse
|
||||
Foundation, the Content is being redistributed by another party
|
||||
("Redistributor") and different terms and conditions may
|
||||
apply to your use of any object code in the Content. Check the
|
||||
Redistributor's license that was provided with the Content. If no such
|
||||
license exists, contact the Redistributor. Unless otherwise indicated
|
||||
below, the terms and conditions of the EPL still apply to any source
|
||||
code in the Content and such source code may be obtained at <a
|
||||
href="http://www.eclipse.org/">http://www.eclipse.org</a>.
|
||||
</p>
|
||||
|
||||
|
||||
<h3>Disassembler</h3>
|
||||
<p>This plug-in contains a bytecode disassembler ("Disassembler") that can produce a listing of the Java assembler mnemonics ("Assembler Mnemonics") for a Java method. If you
|
||||
use the Disassembler to view the Assembler Mnemonics for a method, you should ensure that doing so will not violate the terms of any licenses that apply to your use of that method, as
|
||||
such licenses may not permit you to reverse engineer, decompile, or disassemble method bytecodes.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,34 @@
|
||||
###############################################################################
|
||||
# Copyright (c) 2000, 2014 IBM Corporation and others.
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License 2.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# https://www.eclipse.org/legal/epl-2.0/
|
||||
#
|
||||
# SPDX-License-Identifier: EPL-2.0
|
||||
#
|
||||
# Contributors:
|
||||
# IBM Corporation - initial API and implementation
|
||||
# Harry Terkelsen (het@google.com) - Bug 449262 - Allow the use of third-party Java formatters
|
||||
###############################################################################
|
||||
providerName=Eclipse.org
|
||||
pluginName=Java Development Tools Core
|
||||
javaNatureName=Java
|
||||
javaBuilderName=Java Builder
|
||||
javaProblemName=Java Problem
|
||||
buildPathProblemName=Build Path Problem
|
||||
transientJavaProblemName=Transient Java Problem
|
||||
classpathVariableInitializersName=Classpath Variable Initializers
|
||||
classpathContainerInitializersName=Classpath Container Initializers
|
||||
codeFormattersName=Source Code Formatters
|
||||
compilationParticipantsName=Compilation Participants
|
||||
annotationProcessorManagerName=Java 6 Annotation Processor Manager
|
||||
javaTaskName=Java Task
|
||||
javaPropertiesName=Java Properties File
|
||||
javaSourceName=Java Source File
|
||||
javaClassName=Java Class File
|
||||
jarManifestName=JAR Manifest File
|
||||
traceComponentLabel=JDT Core
|
||||
javaFormatterName=Java Formatter
|
||||
defaultJavaFormatterName=Eclipse [built-in]
|
||||
@@ -0,0 +1,313 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.0"?>
|
||||
<!--
|
||||
Copyright (c) 2004, 2014 IBM Corporation and others.
|
||||
|
||||
This program and the accompanying materials
|
||||
are made available under the terms of the Eclipse Public License 2.0
|
||||
which accompanies this distribution, and is available at
|
||||
https://www.eclipse.org/legal/epl-2.0/
|
||||
|
||||
SPDX-License-Identifier: EPL-2.0
|
||||
|
||||
Contributors:
|
||||
IBM Corporation - initial API and implementation
|
||||
Harry Terkelsen (het@google.com) - Bug 449262 - Allow the use of third-party Java formatters
|
||||
-->
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- JDT/CORE Plug-in Manifest -->
|
||||
<!-- =================================================================================== -->
|
||||
<plugin>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Prerequisite Plug-ins -->
|
||||
<!-- =================================================================================== -->
|
||||
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Runtime Libraries -->
|
||||
<!-- =================================================================================== -->
|
||||
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension Point: Initializers of Classpath Variables -->
|
||||
<!-- =================================================================================== -->
|
||||
|
||||
<extension-point name="%classpathVariableInitializersName"
|
||||
id="classpathVariableInitializer"
|
||||
schema="schema/classpathVariableInitializer.exsd"/>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension Point: Initializers of Classpath Containers -->
|
||||
<!-- =================================================================================== -->
|
||||
|
||||
<extension-point name="%classpathContainerInitializersName"
|
||||
id="classpathContainerInitializer"
|
||||
schema="schema/classpathContainerInitializer.exsd"/>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension Point: Formatter of Source Code -->
|
||||
<!-- =================================================================================== -->
|
||||
|
||||
<extension-point name="%codeFormattersName"
|
||||
id="codeFormatter"
|
||||
schema="schema/codeFormatter.exsd"/>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension Point: Compilation Participant -->
|
||||
<!-- =================================================================================== -->
|
||||
|
||||
<extension-point name="%compilationParticipantsName"
|
||||
id="compilationParticipant"
|
||||
schema="schema/compilationParticipant.exsd"/>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension Point: Java 6 Annotation Processor Manager -->
|
||||
<!-- =================================================================================== -->
|
||||
|
||||
<extension-point name="%annotationProcessorManagerName"
|
||||
id="annotationProcessorManager"
|
||||
schema="schema/annotationProcessorManager.exsd"/>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension Point: Java Source Formatter -->
|
||||
<!-- =================================================================================== -->
|
||||
|
||||
<extension-point name="%javaFormatterName"
|
||||
id="javaFormatter"
|
||||
schema="schema/javaFormatter.exsd"/>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension: Java Nature -->
|
||||
<!-- =================================================================================== -->
|
||||
|
||||
<extension
|
||||
point="org.eclipse.core.resources.natures"
|
||||
id="javanature"
|
||||
name="%javaNatureName">
|
||||
<runtime>
|
||||
<run class="org.eclipse.jdt.internal.core.JavaProject">
|
||||
</run>
|
||||
</runtime>
|
||||
</extension>
|
||||
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension: Java Builder -->
|
||||
<!-- =================================================================================== -->
|
||||
|
||||
<extension
|
||||
point="org.eclipse.core.resources.builders"
|
||||
id="javabuilder"
|
||||
name="%javaBuilderName">
|
||||
<builder>
|
||||
<run class="org.eclipse.jdt.internal.core.builder.JavaBuilder">
|
||||
</run>
|
||||
<dynamicReference class="org.eclipse.jdt.internal.core.DynamicProjectReferences"/>
|
||||
</builder>
|
||||
</extension>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension: Java Problem -->
|
||||
<!-- =================================================================================== -->
|
||||
<extension id="problem" point="org.eclipse.core.resources.markers" name="%javaProblemName">
|
||||
<super type="org.eclipse.core.resources.problemmarker"/>
|
||||
<super type="org.eclipse.core.resources.textmarker"/>
|
||||
<persistent value="true"/>
|
||||
<attribute name="id"/>
|
||||
<attribute name="flags"/>
|
||||
<attribute name="arguments"/>
|
||||
<attribute name="categoryId"/>
|
||||
</extension>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension: Java Buildpath Problem -->
|
||||
<!-- =================================================================================== -->
|
||||
<extension id="buildpath_problem" point="org.eclipse.core.resources.markers" name="%buildPathProblemName">
|
||||
<super type="org.eclipse.core.resources.problemmarker"/>
|
||||
<super type="org.eclipse.core.resources.textmarker"/>
|
||||
<persistent value="true"/>
|
||||
<attribute name ="cycleDetected"/>
|
||||
<attribute name="id"/>
|
||||
<attribute name="arguments"/>
|
||||
</extension>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension: Java Transient Problem -->
|
||||
<!-- =================================================================================== -->
|
||||
<extension id="transient_problem" point="org.eclipse.core.resources.markers" name="%transientJavaProblemName">
|
||||
<super type="org.eclipse.core.resources.textmarker"/>
|
||||
<persistent value="false"/>
|
||||
<attribute name="id"/>
|
||||
<attribute name="flags"/>
|
||||
<attribute name="arguments"/>
|
||||
</extension>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension: Java Task -->
|
||||
<!-- =================================================================================== -->
|
||||
<extension id="task" name="%javaTaskName" point="org.eclipse.core.resources.markers">
|
||||
<super type="org.eclipse.core.resources.taskmarker"/>
|
||||
<persistent value="true"/>
|
||||
</extension>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension: Javac Ant Adapter -->
|
||||
<!-- =================================================================================== -->
|
||||
<extension
|
||||
point="org.eclipse.ant.core.extraClasspathEntries">
|
||||
<extraClasspathEntry
|
||||
library="jdtCompilerAdapter.jar">
|
||||
</extraClasspathEntry>
|
||||
</extension>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension: Javac Ant Task -->
|
||||
<!-- =================================================================================== -->
|
||||
<extension point="org.eclipse.ant.core.antTasks">
|
||||
<antTask
|
||||
name="eclipse.checkDebugAttributes"
|
||||
class="org.eclipse.jdt.core.CheckDebugAttributes"
|
||||
library="jdtCompilerAdapter.jar">
|
||||
</antTask>
|
||||
<antTask
|
||||
name="eclipse.buildJarIndex"
|
||||
class="org.eclipse.jdt.core.BuildJarIndex"
|
||||
library="jdtCompilerAdapter.jar">
|
||||
</antTask>
|
||||
</extension>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension: User Library Container -->
|
||||
<!-- =================================================================================== -->
|
||||
<extension
|
||||
point="org.eclipse.jdt.core.classpathContainerInitializer">
|
||||
<classpathContainerInitializer
|
||||
class="org.eclipse.jdt.internal.core.UserLibraryClasspathContainerInitializer"
|
||||
id="org.eclipse.jdt.USER_LIBRARY">
|
||||
</classpathContainerInitializer>
|
||||
</extension>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension: Module Path Container -->
|
||||
<!-- =================================================================================== -->
|
||||
<extension
|
||||
point="org.eclipse.jdt.core.classpathContainerInitializer">
|
||||
<classpathContainerInitializer
|
||||
class="org.eclipse.jdt.internal.core.ModulePathContainerInitializer"
|
||||
id="org.eclipse.jdt.MODULE_PATH">
|
||||
</classpathContainerInitializer>
|
||||
</extension>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension: Java File Types -->
|
||||
<!-- =================================================================================== -->
|
||||
<extension point="org.eclipse.team.core.fileTypes">
|
||||
<fileTypes extension="java" type="text"/>
|
||||
<fileTypes extension="classpath" type="text"/>
|
||||
<fileTypes extension="properties" type="text"/>
|
||||
<fileTypes extension="class" type="binary"/>
|
||||
<fileTypes extension="jar" type="binary"/>
|
||||
<fileTypes extension="jardesc" type="text"/>
|
||||
<fileTypes extension="zip" type="binary"/>
|
||||
</extension>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension: Java Code Formatter -->
|
||||
<!-- =================================================================================== -->
|
||||
<extension
|
||||
id="JavaCodeFormatter"
|
||||
point="org.eclipse.core.runtime.applications">
|
||||
<application>
|
||||
<run class="org.eclipse.jdt.core.formatter.CodeFormatterApplication" />
|
||||
</application>
|
||||
</extension>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension: Java Generate Indexer -->
|
||||
<!-- =================================================================================== -->
|
||||
<extension
|
||||
id="JavaIndexer"
|
||||
point="org.eclipse.core.runtime.applications">
|
||||
<application>
|
||||
<run class="org.eclipse.jdt.core.index.JavaIndexerApplication" />
|
||||
</application>
|
||||
</extension>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension: Java Content Types -->
|
||||
<!-- =================================================================================== -->
|
||||
<extension point="org.eclipse.core.contenttype.contentTypes">
|
||||
<!-- declares a content type for Java Properties files -->
|
||||
<content-type id="javaProperties" name="%javaPropertiesName"
|
||||
base-type="org.eclipse.core.runtime.text"
|
||||
priority="high"
|
||||
file-extensions="properties"
|
||||
default-charset="ISO-8859-1"/>
|
||||
<!-- Associates .classpath to the XML content type -->
|
||||
<file-association
|
||||
content-type="org.eclipse.core.runtime.xml"
|
||||
file-names=".classpath"/>
|
||||
<!-- declares a content type for Java Source files -->
|
||||
<content-type id="javaSource" name="%javaSourceName"
|
||||
base-type="org.eclipse.core.runtime.text"
|
||||
priority="high"
|
||||
file-extensions="java"/>
|
||||
<!-- declares a content type for Java class files -->
|
||||
<content-type id="javaClass" name="%javaClassName"
|
||||
priority="high"
|
||||
file-extensions="class">
|
||||
<describer
|
||||
class="org.eclipse.core.runtime.content.BinarySignatureDescriber">
|
||||
<parameter name="signature" value="CA, FE, BA, BE"/>
|
||||
</describer>
|
||||
</content-type>
|
||||
<!-- declares a content type for JAR manifest files -->
|
||||
<content-type id="JARManifest" name="%jarManifestName"
|
||||
base-type="org.eclipse.core.runtime.text"
|
||||
priority="high"
|
||||
file-names="MANIFEST.MF"
|
||||
default-charset="UTF-8"/>
|
||||
</extension>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension: Eclipse preferences initializer -->
|
||||
<!-- =================================================================================== -->
|
||||
<extension
|
||||
point="org.eclipse.core.runtime.preferences">
|
||||
<initializer class="org.eclipse.jdt.internal.core.JavaCorePreferenceInitializer"/>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.core.runtime.preferences">
|
||||
<modifier class="org.eclipse.jdt.internal.core.JavaCorePreferenceModifyListener"/>
|
||||
</extension>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension: Eclipse tracing -->
|
||||
<!-- =================================================================================== -->
|
||||
<extension
|
||||
point="org.eclipse.ui.trace.traceComponents">
|
||||
<component
|
||||
id="org.eclipse.jdt.core.trace"
|
||||
label="%traceComponentLabel">
|
||||
<bundle
|
||||
consumed="false"
|
||||
name="org.eclipse.jdt.core">
|
||||
</bundle>
|
||||
</component>
|
||||
</extension>
|
||||
|
||||
<!-- =================================================================================== -->
|
||||
<!-- Extension: Java Code Formatter -->
|
||||
<!-- =================================================================================== -->
|
||||
<extension
|
||||
point="org.eclipse.jdt.core.javaFormatter">
|
||||
<javaFormatter
|
||||
class="org.eclipse.jdt.internal.formatter.DefaultCodeFormatter"
|
||||
id="org.eclipse.jdt.core.defaultJavaFormatter"
|
||||
name="%defaultJavaFormatterName">
|
||||
</javaFormatter>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
@@ -13,7 +13,7 @@ This Mode does not use ecj.jar from the original Java mode, because its files ar
|
||||
For 3.0 alpha 11, the signature files were removed from oorg.eclipse.jdt.core.jar to fix a signing conflict with Android Mode and Ant.
|
||||
https://github.com/processing/processing/pull/3324
|
||||
|
||||
. . .
|
||||
. . .
|
||||
|
||||
http://download.eclipse.org/eclipse/updates/4.5/R-4.5.2-201602121500/plugins/com.ibm.icu_54.1.1.v201501272100.jar
|
||||
|
||||
@@ -35,7 +35,7 @@ http://download.eclipse.org/eclipse/updates/4.5/R-4.5.2-201602121500/plugins/org
|
||||
|
||||
http://download.eclipse.org/eclipse/updates/4.5/R-4.5.2-201602121500/plugins/org.eclipse.text_3.5.400.v20150505-1044.jar
|
||||
|
||||
. . .
|
||||
. . .
|
||||
|
||||
Updated 19 January 2015 to fix Java 8 support. The previous versions gave an "Annotation processing got disabled, since it requires a 1.6 compliant JVM" error.
|
||||
|
||||
@@ -43,3 +43,7 @@ Updated 21 March 2016 to newest version (from R-4.4.1-201409250400 to R-4.5.2-20
|
||||
|
||||
Finally, the archive site contains additional jars for the 4.5.2 release, including the JDT Core Batch Compiler (ECJ):
|
||||
http://archive.eclipse.org/eclipse/downloads/drops4/R-4.5.2-201602121500/
|
||||
|
||||
. . .
|
||||
|
||||
Updated the org.eclipse libs. For eclipse projects, please see https://www.eclipse.org/legal/epl-2.0/ for licensing.
|
||||
|
||||
@@ -54,6 +54,8 @@ import processing.core.PConstants;
|
||||
import processing.data.StringList;
|
||||
import processing.data.XML;
|
||||
import processing.mode.java.pdex.SourceUtils;
|
||||
import processing.mode.java.pdex.util.runtime.RuntimeConst;
|
||||
import processing.mode.java.pdex.util.runtime.strategy.JavaFxRuntimePathFactory;
|
||||
import processing.mode.java.preproc.PdePreprocessor;
|
||||
import processing.mode.java.preproc.PreprocessorResult;
|
||||
import processing.mode.java.preproc.SurfaceInfo;
|
||||
@@ -785,10 +787,10 @@ public class JavaBuild {
|
||||
if (exportPlatform == PConstants.MACOSX) {
|
||||
dotAppFolder = new File(destFolder, sketch.getName() + ".app");
|
||||
|
||||
File contentsOrig = new File(Platform.getJavaHome(), "../../../../..");
|
||||
File contentsOrig = new File(Platform.getJavaHome(), "../../../..");
|
||||
|
||||
if (embedJava) {
|
||||
File jdkFolder = new File(Platform.getJavaHome(), "../../..");
|
||||
File jdkFolder = new File(Platform.getJavaHome(), "../..");
|
||||
String jdkFolderName = jdkFolder.getCanonicalFile().getName();
|
||||
jvmRuntime = "<key>JVMRuntime</key>\n <string>" + jdkFolderName + "</string>";
|
||||
jdkPath = new File(dotAppFolder, "Contents/PlugIns/" + jdkFolderName).getAbsolutePath();
|
||||
@@ -920,7 +922,6 @@ public class JavaBuild {
|
||||
for (Library library : importedLibraries) {
|
||||
// add each item from the library folder / export list to the output
|
||||
for (File exportFile : library.getApplicationExports(exportPlatform, exportVariant)) {
|
||||
// System.out.println("export: " + exportFile);
|
||||
String exportName = exportFile.getName();
|
||||
if (!exportFile.exists()) {
|
||||
System.err.println(exportFile.getName() +
|
||||
@@ -943,7 +944,6 @@ public class JavaBuild {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// create platform-specific CLASSPATH based on included jars
|
||||
|
||||
String exportClassPath = null;
|
||||
@@ -972,23 +972,14 @@ public class JavaBuild {
|
||||
}
|
||||
// https://github.com/processing/processing/issues/2239
|
||||
runOptions.append("-Djna.nosys=true");
|
||||
// https://github.com/processing/processing/issues/4608
|
||||
if (embedJava) {
|
||||
// if people don't embed Java, it might be a mess, but what can we do?
|
||||
if (exportPlatform == PConstants.MACOSX) {
|
||||
runOptions.append("-Djava.ext.dirs=$APP_ROOT/Contents/PlugIns/jdk" +
|
||||
PApplet.javaVersionName +
|
||||
".jdk/Contents/Home/jre/lib/ext");
|
||||
} else if (exportPlatform == PConstants.WINDOWS) {
|
||||
runOptions.append("-Djava.ext.dirs=\"%EXEDIR%\\java\\lib\\ext\"");
|
||||
} else if (exportPlatform == PConstants.LINUX) {
|
||||
runOptions.append("-Djava.ext.dirs=\"$APPDIR/java/lib/ext\"");
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/processing/processing/issues/2559
|
||||
if (exportPlatform == PConstants.WINDOWS) {
|
||||
runOptions.append("-Djava.library.path=\"%EXEDIR%\\lib\"");
|
||||
|
||||
// No scaling of swing (see #5753) on zoomed displays until some issues regarding JEP 263
|
||||
// with rendering artifacts are sorted out.
|
||||
runOptions.append("-Dsun.java2d.uiScale=1");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -103,6 +103,7 @@ class ErrorChecker {
|
||||
|
||||
if (problems.isEmpty()) {
|
||||
AtomicReference<ClassPath> searchClassPath = new AtomicReference<>(null);
|
||||
|
||||
List<Problem> cuProblems = Arrays.stream(iproblems)
|
||||
// Filter Warnings if they are not enabled
|
||||
.filter(iproblem -> !(iproblem.isWarning() && !JavaMode.warningsEnabled))
|
||||
@@ -312,6 +313,7 @@ class ErrorChecker {
|
||||
// replace inner class separators with dots
|
||||
.map(res -> res.replace('$', '.'))
|
||||
// sort, prioritize clases from java. package
|
||||
.map(res -> res.startsWith("classes.") ? res.substring(8) : res)
|
||||
.sorted((o1, o2) -> {
|
||||
// put java.* first, should be prioritized more
|
||||
boolean o1StartsWithJava = o1.startsWith("java");
|
||||
@@ -324,4 +326,4 @@ class ErrorChecker {
|
||||
})
|
||||
.toArray(String[]::new);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
Copyright (c) 2012-15 The Processing Foundation
|
||||
Copyright (c) 2012-19 The Processing Foundation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2
|
||||
@@ -20,20 +20,8 @@ along with this program; if not, write to the Free Software Foundation, Inc.
|
||||
|
||||
package processing.mode.java.pdex;
|
||||
|
||||
import com.google.classpath.ClassPathFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -54,17 +42,16 @@ import org.eclipse.jdt.core.dom.AST;
|
||||
import org.eclipse.jdt.core.dom.ASTParser;
|
||||
import org.eclipse.jdt.core.dom.CompilationUnit;
|
||||
|
||||
import processing.app.Library;
|
||||
import processing.app.Messages;
|
||||
import processing.app.Sketch;
|
||||
import processing.app.SketchCode;
|
||||
import processing.app.SketchException;
|
||||
import processing.app.Util;
|
||||
import processing.data.IntList;
|
||||
import processing.data.StringList;
|
||||
import processing.mode.java.JavaEditor;
|
||||
import processing.mode.java.JavaMode;
|
||||
import processing.mode.java.pdex.TextTransform.OffsetMapper;
|
||||
import processing.mode.java.pdex.util.runtime.RuntimePathBuilder;
|
||||
import processing.mode.java.preproc.PdePreprocessor;
|
||||
import processing.mode.java.preproc.PdePreprocessor.Mode;
|
||||
|
||||
@@ -78,8 +65,6 @@ public class PreprocessingService {
|
||||
|
||||
protected final ASTParser parser = ASTParser.newParser(AST.JLS8);
|
||||
|
||||
private final ClassPathFactory classPathFactory = new ClassPathFactory();
|
||||
|
||||
private final Thread preprocessingThread;
|
||||
private final BlockingQueue<Boolean> requestQueue = new ArrayBlockingQueue<>(1);
|
||||
|
||||
@@ -326,22 +311,15 @@ public class PreprocessingService {
|
||||
toParsable.addAll(SourceUtils.wrapSketch(sketchMode, className, workBuffer.length()));
|
||||
|
||||
{ // Refresh sketch classloader and classpath if imports changed
|
||||
if (javaRuntimeClassPath == null) {
|
||||
javaRuntimeClassPath = buildJavaRuntimeClassPath();
|
||||
sketchModeClassPath = buildModeClassPath(javaMode, false);
|
||||
searchModeClassPath = buildModeClassPath(javaMode, true);
|
||||
}
|
||||
|
||||
if (reloadLibraries) {
|
||||
coreLibraryClassPath = buildCoreLibraryClassPath(javaMode);
|
||||
runtimePathBuilder.markLibrariesChanged();
|
||||
}
|
||||
|
||||
boolean rebuildLibraryClassPath = reloadLibraries ||
|
||||
checkIfImportsChanged(programImports, prevResult.programImports);
|
||||
|
||||
if (rebuildLibraryClassPath) {
|
||||
sketchLibraryClassPath = buildSketchLibraryClassPath(javaMode, programImports);
|
||||
searchLibraryClassPath = buildSearchLibraryClassPath(javaMode);
|
||||
runtimePathBuilder.markLibraryImportsChanged();
|
||||
}
|
||||
|
||||
boolean rebuildClassPath = reloadCodeFolder || rebuildLibraryClassPath ||
|
||||
@@ -349,45 +327,11 @@ public class PreprocessingService {
|
||||
prevResult.classPathArray == null || prevResult.searchClassPathArray == null;
|
||||
|
||||
if (reloadCodeFolder) {
|
||||
codeFolderClassPath = buildCodeFolderClassPath(sketch);
|
||||
runtimePathBuilder.markCodeFolderChanged();
|
||||
}
|
||||
|
||||
if (rebuildClassPath) {
|
||||
{ // Sketch class path
|
||||
List<String> sketchClassPath = new ArrayList<>();
|
||||
sketchClassPath.addAll(javaRuntimeClassPath);
|
||||
sketchClassPath.addAll(sketchModeClassPath);
|
||||
sketchClassPath.addAll(sketchLibraryClassPath);
|
||||
sketchClassPath.addAll(coreLibraryClassPath);
|
||||
sketchClassPath.addAll(codeFolderClassPath);
|
||||
|
||||
String[] classPathArray = sketchClassPath.stream().toArray(String[]::new);
|
||||
URL[] urlArray = Arrays.stream(classPathArray)
|
||||
.map(path -> {
|
||||
try {
|
||||
return Paths.get(path).toUri().toURL();
|
||||
} catch (MalformedURLException e) {
|
||||
Messages.loge("malformed URL when preparing sketch classloader", e);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter(url -> url != null)
|
||||
.toArray(URL[]::new);
|
||||
result.classLoader = new URLClassLoader(urlArray, null);
|
||||
result.classPath = classPathFactory.createFromPaths(classPathArray);
|
||||
result.classPathArray = classPathArray;
|
||||
}
|
||||
|
||||
{ // Search class path
|
||||
List<String> searchClassPath = new ArrayList<>();
|
||||
searchClassPath.addAll(javaRuntimeClassPath);
|
||||
searchClassPath.addAll(searchModeClassPath);
|
||||
searchClassPath.addAll(searchLibraryClassPath);
|
||||
searchClassPath.addAll(coreLibraryClassPath);
|
||||
searchClassPath.addAll(codeFolderClassPath);
|
||||
|
||||
result.searchClassPathArray = searchClassPath.stream().toArray(String[]::new);
|
||||
}
|
||||
runtimePathBuilder.prepareClassPath(result, javaMode);
|
||||
} else {
|
||||
result.classLoader = prevResult.classLoader;
|
||||
result.classPath = prevResult.classPath;
|
||||
@@ -493,141 +437,7 @@ public class PreprocessingService {
|
||||
|
||||
/// CLASSPATHS ---------------------------------------------------------------
|
||||
|
||||
|
||||
private List<String> javaRuntimeClassPath;
|
||||
|
||||
private List<String> sketchModeClassPath;
|
||||
private List<String> searchModeClassPath;
|
||||
|
||||
private List<String> coreLibraryClassPath;
|
||||
|
||||
private List<String> codeFolderClassPath;
|
||||
|
||||
private List<String> sketchLibraryClassPath;
|
||||
private List<String> searchLibraryClassPath;
|
||||
|
||||
|
||||
private static List<String> buildCodeFolderClassPath(Sketch sketch) {
|
||||
StringBuilder classPath = new StringBuilder();
|
||||
|
||||
// Code folder
|
||||
if (sketch.hasCodeFolder()) {
|
||||
File codeFolder = sketch.getCodeFolder();
|
||||
String codeFolderClassPath = Util.contentsToClassPath(codeFolder);
|
||||
classPath.append(codeFolderClassPath);
|
||||
}
|
||||
|
||||
return sanitizeClassPath(classPath.toString());
|
||||
}
|
||||
|
||||
|
||||
private static List<String> buildModeClassPath(JavaMode mode, boolean search) {
|
||||
StringBuilder classPath = new StringBuilder();
|
||||
|
||||
if (search) {
|
||||
String searchClassPath = mode.getSearchPath();
|
||||
if (searchClassPath != null) {
|
||||
classPath.append(File.pathSeparator).append(searchClassPath);
|
||||
}
|
||||
} else {
|
||||
Library coreLibrary = mode.getCoreLibrary();
|
||||
String coreClassPath = coreLibrary != null ?
|
||||
coreLibrary.getClassPath() : mode.getSearchPath();
|
||||
if (coreClassPath != null) {
|
||||
classPath.append(File.pathSeparator).append(coreClassPath);
|
||||
}
|
||||
}
|
||||
|
||||
return sanitizeClassPath(classPath.toString());
|
||||
}
|
||||
|
||||
|
||||
private static List<String> buildCoreLibraryClassPath(JavaMode mode) {
|
||||
StringBuilder classPath = new StringBuilder();
|
||||
|
||||
for (Library lib : mode.coreLibraries) {
|
||||
classPath.append(File.pathSeparator).append(lib.getClassPath());
|
||||
}
|
||||
|
||||
return sanitizeClassPath(classPath.toString());
|
||||
}
|
||||
|
||||
|
||||
private static List<String> buildSearchLibraryClassPath(JavaMode mode) {
|
||||
StringBuilder classPath = new StringBuilder();
|
||||
|
||||
for (Library lib : mode.contribLibraries) {
|
||||
classPath.append(File.pathSeparator).append(lib.getClassPath());
|
||||
}
|
||||
|
||||
return sanitizeClassPath(classPath.toString());
|
||||
}
|
||||
|
||||
|
||||
static private List<String> buildSketchLibraryClassPath(JavaMode mode,
|
||||
List<ImportStatement> programImports) {
|
||||
StringBuilder classPath = new StringBuilder();
|
||||
|
||||
programImports.stream()
|
||||
.map(ImportStatement::getPackageName)
|
||||
.filter(pckg -> !ignorableImport(pckg))
|
||||
.map(pckg -> {
|
||||
try {
|
||||
return mode.getLibrary(pckg);
|
||||
} catch (SketchException e) {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter(lib -> lib != null)
|
||||
.map(Library::getClassPath)
|
||||
.forEach(cp -> classPath.append(File.pathSeparator).append(cp));
|
||||
|
||||
return sanitizeClassPath(classPath.toString());
|
||||
}
|
||||
|
||||
|
||||
static private List<String> buildJavaRuntimeClassPath() {
|
||||
StringBuilder classPath = new StringBuilder();
|
||||
|
||||
{ // Java runtime
|
||||
String rtPath = System.getProperty("java.home") +
|
||||
File.separator + "lib" + File.separator + "rt.jar";
|
||||
if (new File(rtPath).exists()) {
|
||||
classPath.append(File.pathSeparator).append(rtPath);
|
||||
} else {
|
||||
rtPath = System.getProperty("java.home") + File.separator + "jre" +
|
||||
File.separator + "lib" + File.separator + "rt.jar";
|
||||
if (new File(rtPath).exists()) {
|
||||
classPath.append(File.pathSeparator).append(rtPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{ // JavaFX runtime
|
||||
String jfxrtPath = System.getProperty("java.home") +
|
||||
File.separator + "lib" + File.separator + "ext" + File.separator + "jfxrt.jar";
|
||||
if (new File(jfxrtPath).exists()) {
|
||||
classPath.append(File.pathSeparator).append(jfxrtPath);
|
||||
} else {
|
||||
jfxrtPath = System.getProperty("java.home") + File.separator + "jre" +
|
||||
File.separator + "lib" + File.separator + "ext" + File.separator + "jfxrt.jar";
|
||||
if (new File(jfxrtPath).exists()) {
|
||||
classPath.append(File.pathSeparator).append(jfxrtPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sanitizeClassPath(classPath.toString());
|
||||
}
|
||||
|
||||
|
||||
private static List<String> sanitizeClassPath(String classPathString) {
|
||||
// Make sure class path does not contain empty string (home dir)
|
||||
return Arrays.stream(classPathString.split(File.pathSeparator))
|
||||
.filter(p -> p != null && !p.trim().isEmpty())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
private RuntimePathBuilder runtimePathBuilder = new RuntimePathBuilder();
|
||||
|
||||
/// --------------------------------------------------------------------------
|
||||
|
||||
@@ -662,20 +472,13 @@ public class PreprocessingService {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ignore processing packages, java.*.*. etc.
|
||||
*/
|
||||
static private boolean ignorableImport(String packageName) {
|
||||
return (packageName.startsWith("java.") ||
|
||||
packageName.startsWith("javax."));
|
||||
}
|
||||
|
||||
|
||||
static private final Map<String, String> COMPILER_OPTIONS;
|
||||
static {
|
||||
Map<String, String> compilerOptions = new HashMap<>();
|
||||
|
||||
JavaCore.setComplianceOptions(JavaCore.VERSION_1_7, compilerOptions);
|
||||
compilerOptions.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_11);
|
||||
compilerOptions.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_11);
|
||||
compilerOptions.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_11);
|
||||
|
||||
// See http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Fguide%2Fjdt_api_options.htm&anchor=compiler
|
||||
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2019 The Processing Foundation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation,
|
||||
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
package processing.mode.java.pdex.util.runtime;
|
||||
|
||||
|
||||
/**
|
||||
* Constants related to runtime component enumeration.
|
||||
*/
|
||||
public class RuntimeConst {
|
||||
|
||||
/**
|
||||
* The modules comprising the Java standard modules.
|
||||
*/
|
||||
public static final String[] STANDARD_MODULES = {
|
||||
"java.base.jmod",
|
||||
"java.compiler.jmod",
|
||||
"java.datatransfer.jmod",
|
||||
"java.desktop.jmod",
|
||||
"java.instrument.jmod",
|
||||
"java.logging.jmod",
|
||||
"java.management.jmod",
|
||||
"java.management.rmi.jmod",
|
||||
"java.naming.jmod",
|
||||
"java.net.http.jmod",
|
||||
"java.prefs.jmod",
|
||||
"java.rmi.jmod",
|
||||
"java.scripting.jmod",
|
||||
"java.se.jmod",
|
||||
"java.security.jgss.jmod",
|
||||
"java.security.sasl.jmod",
|
||||
"java.smartcardio.jmod",
|
||||
"java.sql.jmod",
|
||||
"java.sql.rowset.jmod",
|
||||
"java.transaction.xa.jmod",
|
||||
"java.xml.crypto.jmod",
|
||||
"java.xml.jmod",
|
||||
"jdk.accessibility.jmod",
|
||||
"jdk.aot.jmod",
|
||||
"jdk.attach.jmod",
|
||||
"jdk.charsets.jmod",
|
||||
"jdk.compiler.jmod",
|
||||
"jdk.crypto.cryptoki.jmod",
|
||||
"jdk.crypto.ec.jmod",
|
||||
"jdk.dynalink.jmod",
|
||||
"jdk.editpad.jmod",
|
||||
"jdk.hotspot.agent.jmod",
|
||||
"jdk.httpserver.jmod",
|
||||
"jdk.internal.ed.jmod",
|
||||
"jdk.internal.jvmstat.jmod",
|
||||
"jdk.internal.le.jmod",
|
||||
"jdk.internal.opt.jmod",
|
||||
"jdk.internal.vm.ci.jmod",
|
||||
"jdk.internal.vm.compiler.jmod",
|
||||
"jdk.internal.vm.compiler.management.jmod",
|
||||
"jdk.jartool.jmod",
|
||||
"jdk.javadoc.jmod",
|
||||
"jdk.jcmd.jmod",
|
||||
"jdk.jconsole.jmod",
|
||||
"jdk.jdeps.jmod",
|
||||
"jdk.jdi.jmod",
|
||||
"jdk.jdwp.agent.jmod",
|
||||
"jdk.jfr.jmod",
|
||||
"jdk.jlink.jmod",
|
||||
"jdk.jshell.jmod",
|
||||
"jdk.jsobject.jmod",
|
||||
"jdk.jstatd.jmod",
|
||||
"jdk.localedata.jmod",
|
||||
"jdk.management.agent.jmod",
|
||||
"jdk.management.jfr.jmod",
|
||||
"jdk.management.jmod",
|
||||
"jdk.naming.dns.jmod",
|
||||
"jdk.naming.rmi.jmod",
|
||||
"jdk.net.jmod",
|
||||
"jdk.pack.jmod",
|
||||
"jdk.rmic.jmod",
|
||||
"jdk.scripting.nashorn.jmod",
|
||||
"jdk.scripting.nashorn.shell.jmod",
|
||||
"jdk.sctp.jmod",
|
||||
"jdk.security.auth.jmod",
|
||||
"jdk.security.jgss.jmod",
|
||||
"jdk.unsupported.desktop.jmod",
|
||||
"jdk.unsupported.jmod",
|
||||
"jdk.xml.dom.jmod",
|
||||
"jdk.zipfs.jmod"
|
||||
};
|
||||
|
||||
/**
|
||||
* The jars required for OpenJFX.
|
||||
*/
|
||||
public static final String[] JAVA_FX_JARS = {
|
||||
"javafx-swt.jar",
|
||||
"javafx.base.jar",
|
||||
"javafx.controls.jar",
|
||||
"javafx.fxml.jar",
|
||||
"javafx.graphics.jar",
|
||||
"javafx.media.jar",
|
||||
"javafx.swing.jar",
|
||||
"javafx.web.jar"
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,220 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
Copyright (c) 2012-19 The Processing Foundation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package processing.mode.java.pdex.util.runtime;
|
||||
|
||||
import com.google.classpath.ClassPathFactory;
|
||||
import processing.app.Messages;
|
||||
import processing.app.Sketch;
|
||||
import processing.mode.java.JavaMode;
|
||||
import processing.mode.java.pdex.ImportStatement;
|
||||
import processing.mode.java.pdex.PreprocessedSketch;
|
||||
import processing.mode.java.pdex.util.runtime.strategy.*;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
/**
|
||||
* Builder which generates runtime paths using a series of caches.
|
||||
*
|
||||
* <p>
|
||||
* Builder which helps generate classpath (and module path) entries for sketches using stateful
|
||||
* and individually invalidate-able caches to prevent duplicate work.
|
||||
* </p>
|
||||
*/
|
||||
public class RuntimePathBuilder {
|
||||
private final List<CachedRuntimePathFactory> libraryDependentCaches;
|
||||
private final List<CachedRuntimePathFactory> libraryImportsDependentCaches;
|
||||
private final List<CachedRuntimePathFactory> codeFolderDependentCaches;
|
||||
|
||||
private final List<RuntimePathFactoryStrategy> sketchClassPathStrategies;
|
||||
private final List<RuntimePathFactoryStrategy> searchClassPathStrategies;
|
||||
|
||||
private final ClassPathFactory classPathFactory;
|
||||
|
||||
/**
|
||||
* Create a new runtime path builder with empty caches.
|
||||
*/
|
||||
public RuntimePathBuilder() {
|
||||
classPathFactory = new ClassPathFactory();
|
||||
|
||||
// Declare caches to be built
|
||||
CachedRuntimePathFactory javaRuntimePathFactory;
|
||||
CachedRuntimePathFactory modeSketchPathFactory;
|
||||
CachedRuntimePathFactory modeSearchPathFactory;
|
||||
CachedRuntimePathFactory librarySketchPathFactory;
|
||||
CachedRuntimePathFactory librarySearchPathFactory;
|
||||
CachedRuntimePathFactory coreLibraryPathFactory;
|
||||
CachedRuntimePathFactory codeFolderPathFactory;
|
||||
|
||||
// Create collections
|
||||
sketchClassPathStrategies = new ArrayList<>();
|
||||
searchClassPathStrategies = new ArrayList<>();
|
||||
|
||||
libraryDependentCaches = new ArrayList<>();
|
||||
libraryImportsDependentCaches = new ArrayList<>();
|
||||
codeFolderDependentCaches = new ArrayList<>();
|
||||
|
||||
// Create strategies
|
||||
List<RuntimePathFactoryStrategy> runtimeStrategies = new ArrayList<>();
|
||||
runtimeStrategies.add(new JavaRuntimePathFactory());
|
||||
runtimeStrategies.add(new JavaFxRuntimePathFactory());
|
||||
javaRuntimePathFactory = new CachedRuntimePathFactory(
|
||||
new RuntimePathFactoryStrategyCollection(runtimeStrategies)
|
||||
);
|
||||
|
||||
modeSketchPathFactory = new CachedRuntimePathFactory(new ModeSketchRuntimePathFactory());
|
||||
modeSearchPathFactory = new CachedRuntimePathFactory(new ModeSearchRuntimePathFactory());
|
||||
|
||||
librarySketchPathFactory = new CachedRuntimePathFactory(new LibrarySketchRuntimePathFactory());
|
||||
librarySearchPathFactory = new CachedRuntimePathFactory(new LibrarySearchRuntimePathFactory());
|
||||
|
||||
coreLibraryPathFactory = new CachedRuntimePathFactory(new CoreLibraryRuntimePathFactory());
|
||||
codeFolderPathFactory = new CachedRuntimePathFactory(new CodeFolderRuntimePathFactory());
|
||||
|
||||
// Assign strategies to collections for producing paths
|
||||
sketchClassPathStrategies.add(javaRuntimePathFactory);
|
||||
sketchClassPathStrategies.add(modeSketchPathFactory);
|
||||
sketchClassPathStrategies.add(librarySketchPathFactory);
|
||||
sketchClassPathStrategies.add(coreLibraryPathFactory);
|
||||
sketchClassPathStrategies.add(codeFolderPathFactory);
|
||||
|
||||
searchClassPathStrategies.add(javaRuntimePathFactory);
|
||||
searchClassPathStrategies.add(modeSearchPathFactory);
|
||||
searchClassPathStrategies.add(librarySearchPathFactory);
|
||||
searchClassPathStrategies.add(coreLibraryPathFactory);
|
||||
searchClassPathStrategies.add(codeFolderPathFactory);
|
||||
|
||||
// Assign strategies to collections for cache invalidation
|
||||
libraryDependentCaches.add(coreLibraryPathFactory);
|
||||
|
||||
libraryImportsDependentCaches.add(librarySketchPathFactory);
|
||||
libraryImportsDependentCaches.add(librarySearchPathFactory);
|
||||
|
||||
codeFolderDependentCaches.add(codeFolderPathFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidate all of the runtime path caches associated with sketch libraries.
|
||||
*/
|
||||
public void markLibrariesChanged() {
|
||||
invalidateAll(libraryDependentCaches);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidate all of the runtime path caches associated with sketch library imports.
|
||||
*/
|
||||
public void markLibraryImportsChanged() {
|
||||
invalidateAll(libraryImportsDependentCaches);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidate all of the runtime path caches associated with the code folder having changed.
|
||||
*/
|
||||
public void markCodeFolderChanged() {
|
||||
invalidateAll(codeFolderDependentCaches);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a classpath and inject it into a {PreprocessedSketch.Builder}.
|
||||
*
|
||||
* @param result The {PreprocessedSketch.Builder} into which the classpath should be inserted.
|
||||
* @param mode The {JavaMode} for which the classpath should be generated.
|
||||
*/
|
||||
public void prepareClassPath(PreprocessedSketch.Builder result, JavaMode mode) {
|
||||
List<ImportStatement> programImports = result.programImports;
|
||||
Sketch sketch = result.sketch;
|
||||
|
||||
prepareSketchClassPath(result, mode, programImports, sketch);
|
||||
prepareSearchClassPath(result, mode, programImports, sketch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidate all of the caches in a provided collection.
|
||||
*
|
||||
* @param caches The caches to invalidate so that, when their value is requested again, the value
|
||||
* is generated again.
|
||||
*/
|
||||
private void invalidateAll(List<CachedRuntimePathFactory> caches) {
|
||||
for (CachedRuntimePathFactory cache : caches) {
|
||||
cache.invalidateCache();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the classpath required for the sketch's execution.
|
||||
*
|
||||
* @param result The PreprocessedSketch builder into which the classpath and class loader should
|
||||
* be injected.
|
||||
* @param mode The JavaMode for which a sketch classpath should be generated.
|
||||
* @param programImports The imports listed by the sketch (user imports).
|
||||
* @param sketch The sketch for which the classpath is being generated.
|
||||
*/
|
||||
private void prepareSketchClassPath(PreprocessedSketch.Builder result, JavaMode mode,
|
||||
List<ImportStatement> programImports, Sketch sketch) {
|
||||
|
||||
Stream<String> sketchClassPath = sketchClassPathStrategies.stream()
|
||||
.flatMap((x) -> x.buildClasspath(mode, programImports, sketch).stream());
|
||||
|
||||
String[] classPathArray = sketchClassPath.toArray(String[]::new);
|
||||
URL[] urlArray = Arrays.stream(classPathArray)
|
||||
.map(path -> {
|
||||
try {
|
||||
return Paths.get(path).toUri().toURL();
|
||||
} catch (MalformedURLException e) {
|
||||
Messages.loge("malformed URL when preparing sketch classloader", e);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.toArray(URL[]::new);
|
||||
|
||||
result.classLoader = new URLClassLoader(urlArray, null);
|
||||
result.classPath = classPathFactory.createFromPaths(classPathArray);
|
||||
result.classPathArray = classPathArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare the classpath for searching in case of import suggestions.
|
||||
*
|
||||
* @param result The PreprocessedSketch builder into which the search classpath should be
|
||||
* injected.
|
||||
* @param mode The JavaMode for which a sketch classpath should be generated.
|
||||
* @param programImports The imports listed by the sketch (user imports).
|
||||
* @param sketch The sketch for which the classpath is being generated.
|
||||
*/
|
||||
private void prepareSearchClassPath(PreprocessedSketch.Builder result, JavaMode mode,
|
||||
List<ImportStatement> programImports, Sketch sketch) {
|
||||
|
||||
Stream<String> searchClassPath = searchClassPathStrategies.stream()
|
||||
.flatMap((x) -> x.buildClasspath(mode, programImports, sketch).stream());
|
||||
|
||||
result.searchClassPathArray = searchClassPath.toArray(String[]::new);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
Copyright (c) 2012-19 The Processing Foundation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package processing.mode.java.pdex.util.runtime;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* Common convenience functions for runtime path formulation.
|
||||
*/
|
||||
public class RuntimePathUtil {
|
||||
|
||||
/**
|
||||
* Remove invalid entries in a classpath string.
|
||||
*
|
||||
* @param classPathString The classpath to clean.
|
||||
* @return The cleaned classpath entries without invalid entries.
|
||||
*/
|
||||
public static List<String> sanitizeClassPath(String classPathString) {
|
||||
// Make sure class path does not contain empty string (home dir)
|
||||
return Arrays.stream(classPathString.split(File.pathSeparator))
|
||||
.filter(p -> p != null && !p.trim().isEmpty())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
Copyright (c) 2019 The Processing Foundation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package processing.mode.java.pdex.util.runtime.strategy;
|
||||
|
||||
import processing.app.Sketch;
|
||||
import processing.mode.java.JavaMode;
|
||||
import processing.mode.java.pdex.ImportStatement;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
|
||||
/**
|
||||
* Runtime path factory which caches the results of another runtime path factory.
|
||||
*
|
||||
* <p>
|
||||
* Runtime path factory which decorates another {RuntimePathFactoryStrategy} that caches the
|
||||
* results of another runtime path factory. This is a lazy cached getter so the value will not be
|
||||
* resolved until it is requested.
|
||||
* </p>
|
||||
*/
|
||||
public class CachedRuntimePathFactory implements RuntimePathFactoryStrategy {
|
||||
|
||||
private AtomicReference<List<String>> cachedResult;
|
||||
private RuntimePathFactoryStrategy innerStrategy;
|
||||
|
||||
/**
|
||||
* Create a new cache around {RuntimePathFactoryStrategy}.
|
||||
*
|
||||
* @param newInnerStrategy The strategy to cache.
|
||||
*/
|
||||
public CachedRuntimePathFactory(RuntimePathFactoryStrategy newInnerStrategy) {
|
||||
cachedResult = new AtomicReference<>(null);
|
||||
innerStrategy = newInnerStrategy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidate the cached path so that, when requested next time, it will be rebuilt from scratch.
|
||||
*/
|
||||
public void invalidateCache() {
|
||||
cachedResult.set(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cached classpath or, if not cached, build a classpath using the inner strategy.
|
||||
*
|
||||
* <p>
|
||||
* Return the cached classpath or, if not cached, build a classpath using the inner strategy.
|
||||
* Note that this getter will not check to see if mode, imports, or sketch have changed. If a
|
||||
* cached value is available, it will be returned without examining the identity of the
|
||||
* parameters.
|
||||
* </p>
|
||||
*
|
||||
* @param mode The {JavaMode} for which the classpath should be built.
|
||||
* @param imports The sketch (user) imports.
|
||||
* @param sketch The sketch for which a classpath is to be returned.
|
||||
* @return Newly generated classpath.
|
||||
*/
|
||||
@Override
|
||||
public List<String> buildClasspath(JavaMode mode, List<ImportStatement> imports, Sketch sketch) {
|
||||
return cachedResult.updateAndGet((cachedValue) ->
|
||||
cachedValue == null ? innerStrategy.buildClasspath(mode, imports, sketch) : cachedValue
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
Copyright (c) 2012-19 The Processing Foundation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package processing.mode.java.pdex.util.runtime.strategy;
|
||||
|
||||
import processing.app.Sketch;
|
||||
import processing.app.Util;
|
||||
import processing.mode.java.JavaMode;
|
||||
import processing.mode.java.pdex.ImportStatement;
|
||||
import processing.mode.java.pdex.util.runtime.RuntimePathUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Path factory which includes resources like jars within the sketch code folder.
|
||||
*/
|
||||
public class CodeFolderRuntimePathFactory implements RuntimePathFactoryStrategy {
|
||||
|
||||
@Override
|
||||
public List<String> buildClasspath(JavaMode mode, List<ImportStatement> imports, Sketch sketch) {
|
||||
StringBuilder classPath = new StringBuilder();
|
||||
|
||||
// Code folder
|
||||
if (sketch.hasCodeFolder()) {
|
||||
File codeFolder = sketch.getCodeFolder();
|
||||
String codeFolderClassPath = Util.contentsToClassPath(codeFolder);
|
||||
classPath.append(codeFolderClassPath);
|
||||
}
|
||||
|
||||
return RuntimePathUtil.sanitizeClassPath(classPath.toString());
|
||||
}
|
||||
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
Copyright (c) 2012-19 The Processing Foundation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package processing.mode.java.pdex.util.runtime.strategy;
|
||||
|
||||
import processing.app.Library;
|
||||
import processing.app.Sketch;
|
||||
import processing.mode.java.JavaMode;
|
||||
import processing.mode.java.pdex.ImportStatement;
|
||||
import processing.mode.java.pdex.util.runtime.RuntimePathUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Runtime path factory for libraries part of the processing mode (like {JavaMode}).
|
||||
*/
|
||||
public class CoreLibraryRuntimePathFactory implements RuntimePathFactoryStrategy {
|
||||
|
||||
@Override
|
||||
public List<String> buildClasspath(JavaMode mode, List<ImportStatement> imports, Sketch sketch) {
|
||||
StringBuilder classPath = new StringBuilder();
|
||||
|
||||
for (Library lib : mode.coreLibraries) {
|
||||
classPath.append(File.pathSeparator).append(lib.getClassPath());
|
||||
}
|
||||
|
||||
return RuntimePathUtil.sanitizeClassPath(classPath.toString());
|
||||
}
|
||||
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
|
||||
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
Copyright (c) 2012-19 The Processing Foundation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 2
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program 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 for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package processing.mode.java.pdex.util.runtime.strategy;
|
||||
|
||||
import processing.app.Sketch;
|
||||
import processing.mode.java.JavaMode;
|
||||
import processing.mode.java.pdex.ImportStatement;
|
||||
import processing.mode.java.pdex.util.runtime.RuntimeConst;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* Runtime path factory which generates classpath entries for JavaFX / OpenFX.
|
||||
*/
|
||||
public class JavaFxRuntimePathFactory implements RuntimePathFactoryStrategy {
|
||||
|
||||
@Override
|
||||
public List<String> buildClasspath(JavaMode mode, List<ImportStatement> imports, Sketch sketch) {
|
||||
return Arrays.stream(RuntimeConst.JAVA_FX_JARS)
|
||||
.map(this::buildEntry)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a single classpath entry for OpenJFX.
|
||||
*
|
||||
* @param jarName The jar name like "javafx.base.jar" for which a fully qualified entry should be
|
||||
* created.
|
||||
* @return The fully qualified classpath entry like ".../Processing.app/Contents/PlugIns/
|
||||
* adoptopenjdk-11.0.1.jdk/Contents/Home/lib/javafx.base.jar"
|
||||
*/
|
||||
private String buildEntry(String jarName) {
|
||||
StringJoiner joiner = new StringJoiner(File.separator);
|
||||
joiner.add(System.getProperty("java.home"));
|
||||
joiner.add("lib");
|
||||
joiner.add(jarName);
|
||||
|
||||
return joiner.toString();
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user