[med-svn] [Git][med-team/nextflow][master] 3 commits: Trying to depend on kryo 5 (to be packaged)
Pierre Gruet (@pgt)
gitlab at salsa.debian.org
Sun Jul 18 15:01:44 BST 2021
Pierre Gruet pushed to branch master at Debian Med / nextflow
Commits:
e85e3ec6 by Pierre Gruet at 2021-07-18T15:59:35+02:00
Trying to depend on kryo 5 (to be packaged)
- - - - -
588cf17b by Pierre Gruet at 2021-07-18T16:00:47+02:00
Adding some files of groovy 4 in the packaging
- - - - -
7e1b0333 by Pierre Gruet at 2021-07-18T16:01:27+02:00
Fixing groovy syntax issues linked to old Debian-packaged groovy
- - - - -
13 changed files:
- debian/control
- debian/copyright
- + debian/groovy/json/DefaultJsonGenerator.java
- + debian/groovy/json/JsonDelegate.java
- + debian/groovy/json/JsonException.java
- + debian/groovy/json/JsonGenerator.java
- + debian/groovy/json/JsonOutput.java
- debian/maven.rules
- debian/patches/groovy_syntax.patch
- + debian/patches/kryo5_abi.patch
- + debian/patches/omit_groovy_MapConstructor_annotation.patch
- debian/patches/series
- debian/rules
Changes:
=====================================
debian/control
=====================================
@@ -17,7 +17,7 @@ Build-Depends: debhelper-compat (= 13),
libgrengine-java,
libjline2-java,
libjoda-time-java,
- libkryo-java,
+ libkryo5-java,
libleveldb-java,
liblog4j1.2-java,
libmail-java,
=====================================
debian/copyright
=====================================
@@ -128,6 +128,16 @@ Copyright: 2020 Andreas Tille <tille at debian.org>
2021 Pierre Gruet <pgt at debian.org>
License: Apache-2.0
+Files: debian/groovy/*
+Copyright: 2003-2021 The Apache Software Foundation
+License: Apache-2.0
+
+Files: debian/groovy/json/DefaultJsonGenerator.java
+ debian/groovy/json/JsonOutput.java
+Copyright: 2003-2021 The Apache Software Foundation
+ 2021 Pierre Gruet <pgt at debian.org>
+License: Apache-2.0
+
License: Apache-2.0
On Debian systems, the full text of the Apache-2.0 license
can be found in the file '/usr/share/common-licenses/Apache-2.0'.
=====================================
debian/groovy/json/DefaultJsonGenerator.java
=====================================
@@ -0,0 +1,563 @@
+/* Copyright 2021 Pierre Gruet <pgt at debian.org>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package groovy.json;
+
+//import org.apache.groovy.json.internal.CharBuf;
+import groovy.json.internal.CharBuf;
+//import org.apache.groovy.json.internal.Chr;
+import groovy.json.internal.Chr;
+import groovy.lang.Closure;
+import groovy.util.Expando;
+import org.codehaus.groovy.runtime.DefaultGroovyMethods;
+
+import java.io.File;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.TimeZone;
+import java.util.UUID;
+
+import static groovy.json.JsonOutput.CLOSE_BRACE;
+import static groovy.json.JsonOutput.CLOSE_BRACKET;
+import static groovy.json.JsonOutput.COMMA;
+import static groovy.json.JsonOutput.EMPTY_LIST_CHARS;
+import static groovy.json.JsonOutput.EMPTY_MAP_CHARS;
+import static groovy.json.JsonOutput.EMPTY_STRING_CHARS;
+import static groovy.json.JsonOutput.OPEN_BRACE;
+import static groovy.json.JsonOutput.OPEN_BRACKET;
+
+/**
+ * A JsonGenerator that can be configured with various {@link JsonGenerator.Options}.
+ * If the default options are sufficient consider using the static {@code JsonOutput.toJson}
+ * methods.
+ *
+ * @see JsonGenerator.Options#build()
+ * @since 2.5.0
+ */
+public class DefaultJsonGenerator implements JsonGenerator {
+
+ protected final boolean excludeNulls;
+ protected final boolean disableUnicodeEscaping;
+ protected final String dateFormat;
+ protected final Locale dateLocale;
+ protected final TimeZone timezone;
+ protected final Set<Converter> converters = new LinkedHashSet<Converter>();
+ protected final Set<String> excludedFieldNames = new HashSet<String>();
+ protected final Set<Class<?>> excludedFieldTypes = new HashSet<Class<?>>();
+
+ protected DefaultJsonGenerator(Options options) {
+ excludeNulls = options.excludeNulls;
+ disableUnicodeEscaping = options.disableUnicodeEscaping;
+ dateFormat = options.dateFormat;
+ dateLocale = options.dateLocale;
+ timezone = options.timezone;
+ if (!options.converters.isEmpty()) {
+ converters.addAll(options.converters);
+ }
+ if (!options.excludedFieldNames.isEmpty()) {
+ excludedFieldNames.addAll(options.excludedFieldNames);
+ }
+ if (!options.excludedFieldTypes.isEmpty()) {
+ excludedFieldTypes.addAll(options.excludedFieldTypes);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toJson(Object object) {
+ CharBuf buffer = CharBuf.create(255);
+ writeObject(object, buffer);
+ return buffer.toString();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isExcludingFieldsNamed(String name) {
+ return excludedFieldNames.contains(name);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isExcludingValues(Object value) {
+ if (value == null) {
+ return excludeNulls;
+ } else {
+ return shouldExcludeType(value.getClass());
+ }
+ }
+
+ /**
+ * Serializes Number value and writes it into specified buffer.
+ */
+ protected void writeNumber(Class<?> numberClass, Number value, CharBuf buffer) {
+ if (numberClass == Integer.class) {
+ buffer.addInt((Integer) value);
+ } else if (numberClass == Long.class) {
+ buffer.addLong((Long) value);
+ } else if (numberClass == BigInteger.class) {
+ buffer.addBigInteger((BigInteger) value);
+ } else if (numberClass == BigDecimal.class) {
+ buffer.addBigDecimal((BigDecimal) value);
+ } else if (numberClass == Double.class) {
+ Double doubleValue = (Double) value;
+ if (doubleValue.isInfinite()) {
+ throw new JsonException("Number " + value + " can't be serialized as JSON: infinite are not allowed in JSON.");
+ }
+ if (doubleValue.isNaN()) {
+ throw new JsonException("Number " + value + " can't be serialized as JSON: NaN are not allowed in JSON.");
+ }
+
+ buffer.addDouble(doubleValue);
+ } else if (numberClass == Float.class) {
+ Float floatValue = (Float) value;
+ if (floatValue.isInfinite()) {
+ throw new JsonException("Number " + value + " can't be serialized as JSON: infinite are not allowed in JSON.");
+ }
+ if (floatValue.isNaN()) {
+ throw new JsonException("Number " + value + " can't be serialized as JSON: NaN are not allowed in JSON.");
+ }
+
+ buffer.addFloat(floatValue);
+ } else if (numberClass == Byte.class) {
+ buffer.addByte((Byte) value);
+ } else if (numberClass == Short.class) {
+ buffer.addShort((Short) value);
+ } else { // Handle other Number implementations
+ buffer.addString(value.toString());
+ }
+ }
+
+ protected void writeObject(Object object, CharBuf buffer) {
+ writeObject(null, object, buffer);
+ }
+
+ /**
+ * Serializes object and writes it into specified buffer.
+ */
+ protected void writeObject(String key, Object object, CharBuf buffer) {
+
+ if (isExcludingValues(object)) {
+ return;
+ }
+
+ if (object == null) {
+ buffer.addNull();
+ return;
+ }
+
+ Class<?> objectClass = object.getClass();
+
+ Converter converter = findConverter(objectClass);
+ if (converter != null) {
+ object = converter.convert(object, key);
+ objectClass = object.getClass();
+ }
+
+ if (CharSequence.class.isAssignableFrom(objectClass)) { // Handle String, StringBuilder, GString and other CharSequence implementations
+ writeCharSequence((CharSequence) object, buffer);
+ } else if (objectClass == Boolean.class) {
+ buffer.addBoolean((Boolean) object);
+ } else if (Number.class.isAssignableFrom(objectClass)) {
+ writeNumber(objectClass, (Number) object, buffer);
+ } else if (Date.class.isAssignableFrom(objectClass)) {
+ writeDate((Date) object, buffer);
+ } else if (Calendar.class.isAssignableFrom(objectClass)) {
+ writeDate(((Calendar) object).getTime(), buffer);
+ } else if (Map.class.isAssignableFrom(objectClass)) {
+ writeMap((Map) object, buffer);
+ } else if (Iterable.class.isAssignableFrom(objectClass)) {
+ writeIterator(((Iterable<?>) object).iterator(), buffer);
+ } else if (Iterator.class.isAssignableFrom(objectClass)) {
+ writeIterator((Iterator) object, buffer);
+ } else if (objectClass == Character.class) {
+ //buffer.addJsonEscapedString(Chr.array((Character) object), disableUnicodeEscaping);
+ buffer.addJsonEscapedString(Chr.array((Character) object));
+ } else if (objectClass == URL.class) {
+ //buffer.addJsonEscapedString(object.toString(), disableUnicodeEscaping);
+ buffer.addJsonEscapedString(object.toString());
+ } else if (objectClass == UUID.class) {
+ buffer.addQuoted(object.toString());
+ } else if (objectClass == JsonOutput.JsonUnescaped.class) {
+ buffer.add(object.toString());
+ } else if (Closure.class.isAssignableFrom(objectClass)) {
+ writeMap(JsonDelegate.cloneDelegateAndGetContent((Closure<?>) object), buffer);
+ } else if (Expando.class.isAssignableFrom(objectClass)) {
+ writeMap(((Expando) object).getProperties(), buffer);
+ } else if (Enumeration.class.isAssignableFrom(objectClass)) {
+ List<?> list = Collections.list((Enumeration<?>) object);
+ writeIterator(list.iterator(), buffer);
+ } else if (objectClass.isArray()) {
+ writeArray(objectClass, object, buffer);
+ } else if (Enum.class.isAssignableFrom(objectClass)) {
+ buffer.addQuoted(((Enum<?>) object).name());
+ } else if (File.class.isAssignableFrom(objectClass)) {
+ Map<?, ?> properties = getObjectProperties(object);
+ //Clean up all recursive references to File objects
+ properties.entrySet().removeIf(entry -> entry.getValue() instanceof File);
+ writeMap(properties, buffer);
+ } else {
+ Map<?, ?> properties = getObjectProperties(object);
+ writeMap(properties, buffer);
+ }
+ }
+
+ protected Map<?, ?> getObjectProperties(Object object) {
+ Map<?, ?> properties = DefaultGroovyMethods.getProperties(object);
+ properties.remove("class");
+ properties.remove("declaringClass");
+ properties.remove("metaClass");
+ return properties;
+ }
+
+ /**
+ * Serializes any char sequence and writes it into specified buffer.
+ */
+ protected void writeCharSequence(CharSequence seq, CharBuf buffer) {
+ if (seq.length() > 0) {
+ //buffer.addJsonEscapedString(seq.toString(), disableUnicodeEscaping);
+ buffer.addJsonEscapedString(seq.toString());
+ } else {
+ buffer.addChars(EMPTY_STRING_CHARS);
+ }
+ }
+
+ /**
+ * Serializes any char sequence and writes it into specified buffer
+ * without performing any manipulation of the given text.
+ */
+ protected void writeRaw(CharSequence seq, CharBuf buffer) {
+ if (seq != null) {
+ buffer.add(seq.toString());
+ }
+ }
+
+ /**
+ * Serializes date and writes it into specified buffer.
+ */
+ protected void writeDate(Date date, CharBuf buffer) {
+ SimpleDateFormat formatter = new SimpleDateFormat(dateFormat, dateLocale);
+ formatter.setTimeZone(timezone);
+ buffer.addQuoted(formatter.format(date));
+ }
+
+ /**
+ * Serializes array and writes it into specified buffer.
+ */
+ protected void writeArray(Class<?> arrayClass, Object array, CharBuf buffer) {
+ if (Object[].class.isAssignableFrom(arrayClass)) {
+ Object[] objArray = (Object[]) array;
+ writeIterator(Arrays.asList(objArray).iterator(), buffer);
+ return;
+ }
+ buffer.addChar(OPEN_BRACKET);
+ if (int[].class.isAssignableFrom(arrayClass)) {
+ int[] intArray = (int[]) array;
+ if (intArray.length > 0) {
+ buffer.addInt(intArray[0]);
+ for (int i = 1; i < intArray.length; i++) {
+ buffer.addChar(COMMA).addInt(intArray[i]);
+ }
+ }
+ } else if (long[].class.isAssignableFrom(arrayClass)) {
+ long[] longArray = (long[]) array;
+ if (longArray.length > 0) {
+ buffer.addLong(longArray[0]);
+ for (int i = 1; i < longArray.length; i++) {
+ buffer.addChar(COMMA).addLong(longArray[i]);
+ }
+ }
+ } else if (boolean[].class.isAssignableFrom(arrayClass)) {
+ boolean[] booleanArray = (boolean[]) array;
+ if (booleanArray.length > 0) {
+ buffer.addBoolean(booleanArray[0]);
+ for (int i = 1; i < booleanArray.length; i++) {
+ buffer.addChar(COMMA).addBoolean(booleanArray[i]);
+ }
+ }
+ } else if (char[].class.isAssignableFrom(arrayClass)) {
+ char[] charArray = (char[]) array;
+ if (charArray.length > 0) {
+ //buffer.addJsonEscapedString(Chr.array(charArray[0]), disableUnicodeEscaping);
+ buffer.addJsonEscapedString(Chr.array(charArray[0]));
+ for (int i = 1; i < charArray.length; i++) {
+ //buffer.addChar(COMMA).addJsonEscapedString(Chr.array(charArray[i]), disableUnicodeEscaping);
+ buffer.addChar(COMMA).addJsonEscapedString(Chr.array(charArray[i]));
+ }
+ }
+ } else if (double[].class.isAssignableFrom(arrayClass)) {
+ double[] doubleArray = (double[]) array;
+ if (doubleArray.length > 0) {
+ buffer.addDouble(doubleArray[0]);
+ for (int i = 1; i < doubleArray.length; i++) {
+ buffer.addChar(COMMA).addDouble(doubleArray[i]);
+ }
+ }
+ } else if (float[].class.isAssignableFrom(arrayClass)) {
+ float[] floatArray = (float[]) array;
+ if (floatArray.length > 0) {
+ buffer.addFloat(floatArray[0]);
+ for (int i = 1; i < floatArray.length; i++) {
+ buffer.addChar(COMMA).addFloat(floatArray[i]);
+ }
+ }
+ } else if (byte[].class.isAssignableFrom(arrayClass)) {
+ byte[] byteArray = (byte[]) array;
+ if (byteArray.length > 0) {
+ buffer.addByte(byteArray[0]);
+ for (int i = 1; i < byteArray.length; i++) {
+ buffer.addChar(COMMA).addByte(byteArray[i]);
+ }
+ }
+ } else if (short[].class.isAssignableFrom(arrayClass)) {
+ short[] shortArray = (short[]) array;
+ if (shortArray.length > 0) {
+ buffer.addShort(shortArray[0]);
+ for (int i = 1; i < shortArray.length; i++) {
+ buffer.addChar(COMMA).addShort(shortArray[i]);
+ }
+ }
+ }
+ buffer.addChar(CLOSE_BRACKET);
+ }
+
+ /**
+ * Serializes map and writes it into specified buffer.
+ */
+ protected void writeMap(Map<?, ?> map, CharBuf buffer) {
+ if (map.isEmpty()) {
+ buffer.addChars(EMPTY_MAP_CHARS);
+ return;
+ }
+ buffer.addChar(OPEN_BRACE);
+ for (Map.Entry<?, ?> entry : map.entrySet()) {
+ if (entry.getKey() == null) {
+ throw new IllegalArgumentException("Maps with null keys can\'t be converted to JSON");
+ }
+ String key = entry.getKey().toString();
+ Object value = entry.getValue();
+ if (isExcludingValues(value) || isExcludingFieldsNamed(key)) {
+ continue;
+ }
+ writeMapEntry(key, value, buffer);
+ buffer.addChar(COMMA);
+ }
+ //buffer.removeLastChar(COMMA); // dangling comma
+ if (buffer.charAt(buffer.len() - 1) == COMMA) {
+ buffer.removeLastChar();
+ }
+ buffer.addChar(CLOSE_BRACE);
+ }
+
+ /**
+ * Serializes a map entry and writes it into specified buffer.
+ */
+ protected void writeMapEntry(String key, Object value, CharBuf buffer) {
+ //buffer.addJsonFieldName(key, disableUnicodeEscaping);
+ buffer.addJsonFieldName(key);
+ writeObject(key, value, buffer);
+ }
+
+ /**
+ * Serializes iterator and writes it into specified buffer.
+ */
+ protected void writeIterator(Iterator<?> iterator, CharBuf buffer) {
+ if (!iterator.hasNext()) {
+ buffer.addChars(EMPTY_LIST_CHARS);
+ return;
+ }
+ buffer.addChar(OPEN_BRACKET);
+ while (iterator.hasNext()) {
+ Object it = iterator.next();
+ if (!isExcludingValues(it)) {
+ writeObject(it, buffer);
+ buffer.addChar(COMMA);
+ }
+ }
+ //buffer.removeLastChar(COMMA); // dangling comma
+ if (buffer.charAt(buffer.len() - 1) == COMMA) {
+ buffer.removeLastChar();
+ }
+ buffer.addChar(CLOSE_BRACKET);
+ }
+
+ /**
+ * Finds a converter that can handle the given type. The first converter
+ * that reports it can handle the type is returned, based on the order in
+ * which the converters were specified. A {@code null} value will be returned
+ * if no suitable converter can be found for the given type.
+ *
+ * @param type that this converter can handle
+ * @return first converter that can handle the given type; else {@code null}
+ * if no compatible converters are found for the given type.
+ */
+ protected Converter findConverter(Class<?> type) {
+ for (Converter c : converters) {
+ if (c.handles(type)) {
+ return c;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Indicates whether the given type should be excluded from the generated output.
+ *
+ * @param type the type to check
+ * @return {@code true} if the given type should not be output, else {@code false}
+ */
+ protected boolean shouldExcludeType(Class<?> type) {
+ for (Class<?> t : excludedFieldTypes) {
+ if (t.isAssignableFrom(type)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * A converter that handles converting a given type using a closure.
+ *
+ * @since 2.5.0
+ */
+ protected static class ClosureConverter implements Converter {
+
+ protected final Class<?> type;
+ protected final Closure<?> closure;
+ protected final int paramCount;
+
+ protected ClosureConverter(Class<?> type, Closure<?> closure) {
+ if (type == null) {
+ throw new NullPointerException("Type parameter must not be null");
+ }
+ if (closure == null) {
+ throw new NullPointerException("Closure parameter must not be null");
+ }
+
+ int paramCount = closure.getMaximumNumberOfParameters();
+ if (paramCount < 1) {
+ throw new IllegalArgumentException("Closure must accept at least one parameter");
+ }
+ Class<?> param1 = closure.getParameterTypes()[0];
+ if (!param1.isAssignableFrom(type)) {
+ throw new IllegalArgumentException("Expected first parameter to be of type: " + type.toString());
+ }
+ if (paramCount > 1) {
+ Class<?> param2 = closure.getParameterTypes()[1];
+ if (!param2.isAssignableFrom(String.class)) {
+ throw new IllegalArgumentException("Expected second parameter to be of type: " + String.class.toString());
+ }
+ }
+ this.type = type;
+ this.closure = closure;
+ this.paramCount = paramCount;
+ }
+
+ /**
+ * Returns {@code true} if this converter can handle conversions
+ * of the given type.
+ *
+ * @param type the type of the object to convert
+ * @return true if this converter can successfully convert values of
+ * the given type
+ */
+ @Override
+ public boolean handles(Class<?> type) {
+ return this.type.isAssignableFrom(type);
+ }
+
+ /**
+ * Converts a given value.
+ *
+ * @param value the object to convert
+ * @param key the key name for the value, may be {@code null}
+ * @return the converted object
+ */
+ @Override
+ public Object convert(Object value, String key) {
+ return (paramCount == 1) ?
+ closure.call(value) :
+ closure.call(value, key);
+ }
+
+ /**
+ * Any two Converter instances registered for the same type are considered
+ * to be equal. This comparison makes managing instances in a Set easier;
+ * since there is no chaining of Converters it makes sense to only allow
+ * one per type.
+ *
+ * @param o the object with which to compare.
+ * @return {@code true} if this object contains the same class; {@code false} otherwise.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof ClosureConverter)) {
+ return false;
+ }
+ return this.type == ((ClosureConverter)o).type;
+ }
+
+ @Override
+ public int hashCode() {
+ return this.type.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + "<" + this.type.toString() + ">";
+ }
+ }
+
+}
=====================================
debian/groovy/json/JsonDelegate.java
=====================================
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package groovy.json;
+
+import groovy.lang.Closure;
+import groovy.lang.GroovyObjectSupport;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Utility class used as delegate of closures representing JSON objects.
+ *
+ * @since 1.8.0
+ */
+public class JsonDelegate extends GroovyObjectSupport {
+
+ private final Map<String, Object> content = new LinkedHashMap<String, Object>();
+
+ /**
+ * Intercepts calls for setting a key and value for a JSON object
+ *
+ * @param name the key name
+ * @param args the value associated with the key
+ */
+ @Override
+ public Object invokeMethod(String name, Object args) {
+ Object val = null;
+ if (args != null && Object[].class.isAssignableFrom(args.getClass())) {
+ Object[] arr = (Object[]) args;
+
+ if (arr.length == 1) {
+ val = arr[0];
+ } else if (isIterableOrArrayAndClosure(arr)) {
+ Closure<?> closure = (Closure<?>) arr[1];
+ Iterator<?> iterator = (arr[0] instanceof Iterable) ?
+ ((Iterable) arr[0]).iterator() : Arrays.asList((Object[])arr[0]).iterator();
+ List<Object> list = new ArrayList<Object>();
+ while (iterator.hasNext()) {
+ list.add(curryDelegateAndGetContent(closure, iterator.next()));
+ }
+ val = list;
+ } else {
+ val = Arrays.asList(arr);
+ }
+ }
+ content.put(name, val);
+
+ return val;
+ }
+
+ private static boolean isIterableOrArrayAndClosure(Object[] args) {
+ if (args.length != 2 || !(args[1] instanceof Closure)) {
+ return false;
+ }
+ return ((args[0] instanceof Iterable) || (args[0] != null && args[0].getClass().isArray()));
+ }
+
+ /**
+ * Factory method for creating <code>JsonDelegate</code>s from closures.
+ *
+ * @param c closure representing JSON objects
+ * @return an instance of <code>JsonDelegate</code>
+ */
+ public static Map<String, Object> cloneDelegateAndGetContent(Closure<?> c) {
+ JsonDelegate delegate = new JsonDelegate();
+ Closure<?> cloned = (Closure<?>) c.clone();
+ cloned.setDelegate(delegate);
+ cloned.setResolveStrategy(Closure.DELEGATE_FIRST);
+ cloned.call();
+
+ return delegate.getContent();
+ }
+
+ /**
+ * Factory method for creating <code>JsonDelegate</code>s from closures currying an object
+ * argument.
+ *
+ * @param c closure representing JSON objects
+ * @param o an object curried to the closure
+ * @return an instance of <code>JsonDelegate</code>
+ */
+ public static Map<String, Object> curryDelegateAndGetContent(Closure<?> c, Object o) {
+ JsonDelegate delegate = new JsonDelegate();
+ Closure<?> curried = c.curry(o);
+ curried.setDelegate(delegate);
+ curried.setResolveStrategy(Closure.DELEGATE_FIRST);
+ curried.call();
+
+ return delegate.getContent();
+ }
+
+ public Map<String, Object> getContent() {
+ return content;
+ }
+
+}
=====================================
debian/groovy/json/JsonException.java
=====================================
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package groovy.json;
+
+/**
+ * <code>JsonException</code> is the exception thrown by the JSON builder and slurper classes,
+ * whenever a problem occurs when creating or parsing JSON data structures.
+ *
+ * @since 1.8.0
+ */
+public class JsonException extends RuntimeException {
+ public JsonException() {
+ super();
+ }
+
+ public JsonException(String s) {
+ super(s);
+ }
+
+ public JsonException(String s, Throwable throwable) {
+ super(s, throwable);
+ }
+
+ public JsonException(Throwable throwable) {
+ super(throwable);
+ }
+
+}
=====================================
debian/groovy/json/JsonGenerator.java
=====================================
@@ -0,0 +1,324 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package groovy.json;
+
+import groovy.lang.Closure;
+import groovy.transform.stc.ClosureParams;
+import groovy.transform.stc.FromString;
+
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Locale;
+import java.util.Set;
+import java.util.TimeZone;
+
+/**
+ * Generates JSON from objects.
+ *
+ * The {@link Options} builder can be used to configure an instance of a JsonGenerator.
+ *
+ * @see Options#build()
+ * @since 2.5.0
+ */
+public interface JsonGenerator {
+
+ /**
+ * Converts an object to its JSON representation.
+ *
+ * @param object to convert to JSON
+ * @return JSON
+ */
+ String toJson(Object object);
+
+ /**
+ * Indicates whether this JsonGenerator is configured to exclude fields by
+ * the given name.
+ *
+ * @param name of the field
+ * @return true if that field is being excluded, else false
+ */
+ boolean isExcludingFieldsNamed(String name);
+
+ /**
+ * Indicates whether this JsonGenerator is configured to exclude values
+ * of the given object (may be {@code null}).
+ *
+ * @param value an instance of an object
+ * @return true if values like this are being excluded, else false
+ */
+ boolean isExcludingValues(Object value);
+
+ /**
+ * Handles converting a given type.
+ *
+ * @since 2.5.0
+ */
+ interface Converter {
+
+ /**
+ * Returns {@code true} if this converter can handle conversions
+ * of the given type.
+ *
+ * @param type the type of the object to convert
+ * @return {@code true} if this converter can successfully convert values of
+ * the given type, else {@code false}
+ */
+ boolean handles(Class<?> type);
+
+ /**
+ * Converts a given object.
+ *
+ * @param value the object to convert
+ * @param key the key name for the value, may be {@code null}
+ * @return the converted object
+ */
+ Object convert(Object value, String key);
+
+ }
+
+ /**
+ * A builder used to construct a {@link JsonGenerator} instance that allows
+ * control over the serialized JSON output. If you do not need to customize the
+ * output it is recommended to use the static {@code JsonOutput.toJson} methods.
+ *
+ * <p>
+ * Example:
+ * <pre><code class="groovyTestCase">
+ * def generator = new groovy.json.JsonGenerator.Options()
+ * .excludeNulls()
+ * .dateFormat('yyyy')
+ * .excludeFieldsByName('bar', 'baz')
+ * .excludeFieldsByType(java.sql.Date)
+ * .build()
+ *
+ * def input = [foo: null, lastUpdated: Date.parse('yyyy-MM-dd', '2014-10-24'),
+ * bar: 'foo', baz: 'foo', systemDate: new java.sql.Date(new Date().getTime())]
+ *
+ * assert generator.toJson(input) == '{"lastUpdated":"2014"}'
+ * </code></pre>
+ *
+ * @since 2.5.0
+ */
+ class Options {
+
+ protected static final String JSON_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZ";
+ protected static final Locale JSON_DATE_FORMAT_LOCALE = Locale.US;
+ protected static final String DEFAULT_TIMEZONE = "GMT";
+
+ protected boolean excludeNulls;
+ protected boolean disableUnicodeEscaping;
+ protected String dateFormat = JSON_DATE_FORMAT;
+ protected Locale dateLocale = JSON_DATE_FORMAT_LOCALE;
+ protected TimeZone timezone = TimeZone.getTimeZone(DEFAULT_TIMEZONE);
+ protected final Set<Converter> converters = new LinkedHashSet<Converter>();
+ protected final Set<String> excludedFieldNames = new HashSet<String>();
+ protected final Set<Class<?>> excludedFieldTypes = new HashSet<Class<?>>();
+
+ public Options() {}
+
+ /**
+ * Do not serialize {@code null} values.
+ *
+ * @return a reference to this {@code Options} instance
+ */
+ public Options excludeNulls() {
+ excludeNulls = true;
+ return this;
+ }
+
+ /**
+ * Disables the escaping of Unicode characters in JSON String values.
+ *
+ * @return a reference to this {@code Options} instance
+ */
+ public Options disableUnicodeEscaping() {
+ disableUnicodeEscaping = true;
+ return this;
+ }
+
+ /**
+ * Sets the date format that will be used to serialize {@code Date} objects.
+ * This must be a valid pattern for {@link java.text.SimpleDateFormat} and the
+ * date formatter will be constructed with the default locale of {@link Locale#US}.
+ *
+ * @param format date format pattern used to serialize dates
+ * @return a reference to this {@code Options} instance
+ * @exception NullPointerException if the given pattern is null
+ * @exception IllegalArgumentException if the given pattern is invalid
+ */
+ public Options dateFormat(String format) {
+ return dateFormat(format, JSON_DATE_FORMAT_LOCALE);
+ }
+
+ /**
+ * Sets the date format that will be used to serialize {@code Date} objects.
+ * This must be a valid pattern for {@link java.text.SimpleDateFormat}.
+ *
+ * @param format date format pattern used to serialize dates
+ * @param locale the locale whose date format symbols will be used
+ * @return a reference to this {@code Options} instance
+ * @exception IllegalArgumentException if the given pattern is invalid
+ */
+ public Options dateFormat(String format, Locale locale) {
+ // validate date format pattern
+ new SimpleDateFormat(format, locale);
+ dateFormat = format;
+ dateLocale = locale;
+ return this;
+ }
+
+ /**
+ * Sets the time zone that will be used to serialize dates.
+ *
+ * @param timezone used to serialize dates
+ * @return a reference to this {@code Options} instance
+ * @exception NullPointerException if the given timezone is null
+ */
+ public Options timezone(String timezone) {
+ this.timezone = TimeZone.getTimeZone(timezone);
+ return this;
+ }
+
+ /**
+ * Registers a converter that will be called when a type it handles is encountered.
+ *
+ * @param converter to register
+ * @return a reference to this {@code Options} instance
+ */
+ public Options addConverter(Converter converter) {
+ if (converter != null) {
+ converters.add(converter);
+ }
+ return this;
+ }
+
+ /**
+ * Registers a closure that will be called when the specified type or subtype
+ * is serialized.
+ *
+ * <p>The closure must accept either 1 or 2 parameters. The first parameter
+ * is required and will be instance of the {@code type} for which the closure
+ * is registered. The second optional parameter should be of type {@code String}
+ * and, if available, will be passed the name of the key associated with this
+ * value if serializing a JSON Object. This parameter will be {@code null} when
+ * serializing a JSON Array or when there is no way to determine the name of the key.
+ *
+ * <p>
+ * Example:
+ * <pre><code class="groovyTestCase">
+ * def generator = new groovy.json.JsonGenerator.Options()
+ * .addConverter(URL) { URL u {@code ->}
+ * u.getHost()
+ * }
+ * .build()
+ *
+ * def input = [domain: new URL('http://groovy-lang.org/json.html#_parser_variants')]
+ *
+ * assert generator.toJson(input) == '{"domain":"groovy-lang.org"}'
+ * </code></pre>
+ *
+ * <p>If two or more closures are registered for the exact same type the last
+ * closure based on the order they were specified will be used. When serializing an
+ * object its type is compared to the list of registered types in the order the were
+ * given and the closure for the first suitable type will be called. Therefore, it is
+ * important to register more specific types first.
+ *
+ * @param type the type to convert
+ * @param closure called when the registered type or any type assignable to the given
+ * type is encountered
+ * @param <T> the type this converter is registered to handle
+ * @return a reference to this {@code Options} instance
+ * @exception NullPointerException if the given type or closure is null
+ * @exception IllegalArgumentException if the given closure does not accept
+ * a parameter of the given type
+ */
+ public <T> Options addConverter(Class<T> type,
+ @ClosureParams(value=FromString.class, options={"T","T,String"})
+ Closure<?> closure)
+ {
+ Converter converter = new DefaultJsonGenerator.ClosureConverter(type, closure);
+ converters.remove(converter);
+ return addConverter(converter);
+ }
+
+ /**
+ * Excludes from the output any fields that match the specified names.
+ *
+ * @param fieldNames name of the field to exclude from the output
+ * @return a reference to this {@code Options} instance
+ */
+ public Options excludeFieldsByName(CharSequence... fieldNames) {
+ return excludeFieldsByName(Arrays.asList(fieldNames));
+ }
+
+ /**
+ * Excludes from the output any fields that match the specified names.
+ *
+ * @param fieldNames collection of names to exclude from the output
+ * @return a reference to this {@code Options} instance
+ */
+ public Options excludeFieldsByName(Iterable<? extends CharSequence> fieldNames) {
+ for (CharSequence cs : fieldNames) {
+ if (cs != null) {
+ excludedFieldNames.add(cs.toString());
+ }
+ }
+ return this;
+ }
+
+ /**
+ * Excludes from the output any fields whose type is the same or is
+ * assignable to any of the given types.
+ *
+ * @param types excluded from the output
+ * @return a reference to this {@code Options} instance
+ */
+ public Options excludeFieldsByType(Class<?>... types) {
+ return excludeFieldsByType(Arrays.asList(types));
+ }
+
+ /**
+ * Excludes from the output any fields whose type is the same or is
+ * assignable to any of the given types.
+ *
+ * @param types collection of types to exclude from the output
+ * @return a reference to this {@code Options} instance
+ */
+ public Options excludeFieldsByType(Iterable<Class<?>> types) {
+ for (Class<?> c : types) {
+ if (c != null) {
+ excludedFieldTypes.add(c);
+ }
+ }
+ return this;
+ }
+
+ /**
+ * Creates a {@link JsonGenerator} that is based on the current options.
+ *
+ * @return a fully configured {@link JsonGenerator}
+ */
+ public JsonGenerator build() {
+ return new DefaultJsonGenerator(this);
+ }
+ }
+
+}
=====================================
debian/groovy/json/JsonOutput.java
=====================================
@@ -0,0 +1,290 @@
+/* Copyright 2021 Pierre Gruet <pgt at debian.org>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package groovy.json;
+
+//import org.apache.groovy.json.internal.CharBuf;
+import groovy.json.internal.CharBuf;
+//import org.apache.groovy.json.internal.Chr;
+import groovy.json.internal.Chr;
+import groovy.lang.Closure;
+import groovy.util.Expando;
+
+import java.io.StringReader;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * Class responsible for the actual String serialization of the possible values of a JSON structure.
+ * This class can also be used as a category, so as to add <code>toJson()</code> methods to various types.
+ * <p>
+ * This class does not provide the ability to customize the resulting output. A {@link JsonGenerator}
+ * can be used if the ability to alter the resulting output is required.
+ *
+ * @see JsonGenerator
+ * @since 1.8.0
+ */
+public class JsonOutput {
+
+ static final char OPEN_BRACKET = '[';
+ static final char CLOSE_BRACKET = ']';
+ static final char OPEN_BRACE = '{';
+ static final char CLOSE_BRACE = '}';
+ static final char COLON = ':';
+ static final char COMMA = ',';
+ static final char SPACE = ' ';
+ static final char NEW_LINE = '\n';
+ static final char QUOTE = '"';
+
+ static final char[] EMPTY_STRING_CHARS = Chr.array(QUOTE, QUOTE);
+ static final char[] EMPTY_MAP_CHARS = {OPEN_BRACE, CLOSE_BRACE};
+ static final char[] EMPTY_LIST_CHARS = {OPEN_BRACKET, CLOSE_BRACKET};
+
+ /* package-private for use in builders */
+ static final JsonGenerator DEFAULT_GENERATOR = new DefaultJsonGenerator(new JsonGenerator.Options());
+
+ /**
+ * @return "true" or "false" for a boolean value
+ */
+ public static String toJson(Boolean bool) {
+ return DEFAULT_GENERATOR.toJson(bool);
+ }
+
+ /**
+ * @return a string representation for a number
+ * @throws JsonException if the number is infinite or not a number.
+ */
+ public static String toJson(Number n) {
+ return DEFAULT_GENERATOR.toJson(n);
+ }
+
+ /**
+ * @return a JSON string representation of the character
+ */
+ public static String toJson(Character c) {
+ return DEFAULT_GENERATOR.toJson(c);
+ }
+
+ /**
+ * @return a properly encoded string with escape sequences
+ */
+ public static String toJson(String s) {
+ return DEFAULT_GENERATOR.toJson(s);
+ }
+
+ /**
+ * Format a date that is parseable from JavaScript, according to ISO-8601.
+ *
+ * @param date the date to format to a JSON string
+ * @return a formatted date in the form of a string
+ */
+ public static String toJson(Date date) {
+ return DEFAULT_GENERATOR.toJson(date);
+ }
+
+ /**
+ * Format a calendar instance that is parseable from JavaScript, according to ISO-8601.
+ *
+ * @param cal the calendar to format to a JSON string
+ * @return a formatted date in the form of a string
+ */
+ public static String toJson(Calendar cal) {
+ return DEFAULT_GENERATOR.toJson(cal);
+ }
+
+ /**
+ * @return the string representation of an uuid
+ */
+ public static String toJson(UUID uuid) {
+ return DEFAULT_GENERATOR.toJson(uuid);
+ }
+
+ /**
+ * @return the string representation of the URL
+ */
+ public static String toJson(URL url) {
+ return DEFAULT_GENERATOR.toJson(url);
+ }
+
+ /**
+ * @return an object representation of a closure
+ */
+ public static String toJson(Closure closure) {
+ return DEFAULT_GENERATOR.toJson(closure);
+ }
+
+ /**
+ * @return an object representation of an Expando
+ */
+ public static String toJson(Expando expando) {
+ return DEFAULT_GENERATOR.toJson(expando);
+ }
+
+ /**
+ * @return "null" for a null value, or a JSON array representation for a collection, array, iterator or enumeration,
+ * or representation for other object.
+ */
+ public static String toJson(Object object) {
+ return DEFAULT_GENERATOR.toJson(object);
+ }
+
+ /**
+ * @return a JSON object representation for a map
+ */
+ public static String toJson(Map m) {
+ return DEFAULT_GENERATOR.toJson(m);
+ }
+
+ /**
+ * Pretty print a JSON payload.
+ *
+ * @param jsonPayload
+ * @return a pretty representation of JSON payload.
+ */
+ public static String prettyPrint(String jsonPayload) {
+ int indentSize = 0;
+ // Just a guess that the pretty view will take 20 percent more than original.
+ final CharBuf output = CharBuf.create((int) (jsonPayload.length() * 1.2));
+
+ JsonLexer lexer = new JsonLexer(new StringReader(jsonPayload));
+ // Will store already created indents.
+ Map<Integer, char[]> indentCache = new HashMap<Integer, char[]>();
+ while (lexer.hasNext()) {
+ JsonToken token = lexer.next();
+ switch (token.getType()) {
+ case OPEN_CURLY:
+ indentSize += 4;
+ output.addChars(Chr.array(OPEN_BRACE, NEW_LINE)).addChars(getIndent(indentSize, indentCache));
+
+ break;
+ case CLOSE_CURLY:
+ indentSize -= 4;
+ output.addChar(NEW_LINE);
+ if (indentSize > 0) {
+ output.addChars(getIndent(indentSize, indentCache));
+ }
+ output.addChar(CLOSE_BRACE);
+
+ break;
+ case OPEN_BRACKET:
+ indentSize += 4;
+ output.addChars(Chr.array(OPEN_BRACKET, NEW_LINE)).addChars(getIndent(indentSize, indentCache));
+
+ break;
+ case CLOSE_BRACKET:
+ indentSize -= 4;
+ output.addChar(NEW_LINE);
+ if (indentSize > 0) {
+ output.addChars(getIndent(indentSize, indentCache));
+ }
+ output.addChar(CLOSE_BRACKET);
+
+ break;
+ case COMMA:
+ output.addChars(Chr.array(COMMA, NEW_LINE)).addChars(getIndent(indentSize, indentCache));
+
+ break;
+ case COLON:
+ output.addChars(Chr.array(COLON, SPACE));
+
+ break;
+ case STRING:
+ String textStr = token.getText();
+ String textWithoutQuotes = textStr.substring(1, textStr.length() - 1);
+ if (textWithoutQuotes.length() > 0) {
+ output.addJsonEscapedString(textWithoutQuotes);
+ } else {
+ output.addQuoted(Chr.array());
+ }
+
+ break;
+ default:
+ output.addString(token.getText());
+ }
+ }
+
+ return output.toString();
+ }
+
+ /**
+ * Creates new indent if it not exists in the indent cache.
+ *
+ * @return indent with the specified size.
+ */
+ private static char[] getIndent(int indentSize, Map<Integer, char[]> indentCache) {
+ char[] indent = indentCache.get(indentSize);
+ if (indent == null) {
+ indent = new char[indentSize];
+ Arrays.fill(indent, SPACE);
+ indentCache.put(indentSize, indent);
+ }
+
+ return indent;
+ }
+
+ /**
+ * Obtains JSON unescaped text for the given text
+ *
+ * @param text The text
+ * @return The unescaped text
+ */
+ public static JsonUnescaped unescaped(CharSequence text) {
+ return new JsonUnescaped(text);
+ }
+
+ /**
+ * Represents unescaped JSON
+ */
+ public static class JsonUnescaped {
+ private CharSequence text;
+
+ public JsonUnescaped(CharSequence text) {
+ this.text = text;
+ }
+
+ public CharSequence getText() {
+ return text;
+ }
+
+ @Override
+ public String toString() {
+ return text.toString();
+ }
+ }
+
+}
=====================================
debian/maven.rules
=====================================
@@ -6,3 +6,4 @@ javax.mail s/mail/javax.mail-api/ * s/.*/debian/ * *
jline jline * s/2\..*/2.x/ * *
junit junit * s/4\..*/4.x/ * *
org.yaml snakeyaml * s/1\..*/1.x/ * *
+s/com\.esotericsoftware\.kryo/com.esotericsoftware/ kryo * s/.*/debian/ * *
=====================================
debian/patches/groovy_syntax.patch
=====================================
@@ -3,7 +3,7 @@ Description: fixing various tiny groovy syntax issues
groovy will be higher than the current 2.4.
Author: Pierre Gruet <pgt at debian.org>
Forwarded: no
-Last-Update: 2021-05-31
+Last-Update: 2021-07-16
--- a/modules/nf-commons/src/main/nextflow/util/Escape.groovy
+++ b/modules/nf-commons/src/main/nextflow/util/Escape.groovy
@@ -148,3 +148,14 @@ Last-Update: 2021-05-31
return result
}
+--- a/modules/nf-commons/src/main/nextflow/extension/Bolts.groovy
++++ b/modules/nf-commons/src/main/nextflow/extension/Bolts.groovy
+@@ -925,7 +925,7 @@
+ static <T extends Map> T deepClone(T map) {
+ if( map == null)
+ return null
+- final result = map instanceof LinkedHashMap ? new LinkedHashMap<>(map) : new HashMap<>(map)
++ final result = map instanceof LinkedHashMap ? new LinkedHashMap<>(map) : new HashMap<>()
+ for( def key : map.keySet() ) {
+ def value = map.get(key)
+ if( value instanceof Map ) {
=====================================
debian/patches/kryo5_abi.patch
=====================================
@@ -0,0 +1,45 @@
+Description: there were several ABI changes between versions 2.4 and 5 of kryo
+ - We provide the new path of DefaultInstantiatorStrategy in kryo 5
+ - Also the method read(Kryo, Input, Class<? extends T>) in kryo 5 had another
+ signature in kryo 2.4.
+Author: Pierre Gruet <pgt at debian.org>
+Forwarded: no
+Last-Update: 2021-07-18
+
+--- a/modules/nextflow/src/main/groovy/nextflow/util/SerializationHelper.groovy
++++ b/modules/nextflow/src/main/groovy/nextflow/util/SerializationHelper.groovy
+@@ -28,6 +28,7 @@
+ import com.esotericsoftware.kryo.Serializer
+ import com.esotericsoftware.kryo.io.Input
+ import com.esotericsoftware.kryo.io.Output
++import com.esotericsoftware.kryo.util.DefaultInstantiatorStrategy
+ import de.javakaffee.kryoserializers.UnmodifiableCollectionsSerializer
+ import groovy.transform.CompileStatic
+ import groovy.util.logging.Slf4j
+@@ -237,7 +238,7 @@
+
+ @Singleton
+ @CompileStatic
+-class InstantiationStrategy extends Kryo.DefaultInstantiatorStrategy {
++class InstantiationStrategy extends DefaultInstantiatorStrategy {
+
+ @Override
+ ObjectInstantiator newInstantiatorOf (final Class type) {
+--- a/modules/nextflow/src/main/java/de/javakaffee/kryoserializers/UnmodifiableCollectionsSerializer.java
++++ b/modules/nextflow/src/main/java/de/javakaffee/kryoserializers/UnmodifiableCollectionsSerializer.java
+@@ -67,7 +67,7 @@
+ }
+
+ @Override
+- public Object read(final Kryo kryo, final Input input, final Class<Object> clazz) {
++ public Object read(final Kryo kryo, final Input input, final Class<? extends Object> clazz) {
+ final int ordinal = input.readInt( true );
+ final UnmodifiableCollection unmodifiableCollection = UnmodifiableCollection.values()[ordinal];
+ final Object sourceCollection = kryo.readClassAndObject( input );
+@@ -196,4 +196,4 @@
+ }
+ }
+
+-}
+\ No newline at end of file
++}
=====================================
debian/patches/omit_groovy_MapConstructor_annotation.patch
=====================================
@@ -0,0 +1,24 @@
+Description: MapConstructor is not part of Debian-packaged groovy yet
+ This patch should be removed when MapConstructor enters Debian's groovy.
+Author: Pierre Gruet <pgt at debian.org>
+Forwarded: not-needed
+Last-Update: 2021-07-18
+
+--- a/modules/nextflow/src/main/groovy/nextflow/dag/DAG.groovy
++++ b/modules/nextflow/src/main/groovy/nextflow/dag/DAG.groovy
+@@ -17,7 +17,6 @@
+
+ package nextflow.dag
+
+-import groovy.transform.MapConstructor
+ import groovy.transform.PackageScope
+ import groovy.transform.ToString
+ import groovy.util.logging.Slf4j
+@@ -433,7 +432,6 @@
+ */
+ @PackageScope
+ @ToString(includeNames = true, includes = 'label,from,to', includePackage=false)
+- @MapConstructor
+ class Edge {
+
+ /**
=====================================
debian/patches/series
=====================================
@@ -7,3 +7,5 @@ old_gradle_syntax.patch
omit_amazon_azure_ignite.patch
omit_groovy_annotation_collector_mode.patch
changing_grengine_package.patch
+kryo5_abi.patch
+omit_groovy_MapConstructor_annotation.patch
=====================================
debian/rules
=====================================
@@ -24,10 +24,14 @@ override_dh_auto_clean:
dh_auto_clean
if [ -e hiddenBuildSrc ]; then mv hiddenBuildSrc buildSrc; fi
rm -rf modules/nextflow/build/ modules/nf-httpfs/build/ plugins/nf-console/build/ plugins/nf-ga4gh/build/ plugins/nf-tower/build/
+ rm -rf modules/nextflow/src/main/groovy/json/
+ rm -rf plugins/nf-toxer/src/main/groovy/
override_dh_auto_configure:
dh_auto_configure
if [ -e buildSrc ]; then mv buildSrc hiddenBuildSrc; fi
+ cp -a debian/groovy/json/ modules/nextflow/src/main/groovy/
+ cp -a debian/groovy/ plugins/nf-tower/src/main/
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
View it on GitLab: https://salsa.debian.org/med-team/nextflow/-/compare/9b1e91bbd116e70ef9def8794f351a89cc59bc98...7e1b0333ba845ba26c0d31b24389558b0b708188
--
View it on GitLab: https://salsa.debian.org/med-team/nextflow/-/compare/9b1e91bbd116e70ef9def8794f351a89cc59bc98...7e1b0333ba845ba26c0d31b24389558b0b708188
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210718/158c6d65/attachment-0001.htm>
More information about the debian-med-commit
mailing list