Search in sources :

Example 1 with SystemCapability

use of org.eclipse.tycho.core.ee.shared.SystemCapability in project tycho by eclipse.

the class CustomExecutionEnvironmentTest method testOsgiEeCapabilityStrangeVersion.

@Test
public void testOsgiEeCapabilityStrangeVersion() throws Exception {
    createExecutionEnvironment(new SystemCapability(Type.OSGI_EE, "JavaSE", "1.6.1"));
    assertThat(customExecutionEnvironment.getProfileProperties().size(), is(3));
    assertProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, "JavaSE-1.6.1");
    assertProperty(Constants.FRAMEWORK_SYSTEMCAPABILITIES, "osgi.ee; osgi.ee=\"JavaSE\"; version:Version=\"1.6.1\"");
}
Also used : SystemCapability(org.eclipse.tycho.core.ee.shared.SystemCapability) Test(org.junit.Test)

Example 2 with SystemCapability

use of org.eclipse.tycho.core.ee.shared.SystemCapability in project tycho by eclipse.

the class CustomExecutionEnvironmentTest method testCDCNameMapping.

@Test
public void testCDCNameMapping() throws Exception {
    createExecutionEnvironment(new SystemCapability(Type.OSGI_EE, "CDC/Foundation", "1.0"), new SystemCapability(Type.OSGI_EE, "CDC/Foundation", "1.1.0"));
    assertProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, "CDC-1.0/Foundation-1.0,CDC-1.1/Foundation-1.1");
    assertProperty(Constants.FRAMEWORK_SYSTEMCAPABILITIES, "osgi.ee; osgi.ee=\"CDC/Foundation\"; version:List<Version>=\"1.0, 1.1\"");
}
Also used : SystemCapability(org.eclipse.tycho.core.ee.shared.SystemCapability) Test(org.junit.Test)

Example 3 with SystemCapability

use of org.eclipse.tycho.core.ee.shared.SystemCapability in project tycho by eclipse.

the class CustomEEResolutionHandler method readCapabilities.

private List<SystemCapability> readCapabilities(IInstallableUnit specificationUnit) {
    List<SystemCapability> result = new ArrayList<>();
    for (IProvidedCapability capability : specificationUnit.getProvidedCapabilities()) {
        String namespace = capability.getNamespace();
        String name = capability.getName();
        String version = capability.getVersion().toString();
        if (JREAction.NAMESPACE_OSGI_EE.equals(namespace)) {
            result.add(new SystemCapability(Type.OSGI_EE, name, version));
        } else if (PublisherHelper.CAPABILITY_NS_JAVA_PACKAGE.equals(namespace)) {
            result.add(new SystemCapability(Type.JAVA_PACKAGE, name, version));
        } else {
        // ignore
        }
    }
    return result;
}
Also used : SystemCapability(org.eclipse.tycho.core.ee.shared.SystemCapability) IProvidedCapability(org.eclipse.equinox.p2.metadata.IProvidedCapability) ArrayList(java.util.ArrayList)

Example 4 with SystemCapability

use of org.eclipse.tycho.core.ee.shared.SystemCapability in project tycho by eclipse.

the class CustomExecutionEnvironment method setSystemPackages.

private void setSystemPackages(List<SystemCapability> systemCapabilities) {
    StringBuilder systemPackagesProperty = new StringBuilder();
    for (SystemCapability capability : systemCapabilities) {
        if (capability.getType() == Type.JAVA_PACKAGE) {
            final String packageName = capability.getName();
            systemPackages.add(packageName);
            append(systemPackagesProperty, toPackageSpecifier(packageName, capability.getVersion()));
        }
    }
    setPropertyIfNotEmpty(Constants.FRAMEWORK_SYSTEMPACKAGES, systemPackagesProperty);
}
Also used : SystemCapability(org.eclipse.tycho.core.ee.shared.SystemCapability)

Example 5 with SystemCapability

use of org.eclipse.tycho.core.ee.shared.SystemCapability in project tycho by eclipse.

the class CustomExecutionEnvironmentTest method testOsgiEeCapabilityAlphanumericVersion.

@Test
public void testOsgiEeCapabilityAlphanumericVersion() throws Exception {
    createExecutionEnvironment(new SystemCapability(Type.OSGI_EE, "JavaSE", "AlphaRelease.beta-245.0"));
    assertThat(customExecutionEnvironment.getProfileProperties().size(), is(3));
    assertProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, "JavaSE-AlphaRelease.beta-245.0");
    assertProperty(Constants.FRAMEWORK_SYSTEMCAPABILITIES, "osgi.ee; osgi.ee=\"JavaSE\"; version:Version=\"AlphaRelease.beta-245.0\"");
}
Also used : SystemCapability(org.eclipse.tycho.core.ee.shared.SystemCapability) Test(org.junit.Test)

Aggregations

SystemCapability (org.eclipse.tycho.core.ee.shared.SystemCapability)10 Test (org.junit.Test)5 ArrayList (java.util.ArrayList)2 File (java.io.File)1 LinkedHashMap (java.util.LinkedHashMap)1 MavenProject (org.apache.maven.project.MavenProject)1 IInstallableUnit (org.eclipse.equinox.p2.metadata.IInstallableUnit)1 IProvidedCapability (org.eclipse.equinox.p2.metadata.IProvidedCapability)1 BundleDescription (org.eclipse.osgi.service.resolver.BundleDescription)1 State (org.eclipse.osgi.service.resolver.State)1 DependencyArtifacts (org.eclipse.tycho.artifacts.DependencyArtifacts)1 CustomExecutionEnvironment (org.eclipse.tycho.core.ee.CustomExecutionEnvironment)1 DependencyEntry (org.eclipse.tycho.core.osgitools.DependencyComputer.DependencyEntry)1