use of io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem in project quarkus by quarkusio.
the class SecurityProcessor method prepareBouncyCastleProviders.
@BuildStep
void prepareBouncyCastleProviders(BuildProducer<ReflectiveClassBuildItem> reflection, BuildProducer<RuntimeReinitializedClassBuildItem> runtimeReInitialized, List<BouncyCastleProviderBuildItem> bouncyCastleProviders, List<BouncyCastleJsseProviderBuildItem> bouncyCastleJsseProviders) throws Exception {
Optional<BouncyCastleJsseProviderBuildItem> bouncyCastleJsseProvider = getOne(bouncyCastleJsseProviders);
if (bouncyCastleJsseProvider.isPresent()) {
reflection.produce(new ReflectiveClassBuildItem(true, true, SecurityProviderUtils.BOUNCYCASTLE_JSSE_PROVIDER_CLASS_NAME));
reflection.produce(new ReflectiveClassBuildItem(true, true, true, "org.bouncycastle.jsse.provider.DefaultSSLContextSpi$LazyManagers"));
runtimeReInitialized.produce(new RuntimeReinitializedClassBuildItem("org.bouncycastle.jsse.provider.DefaultSSLContextSpi$LazyManagers"));
prepareBouncyCastleProvider(reflection, runtimeReInitialized, bouncyCastleJsseProvider.get().isInFipsMode());
} else {
Optional<BouncyCastleProviderBuildItem> bouncyCastleProvider = getOne(bouncyCastleProviders);
if (bouncyCastleProvider.isPresent()) {
prepareBouncyCastleProvider(reflection, runtimeReInitialized, bouncyCastleProvider.get().isInFipsMode());
}
}
}
use of io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem in project quarkus-hazelcast-client by hazelcast.
the class HazelcastClientProcessor method registerICMPHelper.
@BuildStep
void registerICMPHelper(BuildProducer<NativeImageResourceBuildItem> resources, BuildProducer<RuntimeReinitializedClassBuildItem> reinitializedClasses) {
resources.produce(new NativeImageResourceBuildItem("lib/linux-x86/libicmp_helper.so", "lib/linux-x86_64/libicmp_helper.so"));
reinitializedClasses.produce(new RuntimeReinitializedClassBuildItem(ICMPHelper.class.getName()));
}
use of io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem in project quarkus by quarkusio.
the class LiquibaseProcessor method nativeImageConfiguration.
@BuildStep(onlyIf = NativeOrNativeSourcesBuild.class)
@Record(STATIC_INIT)
void nativeImageConfiguration(LiquibaseRecorder recorder, LiquibaseBuildTimeConfig liquibaseBuildConfig, List<JdbcDataSourceBuildItem> jdbcDataSourceBuildItems, CombinedIndexBuildItem combinedIndex, BuildProducer<ReflectiveClassBuildItem> reflective, BuildProducer<NativeImageResourceBuildItem> resource, BuildProducer<ServiceProviderBuildItem> services, BuildProducer<RuntimeInitializedClassBuildItem> runtimeInitialized, BuildProducer<RuntimeReinitializedClassBuildItem> runtimeReInitialized, BuildProducer<NativeImageResourceBundleBuildItem> resourceBundle) {
runtimeInitialized.produce(new RuntimeInitializedClassBuildItem(liquibase.diff.compare.CompareControl.class.getName()));
reflective.produce(new ReflectiveClassBuildItem(false, true, false, liquibase.change.AbstractSQLChange.class.getName(), liquibase.database.jvm.JdbcConnection.class.getName()));
reflective.produce(new ReflectiveClassBuildItem(true, false, false, "liquibase.command.LiquibaseCommandFactory", liquibase.command.CommandFactory.class.getName()));
reflective.produce(new ReflectiveClassBuildItem(true, true, true, liquibase.parser.ChangeLogParserCofiguration.class.getName(), liquibase.hub.HubServiceFactory.class.getName(), liquibase.logging.core.DefaultLoggerConfiguration.class.getName(), liquibase.configuration.GlobalConfiguration.class.getName(), com.datical.liquibase.ext.config.LiquibaseProConfiguration.class.getName(), liquibase.license.LicenseServiceFactory.class.getName(), liquibase.executor.ExecutorService.class.getName(), liquibase.change.ChangeFactory.class.getName(), liquibase.logging.core.LogServiceFactory.class.getName(), liquibase.logging.LogFactory.class.getName(), liquibase.change.ColumnConfig.class.getName(), liquibase.change.AddColumnConfig.class.getName(), liquibase.change.core.LoadDataColumnConfig.class.getName(), liquibase.sql.visitor.PrependSqlVisitor.class.getName(), liquibase.sql.visitor.ReplaceSqlVisitor.class.getName(), liquibase.sql.visitor.AppendSqlVisitor.class.getName(), liquibase.sql.visitor.RegExpReplaceSqlVisitor.class.getName()));
reflective.produce(new ReflectiveClassBuildItem(false, false, true, liquibase.change.ConstraintsConfig.class.getName()));
// register classes marked with @DatabaseChangeProperty for reflection
Set<String> classesMarkedWithDatabaseChangeProperty = new HashSet<>();
for (AnnotationInstance databaseChangePropertyInstance : combinedIndex.getIndex().getAnnotations(DATABASE_CHANGE_PROPERTY)) {
// the annotation is only supported on methods but let's be safe
AnnotationTarget annotationTarget = databaseChangePropertyInstance.target();
if (annotationTarget.kind() == AnnotationTarget.Kind.METHOD) {
classesMarkedWithDatabaseChangeProperty.add(annotationTarget.asMethod().declaringClass().name().toString());
}
}
reflective.produce(new ReflectiveClassBuildItem(true, true, true, classesMarkedWithDatabaseChangeProperty.toArray(new String[0])));
Collection<String> dataSourceNames = jdbcDataSourceBuildItems.stream().map(i -> i.getName()).collect(Collectors.toSet());
resource.produce(new NativeImageResourceBuildItem(getChangeLogs(dataSourceNames, liquibaseBuildConfig).toArray(new String[0])));
Stream.of(liquibase.change.Change.class, liquibase.changelog.ChangeLogHistoryService.class, liquibase.command.LiquibaseCommand.class, liquibase.database.Database.class, liquibase.database.DatabaseConnection.class, liquibase.datatype.LiquibaseDataType.class, liquibase.diff.compare.DatabaseObjectComparator.class, liquibase.diff.DiffGenerator.class, liquibase.diff.output.changelog.ChangeGenerator.class, liquibase.executor.Executor.class, liquibase.license.LicenseService.class, liquibase.lockservice.LockService.class, liquibase.logging.LogService.class, liquibase.parser.ChangeLogParser.class, liquibase.parser.NamespaceDetails.class, liquibase.parser.SnapshotParser.class, liquibase.precondition.Precondition.class, liquibase.serializer.ChangeLogSerializer.class, liquibase.serializer.SnapshotSerializer.class, liquibase.servicelocator.ServiceLocator.class, liquibase.snapshot.SnapshotGenerator.class, liquibase.sqlgenerator.SqlGenerator.class, liquibase.structure.DatabaseObject.class, liquibase.hub.HubService.class).forEach(t -> consumeService(t, (serviceClass, implementations) -> {
services.produce(new ServiceProviderBuildItem(serviceClass.getName(), implementations.toArray(new String[0])));
reflective.produce(new ReflectiveClassBuildItem(true, true, false, implementations.toArray(new String[0])));
}));
// Register Precondition services, and the implementation class for reflection while also registering fields for reflection
consumeService(liquibase.precondition.Precondition.class, (serviceClass, implementations) -> {
services.produce(new ServiceProviderBuildItem(serviceClass.getName(), implementations.toArray(new String[0])));
reflective.produce(new ReflectiveClassBuildItem(true, true, true, implementations.toArray(new String[0])));
});
// CommandStep implementations are needed
consumeService(liquibase.command.CommandStep.class, (serviceClass, implementations) -> {
services.produce(new ServiceProviderBuildItem(serviceClass.getName(), implementations.toArray(new String[0])));
reflective.produce(new ReflectiveClassBuildItem(true, false, false, implementations.toArray(new String[0])));
for (String implementation : implementations) {
runtimeInitialized.produce(new RuntimeInitializedClassBuildItem(implementation));
}
});
// liquibase XSD
resource.produce(new NativeImageResourceBuildItem("www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd", "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd", "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.7.xsd", "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd", "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.9.xsd", "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.10.xsd", "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.0.xsd", "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd", "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.2.xsd", "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd", "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.4.xsd", "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.5.xsd", "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.6.xsd", "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.7.xsd", "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.8.xsd", "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.9.xsd", "www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd", "www.liquibase.org/xml/ns/pro/liquibase-pro-3.8.xsd", "www.liquibase.org/xml/ns/pro/liquibase-pro-3.9.xsd", "www.liquibase.org/xml/ns/pro/liquibase-pro-3.10.xsd", "www.liquibase.org/xml/ns/pro/liquibase-pro-4.0.xsd", "www.liquibase.org/xml/ns/pro/liquibase-pro-4.1.xsd", "www.liquibase.org/xml/ns/pro/liquibase-pro-4.2.xsd", "www.liquibase.org/xml/ns/pro/liquibase-pro-4.3.xsd", "www.liquibase.org/xml/ns/pro/liquibase-pro-4.4.xsd", "www.liquibase.org/xml/ns/pro/liquibase-pro-4.5.xsd", "www.liquibase.org/xml/ns/pro/liquibase-pro-4.6.xsd", "www.liquibase.org/xml/ns/pro/liquibase-pro-4.7.xsd", "www.liquibase.org/xml/ns/pro/liquibase-pro-4.8.xsd", "www.liquibase.org/xml/ns/pro/liquibase-pro-4.9.xsd", "liquibase.build.properties"));
// liquibase resource bundles
resourceBundle.produce(new NativeImageResourceBundleBuildItem("liquibase/i18n/liquibase-core"));
}
use of io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem in project quarkus by quarkusio.
the class SecurityProcessor method prepareBouncyCastleProvider.
private static void prepareBouncyCastleProvider(BuildProducer<ReflectiveClassBuildItem> reflection, BuildProducer<RuntimeReinitializedClassBuildItem> runtimeReInitialized, boolean isFipsMode) {
reflection.produce(new ReflectiveClassBuildItem(true, true, isFipsMode ? SecurityProviderUtils.BOUNCYCASTLE_FIPS_PROVIDER_CLASS_NAME : SecurityProviderUtils.BOUNCYCASTLE_PROVIDER_CLASS_NAME));
reflection.produce(new ReflectiveClassBuildItem(true, true, "org.bouncycastle.jcajce.provider.symmetric.AES", "org.bouncycastle.jcajce.provider.symmetric.AES$CBC", "org.bouncycastle.crypto.paddings.PKCS7Padding", "org.bouncycastle.jcajce.provider.asymmetric.ec.KeyFactorySpi", "org.bouncycastle.jcajce.provider.asymmetric.ec.KeyFactorySpi$EC", "org.bouncycastle.jcajce.provider.asymmetric.ec.KeyFactorySpi$ECDSA", "org.bouncycastle.jcajce.provider.asymmetric.ec.KeyPairGeneratorSpi", "org.bouncycastle.jcajce.provider.asymmetric.ec.KeyPairGeneratorSpi$EC", "org.bouncycastle.jcajce.provider.asymmetric.ec.KeyPairGeneratorSpi$ECDSA", "org.bouncycastle.jcajce.provider.asymmetric.rsa.KeyFactorySpi", "org.bouncycastle.jcajce.provider.asymmetric.rsa.KeyPairGeneratorSpi", "org.bouncycastle.jcajce.provider.asymmetric.rsa.PSSSignatureSpi", "org.bouncycastle.jcajce.provider.asymmetric.rsa.PSSSignatureSpi$SHA256withRSA"));
runtimeReInitialized.produce(new RuntimeReinitializedClassBuildItem("org.bouncycastle.crypto.CryptoServicesRegistrar"));
if (!isFipsMode) {
reflection.produce(new ReflectiveClassBuildItem(true, true, true, "org.bouncycastle.jcajce.provider.drbg.DRBG$Default"));
runtimeReInitialized.produce(new RuntimeReinitializedClassBuildItem("org.bouncycastle.jcajce.provider.drbg.DRBG$Default"));
runtimeReInitialized.produce(new RuntimeReinitializedClassBuildItem("org.bouncycastle.jcajce.provider.drbg.DRBG$NonceAndIV"));
} else {
reflection.produce(new ReflectiveClassBuildItem(true, true, true, "org.bouncycastle.crypto.general.AES"));
runtimeReInitialized.produce(new RuntimeReinitializedClassBuildItem("org.bouncycastle.crypto.general.AES"));
runtimeReInitialized.produce(new RuntimeReinitializedClassBuildItem("org.bouncycastle.crypto.asymmetric.NamedECDomainParameters"));
runtimeReInitialized.produce(new RuntimeReinitializedClassBuildItem("org.bouncycastle.crypto.asymmetric.CustomNamedCurves"));
runtimeReInitialized.produce(new RuntimeReinitializedClassBuildItem("org.bouncycastle.asn1.ua.DSTU4145NamedCurves"));
runtimeReInitialized.produce(new RuntimeReinitializedClassBuildItem("org.bouncycastle.asn1.sec.SECNamedCurves"));
runtimeReInitialized.produce(new RuntimeReinitializedClassBuildItem("org.bouncycastle.asn1.cryptopro.ECGOST3410NamedCurves"));
runtimeReInitialized.produce(new RuntimeReinitializedClassBuildItem("org.bouncycastle.asn1.x9.X962NamedCurves"));
runtimeReInitialized.produce(new RuntimeReinitializedClassBuildItem("org.bouncycastle.asn1.x9.ECNamedCurveTable"));
runtimeReInitialized.produce(new RuntimeReinitializedClassBuildItem("org.bouncycastle.asn1.anssi.ANSSINamedCurves"));
runtimeReInitialized.produce(new RuntimeReinitializedClassBuildItem("org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves"));
runtimeReInitialized.produce(new RuntimeReinitializedClassBuildItem("org.bouncycastle.jcajce.spec.ECUtil"));
}
}
Aggregations