use of org.eclipse.tycho.model.ProductConfiguration in project tycho by eclipse.
the class ArtifactDependencyWalkerTest method walkProduct.
protected void walkProduct(String productFile, final ArrayList<PluginDescription> plugins, final ArrayList<FeatureDescription> features) throws Exception, IOException, XmlPullParserException {
DependencyArtifacts platform = getTargetPlatform();
final ProductConfiguration product = ProductConfiguration.read(new File(productFile));
ArtifactDependencyWalker walker = new AbstractArtifactDependencyWalker(platform) {
@Override
public void walk(ArtifactDependencyVisitor visitor) {
traverseProduct(product, visitor);
}
};
walker.walk(new ArtifactDependencyVisitor() {
@Override
public void visitPlugin(PluginDescription plugin) {
plugins.add(plugin);
}
@Override
public boolean visitFeature(FeatureDescription feature) {
features.add(feature);
return true;
}
});
}
use of org.eclipse.tycho.model.ProductConfiguration in project tycho by eclipse.
the class EclipseRepositoryProject method newDependencyWalker.
@Override
protected ArtifactDependencyWalker newDependencyWalker(MavenProject project, TargetEnvironment environment) {
final List<ProductConfiguration> products = loadProducts(project);
final List<Category> categories = loadCategories(project);
return new AbstractArtifactDependencyWalker(getDependencyArtifacts(project, environment), getEnvironments(project, environment)) {
@Override
public void walk(ArtifactDependencyVisitor visitor) {
WalkbackPath visited = new WalkbackPath();
for (ProductConfiguration product : products) {
traverseProduct(product, visitor, visited);
}
for (Category category : categories) {
for (FeatureRef feature : category.getFeatures()) {
traverseFeature(feature, visitor, visited);
}
}
}
};
}
use of org.eclipse.tycho.model.ProductConfiguration in project tycho by eclipse.
the class ProductConfigurationTest method testProductConfigurationParseWithStartLevel.
@Test
public void testProductConfigurationParseWithStartLevel() throws Exception {
ProductConfiguration config = ProductConfiguration.read(getClass().getResourceAsStream("/product/MyProduct.product"));
Map<String, BundleConfiguration> bundles = config.getPluginConfiguration();
// <plugin id="org.eclipse.core.contenttype" autoStart="true" startLevel="1" />
BundleConfiguration contentType = bundles.get("org.eclipse.core.contenttype");
Assert.assertNotNull(contentType);
Assert.assertTrue(contentType.isAutoStart());
Assert.assertEquals(1, contentType.getStartLevel());
// <plugin id="HeadlessProduct" autoStart="false" startLevel="2" />
BundleConfiguration headlessProduct = bundles.get("HeadlessProduct");
Assert.assertNotNull(headlessProduct);
Assert.assertFalse(headlessProduct.isAutoStart());
Assert.assertEquals(2, headlessProduct.getStartLevel());
}
use of org.eclipse.tycho.model.ProductConfiguration in project tycho by eclipse.
the class ProductConfigurationTest method testFeatureInstallMode.
@Test
public void testFeatureInstallMode() throws Exception {
ProductConfiguration config = ProductConfiguration.read(getClass().getResourceAsStream("/product/rootFeatures.product"));
Map<String, InstallMode> modes = getInstallModes(config);
assertThat(modes.get("org.eclipse.rcp"), is(InstallMode.include));
assertThat(modes.get("org.eclipse.e4.rcp"), is(InstallMode.include));
assertThat(modes.get("org.eclipse.help"), is(InstallMode.root));
assertThat(modes.get("org.eclipse.egit"), is(InstallMode.root));
assertThat(modes.size(), is(4));
}
use of org.eclipse.tycho.model.ProductConfiguration in project tycho by eclipse.
the class EclipseApplicationProductFileManipulator method getProductConfiguration.
private ProductConfiguration getProductConfiguration(ProjectMetadata project) {
ProductConfiguration product = project.getMetadata(ProductConfiguration.class);
if (product == null) {
File file = getProductFile(project);
try {
product = ProductConfiguration.read(file);
project.putMetadata(product);
} catch (IOException e) {
throw new IllegalArgumentException("Could not read product configuration file " + file, e);
}
}
return product;
}
Aggregations