Update to latest upstream snapshot

This commit is contained in:
Mikolaj Izdebski 2021-07-07 09:22:50 +02:00
parent 2a12a7da5a
commit fc4b6c6832
4 changed files with 63 additions and 240 deletions

4
.gitignore vendored
View File

@ -48,3 +48,7 @@
/xmvn-3.1.0.tar.xz /xmvn-3.1.0.tar.xz
/5d1e284.tar.gz /5d1e284.tar.gz
/da67577.tar.gz /da67577.tar.gz
/fac231b.tar.gz
/5547c28.tar.gz
/523e11f.tar.gz
/7e2d3db.tar.gz

View File

@ -1,77 +0,0 @@
From c9362d3f23f950bb6987c63c67b06528de3ce100 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Thu, 23 Jan 2020 12:50:42 +0100
Subject: [PATCH] Initial PoC of XMvn toolchain manager
---
.../aether/XMvnMavenLifecycleParticipant.java | 38 +++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMavenLifecycleParticipant.java b/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMavenLifecycleParticipant.java
index 0e360488..ddd6151b 100644
--- a/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMavenLifecycleParticipant.java
+++ b/xmvn-connector-aether/src/main/java/org/fedoraproject/xmvn/connector/aether/XMvnMavenLifecycleParticipant.java
@@ -15,10 +15,15 @@
*/
package org.fedoraproject.xmvn.connector.aether;
+import java.util.Collections;
+
import org.apache.maven.AbstractMavenLifecycleParticipant;
import org.apache.maven.MavenExecutionException;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenSession;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.toolchain.MisconfiguredToolchainException;
+import org.apache.maven.toolchain.ToolchainManagerPrivate;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
@@ -42,6 +47,9 @@ public class XMvnMavenLifecycleParticipant
@Requirement( role = XMvnMojoExecutionListener.class )
private XMvnMojoExecutionListener mojoExecutionListener;
+ @Requirement
+ private ToolchainManagerPrivate toolchainManager;
+
@Override
public void afterSessionStart( MavenSession session )
throws MavenExecutionException
@@ -61,4 +69,34 @@ public class XMvnMavenLifecycleParticipant
chainedListener.addExecutionListener( reportGenerator );
request.setExecutionListener( chainedListener );
}
+
+ @Override
+ public void afterProjectsRead( MavenSession session )
+ throws MavenExecutionException
+ {
+ MavenProject currentProject = session.getCurrentProject();
+
+ try
+ {
+ for ( var toolchain : toolchainManager.getToolchainsForType( "jdk", session ) )
+ {
+ if ( toolchain.matchesRequirements( Collections.singletonMap( "xmvn", "xmvn" ) ) )
+ {
+ for ( var project : session.getAllProjects() )
+ {
+ session.setCurrentProject( project );
+ toolchainManager.storeToolchainToBuildContext( toolchain, session );
+ }
+ }
+ }
+ }
+ catch ( MisconfiguredToolchainException e )
+ {
+ throw new MavenExecutionException( "Unable to configure toolchains", e );
+ }
+ finally
+ {
+ session.setCurrentProject( currentProject );
+ }
+ }
}
--
2.21.0

View File

@ -1 +1 @@
SHA512 (da67577.tar.gz) = d68cfaea21ec9d5f9ee7e70a2d40cd111c53f8d10868766b9994637a06568b3846360b10402ca93ae29b974abe354146a1a5dc9a72a90e5cc4dcfb314d31845b SHA512 (7e2d3db.tar.gz) = 05265ed0a90a52cf75e67b362b7ec5555caf94f0dc421b060d552ea37714e47ed8b62ec6bf289e20f96c625ba3e558d2866b2662d2386e5bfc84b49124a1fc82

220
xmvn.spec
View File

@ -1,31 +1,19 @@
%bcond_with bootstrap %bcond_with bootstrap
# XMvn uses OSGi environment provided by Tycho, it shouldn't require
# any additional bundles.
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^osgi\\($
%if 0%{?fedora}
%bcond_without ivy
%else
%bcond_with ivy
%endif
%if %{with bootstrap} %if %{with bootstrap}
%global mbi 1 %global mbi 1
%endif %endif
Name: xmvn Name: xmvn
Version: 4.0.0~20191028.da67577 Version: 4.0.0~20210708.54026c1
Release: 8%{?dist} Release: 9%{?dist}
Summary: Local Extensions for Apache Maven Summary: Local Extensions for Apache Maven
License: ASL 2.0 License: ASL 2.0
URL: https://fedora-java.github.io/xmvn/ URL: https://fedora-java.github.io/xmvn/
BuildArch: noarch BuildArch: noarch
#Source0: https://github.com/fedora-java/xmvn/releases/download/%{version}/xmvn-%{version}.tar.xz #Source0: https://github.com/fedora-java/xmvn/releases/download/%{version}/xmvn-%{version}.tar.xz
Source0: https://github.com/fedora-java/xmvn/archive/da67577.tar.gz Source0: https://github.com/fedora-java/xmvn/archive/54026c1.tar.gz
Patch0: 0001-Initial-PoC-of-XMvn-toolchain-manager.patch
BuildRequires: maven-local BuildRequires: maven-local
%if %{with bootstrap} %if %{with bootstrap}
@ -55,15 +43,11 @@ BuildRequires: mvn(org.junit.jupiter:junit-jupiter)
BuildRequires: mvn(org.ow2.asm:asm) BuildRequires: mvn(org.ow2.asm:asm)
BuildRequires: mvn(org.slf4j:slf4j-api) BuildRequires: mvn(org.slf4j:slf4j-api)
BuildRequires: mvn(org.slf4j:slf4j-simple) BuildRequires: mvn(org.slf4j:slf4j-simple)
BuildRequires: mvn(org.xmlunit:xmlunit-assertj) BuildRequires: mvn(org.xmlunit:xmlunit-assertj3)
%if %{with ivy} # Maven home is used as template for XMvn home
BuildRequires: mvn(org.apache.ivy:ivy) BuildRequires: maven
%endif # Test dependency (for testing compatibility with Java 8)
%endif BuildRequires: java-1.8.0-openjdk-devel
# Used to determine location of Maven home
%if %{without bootstrap}
BuildRequires: %{_bindir}/mvn
%endif %endif
Requires: %{name}-minimal = %{version}-%{release} Requires: %{name}-minimal = %{version}-%{release}
@ -77,8 +61,6 @@ creating RPM packages containing Maven artifacts.
%package minimal %package minimal
Summary: Dependency-reduced version of XMvn Summary: Dependency-reduced version of XMvn
Requires: %{name}-api = %{version}-%{release}
Requires: %{name}-connector-aether = %{version}-%{release}
Requires: %{name}-core = %{version}-%{release} Requires: %{name}-core = %{version}-%{release}
Requires: apache-commons-cli Requires: apache-commons-cli
Requires: apache-commons-lang3 Requires: apache-commons-lang3
@ -100,49 +82,21 @@ Requires: maven-lib >= 3.4.0
Requires: maven-jdk-binding Requires: maven-jdk-binding
Suggests: maven-openjdk11 Suggests: maven-openjdk11
Obsoletes: xmvn-connector-aether < 4.0.0
%description minimal %description minimal
This package provides minimal version of XMvn, incapable of using This package provides minimal version of XMvn, incapable of using
remote repositories. remote repositories.
%package parent-pom
Summary: XMvn Parent POM
%description parent-pom
This package provides XMvn parent POM.
%package api
Summary: XMvn API
%description api
This package provides XMvn API module which contains public interface
for functionality implemented by XMvn Core.
%package core %package core
Summary: XMvn Core Summary: XMvn library
Obsoletes: xmvn-parent-pom < 4.0.0
Obsoletes: xmvn-api < 4.0.0
%description core %description core
This package provides XMvn Core module, which implements the essential This package provides XMvn API and XMvn Core modules, which implement
functionality of XMvn such as resolution of artifacts from system the essential functionality of XMvn such as resolution of artifacts
repository. from system repository.
%package connector-aether
Summary: XMvn Connector for Maven Resolver
%description connector-aether
This package provides XMvn Connector for Maven Resolver, which
provides integration of Maven Resolver with XMvn. It provides an
adapter which allows XMvn resolver to be used as Maven workspace
reader.
%if %{with ivy}
%package connector-ivy
Summary: XMvn Connector for Apache Ivy
%description connector-ivy
This package provides XMvn Connector for Apache Ivy, which provides
integration of Apache Ivy with XMvn. It provides an adapter which
allows XMvn resolver to be used as Ivy resolver.
%endif
%package mojo %package mojo
Summary: XMvn MOJO Summary: XMvn MOJO
@ -153,47 +107,29 @@ of several MOJOs. Some goals of these MOJOs are intended to be
attached to default Maven lifecycle when building packages, others can attached to default Maven lifecycle when building packages, others can
be called directly from Maven command line. be called directly from Maven command line.
%package tools-pom %package tools
Summary: XMvn Tools POM Summary: XMvn tools
%description tools-pom
This package provides XMvn Tools parent POM.
%package resolve
Summary: XMvn Resolver
# Explicit javapackages-tools requires since scripts use # Explicit javapackages-tools requires since scripts use
# /usr/share/java-utils/java-functions # /usr/share/java-utils/java-functions
Requires: javapackages-tools Requires: javapackages-tools
Obsoletes: xmvn-tools-pom < 4.0.0
Obsoletes: xmvn-bisect < 4.0.0
Obsoletes: xmvn-install < 4.0.0
Obsoletes: xmvn-resolve < 4.0.0
Obsoletes: xmvn-subst < 4.0.0
%description resolve %description tools
This package provides XMvn Resolver, which is a very simple This package provides various XMvn tools:
commald-line tool to resolve Maven artifacts from system repositories. * XMvn Install, which is a command-line interface to XMvn installer.
Basically it's just an interface to artifact resolution mechanism The installer reads reactor metadata and performs artifact
implemented by XMvn Core. The primary intended use case of XMvn installation according to specified configuration.
Resolver is debugging local artifact repositories. * XMvn Resolver, which is a very simple commald-line tool to resolve
Maven artifacts from system repositories. Basically it's just an
%package subst interface to artifact resolution mechanism implemented by XMvn Core.
Summary: XMvn Subst The primary intended use case of XMvn Resolver is debugging local
# Explicit javapackages-tools requires since scripts use artifact repositories.
# /usr/share/java-utils/java-functions * XMvn Subst, which is a tool that can substitute Maven artifact files
Requires: javapackages-tools with symbolic links to corresponding files in artifact repository.
%description 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 install
Summary: XMvn Install
Requires: apache-commons-compress
# Explicit javapackages-tools requires since scripts use
# /usr/share/java-utils/java-functions
Requires: javapackages-tools
%description 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 javadoc %package javadoc
Summary: API documentation for %{name} Summary: API documentation for %{name}
@ -202,62 +138,36 @@ Summary: API documentation for %{name}
This package provides %{summary}. This package provides %{summary}.
%prep %prep
%setup -q -n xmvn-da67577d9252f0b1fffed546c7c23d97a97dec4b %setup -q -n xmvn-54026c171fe8f4ccb0a22786616ceb5717359b8b
%patch0 -p1
# Port to xmlunit-assertj3 %mvn_package ::tar.gz: __noinstall
find -name '*.java' -exec sed -i 's/org\.xmlunit\.assertj/org.xmlunit.assertj3/' {} + %mvn_package ":{xmvn,xmvn-connector}" xmvn
%mvn_package ":xmvn-{api,core,parent}" core
# Bisect IT has no chances of working in local, offline mode, without %mvn_package ":xmvn-mojo" mojo
# network access - it needs to access remote repositories. %mvn_package ":xmvn-{install,resolve,subst,tools}" tools
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
%mvn_package ":xmvn{,-it}" __noinstall
%pom_remove_dep :xmvn-bisect
%pom_disable_module xmvn-bisect xmvn-tools
%pom_disable_module xmvn-connector-gradle
%if %{without ivy}
%pom_disable_module xmvn-connector-ivy
%endif
# 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 # Don't put Class-Path attributes in manifests
%pom_remove_plugin :maven-jar-plugin xmvn-tools %pom_remove_plugin :maven-jar-plugin xmvn-tools
# get mavenVersion that is expected # Copy Maven home packaged as RPM instead of unpacking Maven binary
# tarball with maven-dependency-plugin
%pom_remove_plugin :maven-dependency-plugin
maven_home=$(realpath $(dirname $(realpath $(%{?jpb_env} which mvn)))/..) maven_home=$(realpath $(dirname $(realpath $(%{?jpb_env} which mvn)))/..)
mver=$(sed -n '/<mavenVersion>/{s/.*>\(.*\)<.*/\1/;p}' \ mver=$(sed -n '/<mavenVersion>/{s/.*>\(.*\)<.*/\1/;p}' \
xmvn-parent/pom.xml) xmvn-parent/pom.xml)
mkdir -p target/dependency/ mkdir -p target/dependency/
cp -a ${maven_home} target/dependency/apache-maven-$mver cp -a "${maven_home}" target/dependency/apache-maven-$mver
%build %build
%mvn_build -s -j %mvn_build -j -- -P\\!quality
version=4.0.0-SNAPSHOT version=4.0.0-SNAPSHOT
tar --delay-directory-restore -xvf target/*tar.bz2 tar --delay-directory-restore -xvf target/xmvn-*-bin.tar.gz
chmod -R +rwX %{name}-${version}* chmod -R +rwX %{name}-${version}*
# These are installed as doc # These are installed as doc
rm -f %{name}-${version}*/{AUTHORS-XMVN,README-XMVN.md,LICENSE,NOTICE,NOTICE-XMVN} rm -f %{name}-${version}*/{AUTHORS-XMVN,README-XMVN.md,LICENSE,NOTICE,NOTICE-XMVN}
# Not needed - we use JPackage launcher scripts # Not needed - we use JPackage launcher scripts
rm -Rf %{name}-${version}*/lib/{installer,resolver,subst,bisect}/ rm -Rf %{name}-${version}*/lib/{installer,resolver,subst}/
# Irrelevant Maven launcher scripts # Irrelevant Maven launcher scripts
rm -f %{name}-${version}*/bin/* rm -f %{name}-${version}*/bin/*
@ -328,7 +238,7 @@ end
%files %files
%{_bindir}/mvn-local %{_bindir}/mvn-local
%files minimal %files minimal -f .mfiles-xmvn
%{_bindir}/%{name} %{_bindir}/%{name}
%dir %{_datadir}/%{name} %dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/bin %dir %{_datadir}/%{name}/bin
@ -343,38 +253,24 @@ end
%{_datadir}/%{name}/conf %{_datadir}/%{name}/conf
%ghost %{_datadir}/%{name}/conf/logging.rpmmoved %ghost %{_datadir}/%{name}/conf/logging.rpmmoved
%files parent-pom -f .mfiles-xmvn-parent %files core -f .mfiles-core
%doc LICENSE NOTICE %license LICENSE NOTICE
%files core -f .mfiles-xmvn-core
%files api -f .mfiles-xmvn-api
%doc LICENSE NOTICE
%doc AUTHORS README.md %doc AUTHORS README.md
%files connector-aether -f .mfiles-xmvn-connector-aether %files mojo -f .mfiles-mojo
%if %{with ivy} %files tools -f .mfiles-tools
%files connector-ivy -f .mfiles-xmvn-connector-ivy %{_bindir}/%{name}-install
%endif
%files mojo -f .mfiles-xmvn-mojo
%files tools-pom -f .mfiles-xmvn-tools
%files resolve -f .mfiles-xmvn-resolve
%{_bindir}/%{name}-resolve %{_bindir}/%{name}-resolve
%files subst -f .mfiles-xmvn-subst
%{_bindir}/%{name}-subst %{_bindir}/%{name}-subst
%files install -f .mfiles-xmvn-install
%{_bindir}/%{name}-install
%files javadoc %files javadoc
%doc LICENSE NOTICE %license LICENSE NOTICE
%changelog %changelog
* Thu Jul 08 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.0.0~20210708.54026c1-9
- Update to latest upstream snapshot
* Tue Jun 01 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.0.0~20191028.da67577-8 * Tue Jun 01 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.0.0~20191028.da67577-8
- Workaround for rpm bug 447156 - rpm fails to change directory to symlink - Workaround for rpm bug 447156 - rpm fails to change directory to symlink