From 55bec90620dc309efd162dd4db263d34c7d0bbf4c89ae08dc627132f04f218d0 Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Fri, 15 Mar 2019 16:36:25 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/Java:packages/xmvn?expand=0&rev=1 --- .gitattributes | 23 + .gitignore | 1 + ...B-for-converting-bytes-to-hex-string.patch | 58 + ...Fix-configuration-of-aliased-plugins.patch | 76 + 0001-Fix-installer-plugin-loading.patch | 403 ++++++ 0001-Port-to-Gradle-4.2.patch | 568 ++++++++ 0001-Port-to-Gradle-4.3.1.patch | 62 + 0001-Replace-JAXB-parser.patch | 1252 +++++++++++++++++ ...g-Xdoclint-none-in-m-javadoc-p-3.0.0.patch | 30 + ...ns-compress-for-manifest-injection-a.patch | 593 ++++++++ 0001-port-to-gradle-4.4.1.patch | 115 ++ xmvn-3.0.0.tar.xz | 3 + xmvn-build.tar.xz | 3 + xmvn-tools.changes | 7 + xmvn-tools.spec | 270 ++++ 15 files changed, 3464 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 0001-Don-t-use-JAXB-for-converting-bytes-to-hex-string.patch create mode 100644 0001-Fix-configuration-of-aliased-plugins.patch create mode 100644 0001-Fix-installer-plugin-loading.patch create mode 100644 0001-Port-to-Gradle-4.2.patch create mode 100644 0001-Port-to-Gradle-4.3.1.patch create mode 100644 0001-Replace-JAXB-parser.patch create mode 100644 0001-Support-setting-Xdoclint-none-in-m-javadoc-p-3.0.0.patch create mode 100644 0001-Use-apache-commons-compress-for-manifest-injection-a.patch create mode 100644 0001-port-to-gradle-4.4.1.patch create mode 100644 xmvn-3.0.0.tar.xz create mode 100644 xmvn-build.tar.xz create mode 100644 xmvn-tools.changes create mode 100644 xmvn-tools.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/0001-Don-t-use-JAXB-for-converting-bytes-to-hex-string.patch b/0001-Don-t-use-JAXB-for-converting-bytes-to-hex-string.patch new file mode 100644 index 0000000..07dcaed --- /dev/null +++ b/0001-Don-t-use-JAXB-for-converting-bytes-to-hex-string.patch @@ -0,0 +1,58 @@ +From 336cbdc97f3c7055ebdf858141bfc160fd4d412b Mon Sep 17 00:00:00 2001 +From: Mikolaj Izdebski +Date: Fri, 8 Dec 2017 18:00:54 +0100 +Subject: [PATCH] Don't use JAXB for converting bytes to hex string + +--- + .../java/org/fedoraproject/xmvn/resolver/impl/CacheManager.java | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/CacheManager.java b/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/CacheManager.java +index 1d6c193b..0902aa88 100644 +--- a/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/CacheManager.java ++++ b/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/CacheManager.java +@@ -16,14 +16,13 @@ + package org.fedoraproject.xmvn.resolver.impl; + + import java.io.IOException; ++import java.math.BigInteger; + import java.nio.file.Files; + import java.nio.file.Path; + import java.nio.file.Paths; + import java.security.MessageDigest; + import java.security.NoSuchAlgorithmException; + +-import javax.xml.bind.annotation.adapters.HexBinaryAdapter; +- + /** + * @author Mikolaj Izdebski + */ +@@ -31,8 +30,6 @@ class CacheManager + { + private static final String DIGEST_ALGORITHM = "SHA-1"; + +- private final HexBinaryAdapter hexAdapter; +- + private final MessageDigest digest; + + private static volatile Path cacheHome; +@@ -41,7 +38,6 @@ class CacheManager + { + try + { +- hexAdapter = new HexBinaryAdapter(); + digest = MessageDigest.getInstance( DIGEST_ALGORITHM ); + } + catch ( NoSuchAlgorithmException e ) +@@ -53,7 +49,7 @@ class CacheManager + private String hash( Path path ) + throws IOException + { +- return hexAdapter.marshal( digest.digest( Files.readAllBytes( path ) ) ); ++ return new BigInteger( 1, digest.digest( Files.readAllBytes( path ) ) ).setBit( 160 ).toString( 16 ).substring( 1 ).toUpperCase(); + } + + private static Path getPathDefault( String key, Object defaultValue ) +-- +2.14.3 + diff --git a/0001-Fix-configuration-of-aliased-plugins.patch b/0001-Fix-configuration-of-aliased-plugins.patch new file mode 100644 index 0000000..e304d21 --- /dev/null +++ b/0001-Fix-configuration-of-aliased-plugins.patch @@ -0,0 +1,76 @@ +From 46ad87218f0be4a4b7e292a1c8b5d5dbce48ae63 Mon Sep 17 00:00:00 2001 +From: Mikolaj Izdebski +Date: Fri, 16 Mar 2018 11:10:35 +0100 +Subject: [PATCH] Fix configuration of aliased plugins + +Normally Maven tries to look up plugin configuration using plugin +coordinates taken from plugin descriptor. This works with pure Maven +as plugin descriptor always matches reference in POM. +However in XMvn they can differ when plugin artifact is resolved +throug artifact alias, so XMvn should force use of coordinates +specified in in POM. +--- + .../aether/XMvnMojoExecutionConfigurator.java | 51 ++++++++++++++++++++++ + 1 file changed, 51 insertions(+) + create mode 100644 xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMojoExecutionConfigurator.java + +diff --git a/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMojoExecutionConfigurator.java b/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMojoExecutionConfigurator.java +new file mode 100644 +index 00000000..72e38b37 +--- /dev/null ++++ b/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMojoExecutionConfigurator.java +@@ -0,0 +1,51 @@ ++/*- ++ * Copyright (c) 2018 Red Hat, Inc. ++ * ++ * 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 org.fedoraproject.xmvn.connector.aether; ++ ++import org.apache.maven.lifecycle.MojoExecutionConfigurator; ++import org.apache.maven.lifecycle.internal.DefaultMojoExecutionConfigurator; ++import org.apache.maven.plugin.MojoExecution; ++import org.apache.maven.plugin.descriptor.PluginDescriptor; ++import org.apache.maven.project.MavenProject; ++import org.codehaus.plexus.component.annotations.Component; ++ ++/** ++ * @author Mikolaj Izdebski ++ */ ++@Component( role = MojoExecutionConfigurator.class ) ++public class XMvnMojoExecutionConfigurator ++ extends DefaultMojoExecutionConfigurator ++{ ++ @Override ++ public void configure( MavenProject project, MojoExecution execution, boolean allowPluginLevelConfig ) ++ { ++ PluginDescriptor originalPluginDescriptor = execution.getMojoDescriptor().getPluginDescriptor(); ++ ++ PluginDescriptor aliasedPluginDescriptor = originalPluginDescriptor.clone(); ++ aliasedPluginDescriptor.setGroupId( execution.getPlugin().getGroupId() ); ++ aliasedPluginDescriptor.setArtifactId( execution.getPlugin().getArtifactId() ); ++ ++ try ++ { ++ execution.getMojoDescriptor().setPluginDescriptor( aliasedPluginDescriptor ); ++ super.configure( project, execution, allowPluginLevelConfig ); ++ } ++ finally ++ { ++ execution.getMojoDescriptor().setPluginDescriptor( originalPluginDescriptor ); ++ } ++ } ++} +-- +2.14.3 + diff --git a/0001-Fix-installer-plugin-loading.patch b/0001-Fix-installer-plugin-loading.patch new file mode 100644 index 0000000..da7dd66 --- /dev/null +++ b/0001-Fix-installer-plugin-loading.patch @@ -0,0 +1,403 @@ +From 0fd7b0d19bd96456292585e883e3ba2ebbaf579b Mon Sep 17 00:00:00 2001 +From: Mikolaj Izdebski +Date: Wed, 21 Jun 2017 10:21:10 +0200 +Subject: [PATCH] Fix installer plugin loading + +--- + .../install/impl/ArtifactInstallerFactory.java | 97 ++++++-- + .../tools/install/impl/IsolatedClassRealm.java | 245 +++++++++++++++++++++ + 2 files changed, 320 insertions(+), 22 deletions(-) + create mode 100644 xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/impl/IsolatedClassRealm.java + +diff --git a/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/impl/ArtifactInstallerFactory.java b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/impl/ArtifactInstallerFactory.java +index 7a80571..e6a9a2d 100644 +--- a/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/impl/ArtifactInstallerFactory.java ++++ b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/impl/ArtifactInstallerFactory.java +@@ -15,8 +15,17 @@ + */ + package org.fedoraproject.xmvn.tools.install.impl; + ++import java.io.BufferedReader; ++import java.io.IOException; ++import java.io.InputStream; ++import java.io.InputStreamReader; ++import java.nio.file.Files; ++import java.nio.file.Path; ++import java.nio.file.Paths; + import java.util.Arrays; +-import java.util.Collection; ++import java.util.LinkedHashMap; ++import java.util.List; ++import java.util.Map; + import java.util.Properties; + + import org.slf4j.Logger; +@@ -35,49 +44,93 @@ class ArtifactInstallerFactory + + private final ArtifactInstaller defaultArtifactInstaller; + +- private final ArtifactInstaller eclipseArtifactInstaller; ++ private final IsolatedClassRealm pluginRealm; + +- private static ArtifactInstaller loadPlugin( String className ) ++ private final Map cachedPluginsByType = new LinkedHashMap<>(); ++ ++ private final Map cachedPluginsByImplClass = new LinkedHashMap<>(); ++ ++ private ArtifactInstaller tryLoadPlugin( String type ) + { ++ if ( cachedPluginsByType.containsKey( type ) ) ++ return cachedPluginsByType.get( type ); ++ + try + { +- return (ArtifactInstaller) ArtifactInstallerFactory.class.getClassLoader().loadClass( className ).newInstance(); ++ String resourceName = ArtifactInstaller.class.getCanonicalName() + "/" + type; ++ InputStream resourceStream = pluginRealm != null ? pluginRealm.getResourceAsStream( resourceName ) : null; ++ if ( resourceStream == null ) ++ { ++ logger.debug( "No XMvn Installer plugin found for packaging type {}", type ); ++ cachedPluginsByType.put( type, null ); ++ return null; ++ } ++ ++ String pluginImplClass; ++ try ( BufferedReader resourceReader = new BufferedReader( new InputStreamReader( resourceStream ) ) ) ++ { ++ pluginImplClass = resourceReader.readLine(); ++ } ++ ++ ArtifactInstaller pluggedInInstaller = cachedPluginsByImplClass.get( pluginImplClass ); ++ if ( pluggedInInstaller == null ) ++ { ++ pluggedInInstaller = (ArtifactInstaller) pluginRealm.loadClass( pluginImplClass ).newInstance(); ++ cachedPluginsByImplClass.put( pluginImplClass, pluggedInInstaller ); ++ } ++ ++ cachedPluginsByType.put( type, pluggedInInstaller ); ++ return pluggedInInstaller; + } +- catch ( ReflectiveOperationException e ) ++ catch ( IOException | ReflectiveOperationException e ) + { +- return null; ++ throw new RuntimeException( "Unable to load XMvn Installer plugin for packaging type " + type, e ); + } + } + + public ArtifactInstallerFactory( Configurator configurator ) + { + defaultArtifactInstaller = new DefaultArtifactInstaller( configurator ); +- // FIXME Don't hardcode plugin class name +- eclipseArtifactInstaller = loadPlugin( "org.fedoraproject.p2.xmvn.EclipseArtifactInstaller" ); ++ ++ Path pluginDir = Paths.get( "/usr/share/xmvn/lib/installer" ); ++ if ( Files.isDirectory( pluginDir ) ) ++ { ++ ClassLoader parentClassLoader = ArtifactInstallerFactory.class.getClassLoader(); ++ pluginRealm = new IsolatedClassRealm( parentClassLoader ); ++ pluginRealm.addJarDirectory( pluginDir ); ++ PLUGIN_IMPORTS.forEach( pluginRealm::importPackage ); ++ } ++ else ++ { ++ pluginRealm = null; ++ } + } + + /** +- * List of Tycho pacgkaging types. ++ * List of packages imported from XMvn Installer class loader to plug-in realms. + */ +- private static final Collection ECLIPSE_PACKAGING_TYPES = Arrays.asList( "eclipse-plugin", // +- "eclipse-test-plugin", // +- "eclipse-feature", // +- "eclipse-repository", // +- "eclipse-application", // +- "eclipse-update-site", // +- "eclipse-target-definition" ); ++ private static final List PLUGIN_IMPORTS = Arrays.asList( // XMvn API ++ "org.fedoraproject.xmvn.artifact", // ++ "org.fedoraproject.xmvn.config", // ++ "org.fedoraproject.xmvn.deployer", // ++ "org.fedoraproject.xmvn.locator", // ++ "org.fedoraproject.xmvn.metadata", // ++ "org.fedoraproject.xmvn.resolver", // ++ // XMvn Installer SPI ++ "org.fedoraproject.xmvn.tools.install", // ++ // SLF4J API ++ "org.slf4j" // ++ ); + + @SuppressWarnings( "unused" ) + public ArtifactInstaller getInstallerFor( Artifact artifact, Properties properties ) + { + String type = properties.getProperty( "type" ); +- if ( type != null && ECLIPSE_PACKAGING_TYPES.contains( type ) ) ++ if ( type != null ) + { +- if ( eclipseArtifactInstaller != null ) +- return eclipseArtifactInstaller; +- +- logger.error( "Unable to load XMvn P2 plugin, Eclipse artifact installation will be impossible" ); +- throw new RuntimeException( "Unable to load XMvn P2 plugin" ); ++ ArtifactInstaller pluggedInInstaller = tryLoadPlugin( type ); ++ if ( pluggedInInstaller != null ) ++ return pluggedInInstaller; + } + + return defaultArtifactInstaller; +diff --git a/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/impl/IsolatedClassRealm.java b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/impl/IsolatedClassRealm.java +new file mode 100644 +index 0000000..3324604 +--- /dev/null ++++ b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/impl/IsolatedClassRealm.java +@@ -0,0 +1,245 @@ ++/*- ++ * Copyright (c) 2014-2017 Red Hat, Inc. ++ * ++ * 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 org.fedoraproject.xmvn.tools.install.impl; ++ ++import java.io.IOException; ++import java.net.MalformedURLException; ++import java.net.URL; ++import java.net.URLClassLoader; ++import java.nio.file.DirectoryStream; ++import java.nio.file.Files; ++import java.nio.file.Path; ++import java.util.Collection; ++import java.util.Collections; ++import java.util.Enumeration; ++import java.util.HashSet; ++import java.util.LinkedHashSet; ++import java.util.Set; ++ ++/** ++ * A generic, isolated class loader. ++ *

++ * This class loader has its own classpath, separate from the primary Java classpath. It has a parent class loader, to ++ * which it delegates loading a set of imported classes. All other classes are loaded from its own classpath. ++ * ++ * @author Mikolaj Izdebski ++ */ ++class IsolatedClassRealm ++ extends URLClassLoader ++{ ++ static ++ { ++ registerAsParallelCapable(); ++ } ++ ++ private final ClassLoader parent; ++ ++ private final Set imports = new HashSet<>(); ++ ++ private final Set importsAll = new HashSet<>(); ++ ++ public IsolatedClassRealm( ClassLoader parent ) ++ { ++ super( new URL[0], null ); ++ this.parent = parent; ++ } ++ ++ public void addJar( Path jar ) ++ { ++ try ++ { ++ addURL( jar.toUri().toURL() ); ++ } ++ catch ( MalformedURLException e ) ++ { ++ throw new RuntimeException( e ); ++ } ++ } ++ ++ public void addJarDirectory( Path dir ) ++ { ++ try ( DirectoryStream stream = Files.newDirectoryStream( dir, "*.jar" ) ) ++ { ++ for ( Path path : stream ) ++ { ++ addJar( path ); ++ } ++ } ++ catch ( IOException e ) ++ { ++ throw new RuntimeException( e ); ++ } ++ } ++ ++ public void importPackage( String packageName ) ++ { ++ imports.add( packageName ); ++ } ++ ++ public void importAllPackages( String packageName ) ++ { ++ importsAll.add( packageName ); ++ } ++ ++ boolean isImported( String name ) ++ { ++ int index = name.lastIndexOf( '/' ); ++ ++ if ( index >= 0 ) ++ { ++ name = name.replace( '/', '.' ); ++ } ++ else ++ { ++ index = Math.max( name.lastIndexOf( '.' ), 0 ); ++ } ++ ++ String namespace = name.substring( 0, index ); ++ ++ if ( imports.contains( namespace ) ) ++ return true; ++ ++ while ( !namespace.isEmpty() ) ++ { ++ if ( importsAll.contains( namespace ) ) ++ return true; ++ ++ namespace = namespace.substring( 0, Math.max( namespace.lastIndexOf( '.' ), 0 ) ); ++ } ++ ++ return false; ++ } ++ ++ @Override ++ public Class loadClass( String name ) ++ throws ClassNotFoundException ++ { ++ return loadClass( name, false ); ++ } ++ ++ @Override ++ protected Class loadClass( String name, boolean resolve ) ++ throws ClassNotFoundException ++ { ++ if ( isImported( name ) ) ++ { ++ try ++ { ++ return parent.loadClass( name ); ++ } ++ catch ( ClassNotFoundException e ) ++ { ++ } ++ } ++ ++ try ++ { ++ return super.loadClass( name, resolve ); ++ } ++ catch ( ClassNotFoundException e ) ++ { ++ } ++ ++ synchronized ( getClassLoadingLock( name ) ) ++ { ++ Class clazz = findLoadedClass( name ); ++ if ( clazz != null ) ++ { ++ return clazz; ++ } ++ ++ try ++ { ++ return super.findClass( name ); ++ } ++ catch ( ClassNotFoundException e ) ++ { ++ } ++ } ++ ++ throw new ClassNotFoundException( name ); ++ } ++ ++ @Override ++ protected Class findClass( String name ) ++ throws ClassNotFoundException ++ { ++ throw new ClassNotFoundException( name ); ++ } ++ ++ @Override ++ public URL getResource( String name ) ++ { ++ if ( isImported( name ) ) ++ { ++ URL resource = parent.getResource( name ); ++ if ( resource != null ) ++ { ++ return resource; ++ } ++ } ++ ++ URL resource = super.getResource( name ); ++ if ( resource != null ) ++ { ++ return resource; ++ } ++ ++ resource = super.findResource( name ); ++ if ( resource != null ) ++ { ++ return resource; ++ } ++ ++ return null; ++ } ++ ++ @Override ++ public Enumeration getResources( String name ) ++ throws IOException ++ { ++ Collection resources = new LinkedHashSet<>(); ++ ++ if ( isImported( name ) ) ++ { ++ try ++ { ++ resources.addAll( Collections.list( parent.getResources( name ) ) ); ++ } ++ catch ( IOException e ) ++ { ++ } ++ } ++ ++ try ++ { ++ resources.addAll( Collections.list( super.getResources( name ) ) ); ++ } ++ catch ( IOException e ) ++ { ++ } ++ ++ try ++ { ++ resources.addAll( Collections.list( super.findResources( name ) ) ); ++ } ++ catch ( IOException e ) ++ { ++ } ++ ++ return Collections.enumeration( resources ); ++ } ++} +-- +2.9.3 + diff --git a/0001-Port-to-Gradle-4.2.patch b/0001-Port-to-Gradle-4.2.patch new file mode 100644 index 0000000..e0549e4 --- /dev/null +++ b/0001-Port-to-Gradle-4.2.patch @@ -0,0 +1,568 @@ +From 34b37637bd469621bb3eadfdf5fb856a806722df Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Mon, 2 Oct 2017 12:01:09 +0300 +Subject: [PATCH] Port to Gradle 4.2 + +--- + libs/gradle-core-api/pom.xml | 32 ++++++ + libs/gradle-logging/pom.xml | 32 ++++++ + libs/gradle-model-core/pom.xml | 32 ++++++ + libs/pom.xml | 3 + + xmvn-connector-gradle/pom.xml | 15 +++ + .../xmvn/connector/gradle/GradleResolver.java | 119 ++++++++++++++------- + .../xmvn/connector/gradle/XMvnGradlePlugin.java | 16 +-- + .../xmvn/connector/gradle/XMvnInstallTask.java | 22 +++- + xmvn-parent/pom.xml | 17 ++- + 9 files changed, 235 insertions(+), 53 deletions(-) + create mode 100644 libs/gradle-core-api/pom.xml + create mode 100644 libs/gradle-logging/pom.xml + create mode 100644 libs/gradle-model-core/pom.xml + +diff --git a/libs/gradle-core-api/pom.xml b/libs/gradle-core-api/pom.xml +new file mode 100644 +index 00000000..7b3d68d5 +--- /dev/null ++++ b/libs/gradle-core-api/pom.xml +@@ -0,0 +1,32 @@ ++ ++ ++ ++ 4.0.0 ++ ++ org.fedoraproject.xmvn ++ libs ++ 3.0.0 ++ .. ++ ++ org.gradle ++ gradle-core-api ++ ${gradleVersion} ++ Gradle core API module ++ +diff --git a/libs/gradle-logging/pom.xml b/libs/gradle-logging/pom.xml +new file mode 100644 +index 00000000..d2dec7c1 +--- /dev/null ++++ b/libs/gradle-logging/pom.xml +@@ -0,0 +1,32 @@ ++ ++ ++ ++ 4.0.0 ++ ++ org.fedoraproject.xmvn ++ libs ++ 3.0.0 ++ .. ++ ++ org.gradle ++ gradle-logging ++ ${gradleVersion} ++ Gradle logging module ++ +diff --git a/libs/gradle-model-core/pom.xml b/libs/gradle-model-core/pom.xml +new file mode 100644 +index 00000000..f841b960 +--- /dev/null ++++ b/libs/gradle-model-core/pom.xml +@@ -0,0 +1,32 @@ ++ ++ ++ ++ 4.0.0 ++ ++ org.fedoraproject.xmvn ++ libs ++ 3.0.0 ++ .. ++ ++ org.gradle ++ gradle-model-core ++ ${gradleVersion} ++ Gradle model-core module ++ +diff --git a/libs/pom.xml b/libs/pom.xml +index 2b31c5d0..fc29e359 100644 +--- a/libs/pom.xml ++++ b/libs/pom.xml +@@ -37,8 +37,11 @@ + gradle-base-services + gradle-base-services-groovy + gradle-core ++ gradle-core-api ++ gradle-model-core + gradle-dependency-management + gradle-resources ++ gradle-logging + + + +diff --git a/xmvn-connector-gradle/pom.xml b/xmvn-connector-gradle/pom.xml +index b433e5dd..f18a285e 100644 +--- a/xmvn-connector-gradle/pom.xml ++++ b/xmvn-connector-gradle/pom.xml +@@ -54,11 +54,21 @@ + + + org.gradle ++ gradle-core-api ++ provided ++ ++ ++ org.gradle + gradle-core + provided + + + org.gradle ++ gradle-model-core ++ provided ++ ++ ++ org.gradle + gradle-dependency-management + provided + +@@ -68,6 +78,11 @@ + provided + + ++ org.gradle ++ gradle-logging ++ provided ++ ++ + org.apache.ivy + ivy + provided +diff --git a/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/GradleResolver.java b/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/GradleResolver.java +index a81c5bc0..6305aa86 100644 +--- a/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/GradleResolver.java ++++ b/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/GradleResolver.java +@@ -18,41 +18,47 @@ package org.fedoraproject.xmvn.connector.gradle; + import java.nio.file.Path; + import java.util.Collections; + import java.util.LinkedHashSet; ++import java.util.Map; + import java.util.Set; + ++import org.gradle.api.artifacts.ComponentMetadataSupplier; + import org.gradle.api.artifacts.ModuleVersionIdentifier; ++import org.gradle.api.artifacts.component.ComponentArtifactIdentifier; + import org.gradle.api.artifacts.component.ModuleComponentIdentifier; ++import org.gradle.api.internal.artifacts.ImmutableModuleIdentifierFactory; + import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ConfiguredModuleComponentRepository; + import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ModuleComponentRepositoryAccess; + import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.DescriptorParseContext; +-import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.GradlePomModuleDescriptorParser; + import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.MetaDataParser; +-import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.DefaultVersionComparator; +-import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.strategy.DefaultVersionSelectorScheme; ++import org.gradle.api.internal.artifacts.ivyservice.resolveengine.artifact.ResolvableArtifact; + import org.gradle.api.internal.artifacts.repositories.AbstractArtifactRepository; + import org.gradle.api.internal.artifacts.repositories.ResolutionAwareRepository; ++import org.gradle.api.internal.artifacts.repositories.resolver.MetadataFetchingCost; + import org.gradle.api.internal.component.ArtifactType; +-import org.gradle.internal.component.external.model.DefaultMavenModuleResolveMetaData; +-import org.gradle.internal.component.external.model.DefaultModuleComponentArtifactMetaData; +-import org.gradle.internal.component.external.model.ModuleComponentResolveMetaData; +-import org.gradle.internal.component.external.model.MutableModuleComponentResolveMetaData; +-import org.gradle.internal.component.model.ComponentArtifactMetaData; ++import org.gradle.internal.component.external.model.DefaultModuleComponentArtifactMetadata; ++import org.gradle.internal.component.external.model.DefaultMutableMavenModuleResolveMetadata; ++import org.gradle.internal.component.external.model.FixedComponentArtifacts; ++import org.gradle.internal.component.external.model.ModuleComponentArtifactMetadata; ++import org.gradle.internal.component.external.model.ModuleComponentResolveMetadata; ++import org.gradle.internal.component.external.model.MutableMavenModuleResolveMetadata; ++import org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata; ++import org.gradle.internal.component.model.ComponentArtifactMetadata; + import org.gradle.internal.component.model.ComponentOverrideMetadata; +-import org.gradle.internal.component.model.ComponentResolveMetaData; +-import org.gradle.internal.component.model.ComponentUsage; ++import org.gradle.internal.component.model.ComponentResolveMetadata; + import org.gradle.internal.component.model.DefaultIvyArtifactName; +-import org.gradle.internal.component.model.DependencyMetaData; ++import org.gradle.internal.component.model.DependencyMetadata; + import org.gradle.internal.component.model.IvyArtifactName; + import org.gradle.internal.component.model.ModuleSource; + import org.gradle.internal.resolve.ArtifactResolveException; + import org.gradle.internal.resolve.ModuleVersionResolveException; + import org.gradle.internal.resolve.result.BuildableArtifactResolveResult; + import org.gradle.internal.resolve.result.BuildableArtifactSetResolveResult; ++import org.gradle.internal.resolve.result.BuildableComponentArtifactsResolveResult; + import org.gradle.internal.resolve.result.BuildableModuleComponentMetaDataResolveResult; + import org.gradle.internal.resolve.result.BuildableModuleVersionListingResolveResult; +-import org.gradle.internal.resource.local.DefaultLocallyAvailableExternalResource; +-import org.gradle.internal.resource.local.DefaultLocallyAvailableResource; ++import org.gradle.internal.resource.local.FileResourceRepository; + import org.gradle.internal.resource.local.LocallyAvailableExternalResource; ++import org.gradle.internal.resource.metadata.DefaultExternalResourceMetaData; + import org.slf4j.Logger; + import org.slf4j.LoggerFactory; + +@@ -72,6 +78,21 @@ public class GradleResolver + implements ResolutionAwareRepository, ConfiguredModuleComponentRepository, ModuleComponentRepositoryAccess, + DescriptorParseContext + { ++ public GradleResolver( MetaDataParser pomParser, ++ ImmutableModuleIdentifierFactory moduleIdentifierFactory, ++ FileResourceRepository fileRepository ) ++ { ++ this.pomParser = pomParser; ++ this.moduleIdentifierFactory = moduleIdentifierFactory; ++ this.fileRepository = fileRepository; ++ } ++ ++ private MetaDataParser pomParser; ++ ++ private ImmutableModuleIdentifierFactory moduleIdentifierFactory; ++ ++ private FileResourceRepository fileRepository; ++ + private final Logger logger = LoggerFactory.getLogger( GradleResolver.class ); + + static class LazyLocatorProvider +@@ -135,17 +156,17 @@ public class GradleResolver + } + + @Override +- public void listModuleVersions( DependencyMetaData arg0, BuildableModuleVersionListingResolveResult arg1 ) ++ public void listModuleVersions( DependencyMetadata arg0, BuildableModuleVersionListingResolveResult arg1 ) + { + logger.debug( "listModuleVersions() called, but it is NOT IMPLEMENTED" ); + } + + @Override +- public void resolveArtifact( ComponentArtifactMetaData artifact, ModuleSource module, ++ public void resolveArtifact( ComponentArtifactMetadata artifact, ModuleSource module, + BuildableArtifactResolveResult result ) + { + ModuleVersionIdentifier moduleId = +- ( (DefaultModuleComponentArtifactMetaData) artifact ).toArtifactIdentifier().getModuleVersionIdentifier(); ++ ( (DefaultModuleComponentArtifactMetadata) artifact ).toArtifactIdentifier().getModuleVersionIdentifier(); + String groupId = moduleId.getGroup(); + String artifactId = artifact.getName().getName(); + String extension = artifact.getName().getExtension(); +@@ -180,11 +201,9 @@ public class GradleResolver + { + logger.debug( "Found Maven POM: {}", pomPath ); + +- MetaDataParser parser = +- new GradlePomModuleDescriptorParser( new DefaultVersionSelectorScheme( new DefaultVersionComparator() ) ); +- MutableModuleComponentResolveMetaData metaData = parser.parseMetaData( this, pomPath.toFile() ); ++ MutableModuleComponentResolveMetadata metaData = pomParser.parseMetaData( this, pomPath.toFile() ); + +- result.resolved( metaData ); ++ result.resolved( metaData.asImmutable() ); + return; + } + else +@@ -204,9 +223,11 @@ public class GradleResolver + if ( path != null ) + { + logger.debug( "Artifact {} found, returning minimal model", artifact3 ); +- MutableModuleComponentResolveMetaData metaData = +- new DefaultMavenModuleResolveMetaData( id, request.getArtifacts() ); +- result.resolved( metaData ); ++ ModuleVersionIdentifier mvi = ++ moduleIdentifierFactory.moduleWithVersion( id.getGroup(), id.getModule(), id.getVersion() ); ++ MutableModuleComponentResolveMetadata metaData = ++ new DefaultMutableMavenModuleResolveMetadata( mvi, id, request.getArtifacts() ); ++ result.resolved( metaData.asImmutable() ); + return; + } + } +@@ -224,24 +245,15 @@ public class GradleResolver + + if ( artifactSet.isEmpty() ) + { +- artifactSet.add( new DefaultIvyArtifactName( id.getModule(), "jar", "jar", +- Collections.emptyMap() ) ); ++ artifactSet.add( new DefaultIvyArtifactName( id.getModule(), "jar", "jar", null ) ); + } + + return artifactSet; + } + + @Override +- public void resolveModuleArtifacts( ComponentResolveMetaData component, ComponentUsage usage, +- BuildableArtifactSetResolveResult result ) +- { +- result.resolved( Collections.singleton( ( (ModuleComponentResolveMetaData) component ).artifact( "jar", "jar", +- null ) ) ); +- } +- +- @Override +- public void resolveModuleArtifacts( ComponentResolveMetaData component, ArtifactType type, +- BuildableArtifactSetResolveResult result ) ++ public void resolveArtifactsWithType( ComponentResolveMetadata component, ArtifactType type, ++ BuildableArtifactSetResolveResult result ) + { + if ( type != ArtifactType.MAVEN_POM ) + { +@@ -250,15 +262,22 @@ public class GradleResolver + return; + } + +- ModuleComponentResolveMetaData metaData = (ModuleComponentResolveMetaData) component; +- ModuleComponentIdentifier id = metaData.getComponentId(); ++ ModuleComponentIdentifier id = (ModuleComponentIdentifier) component.getComponentId(); + DefaultIvyArtifactName name = new DefaultIvyArtifactName( id.getModule(), "pom", "pom" ); +- DefaultModuleComponentArtifactMetaData resolvedMetaData = +- new DefaultModuleComponentArtifactMetaData( id, name ); ++ DefaultModuleComponentArtifactMetadata resolvedMetaData = ++ new DefaultModuleComponentArtifactMetadata( id, name ); + result.resolved( Collections.singleton( resolvedMetaData ) ); + } + + @Override ++ public void resolveArtifacts( ComponentResolveMetadata component, BuildableComponentArtifactsResolveResult result ) ++ { ++ ModuleComponentArtifactMetadata artifact = ++ ( (ModuleComponentResolveMetadata) component ).artifact( "jar", "jar", null ); ++ result.resolved( new FixedComponentArtifacts( Collections.singleton( artifact ) ) ); ++ } ++ ++ @Override + public LocallyAvailableExternalResource getMetaDataArtifact( ModuleComponentIdentifier id, ArtifactType type ) + { + Path pomPath = resolve( new DefaultArtifact( id.getGroup(), id.getModule(), "pom", id.getVersion() ) ); +@@ -266,7 +285,25 @@ public class GradleResolver + if ( pomPath == null ) + return null; + +- return new DefaultLocallyAvailableExternalResource( pomPath.toUri(), +- new DefaultLocallyAvailableResource( pomPath.toFile() ) ); ++ DefaultExternalResourceMetaData metadata = new DefaultExternalResourceMetaData( pomPath.toUri(), 0, 0 ); ++ return fileRepository.resource( pomPath.toFile(), pomPath.toUri(), metadata ); ++ } ++ ++ @Override ++ public ComponentMetadataSupplier createMetadataSupplier() ++ { ++ return null; ++ } ++ ++ @Override ++ public Map getArtifactCache() ++ { ++ return Collections.emptyMap(); ++ } ++ ++ @Override ++ public MetadataFetchingCost estimateMetadataFetchingCost( ModuleComponentIdentifier arg0 ) ++ { ++ return MetadataFetchingCost.CHEAP; + } + } +diff --git a/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/XMvnGradlePlugin.java b/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/XMvnGradlePlugin.java +index 2646f098..c3250e3c 100644 +--- a/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/XMvnGradlePlugin.java ++++ b/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/XMvnGradlePlugin.java +@@ -15,9 +15,11 @@ + */ + package org.fedoraproject.xmvn.connector.gradle; + ++import groovy.lang.Closure; ++import groovy.lang.GroovyShell; + import org.gradle.api.Plugin; + import org.gradle.api.Task; +-import org.gradle.api.artifacts.repositories.ArtifactRepository; ++import org.gradle.api.artifacts.dsl.RepositoryHandler; + import org.gradle.api.invocation.Gradle; + + /** +@@ -26,15 +28,17 @@ import org.gradle.api.invocation.Gradle; + public class XMvnGradlePlugin + implements Plugin + { ++ private void configureRepositories( RepositoryHandler repositories ) ++ { ++ repositories.configure( (Closure) new GroovyShell().evaluate( "{ it -> xmvn() }" ) ); ++ } ++ + @Override + public void apply( Gradle gradle ) + { +- ArtifactRepository repo = new GradleResolver(); +- repo.setName( "xmvn" ); +- + gradle.allprojects( project -> { +- project.getRepositories().addFirst( repo ); +- project.getBuildscript().getRepositories().addFirst( repo ); ++ configureRepositories( project.getRepositories() ); ++ configureRepositories( project.getBuildscript().getRepositories() ); + + Task upload = project.getTasks().create( "xmvnInstall", XMvnInstallTask.class ); + upload.setDescription( "Installs all artifacts through XMvn" ); +diff --git a/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/XMvnInstallTask.java b/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/XMvnInstallTask.java +index 196f4a5b..07905f1f 100644 +--- a/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/XMvnInstallTask.java ++++ b/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/XMvnInstallTask.java +@@ -17,6 +17,7 @@ package org.fedoraproject.xmvn.connector.gradle; + + import java.nio.file.Files; + import java.util.Collections; ++import java.util.HashSet; + import java.util.List; + import java.util.Set; + import java.util.stream.Collectors; +@@ -32,7 +33,7 @@ import org.gradle.api.artifacts.PublishArtifact; + import org.gradle.api.artifacts.PublishException; + import org.gradle.api.component.SoftwareComponent; + import org.gradle.api.internal.component.SoftwareComponentInternal; +-import org.gradle.api.internal.component.Usage; ++import org.gradle.api.internal.component.UsageContext; + import org.gradle.api.tasks.TaskAction; + + import org.fedoraproject.xmvn.artifact.Artifact; +@@ -83,7 +84,7 @@ class XMvnInstallTask + Project dependencyProject = projectDependency.getDependencyProject(); + Stream components = dependencyProject.getComponents().stream(); + Stream internalComponents = components.map( c -> (SoftwareComponentInternal) c ); +- Stream usages = internalComponents.flatMap( ic -> ic.getUsages().stream() ); ++ Stream usages = internalComponents.flatMap( ic -> ic.getUsages().stream() ); + Stream publishArtifacts = usages.flatMap( usage -> usage.getArtifacts().stream() ); + Stream artifacts = publishArtifacts.map( pa -> getPublishArtifact( dependencyProject, pa ) ); + return artifacts.collect( Collectors.toList() ); +@@ -144,7 +145,13 @@ class XMvnInstallTask + } + } + +- DeploymentResult result = getDeployer().deploy( request ); ++ DeploymentResult result; ++ ++ // prevent parallel access to installation plan ++ synchronized ( XMvnInstallTask.class ) ++ { ++ result = getDeployer().deploy( request ); ++ } + + if ( result.getException() != null ) + { +@@ -155,17 +162,22 @@ class XMvnInstallTask + @TaskAction + protected void deployProject() + { ++ Set seenArtifacts = new HashSet<>(); ++ + for ( SoftwareComponent component : getProject().getComponents() ) + { + SoftwareComponentInternal internalComponent = (SoftwareComponentInternal) component; + +- for ( Usage usage : internalComponent.getUsages() ) ++ for ( UsageContext usage : internalComponent.getUsages() ) + { + Set dependencies = usage.getDependencies(); + + for ( PublishArtifact artifact : usage.getArtifacts() ) + { +- deploy( artifact, dependencies ); ++ if ( seenArtifacts.add( artifact ) ) ++ { ++ deploy( artifact, dependencies ); ++ } + } + } + } +diff --git a/xmvn-parent/pom.xml b/xmvn-parent/pom.xml +index 661cc24d..7e7a6d94 100644 +--- a/xmvn-parent/pom.xml ++++ b/xmvn-parent/pom.xml +@@ -84,7 +84,7 @@ + 1 + 2.4.0 + 1.64 +- 2.13-rc-1 ++ 4.2.1 + 2.4.10 + 2.2 + 1.0.3 +@@ -278,11 +278,21 @@ + + + org.gradle ++ gradle-core-api ++ ${gradleVersion} ++ ++ ++ org.gradle + gradle-core + ${gradleVersion} + + + org.gradle ++ gradle-model-core ++ ${gradleVersion} ++ ++ ++ org.gradle + gradle-dependency-management + ${gradleVersion} + +@@ -292,6 +302,11 @@ + ${gradleVersion} + + ++ org.gradle ++ gradle-logging ++ ${gradleVersion} ++ ++ + org.codehaus.groovy + groovy-all + ${groovyVersion} +-- +2.13.6 + diff --git a/0001-Port-to-Gradle-4.3.1.patch b/0001-Port-to-Gradle-4.3.1.patch new file mode 100644 index 0000000..7383639 --- /dev/null +++ b/0001-Port-to-Gradle-4.3.1.patch @@ -0,0 +1,62 @@ +From cd6cf796f7c2230c940f95f46dc905a25152c486 Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Fri, 10 Nov 2017 15:13:45 +0200 +Subject: [PATCH] Port to Gradle 4.3.1 + +--- + .../java/org/fedoraproject/xmvn/connector/gradle/GradleResolver.java | 2 +- + .../java/org/fedoraproject/xmvn/connector/gradle/XMvnInstallTask.java | 4 ++-- + xmvn-parent/pom.xml | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/GradleResolver.java b/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/GradleResolver.java +index 6305aa86..9e1a247a 100644 +--- a/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/GradleResolver.java ++++ b/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/GradleResolver.java +@@ -226,7 +226,7 @@ public class GradleResolver + ModuleVersionIdentifier mvi = + moduleIdentifierFactory.moduleWithVersion( id.getGroup(), id.getModule(), id.getVersion() ); + MutableModuleComponentResolveMetadata metaData = +- new DefaultMutableMavenModuleResolveMetadata( mvi, id, request.getArtifacts() ); ++ DefaultMutableMavenModuleResolveMetadata.missing( mvi, id ); + result.resolved( metaData.asImmutable() ); + return; + } +diff --git a/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/XMvnInstallTask.java b/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/XMvnInstallTask.java +index 07905f1f..d220e266 100644 +--- a/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/XMvnInstallTask.java ++++ b/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/XMvnInstallTask.java +@@ -116,7 +116,7 @@ class XMvnInstallTask + } ).collect( Collectors.toList() ); + } + +- private void deploy( PublishArtifact gradleArtifact, Set dependencies ) ++ private void deploy( PublishArtifact gradleArtifact, Set dependencies ) + { + DeploymentRequest request = new DeploymentRequest(); + +@@ -170,7 +170,7 @@ class XMvnInstallTask + + for ( UsageContext usage : internalComponent.getUsages() ) + { +- Set dependencies = usage.getDependencies(); ++ Set dependencies = usage.getDependencies(); + + for ( PublishArtifact artifact : usage.getArtifacts() ) + { +diff --git a/xmvn-parent/pom.xml b/xmvn-parent/pom.xml +index 7e7a6d94..910e27b6 100644 +--- a/xmvn-parent/pom.xml ++++ b/xmvn-parent/pom.xml +@@ -84,7 +84,7 @@ + 1 + 2.4.0 + 1.64 +- 4.2.1 ++ 4.3.1 + 2.4.10 + 2.2 + 1.0.3 +-- +2.13.6 + diff --git a/0001-Replace-JAXB-parser.patch b/0001-Replace-JAXB-parser.patch new file mode 100644 index 0000000..7a76ff1 --- /dev/null +++ b/0001-Replace-JAXB-parser.patch @@ -0,0 +1,1252 @@ +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/ResolverCli.java xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/ResolverCli.java +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/ResolverCli.java 2019-02-13 22:40:50.101115683 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/ResolverCli.java 2019-02-13 22:43:25.477815024 +0100 +@@ -15,15 +15,13 @@ + */ + package org.fedoraproject.xmvn.tools.resolve; + ++import java.io.IOException; + import java.util.ArrayList; + import java.util.Collections; + import java.util.List; + import java.util.stream.Collectors; + +-import javax.xml.bind.JAXBContext; +-import javax.xml.bind.JAXBException; +-import javax.xml.bind.Marshaller; +-import javax.xml.bind.Unmarshaller; ++import javax.xml.stream.XMLStreamException; + + import org.fedoraproject.xmvn.artifact.Artifact; + import org.fedoraproject.xmvn.artifact.DefaultArtifact; +@@ -32,8 +30,8 @@ + import org.fedoraproject.xmvn.resolver.ResolutionRequest; + import org.fedoraproject.xmvn.resolver.ResolutionResult; + import org.fedoraproject.xmvn.resolver.Resolver; +-import org.fedoraproject.xmvn.tools.resolve.xml.CompoundRequest; +-import org.fedoraproject.xmvn.tools.resolve.xml.CompoundResult; ++import org.fedoraproject.xmvn.tools.resolve.xml.ResolutionRequestListUnmarshaller; ++import org.fedoraproject.xmvn.tools.resolve.xml.ResolutionResultListMarshaller; + + /** + * Resolve artifacts given on command line. +@@ -53,14 +51,11 @@ + } + + private List parseRequests( ResolverCliRequest cli ) +- throws JAXBException ++ throws IOException, XMLStreamException + { + if ( cli.isRaw() ) + { +- JAXBContext jaxbContext = JAXBContext.newInstance( CompoundRequest.class ); +- Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); +- CompoundRequest compoundRequest = (CompoundRequest) jaxbUnmarshaller.unmarshal( System.in ); +- List requests = compoundRequest.getRequests(); ++ List requests = new ResolutionRequestListUnmarshaller( System.in ).unmarshal(); + return requests != null ? requests : Collections.emptyList(); + } + +@@ -83,14 +78,11 @@ + } + + private void printResults( ResolverCliRequest cli, List results ) +- throws JAXBException ++ throws IOException, XMLStreamException + { + if ( cli.isRaw() ) + { +- JAXBContext jaxbContext = JAXBContext.newInstance( CompoundResult.class ); +- Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); +- jaxbMarshaller.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, true ); +- jaxbMarshaller.marshal( new CompoundResult( results ), System.out ); ++ new ResolutionResultListMarshaller( results ).marshal( System.out ); + } + else if ( cli.isClasspath() ) + { +@@ -103,7 +95,7 @@ + } + + private void run( ResolverCliRequest cliRequest ) +- throws JAXBException ++ throws IOException, XMLStreamException + { + try + { +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ArtifactBean.java xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ArtifactBean.java +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ArtifactBean.java 2019-02-13 22:40:50.101115683 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ArtifactBean.java 2019-02-13 22:43:25.477815024 +0100 +@@ -15,16 +15,12 @@ + */ + package org.fedoraproject.xmvn.tools.resolve.xml; + +-import javax.xml.bind.annotation.XmlRootElement; +-import javax.xml.bind.annotation.adapters.XmlAdapter; +- + import org.fedoraproject.xmvn.artifact.Artifact; + import org.fedoraproject.xmvn.artifact.DefaultArtifact; + + /** + * @author Mikolaj Izdebski + */ +-@XmlRootElement( name = "artifact" ) + public class ArtifactBean + { + private String groupId; +@@ -91,14 +87,12 @@ + * @author Mikolaj Izdebski + */ + public static class Adapter +- extends XmlAdapter + { + private static String nullify( String value, String defaultValue ) + { + return value.equals( defaultValue ) ? null : value; + } + +- @Override + public ArtifactBean marshal( Artifact artifact ) + throws Exception + { +@@ -113,7 +107,6 @@ + return bean; + } + +- @Override + public Artifact unmarshal( ArtifactBean bean ) + throws Exception + { +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ArtifactUnmarshaller.java xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ArtifactUnmarshaller.java +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ArtifactUnmarshaller.java 1970-01-01 01:00:00.000000000 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ArtifactUnmarshaller.java 2019-02-13 22:43:25.477815024 +0100 +@@ -0,0 +1,161 @@ ++/*- ++ * Copyright (c) 2018 Red Hat, Inc. ++ * ++ * 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 org.fedoraproject.xmvn.tools.resolve.xml; ++ ++import java.io.IOException; ++import java.nio.file.Path; ++import java.nio.file.Paths; ++ ++import javax.xml.stream.XMLEventReader; ++import javax.xml.stream.XMLStreamConstants; ++import javax.xml.stream.XMLStreamException; ++import javax.xml.stream.events.StartElement; ++import javax.xml.stream.events.XMLEvent; ++ ++import org.fedoraproject.xmvn.artifact.Artifact; ++ ++/** ++ * @author Marian Koncek ++ */ ++class ArtifactUnmarshaller ++{ ++ private XMLEventReader eventReader; ++ ++ static class StringConstants ++ { ++ private static final String GROUP_ID = "groupId"; ++ ++ private static final String ARTIFACT_ID = "artifactId"; ++ ++ private static final String EXTENSION = "extension"; ++ ++ private static final String CLASSIFIER = "classifier"; ++ ++ private static final String VERSION = "version"; ++ ++ private static final String PATH = "path"; ++ } ++ ++ public ArtifactUnmarshaller( XMLEventReader eventReader ) ++ { ++ this.eventReader = eventReader; ++ } ++ ++ /** ++ * @return A String representation of the nested element or an empty string if end of section has been found ++ * @throws IOException ++ * @throws XMLStreamException ++ */ ++ String readUntilEnd( String end ) ++ throws XMLStreamException ++ { ++ StringBuffer stringBuffer = new StringBuffer(); ++ ++ while ( eventReader.hasNext() ) ++ { ++ XMLEvent event = eventReader.nextEvent(); ++ ++ if ( event.getEventType() == XMLStreamConstants.CHARACTERS ) ++ { ++ stringBuffer.append( event.asCharacters().getData() ); ++ } ++ else if ( event.getEventType() == XMLStreamConstants.END_ELEMENT ++ && event.asEndElement().getName().getLocalPart().equals( end ) ) ++ { ++ return stringBuffer.toString(); ++ } ++ } ++ ++ throw new XMLStreamException( "XML stream does not have a proper format" ); ++ } ++ ++ Artifact unmarshal() ++ throws XMLStreamException ++ { ++ ArtifactBean artifactBean = new ArtifactBean(); ++ Path path = null; ++ ++ while ( eventReader.hasNext() ) ++ { ++ XMLEvent event = eventReader.nextEvent(); ++ ++ switch ( event.getEventType() ) ++ { ++ case XMLStreamConstants.START_ELEMENT: ++ StartElement startElement = event.asStartElement(); ++ String startName = startElement.getName().getLocalPart(); ++ ++ switch ( startName ) ++ { ++ case StringConstants.GROUP_ID: ++ artifactBean.setGroupId( readUntilEnd( StringConstants.GROUP_ID ) ); ++ if ( artifactBean.getGroupId().isEmpty() ) ++ { ++ throw new XMLStreamException( "Xml read error: groupId must not be empty" ); ++ } ++ break; ++ ++ case StringConstants.ARTIFACT_ID: ++ artifactBean.setArtifactId( readUntilEnd( StringConstants.ARTIFACT_ID ) ); ++ if ( artifactBean.getArtifactId().isEmpty() ) ++ { ++ throw new XMLStreamException( "Xml read error: artifactId must not be empty" ); ++ } ++ break; ++ ++ case StringConstants.EXTENSION: ++ artifactBean.setExtension( readUntilEnd( StringConstants.EXTENSION ) ); ++ break; ++ ++ case StringConstants.CLASSIFIER: ++ artifactBean.setClassifier( readUntilEnd( StringConstants.CLASSIFIER ) ); ++ break; ++ ++ case StringConstants.VERSION: ++ artifactBean.setVersion( readUntilEnd( StringConstants.VERSION ) ); ++ break; ++ ++ case StringConstants.PATH: ++ path = Paths.get( readUntilEnd( StringConstants.PATH ) ); ++ break; ++ ++ default: ++ continue; ++ } ++ break; ++ ++ case XMLStreamConstants.END_ELEMENT: ++ if ( event.asEndElement().getName().getLocalPart().equals( "artifact" ) ) ++ { ++ try ++ { ++ return new ArtifactBean.Adapter().unmarshal( artifactBean ).setPath( path ); ++ } ++ catch ( Exception e ) ++ { ++ throw new XMLStreamException( "XML stream does not have a proper format", e ); ++ } ++ } ++ break; ++ ++ default: ++ continue; ++ } ++ } ++ ++ throw new XMLStreamException( "XML stream does not have a proper format" ); ++ } ++} +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/CompoundRequest.java xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/CompoundRequest.java +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/CompoundRequest.java 2019-02-13 22:40:50.101115683 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/CompoundRequest.java 1970-01-01 01:00:00.000000000 +0100 +@@ -1,52 +0,0 @@ +-/*- +- * Copyright (c) 2014-2017 Red Hat, Inc. +- * +- * 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 org.fedoraproject.xmvn.tools.resolve.xml; +- +-import java.util.List; +- +-import javax.xml.bind.annotation.XmlElement; +-import javax.xml.bind.annotation.XmlRootElement; +- +-import org.fedoraproject.xmvn.resolver.ResolutionRequest; +- +-/** +- * @author Mikolaj Izdebski +- */ +-@XmlRootElement( name = "requests" ) +-public class CompoundRequest +-{ +- private List requests; +- +- public CompoundRequest() +- { +- } +- +- public CompoundRequest( List requests ) +- { +- this.requests = requests; +- } +- +- @XmlElement( name = "request" ) +- public List getRequests() +- { +- return requests; +- } +- +- public void setRequests( List requests ) +- { +- this.requests = requests; +- } +-} +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/CompoundResult.java xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/CompoundResult.java +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/CompoundResult.java 2019-02-13 22:40:50.101115683 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/CompoundResult.java 1970-01-01 01:00:00.000000000 +0100 +@@ -1,52 +0,0 @@ +-/*- +- * Copyright (c) 2014-2017 Red Hat, Inc. +- * +- * 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 org.fedoraproject.xmvn.tools.resolve.xml; +- +-import java.util.List; +- +-import javax.xml.bind.annotation.XmlElement; +-import javax.xml.bind.annotation.XmlRootElement; +- +-import org.fedoraproject.xmvn.resolver.ResolutionResult; +- +-/** +- * @author Mikolaj Izdebski +- */ +-@XmlRootElement( name = "results" ) +-public class CompoundResult +-{ +- private List results; +- +- public CompoundResult() +- { +- } +- +- public CompoundResult( List results ) +- { +- this.results = results; +- } +- +- @XmlElement( name = "result" ) +- public List getResults() +- { +- return results; +- } +- +- public void setResults( List results ) +- { +- this.results = results; +- } +-} +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/package-info.java xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/package-info.java +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/package-info.java 2019-02-13 22:40:50.101115683 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/package-info.java 1970-01-01 01:00:00.000000000 +0100 +@@ -1,29 +0,0 @@ +-/*- +- * Copyright (c) 2014-2017 Red Hat, Inc. +- * +- * 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. +- */ +-/** +- * @author Mikolaj Izdebski +- */ +-@XmlJavaTypeAdapters( { @XmlJavaTypeAdapter( value = ArtifactBean.Adapter.class, type = Artifact.class ), +- @XmlJavaTypeAdapter( value = ResolutionRequestBean.Adapter.class, type = ResolutionRequest.class ), +- @XmlJavaTypeAdapter( value = ResolutionResultBean.Adapter.class, type = ResolutionResult.class ) } ) +-package org.fedoraproject.xmvn.tools.resolve.xml; +- +-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters; +- +-import org.fedoraproject.xmvn.artifact.Artifact; +-import org.fedoraproject.xmvn.resolver.ResolutionRequest; +-import org.fedoraproject.xmvn.resolver.ResolutionResult; +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionRequestBean.java xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionRequestBean.java +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionRequestBean.java 2019-02-13 22:40:50.101115683 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionRequestBean.java 2019-02-13 22:43:31.597842567 +0100 +@@ -15,16 +15,12 @@ + */ + package org.fedoraproject.xmvn.tools.resolve.xml; + +-import javax.xml.bind.annotation.XmlRootElement; +-import javax.xml.bind.annotation.adapters.XmlAdapter; +- + import org.fedoraproject.xmvn.artifact.Artifact; + import org.fedoraproject.xmvn.resolver.ResolutionRequest; + + /** + * @author Mikolaj Izdebski + */ +-@XmlRootElement( name = "request" ) + public class ResolutionRequestBean + { + private Artifact artifact; +@@ -55,9 +51,7 @@ + * @author Mikolaj Izdebski + */ + public static class Adapter +- extends XmlAdapter + { +- @Override + public ResolutionRequestBean marshal( ResolutionRequest request ) + throws Exception + { +@@ -69,7 +63,6 @@ + return bean; + } + +- @Override + public ResolutionRequest unmarshal( ResolutionRequestBean bean ) + throws Exception + { +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionRequestListUnmarshaller.java xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionRequestListUnmarshaller.java +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionRequestListUnmarshaller.java 1970-01-01 01:00:00.000000000 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionRequestListUnmarshaller.java 2019-02-13 22:43:31.597842567 +0100 +@@ -0,0 +1,105 @@ ++/*- ++ * Copyright (c) 2018 Red Hat, Inc. ++ * ++ * 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 org.fedoraproject.xmvn.tools.resolve.xml; ++ ++import java.io.BufferedReader; ++import java.io.IOException; ++import java.io.InputStream; ++import java.io.InputStreamReader; ++import java.util.ArrayList; ++import java.util.List; ++ ++import javax.xml.stream.XMLEventReader; ++import javax.xml.stream.XMLInputFactory; ++import javax.xml.stream.XMLStreamConstants; ++import javax.xml.stream.XMLStreamException; ++import javax.xml.stream.events.EndElement; ++import javax.xml.stream.events.StartElement; ++import javax.xml.stream.events.XMLEvent; ++ ++import org.fedoraproject.xmvn.resolver.ResolutionRequest; ++ ++/** ++ * @author Marian Koncek ++ */ ++public class ResolutionRequestListUnmarshaller ++{ ++ private InputStream inputStream; ++ ++ public ResolutionRequestListUnmarshaller( InputStream inputStream ) ++ { ++ this.inputStream = inputStream; ++ } ++ ++ public List unmarshal() ++ throws IOException, XMLStreamException ++ { ++ List resolutionRequests = null; ++ ++ try ( BufferedReader bufferedReader = new BufferedReader( new InputStreamReader( inputStream ) ) ) ++ { ++ XMLEventReader eventReader = XMLInputFactory.newInstance().createXMLEventReader( bufferedReader ); ++ ++ try ++ { ++ mainLoop: while ( eventReader.hasNext() ) ++ { ++ XMLEvent event = eventReader.nextEvent(); ++ ++ switch ( event.getEventType() ) ++ { ++ case XMLStreamConstants.START_ELEMENT: ++ StartElement startElement = event.asStartElement(); ++ String startName = startElement.getName().getLocalPart(); ++ ++ switch ( startName ) ++ { ++ case "requests": ++ resolutionRequests = new ArrayList(); ++ break; ++ case "request": ++ resolutionRequests.add( new ResolutionRequestUnmarshaller( eventReader ).unmarshal() ); ++ break; ++ ++ default: ++ continue; ++ } ++ break; ++ ++ case XMLStreamConstants.END_ELEMENT: ++ EndElement endElement = event.asEndElement(); ++ String endName = endElement.getName().getLocalPart(); ++ ++ if ( endName.equals( "requests" ) ) ++ { ++ break mainLoop; ++ } ++ break; ++ ++ default: ++ continue; ++ } ++ } ++ } ++ finally ++ { ++ eventReader.close(); ++ } ++ } ++ ++ return resolutionRequests; ++ } ++} +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionRequestUnmarshaller.java xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionRequestUnmarshaller.java +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionRequestUnmarshaller.java 1970-01-01 01:00:00.000000000 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionRequestUnmarshaller.java 2019-02-13 22:43:31.597842567 +0100 +@@ -0,0 +1,98 @@ ++/*- ++ * Copyright (c) 2018 Red Hat, Inc. ++ * ++ * 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 org.fedoraproject.xmvn.tools.resolve.xml; ++ ++import javax.xml.stream.XMLEventReader; ++import javax.xml.stream.XMLStreamConstants; ++import javax.xml.stream.XMLStreamException; ++import javax.xml.stream.events.StartElement; ++import javax.xml.stream.events.XMLEvent; ++ ++import org.fedoraproject.xmvn.resolver.ResolutionRequest; ++ ++/** ++ * @author Marian Koncek ++ */ ++class ResolutionRequestUnmarshaller ++{ ++ private XMLEventReader eventReader; ++ ++ public ResolutionRequestUnmarshaller( XMLEventReader eventReader ) ++ { ++ this.eventReader = eventReader; ++ } ++ ++ ResolutionRequest unmarshal() ++ throws XMLStreamException ++ { ++ ResolutionRequestBean resolutionRequestBean = new ResolutionRequestBean(); ++ boolean isPersistentFileNeeded = true; ++ ++ while ( eventReader.hasNext() ) ++ { ++ XMLEvent event = eventReader.nextEvent(); ++ ++ switch ( event.getEventType() ) ++ { ++ case XMLStreamConstants.START_ELEMENT: ++ StartElement startElement = event.asStartElement(); ++ String startName = startElement.getName().getLocalPart(); ++ ++ switch ( startName ) ++ { ++ case "artifact": ++ resolutionRequestBean.setArtifact( new ArtifactUnmarshaller( eventReader ).unmarshal() ); ++ break; ++ ++ case "providerNeeded": ++ resolutionRequestBean.setProviderNeeded( Boolean.valueOf( eventReader.nextEvent().asCharacters().getData() ) ); ++ break; ++ ++ case "persistentFileNeeded": ++ isPersistentFileNeeded = ++ Boolean.valueOf( eventReader.nextEvent().asCharacters().getData() ); ++ break; ++ ++ default: ++ continue; ++ } ++ break; ++ ++ case XMLStreamConstants.END_ELEMENT: ++ if ( event.asEndElement().getName().getLocalPart().equals( "request" ) ) ++ { ++ ResolutionRequest resolutionRequest; ++ try ++ { ++ resolutionRequest = new ResolutionRequestBean.Adapter().unmarshal( resolutionRequestBean ); ++ } ++ catch ( Exception e ) ++ { ++ throw new XMLStreamException( "XML stream does not have a proper format", e ); ++ } ++ resolutionRequest.setPersistentFileNeeded( isPersistentFileNeeded ); ++ return resolutionRequest; ++ } ++ break; ++ ++ default: ++ continue; ++ } ++ } ++ ++ throw new XMLStreamException( "XML stream does not have a proper format" ); ++ } ++} +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionResultBean.java xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionResultBean.java +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionResultBean.java 2019-02-13 22:40:50.101115683 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionResultBean.java 2019-02-13 22:43:31.597842567 +0100 +@@ -18,15 +18,11 @@ + import java.nio.file.Path; + import java.nio.file.Paths; + +-import javax.xml.bind.annotation.XmlRootElement; +-import javax.xml.bind.annotation.adapters.XmlAdapter; +- + import org.fedoraproject.xmvn.resolver.ResolutionResult; + + /** + * @author Mikolaj Izdebski + */ +-@XmlRootElement( name = "result" ) + public class ResolutionResultBean + { + private String artifactPath; +@@ -81,9 +77,7 @@ + * @author Mikolaj Izdebski + */ + public static class Adapter +- extends XmlAdapter + { +- @Override + public ResolutionResultBean marshal( ResolutionResult result ) + throws Exception + { +@@ -97,7 +91,6 @@ + return bean; + } + +- @Override + public ResolutionResult unmarshal( final ResolutionResultBean bean ) + throws Exception + { +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionResultListMarshaller.java xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionResultListMarshaller.java +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionResultListMarshaller.java 1970-01-01 01:00:00.000000000 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/main/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionResultListMarshaller.java 2019-02-13 22:43:31.597842567 +0100 +@@ -0,0 +1,114 @@ ++/*- ++ * Copyright (c) 2018 Red Hat, Inc. ++ * ++ * 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 org.fedoraproject.xmvn.tools.resolve.xml; ++ ++import java.io.BufferedWriter; ++import java.io.IOException; ++import java.io.OutputStream; ++import java.io.OutputStreamWriter; ++import java.util.List; ++ ++import javax.xml.stream.XMLOutputFactory; ++import javax.xml.stream.XMLStreamException; ++import javax.xml.stream.XMLStreamWriter; ++ ++import org.fedoraproject.xmvn.resolver.ResolutionResult; ++ ++/** ++ * @author Marian Koncek ++ */ ++public class ResolutionResultListMarshaller ++{ ++ private List resolutionResults; ++ ++ static class StringConstants ++ { ++ private static final String RESULT = "result"; ++ ++ private static final String ARTIFACT_PATH = "artifactPath"; ++ ++ private static final String PROVIDER = "provider"; ++ ++ private static final String COMPAT_VERSION = "compatVersion"; ++ ++ private static final String NAMESPACE = "namespace"; ++ } ++ ++ public ResolutionResultListMarshaller( List resolutionResults ) ++ { ++ this.resolutionResults = resolutionResults; ++ } ++ ++ public void marshal( OutputStream stream ) ++ throws IOException, XMLStreamException ++ { ++ try ( BufferedWriter bw = new BufferedWriter( new OutputStreamWriter( stream ) ) ) ++ { ++ XMLStreamWriter xsw = XMLOutputFactory.newInstance().createXMLStreamWriter( bw ); ++ ++ try ++ { ++ xsw.writeStartElement( "results" ); ++ ++ for ( ResolutionResult resolutionResult : resolutionResults ) ++ { ++ if ( resolutionResult == null ) ++ { ++ continue; ++ } ++ ++ xsw.writeStartElement( StringConstants.RESULT ); ++ ++ if ( resolutionResult.getArtifactPath() != null ) ++ { ++ xsw.writeStartElement( StringConstants.ARTIFACT_PATH ); ++ xsw.writeCharacters( resolutionResult.getArtifactPath().toString() ); ++ xsw.writeEndElement(); ++ } ++ ++ if ( resolutionResult.getProvider() != null ) ++ { ++ xsw.writeStartElement( StringConstants.PROVIDER ); ++ xsw.writeCharacters( resolutionResult.getProvider() ); ++ xsw.writeEndElement(); ++ } ++ ++ if ( resolutionResult.getCompatVersion() != null ) ++ { ++ xsw.writeStartElement( StringConstants.COMPAT_VERSION ); ++ xsw.writeCharacters( resolutionResult.getCompatVersion() ); ++ xsw.writeEndElement(); ++ } ++ ++ if ( resolutionResult.getNamespace() != null ) ++ { ++ xsw.writeStartElement( StringConstants.NAMESPACE ); ++ xsw.writeCharacters( resolutionResult.getNamespace() ); ++ xsw.writeEndElement(); ++ } ++ ++ xsw.writeEndElement(); ++ } ++ ++ xsw.writeEndElement(); ++ } ++ finally ++ { ++ xsw.close(); ++ } ++ } ++ } ++} +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionRequestUnmarshallerListTest.java xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionRequestUnmarshallerListTest.java +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionRequestUnmarshallerListTest.java 1970-01-01 01:00:00.000000000 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionRequestUnmarshallerListTest.java 2019-02-13 22:43:33.765852321 +0100 +@@ -0,0 +1,178 @@ ++/*- ++ * Copyright (c) 2018 Red Hat, Inc. ++ * ++ * 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 org.fedoraproject.xmvn.tools.resolve.xml; ++ ++import static org.junit.Assert.assertEquals; ++import static org.junit.Assert.assertTrue; ++ ++import java.io.FileInputStream; ++import java.io.IOException; ++import java.io.InputStream; ++import java.util.List; ++ ++import javax.xml.stream.XMLStreamException; ++ ++import org.junit.Test; ++ ++import org.fedoraproject.xmvn.artifact.Artifact; ++import org.fedoraproject.xmvn.resolver.ResolutionRequest; ++ ++/** ++ * @author Marian Koncek ++ */ ++public class ResolutionRequestUnmarshallerListTest ++{ ++ private final String resourcePath = "src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml"; ++ ++ @Test ++ public void testEmptierList() ++ throws IOException, XMLStreamException ++ { ++ try ( InputStream is = new FileInputStream( resourcePath + "/test-emptier-list.xml" ) ) ++ { ++ List list = new ResolutionRequestListUnmarshaller( is ).unmarshal(); ++ ++ // The implementation may change. Any of the two results is correct. ++ assertTrue( list == null || list.isEmpty() ); ++ } ++ } ++ ++ @Test ++ public void testEmptyList() ++ throws IOException, XMLStreamException ++ { ++ try ( InputStream is = new FileInputStream( resourcePath + "/test-empty-list.xml" ) ) ++ { ++ List list = new ResolutionRequestListUnmarshaller( is ).unmarshal(); ++ ++ // The implementation may change. Any of the two results is correct. ++ assertTrue( list == null || list.isEmpty() ); ++ } ++ } ++ ++ @Test ++ public void testFullArtifact() ++ throws IOException, XMLStreamException ++ { ++ try ( InputStream is = new FileInputStream( resourcePath + "/test-full-artifact.xml" ) ) ++ { ++ List list = new ResolutionRequestListUnmarshaller( is ).unmarshal(); ++ ++ assertEquals( 1, list.size() ); ++ ++ Artifact artifact = list.get( 0 ).getArtifact(); ++ ++ assertEquals( "test1", artifact.getArtifactId() ); ++ assertEquals( "test1", artifact.getGroupId() ); ++ assertEquals( "test1", artifact.getExtension() ); ++ assertEquals( "test1", artifact.getClassifier() ); ++ assertEquals( "test1", artifact.getVersion() ); ++ assertEquals( "/dev/null", artifact.getPath().toString() ); ++ } ++ } ++ ++ @Test ++ public void testFullRequests() ++ throws IOException, XMLStreamException ++ { ++ try ( InputStream is = new FileInputStream( resourcePath + "/test-full-requests.xml" ) ) ++ { ++ List list = new ResolutionRequestListUnmarshaller( is ).unmarshal(); ++ ++ assertEquals( 6, list.size() ); ++ ++ assertEquals( true, list.get( 0 ).isProviderNeeded() ); ++ assertEquals( true, list.get( 0 ).isPersistentFileNeeded() ); ++ ++ assertEquals( false, list.get( 1 ).isProviderNeeded() ); ++ assertEquals( false, list.get( 1 ).isPersistentFileNeeded() ); ++ ++ assertEquals( false, list.get( 2 ).isProviderNeeded() ); ++ assertEquals( true, list.get( 2 ).isPersistentFileNeeded() ); ++ ++ assertEquals( true, list.get( 3 ).isProviderNeeded() ); ++ assertEquals( false, list.get( 3 ).isPersistentFileNeeded() ); ++ ++ assertEquals( true, list.get( 4 ).isPersistentFileNeeded() ); ++ ++ assertEquals( true, list.get( 5 ).isProviderNeeded() ); ++ } ++ } ++ ++ @Test ++ public void testIntegrationExample() ++ throws IOException, XMLStreamException ++ { ++ try ( InputStream is = new FileInputStream( resourcePath + "/test-integration-example.xml" ) ) ++ { ++ List list = new ResolutionRequestListUnmarshaller( is ).unmarshal(); ++ ++ assertEquals( 2, list.size() ); ++ ++ assertEquals( "foobar", list.get( 0 ).getArtifact().getGroupId() ); ++ assertEquals( "xyzzy", list.get( 0 ).getArtifact().getArtifactId() ); ++ ++ assertEquals( "junit", list.get( 1 ).getArtifact().getArtifactId() ); ++ assertEquals( "junit", list.get( 1 ).getArtifact().getGroupId() ); ++ } ++ } ++ ++ @Test ++ public void testMinimalArtifacts() ++ throws IOException, XMLStreamException ++ { ++ try ( InputStream is = new FileInputStream( resourcePath + "/test-minimal-artifacts.xml" ) ) ++ { ++ List list = new ResolutionRequestListUnmarshaller( is ).unmarshal(); ++ ++ assertEquals( 5, list.size() ); ++ ++ int artifactNum = 1; ++ ++ for ( ResolutionRequest rr : list ) ++ { ++ Artifact artifact = rr.getArtifact(); ++ ++ assertEquals( "test" + Integer.toString( artifactNum ), artifact.getArtifactId() ); ++ assertEquals( "test" + Integer.toString( artifactNum ), artifact.getGroupId() ); ++ ++artifactNum; ++ } ++ } ++ } ++ ++ @Test ++ public void testNestedBrackets() ++ throws IOException, XMLStreamException ++ { ++ try ( InputStream is = new FileInputStream( resourcePath + "/test-nested-brackets.xml" ) ) ++ { ++ List list = new ResolutionRequestListUnmarshaller( is ).unmarshal(); ++ ++ assertEquals( 1, list.size() ); ++ ++ assertEquals( false, list.get( 0 ).isPersistentFileNeeded() ); ++ ++ list.get( 0 ).getArtifact(); ++ list.get( 0 ).getArtifact().getExtension(); ++ assertEquals( "jar", list.get( 0 ).getArtifact().getExtension() ); ++ assertEquals( "aliased-component-metadata", list.get( 0 ).getArtifact().getArtifactId() ); ++ assertEquals( "any", list.get( 0 ).getArtifact().getVersion() ); ++ assertEquals( "alias-test", list.get( 0 ).getArtifact().getGroupId() ); ++ ++ assertEquals( false, list.get( 0 ).isProviderNeeded() ); ++ } ++ } ++} +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionResultMarshallerListTest.java xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionResultMarshallerListTest.java +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionResultMarshallerListTest.java 1970-01-01 01:00:00.000000000 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/java/org/fedoraproject/xmvn/tools/resolve/xml/ResolutionResultMarshallerListTest.java 2019-02-13 22:43:33.765852321 +0100 +@@ -0,0 +1,78 @@ ++/*- ++ * Copyright (c) 2018 Red Hat, Inc. ++ * ++ * 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 org.fedoraproject.xmvn.tools.resolve.xml; ++ ++import java.util.ArrayList; ++import java.util.Arrays; ++import java.util.List; ++ ++import org.junit.Test; ++ ++import org.fedoraproject.xmvn.resolver.ResolutionResult; ++ ++/** ++ * @author Marian Koncek ++ */ ++public class ResolutionResultMarshallerListTest ++{ ++ @Test ++ public void testEmpty() ++ throws Exception ++ { ++ new ResolutionResultListMarshaller( Arrays.asList( new ResolutionResult[] { null } ) ).marshal( System.out ); ++ } ++ ++ @Test ++ public void testMultiple() ++ throws Exception ++ { ++ List list = new ArrayList<>(); ++ ++ ResolutionResultBean temp; ++ temp = new ResolutionResultBean(); ++ temp.setArtifactPath( "/dev/null" ); ++ temp.setCompatVersion( "comp1" ); ++ temp.setNamespace( "namespace1" ); ++ temp.setProvider( "provider1" ); ++ list.add( new ResolutionResultBean.Adapter().unmarshal( temp ) ); ++ ++ temp = new ResolutionResultBean(); ++ temp.setArtifactPath( "/dev/null" ); ++ temp.setCompatVersion( "comp2" ); ++ temp.setNamespace( "namespace2" ); ++ temp.setProvider( "provider2" ); ++ list.add( new ResolutionResultBean.Adapter().unmarshal( temp ) ); ++ ++ list.add( null ); ++ ++ temp = new ResolutionResultBean(); ++ temp.setArtifactPath( "/dev/null" ); ++ temp.setCompatVersion( "comp3" ); ++ temp.setNamespace( "namespace3" ); ++ temp.setProvider( "provider3" ); ++ list.add( new ResolutionResultBean.Adapter().unmarshal( temp ) ); ++ ++ new ResolutionResultListMarshaller( list ).marshal( System.out ); ++ } ++ ++ @Test ++ public void testSingle() ++ throws Exception ++ { ++ ResolutionResult rr = new ResolutionResultBean.Adapter().unmarshal( new ResolutionResultBean() ); ++ new ResolutionResultListMarshaller( Arrays.asList( new ResolutionResult[] { rr } ) ).marshal( System.out ); ++ } ++} +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-emptier-list.xml xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-emptier-list.xml +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-emptier-list.xml 1970-01-01 01:00:00.000000000 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-emptier-list.xml 2019-02-13 22:43:33.765852321 +0100 +@@ -0,0 +1 @@ ++ +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-empty-list.xml xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-empty-list.xml +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-empty-list.xml 1970-01-01 01:00:00.000000000 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-empty-list.xml 2019-02-13 22:43:33.765852321 +0100 +@@ -0,0 +1,3 @@ ++ ++ ++ +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-full-artifact.xml xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-full-artifact.xml +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-full-artifact.xml 1970-01-01 01:00:00.000000000 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-full-artifact.xml 2019-02-13 22:43:33.765852321 +0100 +@@ -0,0 +1,13 @@ ++ ++ ++ ++ ++ test1 ++ test1 ++ test1 ++ test1 ++ test1 ++ /dev/null ++ ++ ++ +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-full-requests.xml xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-full-requests.xml +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-full-requests.xml 1970-01-01 01:00:00.000000000 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-full-requests.xml 2019-02-13 22:43:33.765852321 +0100 +@@ -0,0 +1,49 @@ ++ ++ ++ ++ ++ test1 ++ test1 ++ ++ true ++ true ++ ++ ++ ++ test2 ++ test2 ++ ++ false ++ false ++ ++ ++ ++ test3 ++ test3 ++ ++ false ++ true ++ ++ ++ ++ test4 ++ test4 ++ ++ true ++ false ++ ++ ++ ++ test5 ++ test5 ++ ++ true ++ ++ ++ ++ test6 ++ test6 ++ ++ true ++ ++ +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-integration-example.xml xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-integration-example.xml +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-integration-example.xml 1970-01-01 01:00:00.000000000 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-integration-example.xml 2019-02-13 22:43:33.765852321 +0100 +@@ -0,0 +1,14 @@ ++ ++ ++ ++ foobar ++ xyzzy ++ ++ ++ ++ ++ junit ++ junit ++ ++ ++ +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-minimal-artifacts.xml xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-minimal-artifacts.xml +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-minimal-artifacts.xml 1970-01-01 01:00:00.000000000 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-minimal-artifacts.xml 2019-02-13 22:43:33.765852321 +0100 +@@ -0,0 +1,33 @@ ++ ++ ++ ++ ++ test1 ++ test1 ++ ++ ++ ++ ++ test2 ++ test2 ++ ++ ++ ++ ++ test3 ++ test3 ++ ++ ++ ++ ++ test4 ++ test4 ++ ++ ++ ++ ++ test5 ++ test5 ++ ++ ++ +diff -urEbwBN xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-nested-brackets.xml xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-nested-brackets.xml +--- xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-nested-brackets.xml 1970-01-01 01:00:00.000000000 +0100 ++++ xmvn-3.0.0/xmvn-tools/xmvn-resolve/src/test/resources/org/fedoraproject/xmvn/tools/resolve/xml/test-nested-brackets.xml 2019-02-13 22:43:33.765852321 +0100 +@@ -0,0 +1,15 @@ ++ ++ ++ ++ false ++ ++ jar ++ aliased-component-metadata ++ ++ ++ any ++ alias- ++ ++ ++ ++ diff --git a/0001-Support-setting-Xdoclint-none-in-m-javadoc-p-3.0.0.patch b/0001-Support-setting-Xdoclint-none-in-m-javadoc-p-3.0.0.patch new file mode 100644 index 0000000..0e698f9 --- /dev/null +++ b/0001-Support-setting-Xdoclint-none-in-m-javadoc-p-3.0.0.patch @@ -0,0 +1,30 @@ +From 9aa9c66be355d95e2c532bbdfdc98bdbba9b6606 Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Thu, 7 Dec 2017 15:50:52 +0200 +Subject: [PATCH] Support setting "-Xdoclint:none" in m-javadoc-p >= 3.0.0 + +maven-javadoc-plugin 3.0.0 replaced `additionalparam` string property +with `additionalOptions` list property. +See: https://issues.apache.org/jira/browse/MJAVADOC-368 +--- + .../fedoraproject/xmvn/connector/aether/XMvnMojoExecutionListener.java | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMojoExecutionListener.java b/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMojoExecutionListener.java +index 5f9b5dd4..bb066638 100644 +--- a/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMojoExecutionListener.java ++++ b/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMojoExecutionListener.java +@@ -267,7 +267,10 @@ public class XMvnMojoExecutionListener + // Disable doclint + if ( JAVADOC_AGGREGATE.equals( execution ) ) + { ++ // maven-javadoc-plugin < 3.0.0 + trySetBeanProperty( mojo, "additionalparam", "-Xdoclint:none" ); ++ // maven-javadoc-plugin >= 3.0.0 ++ trySetBeanProperty( mojo, "additionalOptions", new String[] { "-Xdoclint:none" } ); + } + else if ( XMVN_BUILDDEP.equals( execution ) ) + { +-- +2.14.3 + diff --git a/0001-Use-apache-commons-compress-for-manifest-injection-a.patch b/0001-Use-apache-commons-compress-for-manifest-injection-a.patch new file mode 100644 index 0000000..1f5c80a --- /dev/null +++ b/0001-Use-apache-commons-compress-for-manifest-injection-a.patch @@ -0,0 +1,593 @@ +From 4e1e7377d6318d2bd7dd8620269e172a704650e2 Mon Sep 17 00:00:00 2001 +From: Michael Simacek +Date: Mon, 16 Apr 2018 15:29:50 +0200 +Subject: [PATCH] Use apache-commons-compress for manifest injection and native + code detection + +--- + xmvn-parent/pom.xml | 8 +- + xmvn-tools/xmvn-install/pom.xml | 4 + + .../fedoraproject/xmvn/tools/install/JarUtils.java | 176 +++++++++------------ + .../xmvn/tools/install/impl/JarUtilsTest.java | 55 +++++++ + .../src/test/resources/recompression-size.jar | Bin 0 -> 4376 bytes + xmvn.spec | 3 +- + 6 files changed, 140 insertions(+), 106 deletions(-) + create mode 100644 xmvn-tools/xmvn-install/src/test/resources/recompression-size.jar + +diff --git a/xmvn-parent/pom.xml b/xmvn-parent/pom.xml +index df6af7fb..f6465d90 100644 +--- a/xmvn-parent/pom.xml ++++ b/xmvn-parent/pom.xml +@@ -92,6 +92,7 @@ + 3.0.24 + 3.5 + 1.7.25 ++ 1.16.1 + + + 1.3.2.GA +@@ -102,7 +103,7 @@ + 3.6.1 + 3.0.0 + 2.8.2 +- 3.4 ++ 3.5 + 1.6 + 2.5.2 + 0.7.9 +@@ -321,6 +322,11 @@ + plexus-container-default + ${plexusVersion} + ++ ++ org.apache.commons ++ commons-compress ++ ${commonsCompressVersion} ++ + + + +diff --git a/xmvn-tools/xmvn-install/pom.xml b/xmvn-tools/xmvn-install/pom.xml +index 66ac01d7..fbb36a68 100644 +--- a/xmvn-tools/xmvn-install/pom.xml ++++ b/xmvn-tools/xmvn-install/pom.xml +@@ -61,5 +61,9 @@ + org.ow2.asm + asm + ++ ++ org.apache.commons ++ commons-compress ++ + + +diff --git a/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/JarUtils.java b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/JarUtils.java +index 98d3a57e..5cb62b0f 100644 +--- a/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/JarUtils.java ++++ b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/JarUtils.java +@@ -16,19 +16,16 @@ + package org.fedoraproject.xmvn.tools.install; + + import java.io.IOException; +-import java.lang.reflect.Field; ++import java.io.InputStream; + import java.nio.file.Files; + import java.nio.file.Path; +-import java.util.Collection; ++import java.util.Enumeration; + import java.util.jar.Attributes; +-import java.util.jar.JarEntry; +-import java.util.jar.JarInputStream; +-import java.util.jar.JarOutputStream; + import java.util.jar.Manifest; +-import java.util.zip.ZipEntry; +-import java.util.zip.ZipInputStream; +-import java.util.zip.ZipOutputStream; + ++import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; ++import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; ++import org.apache.commons.compress.archivers.zip.ZipFile; + import org.objectweb.asm.ClassReader; + import org.objectweb.asm.ClassVisitor; + import org.objectweb.asm.MethodVisitor; +@@ -43,6 +40,8 @@ import org.fedoraproject.xmvn.artifact.Artifact; + */ + public final class JarUtils + { ++ private static final String MANIFEST_PATH = "META-INF/MANIFEST.MF"; ++ + private static final Logger LOGGER = LoggerFactory.getLogger( JarUtils.class ); + + // From /usr/include/linux/elf.h +@@ -67,28 +66,33 @@ public final class JarUtils + * + * @return {@code true} if native code was found inside given JAR + */ +- public static boolean containsNativeCode( Path jar ) ++ public static boolean containsNativeCode( Path jarPath ) + { +- try ( ZipInputStream jis = new ZipInputStream( Files.newInputStream( jar ) ) ) ++ try ( ZipFile jar = new ZipFile( jarPath.toFile() ) ) + { +- ZipEntry ent; +- while ( ( ent = jis.getNextEntry() ) != null ) ++ Enumeration entries = jar.getEntries(); ++ while ( entries.hasMoreElements() ) + { +- if ( ent.isDirectory() ) ++ ZipArchiveEntry entry = entries.nextElement(); ++ if ( entry.isDirectory() ) + continue; +- if ( jis.read() == ELFMAG0 && jis.read() == ELFMAG1 && jis.read() == ELFMAG2 && jis.read() == ELFMAG3 ) ++ try ( InputStream jis = jar.getInputStream( entry ) ) + { +- LOGGER.debug( "Native code found inside {}: {}", jar, ent.getName() ); +- return true; ++ if ( jis.read() == ELFMAG0 && jis.read() == ELFMAG1 && jis.read() == ELFMAG2 ++ && jis.read() == ELFMAG3 ) ++ { ++ LOGGER.debug( "Native code found inside {}: {}", jarPath, entry.getName() ); ++ return true; ++ } + } + } + +- LOGGER.trace( "Native code not found inside {}", jar ); ++ LOGGER.trace( "Native code not found inside {}", jarPath ); + return false; + } + catch ( IOException e ) + { +- LOGGER.debug( "I/O exception caught when trying to determine whether JAR contains native code: {}", jar, ++ LOGGER.debug( "I/O exception caught when trying to determine whether JAR contains native code: {}", jarPath, + e ); + return false; + } +@@ -122,40 +126,47 @@ public final class JarUtils + * + * @return {@code true} given JAR as found inside to use native code + */ +- public static boolean usesNativeCode( Path jar ) ++ public static boolean usesNativeCode( Path jarPath ) + { +- try ( ZipInputStream jis = new ZipInputStream( Files.newInputStream( jar ) ) ) ++ try ( ZipFile jar = new ZipFile( jarPath.toFile() ) ) + { +- ZipEntry ent; +- while ( ( ent = jis.getNextEntry() ) != null ) ++ Enumeration entries = jar.getEntries(); ++ while ( entries.hasMoreElements() ) + { +- final String entryName = ent.getName(); +- if ( ent.isDirectory() || !entryName.endsWith( ".class" ) ) ++ ZipArchiveEntry entry = entries.nextElement(); ++ final String entryName = entry.getName(); ++ if ( entry.isDirectory() || !entryName.endsWith( ".class" ) ) + continue; + +- new ClassReader( jis ).accept( new ClassVisitor( Opcodes.ASM4 ) ++ try ( InputStream jis = jar.getInputStream( entry ) ) + { +- @Override +- public MethodVisitor visitMethod( int flags, String name, String desc, String sig, String[] exc ) ++ new ClassReader( jis ).accept( new ClassVisitor( Opcodes.ASM4 ) + { +- if ( ( flags & Opcodes.ACC_NATIVE ) != 0 ) +- throw new NativeMethodFound( entryName, name, sig ); ++ @Override ++ public MethodVisitor visitMethod( int flags, String name, String desc, String sig, ++ String[] exc ) ++ { ++ if ( ( flags & Opcodes.ACC_NATIVE ) != 0 ) ++ throw new NativeMethodFound( entryName, name, sig ); + +- return super.visitMethod( flags, name, desc, sig, exc ); +- } +- }, ClassReader.SKIP_CODE ); ++ return super.visitMethod( flags, name, desc, sig, exc ); ++ } ++ }, ClassReader.SKIP_CODE ); ++ } + } + + return false; + } + catch ( NativeMethodFound e ) + { +- LOGGER.debug( "Native method {}({}) found in {}: {}", e.methodName, e.methodSignature, jar, e.className ); ++ LOGGER.debug( "Native method {}({}) found in {}: {}", e.methodName, e.methodSignature, jarPath, ++ e.className ); + return true; + } + catch ( IOException e ) + { +- LOGGER.debug( "I/O exception caught when trying to determine whether JAR uses native code: {}", jar, e ); ++ LOGGER.debug( "I/O exception caught when trying to determine whether JAR uses native code: {}", jarPath, ++ e ); + return false; + } + catch ( RuntimeException e ) +@@ -178,29 +189,13 @@ public final class JarUtils + } + } + +- /** +- * OpenJDK has a sanity check that prevents adding duplicate entries to ZIP streams. The problem is that some of +- * JARs we try to inject manifests to (especially the ones created by Gradle) already contain duplicate entries, so +- * manifest injection would always fail for them with "ZipException: duplicate entry". +- *

+- * This function tries to work around this OpenJDK sanity check, effectively allowing creating ZIP files with +- * duplicated entries. It should be called on particular ZIP output stream before adding each duplicate entry. +- * +- * @param zipOutputStream ZIP stream to hack +- */ +- private static void openJdkAvoidDuplicateEntryHack( ZipOutputStream zipOutputStream ) ++ private static void updateManifest( Artifact artifact, Manifest mf ) + { +- try +- { +- Field namesField = ZipOutputStream.class.getDeclaredField( "names" ); +- namesField.setAccessible( true ); +- Collection names = (Collection) namesField.get( zipOutputStream ); +- names.clear(); +- } +- catch ( ReflectiveOperationException e ) +- { +- // This hack relies on OpenJDK internals and therefore is not guaranteed to work. Ignore failures. +- } ++ putAttribute( mf, Artifact.MF_KEY_GROUPID, artifact.getGroupId(), null ); ++ putAttribute( mf, Artifact.MF_KEY_ARTIFACTID, artifact.getArtifactId(), null ); ++ putAttribute( mf, Artifact.MF_KEY_EXTENSION, artifact.getExtension(), Artifact.DEFAULT_EXTENSION ); ++ putAttribute( mf, Artifact.MF_KEY_CLASSIFIER, artifact.getClassifier(), "" ); ++ putAttribute( mf, Artifact.MF_KEY_VERSION, artifact.getVersion(), Artifact.DEFAULT_VERSION ); + } + + /** +@@ -213,65 +208,38 @@ public final class JarUtils + public static void injectManifest( Path targetJar, Artifact artifact ) + { + LOGGER.trace( "Trying to inject manifest to {}", artifact ); +- Manifest mf = null; + try + { +- try ( JarInputStream jis = new JarInputStream( Files.newInputStream( targetJar ) ) ) ++ try ( ZipFile jar = new ZipFile( targetJar.toFile() ) ) + { +- mf = jis.getManifest(); +- if ( mf == null ) ++ ZipArchiveEntry manifestEntry = jar.getEntry( MANIFEST_PATH ); ++ if ( manifestEntry != null ) + { +- // getManifest sometimes doesn't find the manifest, try finding it as plain entry +- ZipEntry ent; +- while ( ( ent = jis.getNextEntry() ) != null ) ++ Manifest mf = new Manifest( jar.getInputStream( manifestEntry ) ); ++ updateManifest( artifact, mf ); ++ Files.delete( targetJar ); ++ try ( ZipArchiveOutputStream os = new ZipArchiveOutputStream( targetJar.toFile() ) ) + { +- if ( ent.getName().equalsIgnoreCase( "META-INF/MANIFEST.MF" ) ) +- { +- mf = new Manifest( jis ); +- break; +- } ++ // write manifest ++ ZipArchiveEntry newManifestEntry = new ZipArchiveEntry( MANIFEST_PATH ); ++ os.putArchiveEntry( newManifestEntry ); ++ mf.write( os ); ++ os.closeArchiveEntry(); ++ // copy the rest of content ++ jar.copyRawEntries( os, entry -> !entry.equals( manifestEntry ) ); + } +- } +- } +- +- if ( mf == null ) +- { +- LOGGER.trace( "Manifest injection skipped: no pre-existing manifest found to update" ); +- return; +- } +- +- putAttribute( mf, Artifact.MF_KEY_GROUPID, artifact.getGroupId(), null ); +- putAttribute( mf, Artifact.MF_KEY_ARTIFACTID, artifact.getArtifactId(), null ); +- putAttribute( mf, Artifact.MF_KEY_EXTENSION, artifact.getExtension(), Artifact.DEFAULT_EXTENSION ); +- putAttribute( mf, Artifact.MF_KEY_CLASSIFIER, artifact.getClassifier(), "" ); +- putAttribute( mf, Artifact.MF_KEY_VERSION, artifact.getVersion(), Artifact.DEFAULT_VERSION ); +- +- try ( JarInputStream jis = new JarInputStream( Files.newInputStream( targetJar ) ) ) +- { +- +- targetJar = targetJar.toRealPath(); +- Files.delete( targetJar ); +- try ( JarOutputStream jos = new JarOutputStream( Files.newOutputStream( targetJar ), mf ) ) +- { +- byte[] buf = new byte[512]; +- JarEntry entry; +- while ( ( entry = jis.getNextJarEntry() ) != null ) ++ catch ( IOException e ) + { +- openJdkAvoidDuplicateEntryHack( jos ); +- jos.putNextEntry( entry ); +- +- int sz; +- while ( ( sz = jis.read( buf ) ) > 0 ) +- jos.write( buf, 0, sz ); ++ // Re-throw exceptions that occur when processing JAR file after reading header and manifest. ++ throw new RuntimeException( e ); + } ++ LOGGER.trace( "Manifest injected successfully" ); + } +- catch ( IOException e ) ++ else + { +- // Re-throw exceptions that occur when processing JAR file after reading header and manifest. +- throw new RuntimeException( e ); ++ LOGGER.trace( "Manifest injection skipped: no pre-existing manifest found to update" ); ++ return; + } +- +- LOGGER.trace( "Manifest injected successfully" ); + } + } + catch ( IOException e ) +diff --git a/xmvn-tools/xmvn-install/src/test/java/org/fedoraproject/xmvn/tools/install/impl/JarUtilsTest.java b/xmvn-tools/xmvn-install/src/test/java/org/fedoraproject/xmvn/tools/install/impl/JarUtilsTest.java +index 3ec10cfa..98945a64 100644 +--- a/xmvn-tools/xmvn-install/src/test/java/org/fedoraproject/xmvn/tools/install/impl/JarUtilsTest.java ++++ b/xmvn-tools/xmvn-install/src/test/java/org/fedoraproject/xmvn/tools/install/impl/JarUtilsTest.java +@@ -19,11 +19,13 @@ import static org.junit.Assert.assertEquals; + import static org.junit.Assert.assertFalse; + import static org.junit.Assert.assertNotNull; + import static org.junit.Assert.assertTrue; ++import static org.junit.Assume.assumeTrue; + + import java.nio.file.Files; + import java.nio.file.Path; + import java.nio.file.Paths; + import java.nio.file.StandardCopyOption; ++import java.nio.file.attribute.PosixFilePermission; + import java.util.Arrays; + import java.util.jar.Attributes; + import java.util.jar.JarInputStream; +@@ -116,6 +118,38 @@ public class JarUtilsTest + } + } + ++ /** ++ * Regression test for a jar which contains an entry that can recompress with a different size, which caused a ++ * mismatch in sizes. ++ * ++ * @throws Exception ++ */ ++ @Test ++ public void testManifestInjectionRecompressionCausesSizeMismatch() ++ throws Exception ++ { ++ Path testResource = Paths.get( "src/test/resources/recompression-size.jar" ); ++ Path testJar = workDir.resolve( "manifest.jar" ); ++ Files.copy( testResource, testJar, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING ); ++ ++ Artifact artifact = ++ new DefaultArtifact( "org.eclipse.osgi", "osgi.compatibility.state", "1.1.0.v20180409-1212" ); ++ JarUtils.injectManifest( testJar, artifact ); ++ ++ try ( JarInputStream jis = new JarInputStream( Files.newInputStream( testJar ) ) ) ++ { ++ Manifest mf = jis.getManifest(); ++ assertNotNull( mf ); ++ ++ Attributes attr = mf.getMainAttributes(); ++ assertNotNull( attr ); ++ ++ assertEquals( "org.eclipse.osgi", attr.getValue( "JavaPackages-GroupId" ) ); ++ assertEquals( "osgi.compatibility.state", attr.getValue( "JavaPackages-ArtifactId" ) ); ++ assertEquals( "1.1.0.v20180409-1212", attr.getValue( "JavaPackages-Version" ) ); ++ } ++ } ++ + /** + * Test JAR if manifest injection works as expected when some artifact fields have default values. + * +@@ -148,6 +182,27 @@ public class JarUtilsTest + } + } + ++ /** ++ * Test JAR if manifest injection preserves sane file perms. ++ * ++ * @throws Exception ++ */ ++ @Test ++ public void testManifestInjectionSanePermissions() ++ throws Exception ++ { ++ Path testResource = Paths.get( "src/test/resources/example.jar" ); ++ Path testJar = workDir.resolve( "manifest.jar" ); ++ Files.copy( testResource, testJar, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING ); ++ ++ assumeTrue( "sane umask", Files.getPosixFilePermissions( testJar ).contains( PosixFilePermission.OTHERS_READ ) ); ++ ++ Artifact artifact = new DefaultArtifact( "org.apache.maven", "maven-model", "xsd", "model", "2.2.1" ); ++ JarUtils.injectManifest( testJar, artifact ); ++ ++ assertTrue( Files.getPosixFilePermissions( testJar ).contains( PosixFilePermission.OTHERS_READ ) ); ++ } ++ + /** + * Test if native code detection works as expected. + * +diff --git a/xmvn-tools/xmvn-install/src/test/resources/recompression-size.jar b/xmvn-tools/xmvn-install/src/test/resources/recompression-size.jar +new file mode 100644 +index 00000000..976481ea +--- /dev/null ++++ b/xmvn-tools/xmvn-install/src/test/resources/recompression-size.jar +@@ -0,0 +1,145 @@ ++PK ++LLMETA-INF/MANIFEST.MFUT GZ;HZux HHManifest-Version: 1.0 ++ ++PKLL^] dir/fileUT 7GZ8GZux HH0ӫ' QJ %a6mu,%8=x}y?W۳ TxPPATxP{@PATxP{@TxPAPj=ƒ„PPP{@ATx{@PPATx{@APPTxAATxP{PATxP{@PAP{@Tx{@PPTx{@Aԅ ++o(0PPAATxP{PPATxP{@GxPPAP*<=ƒ@TxP{@] ++o PPuaƒ ++*=. Tx{@ATxPPATxP{@PPATxP{@TxPAPj=ƒ„PAP{@ATx{@PPTx{@APPTxAATxP{PATxP{@PAP{@Tx{@PPTxP{@Aԅ ++o(0PPP ++*=ƒ#<( ++jƒ*<=ƒ ++j ++*<=ƒ@TxP{@] ++j PPuaƒ ++*=. Tx{@ATxPPPATxP{@PPATxP{@TxPAPATxP{@]*<=j ++o= ++*= ++o( ++*=ƒ ++/<( ++jƒ*<=ƒ ++j ++*<=ƒj ++j=ƒ ++*= ++j(0PAP ++*=@ATxP{PPATx{@AGxPPAPATxP{@PAuaƒ*<=. TxP{@Aԅ ++j(0P{@PPATx{@APPATx{@ATxPPATxP{@PAP{@Tx{@PPTx{@APPP{@ATxPPPATx{@AGxPPAAATxP{@PATxP{@PAP*<=@ATx{@]( ++o PPATx{@AGxPPPATxP{@PAuaƒ*<=. TxP{@ԅ ++j(0P{@PPATx{@APPTx{@ATxPPATxP{@PAP{@Tx{@PPTxP{@APPP{@ATx{@]( ++j ++*<=ƒ ++j ++*<=ƒ#<( ++j=ƒ*<= ++j(0PAP*<=@ATx{@]( ++o PPATx{@ATxPAPATxP{@PAuaƒ*<=. TxP{@ԅj( ++o= ++*< ++o( ++*=ƒ ++o( ++*=ƒ*<= ++j*<=ƒj ++o=ƒ ++*= ++j( ++*=@ATxP{PPATx{@AGxPPAAATxP{@PATxP{@ԅ ++j(0PAP*<=@ATx{@]( ++j ++*<=ƒ ++o( ++*<=ƒ*< ++jƒ*<=. TxP{@ԅj( ++o= ++*= ++o( ++*=ƒ ++o( ++*=ƒ*<=ƒ ++j*<=ƒj ++j=ƒ ++*= ++j( ++*=@ATx{@]( ++j ++*<=ƒ ++o( ++*<=ƒ#<( ++j=ƒ*<=. TxP{@ԅ ++j(0PAP ++*=@ATx{@]( ++j ++*<=ƒ ++o( ++*<=ƒ*< ++j PAua*<=j( ++o= ++*< ++o( ++*=ƒ ++o( ++jƒ*<=ƒ ++j*<=ƒj ++o=ƒ ++*= ++j(0PPP ++*=@ATxP{PPATxP{@GxPPAAATxP{@] ++j PPuaƒ ++*=. TxP{@Aԅ ++o(0PPPPATxP{@PPATxP{@TxPAPATxP{@]= ++j( ++*=j( ++o= ++*< ++o( ++*=ƒ#<( ++jƒ*<= ++j*<=ƒj ++o=ƒ ++*=. TxP{@Aԅ ++o(0PPAATxP{PPATxP{@GxPPAP*<=ƒ@TxP{@] ++o PPuaƒ ++*=. Tx{@ATxPPATxP{@PPATxP{@TxPAPATxP{@APAP{@ATx{@PPTx{@APPAATxP{PATxP{@PAP{@TxP{@PPuaƒ ++*=. Tx{@Aԅ ++o(0PPAATxP{PATxP{@TxPAP*<=ƒ@TxP{@] ++o PPua ++*=ƒ ++o( ++*=ƒ*< ++j ++*<=ƒ ++j ++j=ƒ ++*= ++j(*<=j( ++o= ++*< ++o( ++*=ƒ#<( ++jƒ*<=ƒ ++j*<=ƒj ++o PPuaƒ ++*=. Tx{@Aԅ ++o( ++*=ƒ#<( ++jƒ*<=ƒ ++j ++*<=ƒ@TxP{@] ++o PPua ++*=ƒ ++o( ++*= ++*< ++j ++*<=ƒ ++j ++j=ƒ*<= ++j(*<=j( ++o= ++*= ++o( ++*=ƒ#<( ++jƒ*<=ƒ ++j*<=ƒjOPK ++LLMETA-INF/MANIFEST.MFUTGZux HHPKLL^] gdir/fileUT7GZux HHPKZ +\ No newline at end of file +diff --git a/xmvn.spec b/xmvn.spec +index 8764b63d..0775d4a2 100644 +--- a/xmvn.spec ++++ b/xmvn.spec +@@ -196,6 +196,7 @@ artifact repository. + + %package install + Summary: XMvn Install ++Requires: apache-commons-compress + + %description install + This package provides XMvn Install, which is a command-line interface +@@ -284,7 +285,7 @@ done + + # helper scripts + %jpackage_script org.fedoraproject.xmvn.tools.bisect.BisectCli "" "-Dxmvn.home=%{_datadir}/%{name}" xmvn/xmvn-bisect:beust-jcommander:maven-invoker:plexus/utils xmvn-bisect +-%jpackage_script org.fedoraproject.xmvn.tools.install.cli.InstallerCli "" "" xmvn/xmvn-install:xmvn/xmvn-api:xmvn/xmvn-core:beust-jcommander:slf4j/api:slf4j/simple:objectweb-asm/asm xmvn-install ++%jpackage_script org.fedoraproject.xmvn.tools.install.cli.InstallerCli "" "" xmvn/xmvn-install:xmvn/xmvn-api:xmvn/xmvn-core:beust-jcommander:slf4j/api:slf4j/simple:objectweb-asm/asm:objenesis/objenesis:commons-compress xmvn-install + %jpackage_script org.fedoraproject.xmvn.tools.resolve.ResolverCli "" "" xmvn/xmvn-resolve:xmvn/xmvn-api:xmvn/xmvn-core:beust-jcommander xmvn-resolve + %jpackage_script org.fedoraproject.xmvn.tools.subst.SubstCli "" "" xmvn/xmvn-subst:xmvn/xmvn-api:xmvn/xmvn-core:beust-jcommander xmvn-subst + +-- +2.14.3 + diff --git a/0001-port-to-gradle-4.4.1.patch b/0001-port-to-gradle-4.4.1.patch new file mode 100644 index 0000000..5d5f627 --- /dev/null +++ b/0001-port-to-gradle-4.4.1.patch @@ -0,0 +1,115 @@ +From 69525c9fff3a3a6b9af6bb542d345d8bc32430e4 Mon Sep 17 00:00:00 2001 +From: Yky +Date: Thu, 4 Oct 2018 20:46:13 +0200 +Subject: [PATCH] port to gradle 4.4.1 + +--- + .../xmvn/connector/gradle/GradleResolver.java | 21 +++++++++++------ + xmvn-parent/pom.xml | 27 +++++++++++----------- + 2 files changed, 28 insertions(+), 20 deletions(-) + +diff --git a/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/GradleResolver.java b/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/GradleResolver.java +index 9e1a247a..9a40aa8c 100644 +--- a/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/GradleResolver.java ++++ b/xmvn-connector-gradle/src/main/java/org/fedoraproject/xmvn/connector/gradle/GradleResolver.java +@@ -40,13 +40,13 @@ import org.gradle.internal.component.external.model.DefaultMutableMavenModuleRes + import org.gradle.internal.component.external.model.FixedComponentArtifacts; + import org.gradle.internal.component.external.model.ModuleComponentArtifactMetadata; + import org.gradle.internal.component.external.model.ModuleComponentResolveMetadata; ++import org.gradle.internal.component.external.model.ModuleDependencyMetadata; + import org.gradle.internal.component.external.model.MutableMavenModuleResolveMetadata; + import org.gradle.internal.component.external.model.MutableModuleComponentResolveMetadata; + import org.gradle.internal.component.model.ComponentArtifactMetadata; + import org.gradle.internal.component.model.ComponentOverrideMetadata; + import org.gradle.internal.component.model.ComponentResolveMetadata; + import org.gradle.internal.component.model.DefaultIvyArtifactName; +-import org.gradle.internal.component.model.DependencyMetadata; + import org.gradle.internal.component.model.IvyArtifactName; + import org.gradle.internal.component.model.ModuleSource; + import org.gradle.internal.resolve.ArtifactResolveException; +@@ -155,12 +155,6 @@ public class GradleResolver + return true; + } + +- @Override +- public void listModuleVersions( DependencyMetadata arg0, BuildableModuleVersionListingResolveResult arg1 ) +- { +- logger.debug( "listModuleVersions() called, but it is NOT IMPLEMENTED" ); +- } +- + @Override + public void resolveArtifact( ComponentArtifactMetadata artifact, ModuleSource module, + BuildableArtifactResolveResult result ) +@@ -306,4 +300,17 @@ public class GradleResolver + { + return MetadataFetchingCost.CHEAP; + } ++ ++ @Override ++ public LocallyAvailableExternalResource getMetaDataArtifact( ModuleDependencyMetadata arg0, ArtifactType arg1 ) ++ { ++ throw new UnsupportedOperationException(); ++ } ++ ++ @Override ++ public void listModuleVersions( ModuleDependencyMetadata arg0, BuildableModuleVersionListingResolveResult arg1 ) ++ { ++ logger.debug( "listModuleVersions() called, but it is NOT IMPLEMENTED" ); ++ ++ } + } +diff --git a/xmvn-parent/pom.xml b/xmvn-parent/pom.xml +index f6465d90..d4f9dda7 100644 +--- a/xmvn-parent/pom.xml ++++ b/xmvn-parent/pom.xml +@@ -84,7 +84,7 @@ + 1 + 2.4.0 + 1.64 +- 4.3.1 ++ 4.4.1 + 2.4.10 + 2.2 + 1.0.3 +@@ -474,6 +474,18 @@ + + + ++ ++ org.apache.rat ++ apache-rat-plugin ++ ++ ++ rat-check ++ ++ check ++ ++ ++ ++ + + + +@@ -501,18 +513,7 @@ + + + +- +- org.apache.rat +- apache-rat-plugin +- +- +- rat-check +- +- check +- +- +- +- ++ + + maven-site-plugin + +-- +2.14.2 + diff --git a/xmvn-3.0.0.tar.xz b/xmvn-3.0.0.tar.xz new file mode 100644 index 0000000..bb57507 --- /dev/null +++ b/xmvn-3.0.0.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ed95573bf8ba028f4fff8da0365c931a90e65b86764f73b89045b0cc6de375a3 +size 168244 diff --git a/xmvn-build.tar.xz b/xmvn-build.tar.xz new file mode 100644 index 0000000..4f1495c --- /dev/null +++ b/xmvn-build.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d24a5dca21ea192468952093125fe7e6768c092e5c091652151a72736af7bd3 +size 4580 diff --git a/xmvn-tools.changes b/xmvn-tools.changes new file mode 100644 index 0000000..27ff598 --- /dev/null +++ b/xmvn-tools.changes @@ -0,0 +1,7 @@ +------------------------------------------------------------------- +Fri Mar 15 16:33:40 UTC 2019 - Fridrich Strba + +- Initial packaging of xmvn-tools 3.0.0 and their dependencies from + xmvn project +- Generate and customize ant build files in order to be able to + build without maven diff --git a/xmvn-tools.spec b/xmvn-tools.spec new file mode 100644 index 0000000..7b481cb --- /dev/null +++ b/xmvn-tools.spec @@ -0,0 +1,270 @@ +# +# spec file for package xmvn +# +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%global parent xmvn +%global subname tools +Name: %{parent}-%{subname} +Version: 3.0.0 +Release: 0 +Summary: Local Extensions for Apache Maven +License: Apache-2.0 +Group: Development/Tools/Building +URL: https://fedora-java.github.io/xmvn/ +Source0: https://github.com/fedora-java/xmvn/releases/download/%{version}/%{parent}-%{version}.tar.xz +Source1: %{parent}-build.tar.xz +Patch0: 0001-Fix-installer-plugin-loading.patch +Patch1: 0001-Port-to-Gradle-4.2.patch +Patch2: 0001-Port-to-Gradle-4.3.1.patch +Patch3: 0001-Support-setting-Xdoclint-none-in-m-javadoc-p-3.0.0.patch +Patch4: 0001-Fix-configuration-of-aliased-plugins.patch +Patch5: 0001-Don-t-use-JAXB-for-converting-bytes-to-hex-string.patch +Patch6: 0001-Use-apache-commons-compress-for-manifest-injection-a.patch +Patch7: 0001-port-to-gradle-4.4.1.patch +Patch8: 0001-Replace-JAXB-parser.patch +BuildRequires: ant +BuildRequires: apache-commons-compress +BuildRequires: beust-jcommander +BuildRequires: fdupes +BuildRequires: javapackages-local +BuildRequires: maven-invoker +BuildRequires: modello +BuildRequires: objectweb-asm +BuildRequires: plexus-containers-component-annotations +BuildRequires: plexus-containers-container-default +BuildRequires: plexus-metadata-generator +BuildRequires: plexus-utils +BuildRequires: slf4j +BuildArch: noarch + +%description +This package provides extensions for Apache Maven that can be used to +manage system artifact repository and use it to resolve Maven +artifacts in offline mode, as well as Maven plugins to help with +creating RPM packages containing Maven artifacts. + +%package -n %{parent}-api +Summary: XMvn API +Group: Development/Tools/Building + +%description -n %{parent}-api +This package provides XMvn API module which contains public interface +for functionality implemented by XMvn Core. + +%package -n %{parent}-core +Summary: XMvn Core +Group: Development/Tools/Building + +%description -n %{parent}-core +This package provides XMvn Core module, which implements the essential +functionality of XMvn such as resolution of artifacts from system +repository. + +%package -n %{parent}-resolve +Summary: XMvn Resolver +# Explicit javapackages-tools requires since scripts use +# /usr/share/java-utils/java-functions +Group: Development/Tools/Building +Requires: beust-jcommander +Requires: javapackages-tools +Requires: %{parent}-api = %{version} +Requires: %{parent}-core = %{version} + +%description -n %{parent}-resolve +This package provides XMvn Resolver, which is a very simple +commald-line tool to resolve Maven artifacts from system repositories. +Basically it's just an interface to artifact resolution mechanism +implemented by XMvn Core. The primary intended use case of XMvn +Resolver is debugging local artifact repositories. + +%package -n %{parent}-bisect +Summary: XMvn Bisect +# Explicit javapackages-tools requires since scripts use +# /usr/share/java-utils/java-functions +Group: Development/Tools/Building +Requires: beust-jcommander +Requires: javapackages-tools +Requires: maven-invoker + +%description -n %{parent}-bisect +This package provides XMvn Bisect, which is a debugging tool that can +diagnose build failures by using bisection method. + +%package -n %{parent}-subst +Summary: XMvn Subst +# Explicit javapackages-tools requires since scripts use +# /usr/share/java-utils/java-functions +Group: Development/Tools/Building +Requires: beust-jcommander +Requires: javapackages-tools +Requires: %{parent}-api = %{version} +Requires: %{parent}-core = %{version} + +%description -n %{parent}-subst +This package provides XMvn Subst, which is a tool that can substitute +Maven artifact files with symbolic links to corresponding files in +artifact repository. + +%package -n %{parent}-install +Summary: XMvn Install +# Explicit javapackages-tools requires since scripts use +# /usr/share/java-utils/java-functions +Group: Development/Tools/Building +Requires: apache-commons-compress +Requires: beust-jcommander +Requires: javapackages-tools +Requires: objectweb-asm +Requires: slf4j +Requires: %{parent}-api = %{version} +Requires: %{parent}-core = %{version} + +%description -n %{parent}-install +This package provides XMvn Install, which is a command-line interface +to XMvn installer. The installer reads reactor metadata and performs +artifact installation according to specified configuration. + +%package -n %{parent}-javadoc +Summary: API documentation for %{name} +Group: Documentation/HTML + +%description -n %{parent}-javadoc +This package provides %{summary}. + +%prep +%setup -q -n %{parent}-%{version} -a1 +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 + +# Bisect IT has no chances of working in local, offline mode, without +# network access - it needs to access remote repositories. +find -name BisectIntegrationTest.java -delete + +# Resolver IT won't work either - it tries to execute JAR file, which +# relies on Class-Path in manifest, which is forbidden in Fedora... +find -name ResolverIntegrationTest.java -delete + +%pom_remove_plugin -r :maven-site-plugin + +# Upstream code quality checks, not relevant when building RPMs +%pom_remove_plugin -r :apache-rat-plugin +%pom_remove_plugin -r :maven-checkstyle-plugin +%pom_remove_plugin -r :jacoco-maven-plugin +# FIXME pom macros don't seem to support submodules in profile +%pom_remove_plugin :jacoco-maven-plugin xmvn-it + +# remove dependency plugin maven-binaries execution +# we provide apache-maven by symlink +%pom_xpath_remove "pom:executions/pom:execution[pom:id[text()='maven-binaries']]" + +# Don't put Class-Path attributes in manifests +%pom_remove_plugin :maven-jar-plugin xmvn-tools + +# This test depends on OpenJDK directory layout that changed since version 9 +%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 9}%{!?pkg_vcmp:0} +rm -f xmvn-core/src/test/java/org/fedoraproject/xmvn/resolver/JavaHomeResolverTest.java +%endif + +for i in api core; do + %pom_xpath_inject "pom:project" " + org.fedoraproject.xmvn + %{version}" %{parent}-${i} + %pom_remove_parent %{parent}-${i} +done +for i in bisect install resolve subst; do + %pom_xpath_inject "pom:project" " + org.fedoraproject.xmvn + %{version}" %{parent}-tools/%{parent}-${i} + %pom_remove_parent %{parent}-tools/%{parent}-${i} +done + +%build +mkdir -p lib +build-jar-repository -s lib \ + beust-jcommander commons-compress maven-invoker/maven-invoker \ + objectweb-asm/asm plexus-containers/plexus-component-annotations \ + plexus-containers/plexus-container-default plexus/utils slf4j/api +%ant -Dtest.skip=true package javadoc + +%install +# jars +install -dm 0755 %{buildroot}%{_javadir}/%{parent} +for i in api core; do + install -pm 0644 %{parent}-${i}/target/%{parent}-${i}-%{version}.jar %{buildroot}%{_javadir}/%{parent}/%{parent}-${i}.jar +done +for i in bisect install resolve subst; do + install -pm 0644 %{parent}-tools/%{parent}-${i}/target/%{parent}-${i}-%{version}.jar %{buildroot}%{_javadir}/%{parent}/%{parent}-${i}.jar +done + +# poms +install -dm 0755 %{buildroot}%{_mavenpomdir}/%{parent} +for i in api core; do + install -pm 0644 %{parent}-${i}/pom.xml %{buildroot}%{_mavenpomdir}/%{parent}/%{parent}-${i}.pom + %add_maven_depmap %{parent}/%{parent}-${i}.pom %{parent}/%{parent}-${i}.jar -f ${i} +done +for i in bisect install resolve subst; do + install -pm 0644 %{parent}-tools/%{parent}-${i}/pom.xml %{buildroot}%{_mavenpomdir}/%{parent}/%{parent}-${i}.pom + %add_maven_depmap %{parent}/%{parent}-${i}.pom %{parent}/%{parent}-${i}.jar -f ${i} +done + +# javadoc +install -dm 0755 %{buildroot}%{_javadocdir}/%{parent} +for i in api core; do + install -dm 0755 %{buildroot}%{_javadocdir}/%{parent}/${i} + cp -pr %{parent}-${i}/target/site/apidocs/* %{buildroot}%{_javadocdir}/%{parent}/${i}/ +done +for i in bisect install resolve subst; do + install -dm 0755 %{buildroot}%{_javadocdir}/%{parent}/${i} + cp -pr %{parent}-tools/%{parent}-${i}/target/site/apidocs/* %{buildroot}%{_javadocdir}/%{parent}/${i}/ +done +%fdupes -s %{buildroot}%{_javadocdir} + +# helper scripts +%jpackage_script org.fedoraproject.xmvn.tools.bisect.BisectCli "" "-Dxmvn.home=%{_datadir}/%{name}" %{parent}/%{parent}-bisect:beust-jcommander:maven-invoker:plexus/utils %{parent}-bisect +%jpackage_script org.fedoraproject.xmvn.tools.install.cli.InstallerCli "" "" %{parent}/%{parent}-install:%{parent}/%{parent}-api:%{parent}/%{parent}-core:beust-jcommander:slf4j/api:slf4j/simple:objectweb-asm/asm:commons-compress %{parent}-install +%jpackage_script org.fedoraproject.xmvn.tools.resolve.ResolverCli "" "" %{parent}/%{parent}-resolve:%{parent}/%{parent}-api:%{parent}/%{parent}-core:beust-jcommander %{parent}-resolve +%jpackage_script org.fedoraproject.xmvn.tools.subst.SubstCli "" "" %{parent}/%{parent}-subst:%{parent}/%{parent}-api:%{parent}/%{parent}-core:beust-jcommander %{parent}-subst + +%files -n %{parent}-core -f .mfiles-core + +%files -n %{parent}-api -f .mfiles-api +%license LICENSE NOTICE +%doc AUTHORS README.md + +%files -n %{parent}-resolve -f .mfiles-resolve +%{_bindir}/%{parent}-resolve + +%files -n %{parent}-bisect -f .mfiles-bisect +%{_bindir}/%{parent}-bisect + +%files -n %{parent}-subst -f .mfiles-subst +%{_bindir}/%{parent}-subst + +%files -n %{parent}-install -f .mfiles-install +%{_bindir}/%{parent}-install + +%files -n %{parent}-javadoc +%license LICENSE NOTICE +%{_javadocdir}/%{parent} + +%changelog