use of org.eclipse.tycho.core.ee.shared.SystemCapability in project tycho by eclipse.
the class CustomExecutionEnvironmentTest method testJavaSEVersionNameMappings.
@Test
public void testJavaSEVersionNameMappings() throws Exception {
List<SystemCapability> javaSeVersions = new ArrayList<>();
for (String version : new String[] { "1.2.0", "1.3.0", "1.4.0", "1.5.0", "1.6.0", "1.7.0" }) {
SystemCapability capability = new SystemCapability(Type.OSGI_EE, "JavaSE", version);
javaSeVersions.add(capability);
}
customExecutionEnvironment = new CustomExecutionEnvironment("name", javaSeVersions);
assertThat(customExecutionEnvironment.getProfileProperties().size(), is(3));
assertProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, "J2SE-1.2,J2SE-1.3,J2SE-1.4,J2SE-1.5,JavaSE-1.6,JavaSE-1.7");
}
use of org.eclipse.tycho.core.ee.shared.SystemCapability in project tycho by eclipse.
the class DependencyComputerTest method testWiringToPackageFromCustomProfile.
// TODO code reuse
@Test
public void testWiringToPackageFromCustomProfile() throws Exception {
File basedir = getBasedir("projects/customProfile");
Map<File, MavenProject> basedirMap = MavenSessionUtils.getBasedirMap(getSortedProjects(basedir, null));
MavenProject project = basedirMap.get(new File(basedir, "bundle"));
DependencyArtifacts platform = (DependencyArtifacts) project.getContextValue(TychoConstants.CTX_DEPENDENCY_ARTIFACTS);
CustomExecutionEnvironment customProfile = new CustomExecutionEnvironment("custom", Arrays.asList(//
new SystemCapability(Type.JAVA_PACKAGE, "package.historically.not.in.jdk", "1.2.1"), //
new SystemCapability(Type.OSGI_EE, "OSGi/Minimum", "1.0.0"), //
new SystemCapability(Type.OSGI_EE, "JavaSE", "1.0.0"), //
new SystemCapability(Type.OSGI_EE, "JavaSE", "1.1.0"), new SystemCapability(Type.OSGI_EE, "JavaSE", "1.2.0")));
State state = resolver.newResolvedState(project, customProfile, false, platform);
BundleDescription bundle = state.getBundleByLocation(project.getBasedir().getAbsolutePath());
List<DependencyEntry> dependencies = dependencyComputer.computeDependencies(state.getStateHelper(), bundle);
if (dependencies.size() > 0) {
assertThat(dependencies.size(), is(1));
assertThat(dependencies.get(0).desc.getSymbolicName(), is(Constants.SYSTEM_BUNDLE_SYMBOLICNAME));
}
}
use of org.eclipse.tycho.core.ee.shared.SystemCapability in project tycho by eclipse.
the class CustomEEResolutionHandler method readFullSpecification.
@Override
public void readFullSpecification(Collection<IInstallableUnit> targetPlatformContent) {
IInstallableUnit specificationUnit = findSpecificationUnit(targetPlatformContent, getResolutionHints());
List<SystemCapability> systemCapabilities = readCapabilities(specificationUnit);
eeConfiguration.setFullSpecificationForCustomProfile(systemCapabilities);
}
use of org.eclipse.tycho.core.ee.shared.SystemCapability in project tycho by eclipse.
the class CustomExecutionEnvironment method setExecutionEnvironmentProperties.
private void setExecutionEnvironmentProperties(List<SystemCapability> systemCapabilities) {
StringBuilder executionEnvironmentProperty = new StringBuilder();
for (SystemCapability capability : systemCapabilities) {
if (capability.getType() == Type.OSGI_EE) {
String environmentName = capability.getName();
String version = normalizeVersion(capability.getVersion());
append(executionEnvironmentProperty, toExecutionEnvironment(environmentName, version));
}
}
setPropertyIfNotEmpty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, executionEnvironmentProperty);
}
use of org.eclipse.tycho.core.ee.shared.SystemCapability in project tycho by eclipse.
the class CustomExecutionEnvironment method setOsgiSystemCapabilities.
private void setOsgiSystemCapabilities(List<SystemCapability> systemCapabilities) {
Map<String, MultipleVersionsCapability> capabilityMap = new LinkedHashMap<>();
for (SystemCapability capability : systemCapabilities) {
if (capability.getType() == Type.OSGI_EE) {
String environmentName = capability.getName();
String version = normalizeVersion(capability.getVersion());
if (capabilityMap.containsKey(environmentName)) {
capabilityMap.get(environmentName).addVersion(version);
} else {
capabilityMap.put(environmentName, new MultipleVersionsCapability(environmentName, version));
}
}
}
StringBuilder systemCapabilitesProperty = new StringBuilder();
for (MultipleVersionsCapability capability : capabilityMap.values()) {
append(systemCapabilitesProperty, capability.toString());
}
setPropertyIfNotEmpty(Constants.FRAMEWORK_SYSTEMCAPABILITIES, systemCapabilitesProperty);
}
Aggregations