Add patch to support xmvn.resolver.disableEffectivePom property

This commit is contained in:
Mikolaj Izdebski 2014-05-30 09:40:05 +02:00
parent 46427f7a85
commit 6adc5bc8fa
4 changed files with 145 additions and 2 deletions

View File

@ -1,7 +1,7 @@
From de2dd29f853fdb39ec5916a6c388f81ced4b61a5 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Thu, 29 May 2014 18:18:30 +0200
Subject: [PATCH] Fix JAR post-processing during installation
Subject: [PATCH 1/3] Fix JAR post-processing during installation
This improves native code detection and Javapackages manifest
injection.

View File

@ -0,0 +1,89 @@
From f428fae1edfc860ed2bcabf920f3cba14a5a9ef5 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Fri, 30 May 2014 06:52:05 +0200
Subject: [PATCH 2/3] Respect xmvn.resolver.disableEffectivePom property
XMvn can't distinguish between two cases: there are
no dependencies in metadata and dependencies weren't
generated. A property saying that dependencies were
omitted is added so that XMvn won't generate effective
POMs for artfacts with no dependencies in metadata.
---
.../xmvn/resolver/impl/DefaultResolver.java | 22 ++++++++++++++--------
.../resolver/impl/depmap/DepmapBasedResolver.java | 2 +-
2 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/DefaultResolver.java b/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/DefaultResolver.java
index 9572dc6..8c55ebe 100644
--- a/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/DefaultResolver.java
+++ b/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/DefaultResolver.java
@@ -18,6 +18,7 @@ package org.fedoraproject.xmvn.resolver.impl;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.Properties;
import javax.inject.Inject;
import javax.inject.Named;
@@ -73,6 +74,8 @@ public class DefaultResolver
@Override
public ResolutionResult resolve( ResolutionRequest request )
{
+ Properties properties = System.getProperties();
+
// FIXME: bisect is not used
Artifact artifact = request.getArtifact();
logger.debug( "Trying to resolve artifact {}", artifact );
@@ -90,9 +93,15 @@ public class DefaultResolver
compatVersion = artifact.getVersion();
}
+ if ( metadata != null )
+ {
+ properties.putAll( metadata.getProperties() );
+ }
+
if ( metadata != null
+ && !StringUtils.equals( properties.getProperty( "xmvn.resolver.disableEffectivePom" ), "true" )
&& StringUtils.equals( metadata.getExtension(), "pom" )
- && ( !StringUtils.equals( metadata.getProperties().getProperty( "type" ), "pom" ) || metadata.getPath() == null ) )
+ && ( !StringUtils.equals( properties.getProperty( "type" ), "pom" ) || metadata.getPath() == null ) )
{
try
{
@@ -122,15 +131,12 @@ public class DefaultResolver
}
// TODO: drop support for depmaps
- if ( System.getProperty( "xmvn.depmap.ignore" ) != null )
+ if ( properties.getProperty( "xmvn.resolver.disableDepmap" ) == null )
{
- logger.debug( "Failed to resolve artifact: {}", artifact );
- return new DefaultResolutionResult();
- }
- else
- {
- // TODO: drop support for depmaps
return depmapResolver.resolve( request );
}
+
+ logger.debug( "Failed to resolve artifact: {}", artifact );
+ return new DefaultResolutionResult();
}
}
diff --git a/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/depmap/DepmapBasedResolver.java b/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/depmap/DepmapBasedResolver.java
index 7571146..298b060 100644
--- a/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/depmap/DepmapBasedResolver.java
+++ b/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/depmap/DepmapBasedResolver.java
@@ -228,7 +228,7 @@ public class DepmapBasedResolver
if ( result == null )
{
- logger.info( "Failed to resolve artifact: {}", artifact );
+ logger.debug( "Failed to resolve artifact: {}", artifact );
return new DefaultResolutionResult();
}
--
1.9.0

View File

@ -0,0 +1,47 @@
From 4f01aad38d63a4f70a2ac08a9264690ffc8df133 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Fri, 30 May 2014 09:34:41 +0200
Subject: [PATCH 3/3] Fix return code of xmvn-install
---
.../java/org/fedoraproject/xmvn/tools/install/cli/InstallerCli.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/cli/InstallerCli.java b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/cli/InstallerCli.java
index 36e10e4..e4f0215 100644
--- a/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/cli/InstallerCli.java
+++ b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/cli/InstallerCli.java
@@ -52,7 +52,7 @@ public class InstallerCli
this.installer = installer;
}
- private void run( InstallerCliRequest cliRequest )
+ private int run( InstallerCliRequest cliRequest )
{
InstallationRequest request = new InstallationRequest();
request.setCheckForUnmatchedRules( !cliRequest.isRelaxed() );
@@ -63,10 +63,12 @@ public class InstallerCli
try
{
installer.install( request );
+ return 0;
}
catch ( ArtifactInstallationException | IOException e )
{
logger.error( "Artifact installation failed", e );
+ return 1;
}
}
@@ -81,7 +83,7 @@ public class InstallerCli
Injector injector = Guice.createInjector( module );
InstallerCli cli = injector.getInstance( InstallerCli.class );
- cli.run( cliRequest );
+ System.exit( cli.run( cliRequest ) );
}
catch ( Throwable e )
{
--
1.9.0

View File

@ -1,6 +1,6 @@
Name: xmvn
Version: 2.0.0
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Local Extensions for Apache Maven
License: ASL 2.0
URL: http://mizdebsk.fedorapeople.org/xmvn
@ -9,6 +9,8 @@ BuildArch: noarch
Source0: https://fedorahosted.org/released/%{name}/%{name}-%{version}.tar.xz
Patch0001: 0001-Fix-JAR-post-processing-during-installation.patch
Patch0002: 0002-Respect-xmvn.resolver.disableEffectivePom-property.patch
Patch0003: 0003-Fix-return-code-of-xmvn-install.patch
BuildRequires: maven >= 3.2.1-3
BuildRequires: maven-local
@ -136,6 +138,8 @@ This package provides %{summary}.
%prep
%setup -q
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%mvn_package :xmvn __noinstall
@ -283,6 +287,9 @@ end
%doc LICENSE NOTICE
%changelog
* Fri May 30 2014 Mikolaj Izdebski <mizdebsk@redhat.com> - 2.0.0-3
- Add patch to support xmvn.resolver.disableEffectivePom property
* Thu May 29 2014 Mikolaj Izdebski <mizdebsk@redhat.com> - 2.0.0-2
- Add patch for injecting Javapackages manifests