use of com.liferay.ide.project.core.IProjectBuilder in project liferay-ide by liferay.
the class MavenModuleProjectTests method testProjectTemplateServiceBuilder.
@Test
public void testProjectTemplateServiceBuilder() throws Exception {
NewLiferayModuleProjectOp op = NewLiferayModuleProjectOp.TYPE.instantiate();
op.setProjectName("service-builder-test");
op.setProjectProvider("maven-module");
op.setProjectTemplateName("service-builder");
op.setPackageName("com.liferay.test");
IProject parent = create(op);
assertTrue(parent != null && parent.exists());
IProject api = CoreUtil.getProject("service-builder-test-api");
assertTrue(api != null && api.exists());
IProject service = CoreUtil.getProject("service-builder-test-service");
assertTrue(service != null && service.exists());
IProjectBuilder builder = LiferayCore.create(IProjectBuilder.class, service);
builder.buildService(monitor);
api.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
service.build(IncrementalProjectBuilder.FULL_BUILD, monitor);
IBundleProject apiBundle = LiferayCore.create(IBundleProject.class, api);
assertNotNull(apiBundle);
IPath apiOutput = apiBundle.getOutputBundle(true, monitor);
assertNotNull(apiOutput);
assertTrue(apiOutput.toFile().exists());
assertEquals("service-builder-test-api-1.0.0.jar", apiOutput.lastSegment());
IBundleProject serviceBundle = LiferayCore.create(IBundleProject.class, service);
IPath serviceOutput = serviceBundle.getOutputBundle(true, monitor);
assertNotNull(serviceOutput);
assertTrue(serviceOutput.toFile().exists());
assertEquals("service-builder-test-service-1.0.0.jar", serviceOutput.lastSegment());
}
use of com.liferay.ide.project.core.IProjectBuilder in project liferay-ide by liferay.
the class MavenModuleProjectTests method testMavenDependencyUpdate.
@Test
public void testMavenDependencyUpdate() throws Exception {
String[][] dependency = new String[][] { { "com.liferay.portal", "com.liferay.portal.kernel", "2.6.0" } };
Dependency mavenDependency = new Dependency();
mavenDependency.setGroupId(dependency[0][0]);
mavenDependency.setArtifactId(dependency[0][1]);
mavenDependency.setVersion(dependency[0][2]);
final URL wsZipUrl = Platform.getBundle("com.liferay.ide.maven.core.tests").getEntry("projects/MavenDependencyTestProject.zip");
final File wsZipFile = new File(FileLocator.toFileURL(wsZipUrl).getFile());
File eclipseWorkspaceLocation = CoreUtil.getWorkspaceRoot().getLocation().toFile();
ZipUtil.unzip(wsZipFile, eclipseWorkspaceLocation);
File mavenDependencyTestProjectFolder = new File(eclipseWorkspaceLocation, "MavenDependencyTestProject");
MavenUtil.importProject(mavenDependencyTestProjectFolder.getAbsolutePath(), monitor);
waitForJobsToComplete(monitor);
IProject mavenDependencyTestProject = CoreUtil.getProject("MavenDependencyTestProject");
assertNotNull(mavenDependencyTestProject);
assertTrue(mavenDependencyTestProject.exists());
IMavenProjectFacade projectFacade = MavenUtil.getProjectFacade(mavenDependencyTestProject, new NullProgressMonitor());
assertNotNull(projectFacade);
MavenProject mavenProject = projectFacade.getMavenProject(new NullProgressMonitor());
List<Dependency> existedDependencies = mavenProject.getDependencies();
assertFalse(checkDependency(existedDependencies, mavenDependency));
ILiferayProject liferayMavenDependencyProject = LiferayCore.create(mavenDependencyTestProject);
IProjectBuilder projectBuilder = liferayMavenDependencyProject.adapt(IProjectBuilder.class);
projectBuilder.updateProjectDependency(mavenDependencyTestProject, Arrays.asList(dependency));
waitForJobsToComplete(monitor);
MavenProject updateMavenProject = projectFacade.getMavenProject(new NullProgressMonitor());
List<Dependency> updateDependencies = updateMavenProject.getDependencies();
assertTrue(checkDependency(updateDependencies, mavenDependency));
}
use of com.liferay.ide.project.core.IProjectBuilder in project liferay-ide by liferay.
the class AbstractLiferayComponentTemplate method doMergeDependencyOperation.
protected void doMergeDependencyOperation() throws CoreException {
IProjectBuilder builder = liferayProject.adapt(IProjectBuilder.class);
builder.updateProjectDependency(project, getComponentDependency());
}
use of com.liferay.ide.project.core.IProjectBuilder in project liferay-ide by liferay.
the class BuildServiceJob method runBuild.
protected void runBuild(IProgressMonitor monitor) throws CoreException {
IProjectBuilder builder = getProjectBuilder();
monitor.worked(50);
IStatus retval = builder.buildService(monitor);
if (retval == null) {
retval = ServiceCore.createErrorStatus(NLS.bind(Msgs.errorRunningBuildService, getProject()));
}
if ((retval == null) || !retval.isOK()) {
throw new CoreException(retval);
}
monitor.worked(90);
}
use of com.liferay.ide.project.core.IProjectBuilder in project liferay-ide by liferay.
the class BuildServiceJob method getProjectBuilder.
protected IProjectBuilder getProjectBuilder() throws CoreException {
ILiferayProject liferayProject = LiferayCore.create(getProject());
if (liferayProject == null) {
throw new CoreException(ServiceCore.createErrorStatus(NLS.bind(Msgs.couldNotCreateLiferayProject, getProject())));
}
IProjectBuilder builder = liferayProject.adapt(IProjectBuilder.class);
if (builder == null) {
throw new CoreException(ServiceCore.createErrorStatus(NLS.bind(Msgs.couldNotCreateProjectBuilder, getProject())));
}
return builder;
}
Aggregations