use of org.eclipse.tycho.core.TargetPlatformConfiguration in project tycho by eclipse.
the class P2DependencyResolver method computePreliminaryTargetPlatform.
@Override
public TargetPlatform computePreliminaryTargetPlatform(MavenSession session, MavenProject project, List<ReactorProject> reactorProjects) {
TargetPlatformConfiguration configuration = TychoProjectUtils.getTargetPlatformConfiguration(project);
ExecutionEnvironmentConfiguration ee = TychoProjectUtils.getExecutionEnvironmentConfiguration(project);
TargetPlatformConfigurationStub tpConfiguration = new TargetPlatformConfigurationStub();
tpConfiguration.setIncludePackedArtifacts(configuration.isIncludePackedArtifacts());
PomDependencyCollector pomDependencies = null;
if (TargetPlatformConfiguration.POM_DEPENDENCIES_CONSIDER.equals(configuration.getPomDependencies())) {
pomDependencies = collectPomDependencies(project, reactorProjects, session);
} else {
// TODO 412416 remove this when the setProjectLocation is no longer needed
pomDependencies = resolverFactory.newPomDependencyCollector();
pomDependencies.setProjectLocation(project.getBasedir());
}
for (ArtifactRepository repository : project.getRemoteArtifactRepositories()) {
addEntireP2RepositoryToTargetPlatform(repository, tpConfiguration);
}
tpConfiguration.setEnvironments(configuration.getEnvironments());
for (File file : configuration.getTargets()) {
addTargetFileContentToTargetPlatform(file, configuration.getTargetDefinitionIncludeSourceMode(), tpConfiguration);
}
tpConfiguration.addFilters(configuration.getFilters());
return reactorRepositoryManager.computePreliminaryTargetPlatform(DefaultReactorProject.adapt(project), tpConfiguration, ee, reactorProjects, pomDependencies);
}
use of org.eclipse.tycho.core.TargetPlatformConfiguration in project tycho by eclipse.
the class DefaultTargetPlatformConfigurationReaderTest method testExtraRequirementMissingVersionRange.
@Test
public void testExtraRequirementMissingVersionRange() throws Exception {
Xpp3Dom dom = createConfigurationDom("type", "id");
try {
configurationReader.readExtraRequirements(new TargetPlatformConfiguration(), dom);
fail();
} catch (BuildFailureException e) {
assertTrue(e.getMessage().contains("Element <versionRange> is missing in <extraRequirements><requirement> section."));
}
}
use of org.eclipse.tycho.core.TargetPlatformConfiguration in project tycho by eclipse.
the class DefaultTargetPlatformConfigurationReaderTest method testAddTargetWithValidTargetDefinition.
@Test
public void testAddTargetWithValidTargetDefinition() {
Xpp3Dom dom = createGavConfiguration("myGroupId", "myArtifactId", "myVersion");
MavenSession session = setupMockSession();
TargetPlatformConfiguration configuration = new TargetPlatformConfiguration();
configurationReader.addTargetArtifact(configuration, session, null, dom);
assertEquals(1, configuration.getTargets().size());
assertEquals(new File("/basedir/myArtifactId.target").getPath(), configuration.getTargets().get(0).getPath());
}
use of org.eclipse.tycho.core.TargetPlatformConfiguration in project tycho by eclipse.
the class DefaultTargetPlatformConfigurationReaderTest method testAddTargetWithMissingVersionInTargetDefinition.
@Test
public void testAddTargetWithMissingVersionInTargetDefinition() {
Xpp3Dom dom = createGavConfiguration("myGroupId", "myArtifactId", null);
MavenSession session = setupMockSession();
TargetPlatformConfiguration configuration = new TargetPlatformConfiguration();
try {
configurationReader.addTargetArtifact(configuration, session, null, dom);
fail();
} catch (BuildFailureException e) {
assertTrue(e.getMessage().contains("The target artifact configuration is invalid"));
}
}
use of org.eclipse.tycho.core.TargetPlatformConfiguration in project tycho by eclipse.
the class DefaultTargetPlatformConfigurationReaderTest method testExtraRequirementMissingType.
@Test
public void testExtraRequirementMissingType() throws Exception {
Xpp3Dom dom = createConfigurationDom("id", "versionRange");
try {
configurationReader.readExtraRequirements(new TargetPlatformConfiguration(), dom);
fail();
} catch (BuildFailureException e) {
assertTrue(e.getMessage().contains("Element <type> is missing in <extraRequirements><requirement> section."));
}
}
Aggregations