-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GR-42693] First draft of native-image bundle support. #5569
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
oracle-contributor-agreement
bot
added
the
OCA Verified
All contributors have signed the Oracle Contributor Agreement.
label
Dec 6, 2022
graalvmbot
force-pushed
the
paw/GR-42693
branch
2 times, most recently
from
December 7, 2022 16:06
012ef42
to
565831d
Compare
oracle-contributor-agreement
bot
added
OCA Required
At least one contributor does not have an approved Oracle Contributor Agreement.
and removed
OCA Verified
All contributors have signed the Oracle Contributor Agreement.
labels
Jan 3, 2023
graalvmbot
force-pushed
the
paw/GR-42693
branch
from
January 3, 2023 13:14
565831d
to
3517fd3
Compare
oracle-contributor-agreement
bot
added
OCA Verified
All contributors have signed the Oracle Contributor Agreement.
and removed
OCA Required
At least one contributor does not have an approved Oracle Contributor Agreement.
labels
Jan 11, 2023
christianwimmer
changed the title
[GR-42693] First draft of replay-bundle support.
[GR-42693] Build bundle support.
Jan 11, 2023
olpaw
changed the title
[GR-42693] Build bundle support.
[GR-42693] First draft of native-image bundle support.
Jan 12, 2023
graalvmbot
force-pushed
the
paw/GR-42693
branch
2 times, most recently
from
January 16, 2023 14:23
154c7b6
to
2597229
Compare
graalvmbot
force-pushed
the
paw/GR-42693
branch
5 times, most recently
from
January 26, 2023 18:25
47755d2
to
c14b88d
Compare
graalvmbot
force-pushed
the
paw/GR-42693
branch
from
January 30, 2023 11:38
c0ef4f6
to
4fbec8c
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds basic bundle support. Two new options are added:
1. Create a new bundle with
--bundle-create
:This creates a new bundle that contains the all files from the
cp
directory and captures the command line args used to create the bundle (-cp cp HelloJava
) and all files that were created during image building. Those files are also directly available in directorysimple-bundle.output
next to the bundle. It is also possible to just create the bundle without getting the image built as well. When--bundle-create
is combined with--dry-run
a bundle will be created that does not contain an image and also no<bundlename>.output
gets created. This is useful if you just want to create a bundle on a machine but build an image from that bundle somewhere else (maybe on a more powerful machine i.e. a build server).If no filename is passed to
--bundle-create
then the name of the bundle will be derived from the image name. E.g. in the above case omitting=simple-bundle.nib
would result in a bundle namedhellojava.nib
(because the image name is derived form the main class nameHelloJava
).A common pattern that I expect to emerge is users to inject
--bundle-create
to non-trivial maven or grade native-image builds to retrieve a bundle. For example, addinggraalvmNative { binaries { main { buildArgs.add('--bundle-create') }}}
inbuild.gradle
of a spring-boot-native application will produce a bundle that can later be rebuilt without requiring the original project. The bundle alone is self-contained and contains everything needed to build the application again.2. Build an image again from a bundle with
--bundle-apply
:The image will be rebuilt in the
simple-bundle.output
directory.Note that passing any additional arguments after
--bundle-apply
will be taken into account in the image build. For example:will again create directory
simple-bundle.output
but this time the image is built with arguments-cp cp HelloJava --pgo-instrument
.3. Creating a new bundle from an existing one with
--bundle-apply
+--bundle-create
:Suppose you have a bundle and you want to derive another bundle from it that builds the original application but with pgo optimization. This can be achieved by combining
--bundle-apply
with as subsequent--bundle-create
. For example if we have pgo profile information in the form of adefault.iprof
in our current working directory we could use the following command to create a new bundle that can build a pgo optimized image.The newly created bundle will contain the
default.iprof
and the arguments needed to pass it to the builder. Also note the use of--dry-run
here again. This will skip image building and only create the new bundle.