From ee322bb5f579c226b8444de448f2481f9adc911f Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 8 Dec 2021 18:45:59 +1030 Subject: [PATCH] Update to netbeans 12.6 --- nbproject/build-impl.xml | 449 ++++++++++++++++++++-------------- nbproject/genfiles.properties | 6 +- nbproject/project.properties | 9 +- nbproject/project.xml | 1 - 4 files changed, 270 insertions(+), 195 deletions(-) diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml index 46a5edb..db8a4d1 100644 --- a/nbproject/build-impl.xml +++ b/nbproject/build-impl.xml @@ -49,9 +49,236 @@ is divided into following sections: - + + + + + + + + + + + + +package netbeans; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; + +public class CoalesceKeyvalue extends Task { + private String property; + + public void setProperty(String property) { + this.property = property; + } + + private String value; + + public void setValue(String value) { + this.value = value; + } + + private String valueSep; + + public void setValueSep(String valueSep) { + this.valueSep = valueSep; + } + + private String entrySep; + + public void setEntrySep(String entrySep) { + this.entrySep = entrySep; + } + + private String multiSep; + + public void setMultiSep(String multiSep) { + this.multiSep = multiSep; + } + + private String outSep; + + public void setOutSep(String outSep) { + this.outSep = outSep; + } + + @Override + public void execute() throws BuildException { + List<String> result = new ArrayList<>(); + Map<String, List<String>> module2Paths = new HashMap<>(); + + for (String entry : value.split(Pattern.quote(entrySep))) { + String[] keyValue = entry.split(Pattern.quote(valueSep), 2); + if (keyValue.length == 1) { + result.add(keyValue[0]); + } else { + module2Paths.computeIfAbsent(keyValue[0], s -> new ArrayList<>()) + .add(keyValue[1].trim()); + } + } + module2Paths.entrySet() + .stream() + .forEach(e -> result.add(e.getKey() + valueSep + e.getValue().stream().collect(Collectors.joining(multiSep)))); + getProject().setProperty(property, result.stream().collect(Collectors.joining(" " + entrySep))); + } + +} + + + + +package netbeans; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Task; + +public class ModsourceRegexp extends Task { + private String property; + + public void setProperty(String property) { + this.property = property; + } + + private String filePattern; + + public void setFilePattern(String filePattern) { + this.filePattern = filePattern; + } + + private String modsource; + + public void setModsource(String modsource) { + this.modsource = modsource; + } + + private List<String> expandGroup(String grp) { + List<String> exp = new ArrayList<>(); + String item = ""; + int depth = 0; + + for (int i = 0; i < grp.length(); i++) { + char c = grp.charAt(i); + switch (c) { + case '{': + if (depth++ == 0) { + continue; + } + break; + case '}': + if (--depth == 0) { + exp.add(item); + continue; + } + break; + case ',': + if (depth == 1) { + exp.add(item); + item = ""; + continue; + } + default: + break; + } + item = item + c; + } + return exp; + } + + private List<String> pathVariants(String spec) { + return pathVariants(spec, new ArrayList<>()); + } + + private List<String> pathVariants(String spec, List<String> res) { + int start = spec.indexOf('{'); + if (start == -1) { + res.add(spec); + return res; + } + int depth = 1; + int end; + for (end = start + 1; end < spec.length() && depth > 0; end++) { + char c = spec.charAt(end); + switch (c) { + case '{': depth++; break; + case '}': depth--; break; + } + } + String prefix = spec.substring(0, start); + String suffix = spec.substring(end); + expandGroup(spec.substring(start, end)).stream().forEach(item -> { + pathVariants(prefix + item + suffix, res); + }); + return res; + } + + private String toRegexp2(String spec, String filepattern, String separator) { + List<String> prefixes = new ArrayList<>(); + List<String> suffixes = new ArrayList<>(); + pathVariants(spec).forEach(item -> { + suffixes.add(item); + }); + String tail = ""; + String separatorString = separator; + if ("\\".equals(separatorString)) { + separatorString = "\\\\"; + } + if (filepattern != null && !Objects.equals(filepattern, tail)) { + tail = separatorString + filepattern; + } + return "([^" + separatorString +"]+)\\Q" + separator + "\\E(" + suffixes.stream().collect(Collectors.joining("|")) + ")" + tail; + } + + @Override + public void execute() throws BuildException { + getProject().setProperty(property, toRegexp2(modsource, filePattern, getProject().getProperty("file.separator"))); + } + +} + + + + +package netbeans; + +import java.io.File; +import java.util.Arrays; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.types.selectors.BaseExtendSelector; + +public class ModuleInfoSelector extends BaseExtendSelector { + + @Override + public boolean isSelected(File basedir, String filename, File file) throws BuildException { + String extension = Arrays.stream(getParameters()) + .filter(p -> "extension".equals(p.getName())) + .map(p -> p.getValue()) + .findAny() + .get(); + return !new File(file, "module-info." + extension).exists(); + } + +} + + + + + + + + @@ -69,43 +296,7 @@ is divided into following sections: - - - - - - - - - - - - - - - - - - - - - - - - - - Must set platform.home - Must set platform.bootcp - Must set platform.java - Must set platform.javac - - The J2SE Platform is not correctly set up. - Your active platform is: ${platform.active}, but the corresponding property "platforms.${platform.active}.home" is not found in the project's properties files. - Either open the project in the IDE and setup the Platform with the same name or add it manually. - For example like this: - ant -Duser.properties.file=<path_to_property_file> jar (where you put the property "platforms.${platform.active}.home" in a .properties file) - or ant -Dplatforms.${platform.active}.home=<path_to_JDK_home> jar (where no properties file is used) - + @@ -123,9 +314,6 @@ is divided into following sections: - - self.setSelected(!new java.io.File(file, "module-info.java").exists()); - @@ -221,6 +409,20 @@ is divided into following sections: + + + + + + + + + + + + + + @@ -345,7 +547,7 @@ is divided into following sections: - + @@ -438,7 +640,7 @@ is divided into following sections: - + @@ -523,7 +725,7 @@ is divided into following sections: - + @@ -754,9 +956,6 @@ is divided into following sections: - - - @@ -806,7 +1005,7 @@ is divided into following sections: - + @@ -893,131 +1092,6 @@ is divided into following sections: - - - - - - - - - - function coalesce(input, keyValueSeparator, multiSeparator, entrySeparator) { - var result = []; - var values = {}; - - (typeof input === "string" ? input.split(entrySeparator) : input).forEach(function(entry) { - var idx = entry.indexOf(keyValueSeparator); - if (idx < 1) { - result.push(entry); - } else { - var key = entry.substring(0, idx); - var val = entry.substring(idx + 1); - if (!values[key]) { - values[key] = []; - } - values[key].push(val.trim()); - } - }); - Object.keys(values).sort().forEach(function(k) { - result.push(k + keyValueSeparator + values[k].join(multiSeparator)); - }); - return result.join(" " + entrySeparator); - } - self.project.setProperty(attributes.get("property"), - coalesce(attributes.get("value"), - attributes.get("value-sep"), - attributes.get("entry-sep"), - attributes.get("multi-sep") - )); - - - - - - - - - function expandGroup(grp) { - var exp = []; - var item = ""; - var depth = 0; - - for (i = 0; i < grp.length; i++) { - var c = grp[i]; - switch (c) { - case '{': - if (depth++ === 0) { - continue; - } - break; - case '}': - if (--depth === 0) { - exp.push(item); - continue; - } - break; - case ',': - if (depth === 1) { - exp.push(item); - item = ""; - continue; - } - default: - break; - } - item = item + c; - } - return exp; - } - - function pathVariants(spec, res) { - res = res || []; - var start = spec.indexOf('{'); - if (start === -1) { - res.push(spec); - return res; - } - var depth = 1; - var end; - for (end = start + 1; end < spec.length && depth > 0; end++) { - var c = spec[end]; - switch (c) { - case '{': depth++; break; - case '}': depth--; break; - } - } - var prefix = spec.substring(0, start); - var suffix = spec.substring(end); - expandGroup(spec.slice(start, end)).forEach(function (item) { - pathVariants(prefix + item + suffix, res); - }) - return res; - } - - function toRegexp2(spec, filepattern, separator) { - var prefixes = []; - var suffixes = []; - pathVariants(spec).forEach(function(item) { - suffixes.push(item); - }); - var tail = ""; - var separatorString = separator; - if (separatorString == "\\") { - separatorString = "\\\\"; - } - if (filepattern && filepattern != tail) { - tail = separatorString + filepattern; - } - return "([^" + separatorString +"]+)\\Q" + separator + "\\E(" + suffixes.join("|") + ")" + tail; - } - self.project.setProperty(attributes.get("property"), - toRegexp2(attributes.get("modsource"), attributes.get("filepattern"), self.project.getProperty("file.separator"))); - - - - - @@ -1212,8 +1286,8 @@ is divided into following sections: - - + + @@ -1468,19 +1542,16 @@ is divided into following sections: - - - - + - + - + @@ -1553,9 +1624,9 @@ is divided into following sections: - - self.setSelected(!new java.io.File(file, "module-info.class").exists()); - + + + @@ -1564,7 +1635,7 @@ is divided into following sections: - + @@ -1597,7 +1668,7 @@ is divided into following sections: - + @@ -1714,6 +1785,7 @@ is divided into following sections: + @@ -1768,7 +1840,10 @@ is divided into following sections: - + + + + diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties index 10ac352..5698f3e 100644 --- a/nbproject/genfiles.properties +++ b/nbproject/genfiles.properties @@ -3,6 +3,6 @@ build.xml.script.CRC32=b55362bc build.xml.stylesheet.CRC32=32069288@1.6.1 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. -nbproject/build-impl.xml.data.CRC32=2c0455af -nbproject/build-impl.xml.script.CRC32=0af0e4e8 -nbproject/build-impl.xml.stylesheet.CRC32=496e4d3b@1.9 +nbproject/build-impl.xml.data.CRC32=697f393b +nbproject/build-impl.xml.script.CRC32=c40dc6a1 +nbproject/build-impl.xml.stylesheet.CRC32=d1ebcf0f@1.16 diff --git a/nbproject/project.properties b/nbproject/project.properties index 25a39d7..ad1c93c 100644 --- a/nbproject/project.properties +++ b/nbproject/project.properties @@ -48,9 +48,10 @@ javac.modulepath=\ javac.processormodulepath= javac.processorpath=\ ${javac.classpath} -javac.source=13 -javac.target=13 +javac.source=17 +javac.target=17 javac.test.classpath=\ + ${libs.junit_4.classpath}:\ ${javac.classpath} javac.test.modulepath=\ ${javac.modulepath}:\ @@ -75,13 +76,13 @@ jlink.additionalmodules= jlink.additionalparam= jlink.launcher=true jlink.launcher.name=notzed.zcl -platform.active=JDK_15_panama +platform.active=default_platform project.license=gpl3-notzed run.classpath= # Space-separated list of JVM arguments used when running the project. # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. # To set system properties for unit tests define test-sys-prop.name=value: -run.jvmargs=--add-exports jdk.incubator.foreign/jdk.incubator.foreign.unsafe=notzed.zcl +run.jvmargs=--enable-native-access=notzed.zcl -Djava.library.path=/usr/lib64 run.modulepath=\ ${javac.modulepath}:\ ${build.modules.dir} diff --git a/nbproject/project.xml b/nbproject/project.xml index 575ebab..4ab7bb7 100644 --- a/nbproject/project.xml +++ b/nbproject/project.xml @@ -4,7 +4,6 @@ notzed.zcl - -- 2.39.5