Search in sources :

Example 1 with ProductConfiguration

use of org.eclipse.tycho.model.ProductConfiguration in project tycho by eclipse.

the class ProductConfigurationTest method testRemoveRootFeatures.

@Test
public void testRemoveRootFeatures() throws Exception {
    ProductConfiguration config = ProductConfiguration.read(getClass().getResourceAsStream("/product/rootFeatures.product"));
    config.removeRootInstalledFeatures();
    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.size(), is(2));
}
Also used : ProductConfiguration(org.eclipse.tycho.model.ProductConfiguration) InstallMode(org.eclipse.tycho.model.FeatureRef.InstallMode) Test(org.junit.Test)

Example 2 with ProductConfiguration

use of org.eclipse.tycho.model.ProductConfiguration in project tycho by eclipse.

the class ProductConfigurationTest method testProductConfigurationParse.

@Test
public void testProductConfigurationParse() throws Exception {
    ProductConfiguration config = ProductConfiguration.read(getClass().getResourceAsStream("/product/MyFirstRCP.product"));
    Assert.assertEquals("My First RCP", config.getName());
    Assert.assertEquals("MyFirstRCP.product1", config.getProduct());
    Assert.assertEquals("MyFirstRCP.application", config.getApplication());
    Assert.assertEquals(false, config.useFeatures());
    /*
         * ConfigIni configIni = config.getConfigIni(); Assert.assertNotNull(configIni);
         * Assert.assertEquals("linux.ini", configIni.getLinuxIcon());
         * Assert.assertEquals("macosx.ini", configIni.getMacosxIcon());
         * Assert.assertEquals("solaris.ini", configIni.getSolarisIcon());
         * Assert.assertEquals("win32.ini", configIni.getWin32());
         * 
         * LauncherArguments launcherArgs = config.getLauncherArgs();
         * Assert.assertNotNull(launcherArgs); Assert.assertEquals("-all args",
         * launcherArgs.getProgramArgs()); Assert.assertEquals("-linux args",
         * launcherArgs.getProgramArgsLin()); Assert.assertEquals("-mac args",
         * launcherArgs.getProgramArgsMac()); Assert.assertEquals("-solaris args",
         * launcherArgs.getProgramArgsSol()); Assert.assertEquals("-win32 args",
         * launcherArgs.getProgramArgsWin()); Assert.assertEquals("-all vm",
         * launcherArgs.getVmArgs()); Assert.assertEquals("-linux vm", launcherArgs.getVmArgsLin());
         * Assert.assertEquals("-mac vm", launcherArgs.getVmArgsMac());
         * Assert.assertEquals("-solaris vm", launcherArgs.getVmArgsSol());
         * Assert.assertEquals("-win32 vm", launcherArgs.getVmArgsWin());
         */
    Launcher launcher = config.getLauncher();
    Assert.assertNotNull(launcher);
    Assert.assertEquals("launchername", launcher.getName());
    Assert.assertEquals("XPM", launcher.getLinuxIcon().get(Launcher.ICON_LINUX));
    Assert.assertEquals("icns", launcher.getMacosxIcon().get(Launcher.ICON_MAC));
    Assert.assertEquals("large", launcher.getSolarisIcon().get(Launcher.ICON_SOLARIS_LARGE));
    Assert.assertEquals("medium", launcher.getSolarisIcon().get(Launcher.ICON_SOLARIS_MEDIUM));
    Assert.assertEquals("small", launcher.getSolarisIcon().get(Launcher.ICON_SOLARIS_SMALL));
    Assert.assertEquals("tiny", launcher.getSolarisIcon().get(Launcher.ICON_SOLARIS_TINY));
    Assert.assertEquals(false, launcher.getWindowsUseIco());
    // Assert.assertEquals("iconon", launcher.getWindowsIcon().getIco().getPath());
    Assert.assertEquals("16-32", launcher.getWindowsIcon().get(Launcher.ICON_WINDOWS_SMALL_HIGH));
    Assert.assertEquals("16-8", launcher.getWindowsIcon().get(Launcher.ICON_WINDOWS_SMALL_LOW));
    Assert.assertEquals("32-32", launcher.getWindowsIcon().get(Launcher.ICON_WINDOWS_MEDIUM_HIGH));
    Assert.assertEquals("32-8", launcher.getWindowsIcon().get(Launcher.ICON_WINDOWS_MEDIUM_LOW));
    Assert.assertEquals("48-32", launcher.getWindowsIcon().get(Launcher.ICON_WINDOWS_LARGE_HIGH));
    Assert.assertEquals("48-8", launcher.getWindowsIcon().get(Launcher.ICON_WINDOWS_LARGE_LOW));
    Assert.assertEquals("256-32", launcher.getWindowsIcon().get(Launcher.ICON_WINDOWS_EXTRA_LARGE_HIGH));
    List<PluginRef> plugins = config.getPlugins();
    Assert.assertNotNull(plugins);
    Assert.assertEquals(2, plugins.size());
    PluginRef plugin = plugins.get(0);
    Assert.assertNotNull(plugin);
    Assert.assertEquals("HeadlessProduct", plugin.getId());
    Assert.assertNull(plugin.getVersion());
    List<FeatureRef> features = config.getFeatures();
    Assert.assertNotNull(features);
    Assert.assertEquals(2, features.size());
    FeatureRef feature = features.get(0);
    Assert.assertNotNull(feature);
    Assert.assertEquals("HeadlessFeature", feature.getId());
    Assert.assertEquals("1.0.0", feature.getVersion());
}
Also used : ProductConfiguration(org.eclipse.tycho.model.ProductConfiguration) PluginRef(org.eclipse.tycho.model.PluginRef) Launcher(org.eclipse.tycho.model.Launcher) FeatureRef(org.eclipse.tycho.model.FeatureRef) Test(org.junit.Test)

Example 3 with ProductConfiguration

use of org.eclipse.tycho.model.ProductConfiguration in project tycho by eclipse.

the class OsgiBundleProject method getDependencyWalker.

@Override
public ArtifactDependencyWalker getDependencyWalker(MavenProject project) {
    final DependencyArtifacts artifacts = getDependencyArtifacts(project);
    final List<ClasspathEntry> cp = getClasspath(project);
    return new ArtifactDependencyWalker() {

        @Override
        public void walk(ArtifactDependencyVisitor visitor) {
            for (ClasspathEntry entry : cp) {
                ArtifactDescriptor artifact = artifacts.getArtifact(entry.getArtifactKey());
                ArtifactKey key = artifact.getKey();
                File location = artifact.getLocation();
                ReactorProject project = artifact.getMavenProject();
                String classifier = artifact.getClassifier();
                Set<Object> installableUnits = artifact.getInstallableUnits();
                PluginDescription plugin = new DefaultPluginDescription(key, location, project, classifier, null, installableUnits);
                visitor.visitPlugin(plugin);
            }
        }

        @Override
        public void traverseFeature(File location, Feature feature, ArtifactDependencyVisitor visitor) {
        }

        @Override
        public void traverseUpdateSite(UpdateSite site, ArtifactDependencyVisitor artifactDependencyVisitor) {
        }

        @Override
        public void traverseProduct(ProductConfiguration productConfiguration, ArtifactDependencyVisitor visitor) {
        }
    };
}
Also used : DependencyArtifacts(org.eclipse.tycho.artifacts.DependencyArtifacts) ArtifactKey(org.eclipse.tycho.ArtifactKey) ProductConfiguration(org.eclipse.tycho.model.ProductConfiguration) ReactorProject(org.eclipse.tycho.ReactorProject) ArtifactDependencyWalker(org.eclipse.tycho.core.ArtifactDependencyWalker) Feature(org.eclipse.tycho.model.Feature) ArtifactDependencyVisitor(org.eclipse.tycho.core.ArtifactDependencyVisitor) ArtifactDescriptor(org.eclipse.tycho.ArtifactDescriptor) ClasspathEntry(org.eclipse.tycho.classpath.ClasspathEntry) File(java.io.File) PluginDescription(org.eclipse.tycho.core.PluginDescription) UpdateSite(org.eclipse.tycho.model.UpdateSite)

Example 4 with ProductConfiguration

use of org.eclipse.tycho.model.ProductConfiguration in project tycho by eclipse.

the class EclipseApplicationProject method getArtifactKey.

@Override
public ArtifactKey getArtifactKey(ReactorProject project) {
    ProductConfiguration product = loadProduct(project);
    String id = product.getId() != null ? product.getId() : project.getArtifactId();
    String version = product.getVersion() != null ? product.getVersion() : getOsgiVersion(project);
    // TODO this is an invalid type constant for an ArtifactKey
    return new DefaultArtifactKey(PackagingType.TYPE_ECLIPSE_APPLICATION, id, version);
}
Also used : ProductConfiguration(org.eclipse.tycho.model.ProductConfiguration) DefaultArtifactKey(org.eclipse.tycho.DefaultArtifactKey)

Example 5 with ProductConfiguration

use of org.eclipse.tycho.model.ProductConfiguration in project tycho by eclipse.

the class WorkspaceTychoOsgiRuntimeLocator method addProduct.

public boolean addProduct(EquinoxRuntimeDescription result, Artifact pom) throws MavenExecutionException {
    ProductConfiguration product;
    try {
        product = ProductConfiguration.read(new File(pom.getFile().getParentFile(), pom.getArtifactId() + ".product"));
    } catch (IOException e) {
        return false;
    }
    // the above fails with IOException if .product file is not available or can't be read
    // we get here only when we have valid product instance
    Set<String> missing = new LinkedHashSet<>();
    for (PluginRef pluginRef : product.getPlugins()) {
        DevBundleInfo bundleInfo = workspaceState.getBundleInfo(pluginRef.getId(), pluginRef.getVersion());
        if (bundleInfo != null) {
            addBundle(result, bundleInfo);
        } else {
            missing.add(pluginRef.toString());
        }
    }
    if (!missing.isEmpty()) {
        throw new MavenExecutionException("Inconsistent m2e-tycho workspace state, missing bundles: " + missing.toString(), (Throwable) null);
    }
    Map<String, BundleConfiguration> bundleConfigurations = product.getPluginConfiguration();
    if (bundleConfigurations != null) {
        for (BundleConfiguration bundleConfiguration : bundleConfigurations.values()) {
            result.addBundleStartLevel(bundleConfiguration.getId(), bundleConfiguration.getStartLevel(), bundleConfiguration.isAutoStart());
        }
    }
    return true;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) MavenExecutionException(org.apache.maven.MavenExecutionException) BundleConfiguration(org.eclipse.tycho.model.BundleConfiguration) ProductConfiguration(org.eclipse.tycho.model.ProductConfiguration) DevBundleInfo(org.eclipse.tycho.dev.DevBundleInfo) PluginRef(org.eclipse.tycho.model.PluginRef) IOException(java.io.IOException) 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