|
28 | 28 | import static com.oracle.svm.core.SubstrateOptions.EnableURLProtocols; |
29 | 29 | import static com.oracle.svm.core.SubstrateOptions.Preserve; |
30 | 30 | import static com.oracle.svm.core.jdk.JRTSupport.Options.AllowJRTFileSystem; |
| 31 | +import static com.oracle.svm.core.metadata.MetadataTracer.Options.MetadataTracingSupport; |
31 | 32 | import static com.oracle.svm.hosted.SecurityServicesFeature.Options.AdditionalSecurityProviders; |
32 | 33 | import static com.oracle.svm.hosted.jdk.localization.LocalizationFeature.Options.AddAllCharsets; |
33 | 34 | import static com.oracle.svm.hosted.jdk.localization.LocalizationFeature.Options.IncludeAllLocales; |
|
40 | 41 | import java.security.Security; |
41 | 42 | import java.util.Arrays; |
42 | 43 | import java.util.Comparator; |
| 44 | +import java.util.List; |
43 | 45 | import java.util.Set; |
44 | 46 | import java.util.StringJoiner; |
45 | 47 | import java.util.stream.Stream; |
@@ -140,19 +142,32 @@ public static void parsePreserveOption(EconomicMap<OptionKey<?>, Object> hostedV |
140 | 142 | } |
141 | 143 | }); |
142 | 144 | if (classLoaderSupport.isPreserveMode()) { |
| 145 | + /* Significantly speeds up analysis */ |
143 | 146 | if (UseConservativeUnsafeAccess.hasBeenSet(optionValues)) { |
144 | 147 | UserError.guarantee(UseConservativeUnsafeAccess.getValue(optionValues), "%s can not be used together with %s. Please unset %s.", |
145 | 148 | SubstrateOptionsParser.commandArgument(UseConservativeUnsafeAccess, "-"), |
146 | 149 | SubstrateOptionsParser.commandArgument(Preserve, "<value>"), |
147 | 150 | SubstrateOptionsParser.commandArgument(UseConservativeUnsafeAccess, "-")); |
148 | 151 | } |
149 | 152 | UseConservativeUnsafeAccess.update(hostedValues, true); |
| 153 | + } |
150 | 154 |
|
| 155 | + if (classLoaderSupport.isPreserveAll()) { |
| 156 | + /* Include all parts of native image that are stripped */ |
151 | 157 | AddAllCharsets.update(hostedValues, true); |
152 | 158 | IncludeAllLocales.update(hostedValues, true); |
153 | 159 | AllowJRTFileSystem.update(hostedValues, true); |
154 | | - EnableURLProtocols.update(hostedValues, "http,https,ftp,jar,file,mailto,jrt,jmod"); |
| 160 | + |
| 161 | + /* Should be removed with GR-61365 */ |
| 162 | + var missingJDKProtocols = List.of("http", "https", "ftp", "jar", "mailto", "jrt", "jmod"); |
| 163 | + for (String missingProtocol : missingJDKProtocols) { |
| 164 | + EnableURLProtocols.update(hostedValues, missingProtocol); |
| 165 | + } |
| 166 | + |
155 | 167 | AdditionalSecurityProviders.update(hostedValues, getSecurityProvidersCSV()); |
| 168 | + |
| 169 | + /* Allow metadata tracing in preserve all images */ |
| 170 | + MetadataTracingSupport.update(hostedValues, true); |
156 | 171 | } |
157 | 172 | } |
158 | 173 |
|
|
0 commit comments