15 Commits

Author SHA1 Message Date
Phillip Webb
f08188d5cf Change relevant Assert calls to throw IllegalStateException
Change certain Assert class from `assert...` to `assertState`
so that a more appropriate `IllegalStateException` is thrown.

Fixes gh-43779
2025-01-11 21:16:36 -08:00
Phillip Webb
e394cadc48 Merge branch '3.3.x'
Closes gh-43436
2024-12-06 19:01:30 -08:00
Phillip Webb
f21402d4c3 Consistently return non-zero exit codes for jarmode failures
Update jar mode launchers to catch all exceptions and return a non-zero
exit code. This refinement also allows us to consolidate the existing
error reporting logic to a central locations. Modes that wish to report
a simple error rather than a full stacktrace can throw the newly
introduced `JarModeErrorException`.

Fixes gh-43435
2024-12-06 19:00:50 -08:00
Moritz Halbritter
c018c43886 Merge branch '3.3.x'
Closes gh-42736
2024-10-17 13:44:25 +02:00
Moritz Halbritter
8efe6e02d9 Merge branch '3.2.x' into 3.3.x
Closes gh-42735
2024-10-17 13:38:03 +02:00
Phillip Webb
54dcd9894c Remove remaining use of loader classic
Closes gh-42495
2024-10-01 18:23:35 -07:00
Phillip Webb
100bedc07d Merge branch '3.2.x' into 3.3.x
Closes gh-42440
2024-09-24 14:29:09 -07:00
Moritz Halbritter
9def6f86c9 Keep track of written jar entries to not duplicate them
Closes gh-40903
2024-05-27 12:18:00 +02:00
Moritz Halbritter
de560a933c Extract all files under META-INF
Closes gh-40456
2024-04-22 13:20:57 +02:00
Phillip Webb
6963bd884b Merge branch '3.2.x' 2024-04-18 12:53:26 -07:00
Phillip Webb
3ed77ae5f3 Polish 2024-04-04 23:45:21 -07:00
Moritz Halbritter
558d811b0a Use JarFile instead of ZipInputStream
ZipInputStream can't cope with some non-deflated entries, see
https://bugs.openjdk.org/browse/JDK-8143613.

JarFile works better, but it doesn't support creation time / access
time.

See gh-38276
2024-03-20 12:11:56 +01:00
Moritz Halbritter
9411a4ce99 Adjust defaults for ExtractCommand
It now extracts the contents of the JAR in a folder named after the JAR
without the extension. It now also checks if the folder is empty.
There's a new --force option to skip those checks.

The "runner.jar" is now named like the uber JAR from which the
extraction has been started.

See gh-38276
2024-03-12 11:52:33 +01:00
Moritz Halbritter
7a417503e5 Fix tests on windows 2024-03-07 14:14:24 +01:00
Moritz Halbritter
793aca60d2 Implement extract and list-layers command
Adds a new jarmode called 'tools'. This provides two commands,
'extract' and 'list-layers'. list-layers is the same as list from
the layertools.

extract is able to extract the JAR in four different modes:

- CDS compatible extraction with libraries in a lib folder and a runner
.jar
- CDS compatible as above, but with layers
- Launcher based
- Launcher based with layers. This is essentially the same as extract
  from the layertools

The commands in layertools have been deprecated in favor of the commands
in 'tools'.

This also changes the behavior of layers.enabled from the Gradle and
Maven plugin: before this commit, layers.enabled prevents the inclusion
of the layer index file as well as the layertools JAR.
After this commit, layers.enabled only prevents the inclusion of the
layer index file.

layer.includeLayerTools have been deprecated in favor of includeTools,
and the layertools JAR has been renamed to tools.

Closes gh-38276
2024-03-07 13:34:13 +01:00