use of org.kie.workbench.common.services.backend.compiler.impl.BaseMavenCompiler in project kie-wb-common by kiegroup.
the class ClasspathDepsAfterDecoratorTest method compileTest.
@Test
public void compileTest() {
CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[] { MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath }, Boolean.FALSE);
ClasspathDepsAfterDecorator decorator = new ClasspathDepsAfterDecorator(new BaseMavenCompiler(true, false));
CompilationResponse res = decorator.compile(req);
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(res.isSuccessful()).isTrue();
softly.assertThat(res.getDependencies()).hasSize(4);
});
}
use of org.kie.workbench.common.services.backend.compiler.impl.BaseMavenCompiler in project kie-wb-common by kiegroup.
the class KieAfterDecoratorTest method compileWithouKieMavenPlugin.
@Test
public void compileWithouKieMavenPlugin() throws Exception {
CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, createdNewPrjInRepo("normal-dummy", ResourcesConstants.DUMMY), new String[] { MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath }, Boolean.FALSE);
KieAfterDecorator decorator = new KieAfterDecorator(new BaseMavenCompiler(false, false));
KieCompilationResponse kieRes = (KieCompilationResponse) decorator.compile(req);
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(kieRes.isSuccessful()).isTrue();
softly.assertThat(kieRes.getMavenOutput()).isEmpty();
softly.assertThat(kieRes.getKieModule()).isNotNull();
softly.assertThat(kieRes.getKieModuleMetaInfo()).isNotNull();
});
}
use of org.kie.workbench.common.services.backend.compiler.impl.BaseMavenCompiler in project kie-wb-common by kiegroup.
the class KieAfterDecoratorTest method compileWithOverrideTest.
@Test
@Ignore("https://issues.redhat.com/browse/AF-2892")
public void compileWithOverrideTest() throws Exception {
Map<Path, InputStream> override = new HashMap<>();
Path path = Paths.get(tmpRoot + "/src/main/java/org/kie/maven/plugin/test/Person.java");
InputStream input = new FileInputStream(new File(ResourcesConstants.KJAR_2_SINGLE_RESOURCES_OVERRIDE + "/src/main/java/org/kie/maven/plugin/test/Person.java"));
override.put(path, input);
CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[] { MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath }, Boolean.FALSE);
KieAfterDecorator decorator = new KieAfterDecorator(new BaseMavenCompiler(false, false));
KieCompilationResponse kieRes = (KieCompilationResponse) decorator.compile(req, override);
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(kieRes.isSuccessful()).isTrue();
softly.assertThat(kieRes.getMavenOutput()).isEmpty();
softly.assertThat(kieRes.getKieModule()).isNotNull();
softly.assertThat(kieRes.getKieModuleMetaInfo()).isNotNull();
});
}
use of org.kie.workbench.common.services.backend.compiler.impl.BaseMavenCompiler in project kie-wb-common by kiegroup.
the class KieAfterDecoratorTest method compileTest.
@Test
@Ignore("https://issues.redhat.com/browse/AF-2892")
public void compileTest() {
CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[] { MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath }, Boolean.FALSE);
KieAfterDecorator decorator = new KieAfterDecorator(new BaseMavenCompiler(false, false));
KieCompilationResponse kieRes = (KieCompilationResponse) decorator.compile(req);
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(kieRes.isSuccessful()).isTrue();
softly.assertThat(kieRes.getMavenOutput()).isEmpty();
softly.assertThat(kieRes.getKieModule()).isNotNull();
softly.assertThat(kieRes.getKieModuleMetaInfo()).isNotNull();
});
}
use of org.kie.workbench.common.services.backend.compiler.impl.BaseMavenCompiler in project kie-wb-common by kiegroup.
the class KieMavenCompilerFactory method createAndAddNewCompiler.
private static <T extends CompilationResponse> AFCompiler<T> createAndAddNewCompiler(Set<KieDecorator> decorators) {
boolean enableIncremental = decorators.contains(KieDecorator.ENABLE_INCREMENTAL_BUILD);
boolean enableLogging = decorators.contains(KieDecorator.ENABLE_LOGGING);
// Order of the construction of the decorators matters, DO not change the order.
AFCompiler compiler = new BaseMavenCompiler(enableIncremental, enableLogging);
if (decorators.contains(KieDecorator.STORE_BUILD_CLASSPATH)) {
compiler = new ClasspathDepsAfterDecorator(compiler);
}
if (decorators.contains(KieDecorator.ENABLE_LOGGING)) {
compiler = new OutputLogAfterDecorator(compiler);
}
if (decorators.contains(KieDecorator.STORE_KIE_OBJECTS)) {
compiler = new KieAfterDecorator(compiler);
}
if (decorators.contains(KieDecorator.UPDATE_JGIT_BEFORE_BUILD)) {
compiler = new JGITCompilerBeforeDecorator(compiler);
}
return compiler;
}
Aggregations