Search in sources :

Example 6 with TargetPlatform

use of org.eclipse.tycho.artifacts.TargetPlatform in project tycho by eclipse.

the class IUXmlTransformerTest method testExpandReferences.

@Test
public void testExpandReferences() throws Exception {
    subject = new IUXmlTransformer();
    IU iu = IU.read(new File(TestUtil.getBasedir("projects/iuXmlValueReplacement/"), "p2iu.xml"));
    TargetPlatform tp = mock(TargetPlatform.class);
    when(tp.resolveArtifact("p2-installable-unit", "org.junit4", "0.0.0")).thenReturn(junit4InTP);
    when(tp.resolveArtifact("p2-installable-unit", "org.hamcrest.core", "1.1.0.qualifier")).thenReturn(hamcrestInTP);
    subject.replaceZerosInRequirements(iu, tp);
    subject.replaceQualifierInRequirements(iu, tp);
    assertThat(iu.getRequiredCapabilites(), hasItem(requirement("org.junit4", "4.8.1.v20100302")));
    assertThat(iu.getRequiredCapabilites(), hasItem(requirement("org.hamcrest.core", "1.1.0.v20090501071000")));
}
Also used : TargetPlatform(org.eclipse.tycho.artifacts.TargetPlatform) IU(org.eclipse.tycho.model.IU) File(java.io.File) Test(org.junit.Test)

Example 7 with TargetPlatform

use of org.eclipse.tycho.artifacts.TargetPlatform in project tycho by eclipse.

the class PackageFeatureMojo method expandVersionQualifiers.

private void expandVersionQualifiers(Feature feature) throws MojoFailureException {
    feature.setVersion(DefaultReactorProject.adapt(project).getExpandedVersion());
    TargetPlatform targetPlatform = TychoProjectUtils.getTargetPlatformIfAvailable(project);
    if (targetPlatform == null) {
        getLog().warn("Skipping version reference expansion in eclipse-feature project using the deprecated -Dtycho.targetPlatform configuration");
        return;
    }
    featureXmlTransformer.expandReferences(feature, targetPlatform);
}
Also used : TargetPlatform(org.eclipse.tycho.artifacts.TargetPlatform)

Aggregations

TargetPlatform (org.eclipse.tycho.artifacts.TargetPlatform)7 File (java.io.File)3 DependencyArtifacts (org.eclipse.tycho.artifacts.DependencyArtifacts)2 DependencyResolver (org.eclipse.tycho.core.DependencyResolver)2 DependencyResolverConfiguration (org.eclipse.tycho.core.DependencyResolverConfiguration)2 TargetPlatformConfiguration (org.eclipse.tycho.core.TargetPlatformConfiguration)2 Test (org.junit.Test)2 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 HashSet (java.util.HashSet)1 Dependency (org.apache.maven.model.Dependency)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 SilentLog (org.apache.maven.plugin.testing.SilentLog)1 ArtifactDescriptor (org.eclipse.tycho.ArtifactDescriptor)1 ReactorProject (org.eclipse.tycho.ReactorProject)1 AbstractTychoProject (org.eclipse.tycho.core.osgitools.AbstractTychoProject)1 DefaultReactorProject (org.eclipse.tycho.core.osgitools.DefaultReactorProject)1 Feature (org.eclipse.tycho.model.Feature)1 IU (org.eclipse.tycho.model.IU)1 PluginRef (org.eclipse.tycho.model.PluginRef)1