use of org.kie.workbench.common.services.backend.compiler.CompilationRequest in project kie-wb-common by kiegroup.
the class DefaultIncrementalCompilerEnablerTest method processTest.
@Test
public void processTest() {
CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[] { MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath }, Boolean.FALSE);
byte[] encoded = Files.readAllBytes(Paths.get(tmpRoot + "/dummy/pom.xml"));
String pomAsAstring = new String(encoded, StandardCharsets.UTF_8);
assertThat(pomAsAstring).doesNotContain(TestConstants.KIE_TAKARI_LIFECYCLE_ARTIFACT);
IncrementalCompilerEnabler enabler = new DefaultIncrementalCompilerEnabler();
ProcessedPoms poms = enabler.process(req);
assertThat(poms).isNotNull();
assertThat(poms.getResult()).isTrue();
assertThat(poms.getProjectPoms()).hasSize(1);
String pom = poms.getProjectPoms().get(0);
assertThat(pom).isEqualTo(tmpRoot.toString() + "/dummy/pom.xml");
encoded = Files.readAllBytes(Paths.get(tmpRoot + "/dummy/pom.xml"));
pomAsAstring = new String(encoded, StandardCharsets.UTF_8);
assertThat(pomAsAstring).contains(TestConstants.KIE_TAKARI_LIFECYCLE_ARTIFACT);
}
use of org.kie.workbench.common.services.backend.compiler.CompilationRequest in project kie-wb-common by kiegroup.
the class DefaultRemoteExecutor method internalBuild.
private CompletableFuture<KieCompilationResponse> internalBuild(String projectPath, String mavenRepoPath, String settingsXmlPath, boolean skipProjectDepCreation, String goal) {
WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(Paths.get(projectPath));
AFCompiler compiler = getCompiler(projectPath);
CompilationRequest req;
if (settingsXmlPath != null) {
req = new DefaultCompilationRequest(mavenRepoPath, info, new String[] { MavenCLIArgs.ALTERNATE_USER_SETTINGS + settingsXmlPath, goal }, skipProjectDepCreation);
} else {
req = new DefaultCompilationRequest(mavenRepoPath, info, new String[] { goal }, skipProjectDepCreation);
}
return runInItsOwnThread(compiler, req);
}
use of org.kie.workbench.common.services.backend.compiler.CompilationRequest in project kie-wb-common by kiegroup.
the class DefaultLocalExecutor method internalBuild.
private CompletableFuture<KieCompilationResponse> internalBuild(Path projectPath, String mavenRepoPath, String settingXML, boolean skipProjectDepCreation, String goal) {
WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(projectPath);
AFCompiler compiler = getCompiler(projectPath);
CompilationRequest req;
if (settingXML != null) {
req = getDefaultRequest(mavenRepoPath, info, skipProjectDepCreation, new String[] { MavenCLIArgs.ALTERNATE_USER_SETTINGS + settingXML, goal });
} else {
req = getDefaultRequest(mavenRepoPath, info, skipProjectDepCreation, new String[] { goal });
}
return CompletableFuture.supplyAsync(() -> ((KieCompilationResponse) compiler.compile(req)), executor);
}
use of org.kie.workbench.common.services.backend.compiler.CompilationRequest 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.CompilationRequest 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();
});
}
Aggregations