Skip to content

Commit 2bab356

Browse files
committed
[GR-64985] Make sure capnproto is hosted only.
PullRequest: graal/20804
2 parents 1add88d + ac00cf6 commit 2bab356

File tree

3 files changed

+32
-12
lines changed

3 files changed

+32
-12
lines changed

substratevm/mx.substratevm/mx_substratevm.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2543,14 +2543,24 @@ def capnp_compile(args):
25432543
* or visit www.oracle.com if you need additional information or have any
25442544
* questions.
25452545
*/
2546-
//@formatter:off
2547-
//Checkstyle: stop
2548-
// Generated via:
2549-
// $ mx capnp-compile
2546+
// @formatter:off
2547+
// Checkstyle: stop
25502548
""")
25512549
for line in lines:
25522550
if line.startswith("public final class "):
2553-
f.write('@SuppressWarnings("all")\n')
2551+
f.write(
2552+
"""import org.graalvm.nativeimage.Platform;
2553+
import org.graalvm.nativeimage.Platforms;
2554+
2555+
/**
2556+
* This class contains the methods used by the Native Image Layers feature to communicate with the Cap'n Proto Java runtime.
2557+
* The Native Image Layers feature uses Cap'n Proto to serialize and deserialize metadata between layered build processes.
2558+
* This file is generated from the {@code SharedLayerSnapshotCapnProtoSchema.capnp} schema file using {@code mx capnp-compile}
2559+
* and should not be modified manually.
2560+
*/
2561+
@Platforms(Platform.HOSTED_ONLY.class)
2562+
@SuppressWarnings("all")
2563+
""")
25542564
if 'public static final class Schemas {' in line:
25552565
break
25562566
# Replace org.capnproto with com.oracle.svm.shaded.org.capnproto in generated code

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/imagelayer/NativeImageLayers.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,10 @@ In the future we will eventually provide a solution to refine the resource inclu
9393

9494
##### `--layer-create` suboption `package=<package-name>`
9595

96-
Suboption `package` allows the inclusion of individual Java packages. For this kind of inclusion it does not matter if the specified package is from a classpath-entry or part of a module, both are supported.
96+
Suboption `package` allows the inclusion of individual Java packages. For this kind of inclusion it does not matter if the specified package is from a classpath entry or part of a module, both are supported.
9797
Contrary to the `module` suboption, resources are not also automatically included. If resource inclusion is needed, the usual ways can be used (`resource-config.json`, `reachability-metadata.json` or resource related Feature API).
9898

99-
##### `--layer-create` suboption `path=<classpath entry>`
99+
##### `--layer-create` suboption `path=<classpath-entry>`
100100

101101
This is a convenience suboption that requires a `classpath entry`.
102102
If the provided entry is not also specified in the classpath of the given `native-image` invocation, an error message is shown.
@@ -207,13 +207,15 @@ At build time a shared layer is stored in a layer archive that contains the foll
207207

208208
```shell
209209
[shared-layer.nil] # shared layer archive file
210-
├── shared-layer.json # snapshot of the shared layer metadata; used by subsequent build processes
210+
├── shared-layer.lsb # snapshot of the shared layer metadata; used by subsequent build processes
211+
├── shared-layer.big # serialized shared layer compiler graphs; used by subsequent build processes
211212
├── shared-layer.so # shared object of the shared layer; used by subsequent build processes and at run time
212213
└── shared-layer.properties # contains info about layer input data
213214
```
214215

215216
The layer snapshot file will be consumed by subsequent build processes that depend on this layer.
216217
It contains Native Image metadata, such as the analysis universe and available image singletons.
218+
Sharing compiler graphs between layers enables cross-layer optimizations such as inlining.
217219
The shared object file will be used at build time for symbol resolution, and at run time for application execution.
218220
The layer properties file contains metadata that uniquely identifies this layer: the options used to create the
219221
layer, all the input files and their checksum.

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/imagelayer/SharedLayerSnapshotCapnProtoSchemaHolder.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,23 @@
2222
* or visit www.oracle.com if you need additional information or have any
2323
* questions.
2424
*/
25-
//@formatter:off
26-
//Checkstyle: stop
27-
// Generated via:
28-
// $ mx capnp-compile
25+
// @formatter:off
26+
// Checkstyle: stop
2927
// Generated by Cap'n Proto compiler, DO NOT EDIT
3028
// source: SharedLayerSnapshotCapnProtoSchema.capnp
3129

3230
package com.oracle.svm.hosted.imagelayer;
3331

32+
import org.graalvm.nativeimage.Platform;
33+
import org.graalvm.nativeimage.Platforms;
34+
35+
/**
36+
* This class contains the methods used by the Native Image Layers feature to communicate with the Cap'n Proto Java runtime.
37+
* The Native Image Layers feature uses Cap'n Proto to serialize and deserialize metadata between layered build processes.
38+
* This file is generated from the {@code SharedLayerSnapshotCapnProtoSchema.capnp} schema file using {@code mx capnp-compile}
39+
* and should not be modified manually.
40+
*/
41+
@Platforms(Platform.HOSTED_ONLY.class)
3442
@SuppressWarnings("all")
3543
public final class SharedLayerSnapshotCapnProtoSchemaHolder {
3644
public static class PersistedAnalysisType {

0 commit comments

Comments
 (0)