Skip to content

Commit a6a286d

Browse files
authored
Mr java8 (#1719)
* Make jars multi-release for Java 8. * Remove printout. * Add multi-release to release profile. * Add readme section about Java file size.
1 parent 8a38f33 commit a6a286d

File tree

6 files changed

+68
-4
lines changed

6 files changed

+68
-4
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ jobs:
155155
architecture: x64
156156
cache: maven
157157
- name: Build project
158-
run: ./mvnw jacoco:prepare-agent verify jacoco:report coveralls:report -DrepoToken=${{ secrets.coveralls }} -Pextras -Pchecks -Panalysis -Pintegration -Pchecksum-enforce
158+
run: ./mvnw jacoco:prepare-agent verify jacoco:report coveralls:report -DrepoToken=${{ secrets.coveralls }} -Pextras -Pchecks -Panalysis -Pintegration -Pmulti-release -Pchecksum-enforce
159159
release:
160160
name: Release new version
161161
runs-on: ubuntu-24.04

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,17 @@ version conflicts.
292292

293293
Please note the [security policy](https://github.com/raphw/byte-buddy/blob/master/SECURITY.md) of this project.
294294

295+
Byte Buddy supports execution on all JVM versions from version five and onwards in a single jar. This is done to ease
296+
the development of Java agents which often require to support older, or unknown, applications which are not actively
297+
updated. To allow for this while also supporting modern Java and features like CDS or class validation with stack
298+
map frames, the main jars for Byte Buddy ship as multi-release jars that contain class files in version five and eight.
299+
As a result, the jar size of Byte Buddy is higher as one would expect. Jar file size is not normally a problem, as
300+
the majority of Byte Buddy's classes will never be loaded. Yet, file size might be an issue when distributing Java
301+
agents. As agents already need to be bundled as a single jar, it is therefore recommended to remove either the basic
302+
Java five version, or the multi-release Java eight version of the contained class files, to reduce this issue. This
303+
is supported by most build plugins for this purpose, such as the
304+
[Maven Shade plugin](https://maven.apache.org/plugins/maven-shade-plugin/shade-mojo.html#filters).
305+
295306
License and development
296307
-----------------------
297308

byte-buddy-agent/pom.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,5 +227,32 @@
227227
</plugins>
228228
</build>
229229
</profile>
230+
<profile>
231+
<id>multi-release</id>
232+
<activation>
233+
<activeByDefault>false</activeByDefault>
234+
</activation>
235+
<build>
236+
<plugins>
237+
<plugin>
238+
<groupId>org.apache.maven.plugins</groupId>
239+
<artifactId>maven-compiler-plugin</artifactId>
240+
<version>${version.plugin.compiler}</version>
241+
<executions>
242+
<execution>
243+
<id>java8-multi-release</id>
244+
<goals>
245+
<goal>compile</goal>
246+
</goals>
247+
<configuration>
248+
<outputDirectory>${project.build.outputDirectory}/META-INF/versions/8</outputDirectory>
249+
<target>1.8</target>
250+
</configuration>
251+
</execution>
252+
</executions>
253+
</plugin>
254+
</plugins>
255+
</build>
256+
</profile>
230257
</profiles>
231258
</project>

byte-buddy-dep/pom.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,33 @@
357357
</plugins>
358358
</build>
359359
</profile>
360+
<profile>
361+
<id>multi-release</id>
362+
<activation>
363+
<activeByDefault>false</activeByDefault>
364+
</activation>
365+
<build>
366+
<plugins>
367+
<plugin>
368+
<groupId>org.apache.maven.plugins</groupId>
369+
<artifactId>maven-compiler-plugin</artifactId>
370+
<version>${version.plugin.compiler}</version>
371+
<executions>
372+
<execution>
373+
<id>java8-multi-release</id>
374+
<goals>
375+
<goal>compile</goal>
376+
</goals>
377+
<configuration>
378+
<outputDirectory>${project.build.outputDirectory}/META-INF/versions/8</outputDirectory>
379+
<target>1.8</target>
380+
</configuration>
381+
</execution>
382+
</executions>
383+
</plugin>
384+
</plugins>
385+
</build>
386+
</profile>
360387
<!-- Precompilation configuration for Java 1.4 class files. -->
361388
<profile>
362389
<id>java-4-precompile</id>

byte-buddy-dep/src/test/java/net/bytebuddy/implementation/EqualsMethodOtherTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ public void testIdentityField() throws Exception {
9595
.defineField(FOO, Object.class, Visibility.PUBLIC)
9696
.method(isEquals())
9797
.intercept(EqualsMethod.isolated().withIdentityFields(named(FOO)))
98-
.visit(DebuggingWrapper.makeDefault(true))
9998
.make()
10099
.load(ClassLoadingStrategy.BOOTSTRAP_LOADER, ClassLoadingStrategy.Default.WRAPPER);
101100
assertThat(loaded.getLoadedAuxiliaryTypes().size(), is(0));

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<version.junit>4.13.2</version.junit>
7474
<version.mockito>2.28.2</version.mockito>
7575
<version.plugin.clean>3.2.0</version.plugin.clean>
76-
<version.plugin.bundle>5.1.7</version.plugin.bundle>
76+
<version.plugin.bundle>5.1.9</version.plugin.bundle>
7777
<version.plugin.compiler>3.10.1</version.plugin.compiler>
7878
<version.plugin.install>3.0.1</version.plugin.install>
7979
<version.plugin.deploy>3.0.0</version.plugin.deploy>
@@ -183,7 +183,7 @@
183183
<version>${version.plugin.release}</version>
184184
<configuration>
185185
<useReleaseProfile>false</useReleaseProfile>
186-
<releaseProfiles>extras,gpg,gradle-release</releaseProfiles>
186+
<releaseProfiles>extras,gpg,gradle-release,multi-release</releaseProfiles>
187187
<autoVersionSubmodules>true</autoVersionSubmodules>
188188
<tagNameFormat>byte-buddy-@{project.version}</tagNameFormat>
189189
</configuration>

0 commit comments

Comments
 (0)