use of org.kie.kogito.codegen.api.utils.AppPaths in project kogito-runtimes by kiegroup.
the class AbstractKieMojo method discoverKogitoRuntimeContext.
protected KogitoBuildContext discoverKogitoRuntimeContext(ClassLoader classLoader) {
AppPaths appPaths = AppPaths.fromProjectDir(projectDir.toPath(), outputDirectory.toPath());
KogitoBuildContext context = contextBuilder().withClassAvailabilityResolver(this::hasClassOnClasspath).withApplicationProperties(appPaths.getResourceFiles()).withPackageName(appPackageName()).withAddonsConfig(AddonsConfigDiscovery.discover(this::hasClassOnClasspath)).withClassLoader(classLoader).withAppPaths(appPaths).withGAV(new KogitoGAV(project.getGroupId(), project.getArtifactId(), project.getVersion())).build();
additionalProperties(context);
return context;
}
use of org.kie.kogito.codegen.api.utils.AppPaths in project kogito-runtimes by kiegroup.
the class KogitoQuarkusResourceUtils method kogitoBuildContext.
public static KogitoBuildContext kogitoBuildContext(Path outputTarget, Iterable<Path> paths, IndexView index, Dependency appArtifact) {
// scan and parse paths
AppPaths.BuildTool buildTool;
if (System.getProperty("org.gradle.appname") == null) {
buildTool = AppPaths.BuildTool.MAVEN;
} else {
buildTool = AppPaths.BuildTool.GRADLE;
}
AppPaths appPaths = AppPaths.fromQuarkus(outputTarget, paths, buildTool);
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
KogitoBuildContext context = QuarkusKogitoBuildContext.builder().withApplicationPropertyProvider(new KogitoQuarkusApplicationPropertiesProvider()).withClassLoader(classLoader).withClassAvailabilityResolver(className -> classAvailabilityResolver(classLoader, index, className)).withAppPaths(appPaths).withGAV(new KogitoGAV(appArtifact.getGroupId(), appArtifact.getArtifactId(), appArtifact.getVersion())).build();
if (!context.hasClassAvailable(QuarkusKogitoBuildContext.QUARKUS_REST)) {
LOGGER.info("Disabling REST generation because class '" + QuarkusKogitoBuildContext.QUARKUS_REST + "' is not available");
context.setApplicationProperty(KogitoBuildContext.KOGITO_GENERATE_REST, "false");
}
if (!context.hasClassAvailable(QuarkusKogitoBuildContext.QUARKUS_DI)) {
LOGGER.info("Disabling dependency injection generation because class '" + QuarkusKogitoBuildContext.QUARKUS_DI + "' is not available");
context.setApplicationProperty(KogitoBuildContext.KOGITO_GENERATE_DI, "false");
}
return context;
}
Aggregations