Bootstrap Maven as non-modular packages

Resolves: rhbz#1951482
This commit is contained in:
Mikolaj Izdebski 2021-06-08 20:17:56 +02:00
parent f4671859c6
commit e3f34e9131
6 changed files with 2538 additions and 61 deletions

View File

@ -1,5 +1,16 @@
--- byte-buddy/pom.xml.orig 2020-07-31 08:09:49.000000000 -0600
+++ byte-buddy/pom.xml 2020-08-14 13:55:09.300521492 -0600
From ceca0b287ac211a968e84cee7f05cfd6c2a843ec Mon Sep 17 00:00:00 2001
From: Marian Koncek <mkoncek@redhat.com>
Date: Tue, 29 Sep 2020 14:46:16 +0200
Subject: [PATCH] Avoid bundling asm
---
byte-buddy/pom.xml | 70 ++++++++++------------------------------------
1 file changed, 15 insertions(+), 55 deletions(-)
diff --git a/byte-buddy/pom.xml b/byte-buddy/pom.xml
index 16388f3..c97b4d9 100644
--- a/byte-buddy/pom.xml
+++ b/byte-buddy/pom.xml
@@ -26,8 +26,6 @@
-->
@ -9,25 +20,20 @@
<packages.list>
net.bytebuddy,
net.bytebuddy.agent.builder,
@@ -61,10 +59,7 @@
net.bytebuddy.pool,
@@ -62,9 +60,6 @@
net.bytebuddy.utility,
net.bytebuddy.utility.privilege,
- net.bytebuddy.utility.visitor,
net.bytebuddy.utility.visitor,
- ${shade.target},
- ${shade.target}.signature,
- ${shade.target}.commons
+ net.bytebuddy.utility.visitor
</packages.list>
</properties>
@@ -77,7 +72,17 @@
<dependency>
<groupId>${project.groupId}</groupId>
@@ -79,6 +74,16 @@
<artifactId>byte-buddy-dep</artifactId>
- <version>${project.version}</version>
+ <version>${project.version}</version>
+ </dependency>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm</artifactId>
@ -37,10 +43,11 @@
+ <groupId>org.ow2.asm</groupId>
+ <artifactId>asm-commons</artifactId>
+ <version>${version.asm}</version>
</dependency>
+ </dependency>
</dependencies>
@@ -105,12 +110,6 @@
<build>
@@ -105,44 +110,6 @@
<createDependencyReducedPom>true</createDependencyReducedPom>
<createSourcesJar>${bytebuddy.extras}</createSourcesJar>
<shadeSourcesContent>true</shadeSourcesContent>
@ -50,13 +57,13 @@
- <shadedPattern>${shade.target}</shadedPattern>
- </relocation>
- </relocations>
<filters>
<filter>
<artifact>net.bytebuddy:byte-buddy-dep:*</artifact>
@@ -118,30 +117,6 @@
<exclude>META-INF/MANIFEST.MF</exclude>
</excludes>
</filter>
- <filters>
- <filter>
- <artifact>net.bytebuddy:byte-buddy-dep:*</artifact>
- <excludes>
- <exclude>META-INF/MANIFEST.MF</exclude>
- </excludes>
- </filter>
- <filter>
- <artifact>org.ow2.asm:*</artifact>
- <excludes>
@ -81,10 +88,11 @@
- <include>org/objectweb/asm/commons/SimpleRemapper.**</include>
- </includes>
- </filter>
</filters>
- </filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
@@ -151,21 +126,14 @@
<mainClass>net.bytebuddy.build.Plugin$Engine$Default</mainClass>
@@ -151,21 +118,14 @@
<resource>META-INF/LICENSE</resource>
</transformer>
</transformers>
@ -111,3 +119,6 @@
</plugin>
<!-- Disable pitest as it fails for empty modules -->
<plugin>
--
2.26.2

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,43 @@
From 9763d7d30bcbb8bf56a6682bb7362f3de33a0802 Mon Sep 17 00:00:00 2001
From: Marian Koncek <mkoncek@redhat.com>
Date: Thu, 4 Feb 2021 15:17:13 +0100
Subject: [PATCH] Remove Java 14 tests
---
.../test/precompiled/SampleRecord.java | 24 -------------------
1 file changed, 24 deletions(-)
delete mode 100644 byte-buddy-dep/src/precompiled/java/net/bytebuddy/test/precompiled/SampleRecord.java
diff --git a/byte-buddy-dep/src/precompiled/java/net/bytebuddy/test/precompiled/SampleRecord.java b/byte-buddy-dep/src/precompiled/java/net/bytebuddy/test/precompiled/SampleRecord.java
deleted file mode 100644
index 522eefa..0000000
--- a/byte-buddy-dep/src/precompiled/java/net/bytebuddy/test/precompiled/SampleRecord.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 2014 - Present Rafael Winterhalter
- *
- * 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 net.bytebuddy.test.precompiled;
-
-import net.bytebuddy.description.type.AbstractTypeDescriptionTest;
-
-import java.util.List;
-
-public record SampleRecord(@AbstractTypeDescriptionTest.SampleAnnotation @TypeAnnotation(42) List<@TypeAnnotation(84) String> foo) {
- /* empty */
-}
--
2.29.2

View File

@ -1,45 +1,48 @@
# Byte Buddy requires itself to build, so set this flag
# to break the bootstrap cycle
%bcond_with bootstrap
# Workaround for rhbz#1969370: __bootstrap macro is not defined in
# CentOS Stream, See https://bugzilla.redhat.com/1969370
%global __bootstrap ~bootstrap
Name: byte-buddy
Version: 1.10.14
Release: 3%{?dist}
Summary: Runtime code generation for the Java virtual machine
License: ASL 2.0
URL: http://bytebuddy.net/
Source0: https://github.com/raphw/byte-buddy/archive/%{name}-%{version}.tar.gz
%bcond_without bootstrap
Name: byte-buddy
Version: 1.10.20
Release: 3%{?dist}
Summary: Runtime code generation for the Java virtual machine
License: ASL 2.0
URL: http://bytebuddy.net/
# ./generate-tarball.sh
Source0: %{name}-%{version}.tar.gz
# Patch the build to avoid bundling inside shaded jars
Patch0: avoid-bundling-asm.patch
Patch1: 0001-Avoid-bundling-asm.patch
Patch2: 0002-Remove-dependency-on-jna.patch
Patch3: 0003-Remove-Java-14-tests.patch
BuildRequires: maven-local
%if %{without bootstrap}
%if %{with bootstrap}
BuildRequires: javapackages-bootstrap
%else
BuildRequires: mvn(junit:junit)
BuildRequires: mvn(net.bytebuddy:byte-buddy)
BuildRequires: mvn(net.bytebuddy:byte-buddy-dep)
BuildRequires: mvn(net.bytebuddy:byte-buddy-maven-plugin)
BuildRequires: mvn(org.apache.maven:maven-compat)
BuildRequires: mvn(org.apache.maven.plugin-testing:maven-plugin-testing-harness)
BuildRequires: mvn(org.mockito:mockito-core)
BuildRequires: mvn(org.ow2.asm:asm-analysis)
BuildRequires: mvn(org.ow2.asm:asm-util)
%endif
BuildRequires: mvn(net.java.dev.jna:jna)
BuildRequires: mvn(net.java.dev.jna:jna-platform)
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires: mvn(org.apache.maven:maven-core)
BuildRequires: mvn(org.apache.maven:maven-plugin-api)
BuildRequires: mvn(org.apache.maven.plugins:maven-plugin-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-shade-plugin)
BuildRequires: mvn(org.apache.maven.plugin-tools:maven-plugin-annotations)
BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin)
BuildRequires: mvn(org.eclipse.aether:aether-api)
BuildRequires: mvn(org.eclipse.aether:aether-util)
BuildRequires: mvn(org.ow2.asm:asm)
BuildRequires: mvn(org.ow2.asm:asm-commons)
%endif
BuildArch: noarch
BuildArch: noarch
%description
Byte Buddy is a code generation library for creating Java classes during the
@ -75,14 +78,12 @@ This package contains API documentation for %{name}.
%prep
%setup -q -n %{name}-%{name}-%{version}
%patch0
# Remove pre-built jars
find -name *.jar -delete
find -name *.class -delete
%patch1 -p1
%patch2 -p1
%patch3 -p1
# JDK 11 does not know about the Java record type
rm byte-buddy-dep/src/precompiled/java/net/bytebuddy/test/precompiled/SampleRecord.java
rm byte-buddy-agent/src/test/java/net/bytebuddy/agent/VirtualMachineAttachmentTest.java
# Cause pre-compiled stuff to be re-compiled
mv byte-buddy-dep/src/precompiled/java/net/bytebuddy/build/*.java \
@ -109,6 +110,9 @@ mv byte-buddy-dep/src/precompiled/java/net/bytebuddy/test/precompiled/*.java \
%pom_remove_plugin :clirr-maven-plugin
%pom_remove_plugin :maven-release-plugin
# Avoid circural dependency
%pom_remove_plugin :byte-buddy-maven-plugin byte-buddy-dep
# Not interested in shading sources (causes NPE on old versions of shade plugin)
%pom_xpath_set "pom:createSourcesJar" "false" byte-buddy
@ -119,22 +123,19 @@ sed -i -e '/SuppressFBWarnings/d' $(grep -lr SuppressFBWarnings)
# Plugin for generating Java 9 module-info file is not in Fedora
%pom_remove_plugin -r :modulemaker-maven-plugin
%if %{with bootstrap}
# Remove circular self-dependency to allow bootstrapping
%pom_remove_plugin :byte-buddy-maven-plugin byte-buddy-dep
%endif
%pom_remove_dep org.ow2.asm:asm-deprecated
%pom_remove_plugin :maven-shade-plugin byte-buddy
%pom_remove_plugin :maven-shade-plugin byte-buddy-benchmark
%pom_remove_dep :jna byte-buddy-agent
%pom_remove_dep :jna-platform byte-buddy-agent
%build
%if %{with bootstrap}
# Cannot run the test suite in bootstrap mode due to circular dep
# on self and mockito
%mvn_build -s -f -- -P'java8,!checks'
%else
# Ignore test failures, there seems to be something different about the
# bytecode of our recompiled test resources, expect 6 test failures in
# the byte-buddy-dep module
%mvn_build -s -- -P'java8,!checks' -Dsourcecode.test.version=1.8 -Dmaven.test.failure.ignore=true
%endif
%install
%mvn_install
@ -155,12 +156,22 @@ sed -i -e '/SuppressFBWarnings/d' $(grep -lr SuppressFBWarnings)
%license LICENSE NOTICE
%changelog
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 1.10.14-3
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jun 08 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.10.20-3
- Bootstrap Maven for CentOS Stream 9
* Mon May 17 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.10.20-2
- Bootstrap build
- Non-bootstrap build
* Thu Feb 04 2021 Marian Koncek <mkoncek@redhat.com> - 1.10.20-1
- Update to upstream version 1.10.20
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.14-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Sep 29 2020 Marian Koncek <mkoncek@redhat.com> - 1.10.16-1
- Update to upstram version 1.10.16
* Fri Aug 14 2020 Jerry James <loganjerry@gmail.com> - 1.10.14-1
- Version 1.10.14
- Remove no longer needed no-unixsocket.patch
@ -175,9 +186,30 @@ sed -i -e '/SuppressFBWarnings/d' $(grep -lr SuppressFBWarnings)
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.5-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Tue Jan 21 2020 Marian Koncek <mkoncek@redhat.com> - 1.10.7-1
- Update to upstream version 1.10.7
* Thu Nov 21 2019 Marian Koncek <mkoncek@redhat.com> - 1.10.3-1
- Update to upstream version 1.10.3
* Tue Nov 05 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.10.1-2
- Mass rebuild for javapackages-tools 201902
* Thu Sep 12 2019 Marian Koncek <mkoncek@redhat.com> - 1.10.1-1
- Update to upstream version 1.10.1
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Wed Jul 10 2019 Marian Koncek <mkoncek@redhat.com> - 1.9.13-2
- Remove the dependency on maven-shade-plugin
* Thu Jun 06 2019 Marian Koncek <mkoncek@redhat.com> - 1.9.13-1
- Update to upstream version 1.9.13
* Fri May 24 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.9.5-5
- Mass rebuild for javapackages-tools 201901
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.5-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
@ -202,4 +234,3 @@ sed -i -e '/SuppressFBWarnings/d' $(grep -lr SuppressFBWarnings)
* Tue Dec 22 2015 gil cattaneo <puntogil@libero.it> 0.7.7-1
- initial rpm

23
generate-tarball.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
set -e
name=byte-buddy
version="$(sed -n 's/Version:\s*//p' *.spec)"
# RETRIEVE
wget "https://github.com/raphw/byte-buddy/archive/${name}-${version}.tar.gz" -O "${name}-${version}.orig.tar.gz"
rm -rf tarball-tmp
mkdir tarball-tmp
pushd tarball-tmp
tar -xf "../${name}-${version}.orig.tar.gz"
# CLEAN TARBALL
find -name '*.jar' -delete
find -name '*.class' -delete
find -name '*.zip' -delete
find -name '*.dll' -delete
tar -czf "../${name}-${version}.tar.gz" *
popd
rm -r tarball-tmp "${name}-${version}.orig.tar.gz"

View File

@ -1 +1 @@
SHA512 (byte-buddy-1.10.14.tar.gz) = e4007227db2710c8861866f5cdc61ab4e54541aba372dd18b5c0edd81ab9962de5463314c823644a30aedab79ef80f7a8040e77e567e5612ae69bec13f0285b2
SHA512 (byte-buddy-1.10.20.tar.gz) = a1e19f8da58a4320896b4e322048e19c66d23e9c172e0a701f3293f580557b0c274dbe465a89a208af7173a2ca21077349ebfbbb4db8d928c3a12aa44c41bc0e