Search in sources :

Example 21 with TargetEnvironment

use of org.eclipse.tycho.core.shared.TargetEnvironment in project tycho by eclipse.

the class TargetDefinitionResolverWithPlatformSpecificUnitsTest method testPlannerResolutionWithOnePlatform.

@Test
public void testPlannerResolutionWithOnePlatform() throws Exception {
    TargetEnvironment environment = new TargetEnvironment("linux", "gtk", "x86_64");
    targetDefinition = definitionWith(new FilterRepoLocationStubWithLauncherUnit(IncludeMode.PLANNER));
    subject = createResolver(Collections.singletonList(environment));
    TargetDefinitionContent units = subject.resolveContent(targetDefinition);
    assertThat(versionedIdsOf(units), bagEquals(versionedIdList(LAUNCHER_FEATURE, LAUNCHER_FEATURE_JAR, LAUNCHER_BUNDLE, LAUNCHER_BUNDLE_LINUX)));
}
Also used : TargetEnvironment(org.eclipse.tycho.core.shared.TargetEnvironment) Test(org.junit.Test)

Example 22 with TargetEnvironment

use of org.eclipse.tycho.core.shared.TargetEnvironment in project tycho by eclipse.

the class TargetPlatformFactoryTest method setUpSubjectAndContext.

@Before
public void setUpSubjectAndContext() throws Exception {
    subject = new TestResolverFactory(logVerifier.getLogger()).getTargetPlatformFactoryImpl();
    tpConfig = new TargetPlatformConfigurationStub();
    // dummy value for target file resolution
    tpConfig.setEnvironments(Collections.singletonList(new TargetEnvironment(null, null, null)));
}
Also used : TargetPlatformConfigurationStub(org.eclipse.tycho.p2.target.facade.TargetPlatformConfigurationStub) TargetEnvironment(org.eclipse.tycho.core.shared.TargetEnvironment) Before(org.junit.Before)

Example 23 with TargetEnvironment

use of org.eclipse.tycho.core.shared.TargetEnvironment in project tycho by eclipse.

the class AbstractSiteDependenciesAction method getRequiredCapabilities.

@Override
protected Set<IRequirement> getRequiredCapabilities() {
    Set<IRequirement> required = new LinkedHashSet<>();
    for (SiteFeature feature : getSiteModel().getFeatures()) {
        // $NON-NLS-1$
        String id = feature.getFeatureIdentifier() + FEATURE_GROUP_IU_SUFFIX;
        VersionRange range = getVersionRange(createVersion(feature.getFeatureVersion()));
        String filter = new TargetEnvironment(feature.getOS(), feature.getWS(), feature.getOSArch()).toFilterExpression();
        // boolean optional = feature.isOptional();
        required.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, id, range, InstallableUnit.parseFilter(filter), false, false));
    }
    for (SiteBundle bundle : getSiteModel().getBundles()) {
        String id = bundle.getBundleIdentifier();
        VersionRange range = getVersionRange(createVersion(bundle.getBundleVersion()));
        String filter = new TargetEnvironment(bundle.getOS(), bundle.getWS(), bundle.getOSArch()).toFilterExpression();
        // boolean optional = feature.isOptional();
        required.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, id, range, InstallableUnit.parseFilter(filter), false, false));
    }
    for (SiteIU iu : getSiteModel().getIUs()) {
        IRequirement requirement = getRequirement(iu);
        if (requirement != null)
            required.add(requirement);
    }
    return required;
}
Also used : IRequirement(org.eclipse.equinox.p2.metadata.IRequirement) LinkedHashSet(java.util.LinkedHashSet) SiteIU(org.eclipse.equinox.internal.p2.updatesite.SiteIU) SiteFeature(org.eclipse.equinox.internal.p2.updatesite.SiteFeature) VersionRange(org.eclipse.equinox.p2.metadata.VersionRange) SiteBundle(org.eclipse.equinox.internal.p2.updatesite.SiteBundle) TargetEnvironment(org.eclipse.tycho.core.shared.TargetEnvironment)

Example 24 with TargetEnvironment

use of org.eclipse.tycho.core.shared.TargetEnvironment in project tycho by eclipse.

the class P2DependencyGeneratorImplTest method generateDependencies.

private void generateDependencies(String testProjectId, String packagingType) throws IOException {
    File reactorProjectRoot = new File("resources/generator/" + testProjectId).getCanonicalFile();
    ArtifactMock reactorProject = new ArtifactMock(reactorProjectRoot, DEFAULT_GROUP_ID, testProjectId, DEFAULT_VERSION, packagingType, DEFAULT_CLASSIFIER);
    ArrayList<TargetEnvironment> emptyEnvironments = new ArrayList<>();
    DependencyMetadata metadata = subject.generateMetadata(reactorProject, emptyEnvironments);
    this.units = new ArrayList<>(metadata.getInstallableUnits());
    this.artifacts = new ArrayList<>(metadata.getArtifactDescriptors());
}
Also used : ArrayList(java.util.ArrayList) ArtifactMock(org.eclipse.tycho.p2.impl.test.ArtifactMock) TargetEnvironment(org.eclipse.tycho.core.shared.TargetEnvironment) File(java.io.File)

Example 25 with TargetEnvironment

use of org.eclipse.tycho.core.shared.TargetEnvironment in project tycho by eclipse.

the class P2MetadataGeneratorImplTest method gav.

@Test
public void gav() throws Exception {
    P2GeneratorImpl impl = new P2GeneratorImpl(false);
    impl.setBuildPropertiesParser(new BuildPropertiesParserForTesting());
    File location = new File("resources/generator/bundle").getCanonicalFile();
    String groupId = "org.eclipse.tycho.p2.impl.test";
    String artifactId = "bundle";
    String version = "1.0.0-SNAPSHOT";
    List<TargetEnvironment> environments = new ArrayList<>();
    DependencyMetadata metadata = impl.generateMetadata(new ArtifactMock(location, groupId, artifactId, version, PackagingType.TYPE_ECLIPSE_PLUGIN), environments);
    List<IInstallableUnit> units = new ArrayList<>(metadata.getInstallableUnits());
    List<IArtifactDescriptor> artifacts = new ArrayList<>(metadata.getArtifactDescriptors());
    Assert.assertEquals(1, units.size());
    IInstallableUnit unit = units.iterator().next();
    Assert.assertEquals("org.eclipse.tycho.p2.impl.test.bundle", unit.getId());
    Assert.assertEquals("1.0.0.qualifier", unit.getVersion().toString());
    Assert.assertEquals(2, unit.getRequirements().size());
    Assert.assertEquals(1, artifacts.size());
    IArtifactDescriptor ad = artifacts.iterator().next();
    Assert.assertEquals("org.eclipse.tycho.p2.impl.test.bundle", ad.getArtifactKey().getId());
    Assert.assertEquals("1.0.0.qualifier", ad.getArtifactKey().getVersion().toString());
    Assert.assertEquals(groupId, ad.getProperties().get(RepositoryLayoutHelper.PROP_GROUP_ID));
    Assert.assertEquals(artifactId, ad.getProperties().get(RepositoryLayoutHelper.PROP_ARTIFACT_ID));
    Assert.assertEquals(version, ad.getProperties().get(RepositoryLayoutHelper.PROP_VERSION));
}
Also used : IArtifactDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor) ArrayList(java.util.ArrayList) TargetEnvironment(org.eclipse.tycho.core.shared.TargetEnvironment) P2GeneratorImpl(org.eclipse.tycho.p2.impl.publisher.P2GeneratorImpl) BuildPropertiesParserForTesting(org.eclipse.tycho.test.util.BuildPropertiesParserForTesting) DependencyMetadata(org.eclipse.tycho.p2.impl.publisher.DependencyMetadata) IInstallableUnit(org.eclipse.equinox.p2.metadata.IInstallableUnit) File(java.io.File) Test(org.junit.Test)

Aggregations

TargetEnvironment (org.eclipse.tycho.core.shared.TargetEnvironment)38 Test (org.junit.Test)14 File (java.io.File)10 ArrayList (java.util.ArrayList)6 TargetPlatformConfiguration (org.eclipse.tycho.core.TargetPlatformConfiguration)6 HashMap (java.util.HashMap)4 LinkedHashMap (java.util.LinkedHashMap)3 LinkedHashSet (java.util.LinkedHashSet)3 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)3 MojoFailureException (org.apache.maven.plugin.MojoFailureException)3 Xpp3Dom (org.codehaus.plexus.util.xml.Xpp3Dom)3 P2ResolutionResult (org.eclipse.tycho.p2.resolver.facade.P2ResolutionResult)3 IOException (java.io.IOException)2 Map (java.util.Map)2 Properties (java.util.Properties)2 MavenSession (org.apache.maven.execution.MavenSession)2 MavenProject (org.apache.maven.project.MavenProject)2 ArtifactDescriptor (org.eclipse.tycho.ArtifactDescriptor)2 ArtifactKey (org.eclipse.tycho.ArtifactKey)2 ReactorProject (org.eclipse.tycho.ReactorProject)2