Merge pull request #1 from processing/master

Merge from main repo
This commit is contained in:
Liam James
2020-01-19 10:11:49 +10:00
committed by GitHub
15 changed files with 140 additions and 787 deletions
+7 -56
View File
@@ -354,9 +354,6 @@
<target name="jdk-download" depends="jdk-check, downloader-setup"
unless="jdk.tgz.downloaded">
<!-- we normally download a JRE, except on arm -->
<property name="jdk.download.jdk" value="true" />
<condition property="jdk.downloader"
value="${target-platform}-i586.tar.gz">
<equals arg1="${jdk.data.model}" arg2="32" />
@@ -366,13 +363,12 @@
<equals arg1="${jdk.data.model}" arg2="64" />
</condition>
<downloader train="${jdk.train}"
<downloader component="jdk"
train="${jdk.train}"
version="${jdk.version}"
openJdk="true"
platform="${target-platform}${jdk.data.model}"
update="${jdk.update}"
build="${jdk.build}"
component="JDK"
flavor="${jdk.downloader}"
path="${jdk.tgz.path}" />
</target>
@@ -380,17 +376,14 @@
<target name="jfx-download" depends="jfx-check, downloader-setup"
unless="jfx.zip.downloaded">
<downloader train="${jfx.train}"
<downloader component="jfx"
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 -->
@@ -694,16 +687,7 @@
<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>
<property name="jdk.dir" value="macosx/work/jdk-${jdk.esoteric}+${jdk.build}.jdk/" />
<!-- app bundler for OS X and Java -->
<taskdef name="bundleapp"
@@ -1133,31 +1117,7 @@
<arg value="../${jdk.tgz.path}"/>
</exec>
<!-- 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 -->
<and>
<equals arg1="${jdk.download.jdk}" arg2="true" />
<equals arg1="${jdk.train}" arg2="1" />
</and>
</condition>
<!-- 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="${jdk.train}" arg2="1" />
</not>
</condition>
<property name="jdk.dir" value="jdk-${jdk.esoteric}+${jdk.build}/" />
<exec executable="rsync" dir="linux">
<arg value="-a" />
@@ -1485,16 +1445,7 @@
src="${jdk.tgz.path}"
overwrite="false" />
<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>
<property name="jdk.dir" value="windows/work/jdk-${jdk.esoteric}+${jdk.build}/" />
<move file="${jdk.dir}" tofile="windows/work/java" />
+2 -3
View File
@@ -35,15 +35,14 @@
</macrodef>
<target name="test-compile">
<compilecommon srcdir="src; test" destdir="bin-test" classpath="classpath.test" />
<!-- <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" />
<!-- <test name="AdoptOpenJdkDownloadUrlGeneratorTest" /> -->
</junit>
</target>
@@ -1,89 +0,0 @@
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
Part of the Processing project - http://processing.org
Copyright (c) 2019-20 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 {
static private 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) {
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";
}
}
-77
View File
@@ -1,77 +0,0 @@
/* -*- 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;
}
}
-85
View File
@@ -1,85 +0,0 @@
/* -*- 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);
/**
* 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".
*/
public String getLocalFilename(String downloadPlatform, String component,
int train, int version, int update,
int build, String flavor) {
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;
}
}
+114 -123
View File
@@ -3,7 +3,7 @@
/*
Part of the Processing project - http://processing.org
Copyright (c) 2014-19 The Processing Foundation
Copyright (c) 2014-20 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
@@ -31,32 +31,27 @@ import org.apache.tools.ant.Task;
* Ant Task for downloading the latest JRE, JDK, or OpenJFX release.
*/
public class Downloader extends Task {
private static final boolean PRINT_LOGGING = true;
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
private String component; // "jre", "jdk", or "jfx"
private String component; // "jdk" or "jfx"
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.
* @param platform The platform for which files are being downloaded like macosx.
*/
public void setPlatform(String platform) {
this.platform = platform;
this.platform = platform.toLowerCase();
}
@@ -103,10 +98,10 @@ public class Downloader extends Task {
/**
* Indicate what component or release type of Java is being downloaded.
*
* @param component The component to download like "JDK", "JRE", or "OpenJFX".
* @param component The component to download like "jdk" or "jfx"
*/
public void setComponent(String component) {
this.component = component;
this.component = component.toLowerCase();
}
@@ -131,7 +126,7 @@ public class Downloader extends Task {
/**
* Download the JDK or JRE.
* Entry point called by Ant
*/
public void execute() throws BuildException {
if (train == 0) {
@@ -139,8 +134,7 @@ public class Downloader extends Task {
throw new BuildException("Train (i.e. 1 or 11) must be set");
}
boolean isJava11 = train == 11;
if (!isJava11 && version == 0) {
if (train != 11 && version == 0) {
throw new BuildException("Version (i.e. 7 or 8) must be set");
}
@@ -164,58 +158,54 @@ public class Downloader extends Task {
* Download the package from AdoptOpenJDK or Oracle.
*/
void download() throws IOException {
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 = downloadItem.getLocalPath();
path = getLocalFilename(component, version, update, flavor);
}
String url = downloadItem.getUrl();
// Downlaod
println("Attempting download at " + url);
String url = null;
if (component.equals("jdk")) {
url = adoptOpenJdkUrl(platform, component, train, version, update, build, flavor);
} else if (component.equals("jfx")) {
url = gluonHqUrl(platform, component, train, version, update);
} else {
throw new RuntimeException("Do not know how to download: " + component);
}
System.out.println("Downloading from " + url);
HttpURLConnection conn =
(HttpURLConnection) new URL(url).openConnection();
/*
Optional<String> cookieMaybe = downloadItem.getCookie();
if (cookieMaybe.isPresent()) {
conn.setRequestProperty("Cookie", cookieMaybe.get());
}
*/
//printHeaders(conn);
//conn.connect();
while (conn.getResponseCode() == 302 || conn.getResponseCode() == 301) {
Map<String, List<String>> headers = conn.getHeaderFields();
List<String> location = headers.get("Location");
if (location.size() == 1) {
if (location.size() > 0) {
url = location.get(0);
println("Redirecting to " + url);
System.out.println("Redirecting to " + url);
} else {
throw new BuildException("Got " + location.size() + " locations.");
// TODO should this just do one of the
throw new BuildException("No redirect location provided");
}
List<String> cookies = headers.get("Set-Cookie");
conn = (HttpURLConnection) new URL(url).openConnection();
/*
List<String> cookies = headers.get("Set-Cookie");
if (cookies != null) {
for (String cookie : cookies) {
System.out.println("Setting cookie " + cookie);
conn.setRequestProperty("Cookie", cookie);
}
}
if (cookieMaybe.isPresent()) {
conn.setRequestProperty("Cookie", cookieMaybe.get());
}
*/
conn.connect();
}
@@ -224,8 +214,8 @@ public class Downloader extends Task {
BufferedInputStream bis = new BufferedInputStream(input);
File outputFile = new File(path); //folder, filename);
String msg = String.format("Downloading %s from %s%n", outputFile.getAbsolutePath(), url);
println(msg);
System.out.format("Downloading %s from %s%n",
outputFile.getAbsolutePath(), url);
// Write to a temp file so that we don't have an incomplete download
// masquerading as a good archive.
@@ -243,7 +233,8 @@ public class Downloader extends Task {
if (outputFile.exists()) {
if (!outputFile.delete()) {
throw new BuildException("Could not delete old download: " + outputFile.getAbsolutePath());
throw new BuildException("Could not delete old download: " +
outputFile.getAbsolutePath());
}
}
if (!tempFile.renameTo(outputFile)) {
@@ -257,97 +248,97 @@ public class Downloader extends Task {
}
}
static private String adoptOpenJdkUrl(String platform, String component,
int train, int version, int update,
int build, String flavor) {
final String URL_FORMAT = "https://github.com/AdoptOpenJDK/openjdk%d-binaries/releases/download/jdk-%d.%d.%d%%2B%d/OpenJDK%dU-%s_%d.%d.%d_%d.%s";
String filename = null;
switch (platform) {
case "windows32": filename = "jdk_x86-32_windows_hotspot"; break;
case "windows64": filename = "jdk_x64_windows_hotspot"; break;
case "macosx64": filename = "jdk_x64_mac_hotspot"; break;
case "linux32": throw new RuntimeException("32-bit Linux not supported by AdoptOpenJDK.");
case "linux64": filename = "jdk_x64_linux_hotspot"; break;
case "linuxarm": filename = "jdk_aarch64_linux_hotspot"; break;
default: throw new RuntimeException("Unknown platform: " + platform);
}
String fileExtension = platform.startsWith("windows") ? "zip" : "tar.gz";
return String.format(
URL_FORMAT,
train,
train,
version,
update,
build,
train,
filename,
train,
version,
update,
build,
fileExtension
);
}
static private String gluonHqUrl(String platform, String component,
int train, int version, int update) {
final String URL_FORMAT =
"https://gluonhq.com/download/javafx-%d-%d-%d-sdk-%s/";
String platformShort;
if (platform.contains("linux")) {
platformShort = "linux";
} else if (platform.contains("mac")) {
platformShort = "mac";
} else if (platform.contains("windows")) {
platformShort = "windows";
} else {
throw new RuntimeException("Unsupported platform for JFX: " + platform);
}
return String.format(URL_FORMAT, train, version, update, platformShort);
}
/**
* Print the headers used for {URLConnection}.
* 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".
*/
static void printHeaders(URLConnection conn) {
static private String getLocalFilename(String component, int version,
int update, String flavor) {
String versionStr;
if (update == 0) {
versionStr = String.format("-%d-%s", version, flavor);
} else {
versionStr = String.format("-%du%d-%s", version, update, flavor);
}
return component + versionStr;
}
static private 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();
println("Header Name:" + headerName);
System.err.println("Header Name:" + headerName);
List<String> headerValues = entry.getValue();
for (String value : headerValues) {
print("Header value:" + value);
System.err.println("Header Value:" + value);
}
printEmptyLine();
printEmptyLine();
System.err.println();
}
}
/**
* 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) {
downloadUrlGenerator = new AdoptOpenJdkDownloadUrlGenerator();
} else if (isJfxDownload) {
downloadUrlGenerator = new GluonHqDownloadUrlGenerator();
} 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
);
String url = downloadUrlGenerator.buildUrl(
platform,
component,
train,
version,
update,
build,
flavor
);
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("");
}
}
@@ -1,50 +0,0 @@
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
Part of the Processing project - http://processing.org
Copyright (c) 2014-20 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 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);
}
}
@@ -1,128 +0,0 @@
/* -*- 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
);
}
}
@@ -1,108 +0,0 @@
/* -*- 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
);
}
}
@@ -1,59 +0,0 @@
/* -*- 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
);
}
}
+1 -1
View File
@@ -13,7 +13,7 @@
<img src="../icons/pde-64.png" width="64" height="64">
</td>
<td valign="middle">
<h1>Welcome to Processing 4 (alpha)</h1>
<h1>Processing 4 (alpha)</h1>
</td>
</tr>
</table>
+1 -1
View File
@@ -13,7 +13,7 @@
<img src="../icons/pde-64.png" width="64" height="64">
</td>
<td valign="middle">
<h1>Welcome to Processing 4 (alpha)
<h1>Processing 4 (alpha)
</td>
</tr>
</table>
+6 -2
View File
@@ -22,8 +22,6 @@ _ removing AWT from core
_ https://github.com/codeanticode/processing-lwjgl/wiki#making-awt-optional-in-papplet
_ move loadImage() into surface
_ size() issues on Mojave? (3.4 works, 3.5.3 does not)
_ https://github.com/processing/processing/issues/5791
_ use exit event to set mouseY to 0 on macOS
_ https://github.com/processing/processing/pull/5796/files
@@ -31,6 +29,12 @@ _ possible fix for precision issues with PDF
_ https://github.com/processing/processing/issues/5801#issuecomment-466632459
high
_ size() issues on Mojave? (3.4 works, 3.5.3 does not)
_ https://github.com/processing/processing/issues/5791
_ closed for now; unable to confirm anything in the thread
high-ish
_ Update isAccessible() in Table to use JDK 11 reflection methods
_ https://github.com/processing/processing4/issues/3
@@ -129,8 +129,8 @@ class Rename {
final String newName = textField.getText().trim();
if (!newName.isEmpty()) {
if (newName.length() >= 1 &&
newName.chars().limit(1).allMatch(Character::isUnicodeIdentifierStart) &&
newName.chars().skip(1).allMatch(Character::isUnicodeIdentifierPart)) {
newName.chars().limit(1).allMatch(Character::isJavaIdentifierStart) &&
newName.chars().skip(1).allMatch(Character::isJavaIdentifierPart)) {
rename(ps, binding, newName);
window.setVisible(false);
} else {
+7 -3
View File
@@ -12,6 +12,8 @@ X link to a wiki page for 4.x
X create wiki page for changes in 4.x
X selecting a sketch in the Sketch menu no longer opens its window
X https://github.com/processing/processing/issues/5882
X streamlining the jdk downloader
X https://github.com/processing/processing4/issues/47
cross-ported from 3.5.4
X don't remove entries from Recent menu on Save As
@@ -74,6 +76,9 @@ X https://github.com/processing/processing/issues/5805
X https://github.com/processing/processing/pull/5909
X updtes to Ukrainian translation
X https://github.com/processing/processing/pull/5944
X rename-variable menu allows Java identifiers
X https://github.com/processing/processing/issues/5828
X https://github.com/processing/processing/pull/5906
sampottinger
X Fix JDK naming and cleanup in ant build
@@ -117,6 +122,8 @@ _ change help menu links to go to newer FAQ and the rest
open issues
_ update the docs repo
_ check with Casey re: shallow clone or approach
_ reliable getLibraryFolder() and getDocumentsFolder() methods in MacPlatform
_ https://github.com/processing/processing4/issues/9
_ further streamline the downloader
@@ -129,9 +136,6 @@ _ windows anti-malware leaves browser stuck at 100%
_ https://github.com/processing/processing/issues/5893
quick fixes
_ rename-variable menu allows Java identifiers
_ https://github.com/processing/processing/pull/5906
from Casey
_ Math for BLEND incorrect in the reference?