Search in sources :

Example 6 with ProductConfiguration

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;
        }
    });
}
Also used : AbstractArtifactDependencyWalker(org.eclipse.tycho.core.osgitools.AbstractArtifactDependencyWalker) DependencyArtifacts(org.eclipse.tycho.artifacts.DependencyArtifacts) ProductConfiguration(org.eclipse.tycho.model.ProductConfiguration) FeatureDescription(org.eclipse.tycho.core.FeatureDescription) AbstractArtifactDependencyWalker(org.eclipse.tycho.core.osgitools.AbstractArtifactDependencyWalker) ArtifactDependencyWalker(org.eclipse.tycho.core.ArtifactDependencyWalker) File(java.io.File) PluginDescription(org.eclipse.tycho.core.PluginDescription) ArtifactDependencyVisitor(org.eclipse.tycho.core.ArtifactDependencyVisitor)

Example 7 with ProductConfiguration

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);
                }
            }
        }
    };
}
Also used : ProductConfiguration(org.eclipse.tycho.model.ProductConfiguration) Category(org.eclipse.tycho.model.Category) FeatureRef(org.eclipse.tycho.model.FeatureRef) ArtifactDependencyVisitor(org.eclipse.tycho.core.ArtifactDependencyVisitor)

Example 8 with ProductConfiguration

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());
}
Also used : BundleConfiguration(org.eclipse.tycho.model.BundleConfiguration) ProductConfiguration(org.eclipse.tycho.model.ProductConfiguration) Test(org.junit.Test)

Example 9 with ProductConfiguration

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));
}
Also used : ProductConfiguration(org.eclipse.tycho.model.ProductConfiguration) InstallMode(org.eclipse.tycho.model.FeatureRef.InstallMode) Test(org.junit.Test)

Example 10 with ProductConfiguration

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;
}
Also used : ProductConfiguration(org.eclipse.tycho.model.ProductConfiguration) IOException(java.io.IOException) PomFile(org.eclipse.tycho.versions.pom.PomFile) File(java.io.File)

Aggregations

ProductConfiguration (org.eclipse.tycho.model.ProductConfiguration)11 File (java.io.File)5 Test (org.junit.Test)4 IOException (java.io.IOException)3 ArtifactDependencyVisitor (org.eclipse.tycho.core.ArtifactDependencyVisitor)3 DependencyArtifacts (org.eclipse.tycho.artifacts.DependencyArtifacts)2 ArtifactDependencyWalker (org.eclipse.tycho.core.ArtifactDependencyWalker)2 PluginDescription (org.eclipse.tycho.core.PluginDescription)2 BundleConfiguration (org.eclipse.tycho.model.BundleConfiguration)2 FeatureRef (org.eclipse.tycho.model.FeatureRef)2 InstallMode (org.eclipse.tycho.model.FeatureRef.InstallMode)2 PluginRef (org.eclipse.tycho.model.PluginRef)2 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1 MavenExecutionException (org.apache.maven.MavenExecutionException)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 ArtifactDescriptor (org.eclipse.tycho.ArtifactDescriptor)1 ArtifactKey (org.eclipse.tycho.ArtifactKey)1 DefaultArtifactKey (org.eclipse.tycho.DefaultArtifactKey)1 ReactorProject (org.eclipse.tycho.ReactorProject)1