diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7e7f77a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/gson-parent-2.8.6.tar.gz diff --git a/.google-gson.metadata b/.google-gson.metadata new file mode 100644 index 0000000..fa5764e --- /dev/null +++ b/.google-gson.metadata @@ -0,0 +1 @@ +54c266e474fb83a3b7f957e472f60c5cab7b5bb2 SOURCES/gson-parent-2.8.6.tar.gz diff --git a/SOURCES/java-eight-build.patch b/SOURCES/java-eight-build.patch new file mode 100644 index 0000000..f2c701e --- /dev/null +++ b/SOURCES/java-eight-build.patch @@ -0,0 +1,15 @@ +diff --git a/pom.xml b/pom.xml +index 4774e70..c7941b2 100644 +--- a/pom.xml ++++ b/pom.xml +@@ -69,9 +69,8 @@ + default-compile + + +- 9 ++ 8 + +- 9 + + + diff --git a/SOURCES/no-templating-maven-plugin.patch b/SOURCES/no-templating-maven-plugin.patch new file mode 100644 index 0000000..f58e07f --- /dev/null +++ b/SOURCES/no-templating-maven-plugin.patch @@ -0,0 +1,261 @@ +diff --git a/gson/pom.xml b/gson/pom.xml +index ffe41ac..5ce5d96 100644 +--- a/gson/pom.xml ++++ b/gson/pom.xml +@@ -56,23 +56,6 @@ + org.apache.felix + maven-bundle-plugin + +- +- org.codehaus.mojo +- templating-maven-plugin +- 1.0.0 +- +- +- filtering-java-templates +- +- filter-sources +- +- +- ${basedir}/src/main/java-templates +- ${project.build.directory}/generated-sources/java-templates +- +- +- +- + + + +diff --git a/gson/src/main/java-templates/com/google/gson/internal/GsonBuildConfig.java b/gson/src/main/java-templates/com/google/gson/internal/GsonBuildConfig.java +deleted file mode 100644 +index a94c96b..0000000 +--- a/gson/src/main/java-templates/com/google/gson/internal/GsonBuildConfig.java ++++ /dev/null +@@ -1,32 +0,0 @@ +-/* +- * Copyright (C) 2018 The Gson authors +- * +- * 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. +- */ +- +-package com.google.gson.internal; +- +-/** +- * Build configuration for Gson. This file is automatically populated by +- * templating-maven-plugin and .java/.class files are generated for use in Gson. +- * +- * @author Inderjeet Singh +- */ +-public final class GsonBuildConfig { +- // Based on https://stackoverflow.com/questions/2469922/generate-a-version-java-file-in-maven +- +- /** This field is automatically populated by Maven when a build is triggered */ +- public static final String VERSION = "${project.version}"; +- +- private GsonBuildConfig() { } +-} +diff --git a/gson/src/main/java/com/google/gson/Gson.java b/gson/src/main/java/com/google/gson/Gson.java +index 27f3ee9..d584ece 100644 +--- a/gson/src/main/java/com/google/gson/Gson.java ++++ b/gson/src/main/java/com/google/gson/Gson.java +@@ -37,7 +37,6 @@ import java.util.concurrent.atomic.AtomicLongArray; + + import com.google.gson.internal.ConstructorConstructor; + import com.google.gson.internal.Excluder; +-import com.google.gson.internal.GsonBuildConfig; + import com.google.gson.internal.Primitives; + import com.google.gson.internal.Streams; + import com.google.gson.internal.bind.ArrayTypeAdapter; +@@ -462,7 +461,7 @@ public final class Gson { + return candidate; + } + } +- throw new IllegalArgumentException("GSON (" + GsonBuildConfig.VERSION + ") cannot handle " + type); ++ throw new IllegalArgumentException("GSON cannot handle " + type); + } finally { + threadCalls.remove(type); + +@@ -704,10 +703,6 @@ public final class Gson { + ((TypeAdapter) adapter).write(writer, src); + } catch (IOException e) { + throw new JsonIOException(e); +- } catch (AssertionError e) { +- AssertionError error = new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage()); +- error.initCause(e); +- throw error; + } finally { + writer.setLenient(oldLenient); + writer.setHtmlSafe(oldHtmlSafe); +@@ -784,10 +779,6 @@ public final class Gson { + Streams.write(jsonElement, writer); + } catch (IOException e) { + throw new JsonIOException(e); +- } catch (AssertionError e) { +- AssertionError error = new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage()); +- error.initCause(e); +- throw error; + } finally { + writer.setLenient(oldLenient); + writer.setHtmlSafe(oldHtmlSafe); +@@ -945,10 +936,6 @@ public final class Gson { + } catch (IOException e) { + // TODO(inder): Figure out whether it is indeed right to rethrow this as JsonSyntaxException + throw new JsonSyntaxException(e); +- } catch (AssertionError e) { +- AssertionError error = new AssertionError("AssertionError (GSON " + GsonBuildConfig.VERSION + "): " + e.getMessage()); +- error.initCause(e); +- throw error; + } finally { + reader.setLenient(oldLenient); + } +diff --git a/gson/src/test/java/com/google/gson/functional/GsonVersionDiagnosticsTest.java b/gson/src/test/java/com/google/gson/functional/GsonVersionDiagnosticsTest.java +deleted file mode 100644 +index 36eff8e..0000000 +--- a/gson/src/test/java/com/google/gson/functional/GsonVersionDiagnosticsTest.java ++++ /dev/null +@@ -1,96 +0,0 @@ +-/* +- * Copyright (C) 2018 Gson Authors +- * +- * 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. +- */ +-package com.google.gson.functional; +- +-import java.io.IOException; +-import java.util.regex.Pattern; +- +-import org.junit.Before; +-import org.junit.Test; +- +-import com.google.gson.Gson; +-import com.google.gson.GsonBuilder; +-import com.google.gson.TypeAdapter; +-import com.google.gson.stream.JsonReader; +-import com.google.gson.stream.JsonWriter; +- +-import junit.framework.TestCase; +- +-/** +- * Functional tests to validate printing of Gson version on AssertionErrors +- * +- * @author Inderjeet Singh +- */ +-public class GsonVersionDiagnosticsTest extends TestCase { +- private static final Pattern GSON_VERSION_PATTERN = Pattern.compile("(\\(GSON \\d\\.\\d\\.\\d)(?:[-.][A-Z]+)?\\)$"); +- +- private Gson gson; +- +- @Before +- public void setUp() { +- gson = new GsonBuilder().registerTypeAdapter(TestType.class, new TypeAdapter() { +- @Override public void write(JsonWriter out, TestType value) { +- throw new AssertionError("Expected during serialization"); +- } +- @Override public TestType read(JsonReader in) throws IOException { +- throw new AssertionError("Expected during deserialization"); +- } +- }).create(); +- } +- +- @Test +- public void testVersionPattern() { +- assertTrue(GSON_VERSION_PATTERN.matcher("(GSON 2.8.5)").matches()); +- assertTrue(GSON_VERSION_PATTERN.matcher("(GSON 2.8.5-SNAPSHOT)").matches()); +- } +- +- @Test +- public void testAssertionErrorInSerializationPrintsVersion() { +- try { +- gson.toJson(new TestType()); +- fail(); +- } catch (AssertionError expected) { +- ensureAssertionErrorPrintsGsonVersion(expected); +- } +- } +- +- @Test +- public void testAssertionErrorInDeserializationPrintsVersion() { +- try { +- gson.fromJson("{'a':'abc'}", TestType.class); +- fail(); +- } catch (AssertionError expected) { +- ensureAssertionErrorPrintsGsonVersion(expected); +- } +- } +- +- private void ensureAssertionErrorPrintsGsonVersion(AssertionError expected) { +- String msg = expected.getMessage(); +- // System.err.println(msg); +- int start = msg.indexOf("(GSON"); +- assertTrue(start > 0); +- int end = msg.indexOf("):") + 1; +- assertTrue(end > 0 && end > start + 6); +- String version = msg.substring(start, end); +- // System.err.println(version); +- assertTrue(GSON_VERSION_PATTERN.matcher(version).matches()); +- } +- +- private static final class TestType { +- @SuppressWarnings("unused") +- String a; +- } +-} +diff --git a/gson/src/test/java/com/google/gson/internal/GsonBuildConfigTest.java b/gson/src/test/java/com/google/gson/internal/GsonBuildConfigTest.java +deleted file mode 100644 +index dc39bc0..0000000 +--- a/gson/src/test/java/com/google/gson/internal/GsonBuildConfigTest.java ++++ /dev/null +@@ -1,33 +0,0 @@ +-/* +- * Copyright (C) 2018 The Gson authors +- * +- * 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. +- */ +-package com.google.gson.internal; +- +-import static org.junit.Assert.assertFalse; +- +-import org.junit.Test; +- +-/** +- * Unit tests for {@code GsonBuildConfig} +- * +- * @author Inderjeet Singh +- */ +-public class GsonBuildConfigTest { +- +- @Test +- public void testEnsureGsonBuildConfigGetsUpdatedToMavenVersion() { +- assertFalse("${project.version}".equals(GsonBuildConfig.VERSION)); +- } +-} diff --git a/SOURCES/osgi-export-internal.patch b/SOURCES/osgi-export-internal.patch new file mode 100644 index 0000000..9f2875d --- /dev/null +++ b/SOURCES/osgi-export-internal.patch @@ -0,0 +1,11 @@ +--- gson-gson-parent-2.8.1/gson/bnd.bnd.orig 2017-08-29 11:07:29.630655005 +0100 ++++ gson-gson-parent-2.8.1/gson/bnd.bnd 2017-08-29 11:08:29.592075069 +0100 +@@ -11,4 +11,7 @@ + com.google.gson,\ + com.google.gson.annotations,\ + com.google.gson.reflect,\ +- com.google.gson.stream ++ com.google.gson.stream,\ ++ com.google.gson.internal;x-internal:=true,\ ++ com.google.gson.internal.bind;x-internal:=true,\ ++ com.google.gson.internal.bind.util;x-internal:=true diff --git a/SPECS/google-gson.spec b/SPECS/google-gson.spec new file mode 100644 index 0000000..3d92f95 --- /dev/null +++ b/SPECS/google-gson.spec @@ -0,0 +1,190 @@ +Name: google-gson +Version: 2.8.6 +Release: 5%{?dist} +Summary: Java lib for conversion of Java objects into JSON representation +License: ASL 2.0 +URL: https://github.com/google/gson +Source0: https://github.com/google/gson/archive/gson-parent-%{version}.tar.gz +Patch0: osgi-export-internal.patch +Patch1: java-eight-build.patch + +# This commit added a dependency on templating-maven-plugin, +# we don't want it nor need it, so we revert it +# https://github.com/google/gson/commit/d84e26d +Patch2: no-templating-maven-plugin.patch + +BuildArch: noarch + +BuildRequires: maven-local +BuildRequires: mvn(junit:junit) +BuildRequires: mvn(org.apache.felix:maven-bundle-plugin) + +%description +Gson is a Java library that can be used to convert a Java object into its +JSON representation. It can also be used to convert a JSON string into an +equivalent Java object. Gson can work with arbitrary Java objects including +pre-existing objects that you do not have source-code of. + +%package javadoc +Summary: API documentation for %{name} + +%description javadoc +This package contains the API documentation for %{name}. + +%prep +%setup -q -n gson-gson-parent-%{version} +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 + +# remove unnecessary dependency on parent POM +%pom_remove_parent + +# presence of these files breaks builds with Java 8 +find -name "module-info.java" -print -delete + +# Use felix maven-bundle-plugin only for OSGi metadata +%pom_remove_plugin :bnd-maven-plugin gson +%pom_xpath_inject "pom:plugin[pom:artifactId='maven-bundle-plugin']" " + + <_include>bnd.bnd + + + + + create-manifest + process-classes + manifest + + " gson + +%build +%mvn_build --xmvn-javadoc + +%install +%mvn_install + +%files -f .mfiles +%license LICENSE +%doc README.md CHANGELOG.md UserGuide.md + +%files javadoc -f .mfiles-javadoc +%license LICENSE + +%changelog +* Fri Jul 10 2020 Jiri Vanek - 2.8.6-5 +- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11 + +* Mon Jun 06 2020 Fedora Release Engineering - 2.8.6-4 +- fixed javadoc to build on jdk11 + +* Wed Jan 29 2020 Fedora Release Engineering - 2.8.6-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Nov 21 2019 Fabio Valentini - 2.8.6-2 +- Remove unnecessary dependency on parent POM. + +* Fri Nov 01 2019 Fabio Valentini - 2.8.6-1 +- Update to version 2.8.6. + +* Thu Jul 25 2019 Fedora Release Engineering - 2.8.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Fri Feb 01 2019 Fedora Release Engineering - 2.8.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Fri Jul 13 2018 Fedora Release Engineering - 2.8.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Wed Mar 21 2018 Alexander Kurtakov 2.8.2-1 +- Update to upstream 2.8.2 release. + +* Wed Feb 07 2018 Fedora Release Engineering - 2.8.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Tue Aug 29 2017 Mat Booth - 2.8.1-2 +- Also export internal packages in OSGi metadata + +* Fri Aug 25 2017 Mat Booth - 2.8.1-1 +- Update to latest upstream release + +* Wed Jul 26 2017 Fedora Release Engineering - 2.3.1-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Thu Feb 23 2017 Mikolaj Izdebski - 2.3.1-6 +- Remove unneeded maven-javadoc-plugin invocation + +* Fri Feb 10 2017 Fedora Release Engineering - 2.3.1-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Thu Jun 02 2016 Michael Simacek - 2.3.1-4 +- Skip default jar plugin execution to fix FTBFS + +* Wed Feb 03 2016 Fedora Release Engineering - 2.3.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Jun 17 2015 Fedora Release Engineering - 2.3.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sun Apr 26 2015 Michael Simacek - 2.3.1-1 +- Update to upstream version 2.3.1 + +* Mon Apr 20 2015 Michael Simacek - 2.2.4-8 +- Remove test that relies on networking + +* Mon Mar 30 2015 Michael Simacek - 2.2.4-7 +- Remove dependency on cobertura + +* Tue Jun 10 2014 Severin Gehwolf - 2.2.4-6 +- Move to xmvn style packaging. +- Fix FTBFS. Resolves RHBZ#1106707. + +* Sat Jun 07 2014 Fedora Release Engineering - 2.2.4-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Fri Mar 28 2014 Michael Simacek - 2.2.4-4 +- Use Requires: java-headless rebuild (#1067528) + +* Mon Aug 05 2013 Severin Gehwolf 2.2.4-3 +- Add BR maven-install-plugin, resolves RHBZ#992422. + +* Sat Aug 03 2013 Fedora Release Engineering - 2.2.4-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Tue May 14 2013 Alexander Kurtakov 2.2.4-1 +- Update to newer upstream release. + +* Thu Feb 14 2013 Fedora Release Engineering - 2.2.2-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Wed Feb 06 2013 Java SIG - 2.2.2-3 +- Update for https://fedoraproject.org/wiki/Fedora_19_Maven_Rebuild +- Replace maven BuildRequires with maven-local + +* Wed Dec 19 2012 Severin Gehwolf 2.2.2-2 +- Add BR for surefire junit provider. + +* Wed Dec 19 2012 Severin Gehwolf 2.2.2-1 +- Update to latest upstream release. + +* Thu Jul 19 2012 Fedora Release Engineering - 2.2.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Mon Jul 2 2012 Alexander Kurtakov 2.2.1-2 +- Add missing BR on maven-enforcer-plugin. +- Remove no longer needed parts of the spec. + +* Mon Jul 2 2012 Krzysztof Daniel 2.2.1-1 +- Update to latest upstream 2.2.1 + +* Fri Jan 13 2012 Fedora Release Engineering - 1.7.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Fri May 13 2011 Jaromir Capik - 1.7.1-3 +- Removal of failing testInetAddressSerializationAndDeserialization + +* Wed May 11 2011 Jaromir Capik - 1.7.1-2 +- Conversion of CR+LF to LF in the license file + +* Tue May 10 2011 Jaromir Capik - 1.7.1-1 +- Initial version of the package \ No newline at end of file