use of org.eclipse.tycho.artifacts.DependencyArtifacts in project tycho by eclipse.
the class ArtifactDependencyWalkerTest method getTargetPlatform.
protected DependencyArtifacts getTargetPlatform() throws Exception {
LocalDependencyResolver resolver = (LocalDependencyResolver) lookup(DependencyResolver.class, LocalDependencyResolver.ROLE_HINT);
MavenExecutionRequest request = new DefaultMavenExecutionRequest();
request.setLocalRepository(new StubArtifactRepository(System.getProperty("java.io.tmpdir")));
MavenExecutionResult result = new DefaultMavenExecutionResult();
DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
MavenSession session = new MavenSession(getContainer(), repositorySession, request, result);
session.setProjects(new ArrayList<MavenProject>());
lookup(LegacySupport.class).setSession(session);
MavenProject project = new MavenProject();
resolver.setLocation(new File("src/test/resources/targetplatforms/basic"));
DependencyArtifacts platform = resolver.resolveDependencies(session, project, null, DefaultReactorProject.adapt(session), null);
return platform;
}
use of org.eclipse.tycho.artifacts.DependencyArtifacts in project tycho by eclipse.
the class DependencyComputerTest method computeDependencies.
private List<DependencyEntry> computeDependencies(MavenProject project) throws BundleException {
DependencyArtifacts platform = (DependencyArtifacts) project.getContextValue(TychoConstants.CTX_DEPENDENCY_ARTIFACTS);
State state = resolver.newResolvedState(project, ExecutionEnvironmentUtils.getExecutionEnvironment("J2SE-1.4"), false, platform);
BundleDescription bundle = state.getBundleByLocation(project.getBasedir().getAbsolutePath());
return dependencyComputer.computeDependencies(state.getStateHelper(), bundle);
}
use of org.eclipse.tycho.artifacts.DependencyArtifacts in project tycho by eclipse.
the class DependencyComputerTest method testExportPackage.
@Test
public void testExportPackage() throws Exception {
File basedir = getBasedir("projects/exportpackage");
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);
ExecutionEnvironment executionEnvironment = TychoProjectUtils.getExecutionEnvironmentConfiguration(project).getFullSpecification();
State state = resolver.newResolvedState(project, executionEnvironment, false, platform);
BundleDescription bundle = state.getBundleByLocation(project.getBasedir().getAbsolutePath());
List<DependencyEntry> dependencies = dependencyComputer.computeDependencies(state.getStateHelper(), bundle);
Assert.assertEquals(3, dependencies.size());
Assert.assertEquals("dep", dependencies.get(0).desc.getSymbolicName());
Assert.assertEquals("dep2", dependencies.get(1).desc.getSymbolicName());
Assert.assertEquals("dep3", dependencies.get(2).desc.getSymbolicName());
Assert.assertTrue(dependencies.get(2).rules.isEmpty());
}
use of org.eclipse.tycho.artifacts.DependencyArtifacts in project tycho by eclipse.
the class LocalDependencyResolverTest method testBundleIdParsing.
public void testBundleIdParsing() throws Exception {
DependencyArtifacts platform = getTargetPlatform(new File("src/test/resources/targetplatforms/basic"));
ArtifactDescriptor artifact = platform.getArtifact(ArtifactType.TYPE_ECLIPSE_PLUGIN, "bundle01", null);
ArtifactKey key = artifact.getKey();
assertEquals("bundle01", key.getId());
assertEquals("0.0.1", key.getVersion());
File file = artifact.getLocation();
assertEquals("bundle01_0.0.1", file.getName());
}
use of org.eclipse.tycho.artifacts.DependencyArtifacts in project tycho by eclipse.
the class LocalDependencyResolverTest method testBundleRelativePath.
public void testBundleRelativePath() throws Exception {
File platformPath = new File("src/test/resources/targetplatforms/basic").getAbsoluteFile();
DependencyArtifacts platform = getTargetPlatform(platformPath);
File bundlePath = new File("src/test/resources/targetplatforms/basic/plugins/org.eclipse.equinox.launcher_1.0.101.R34x_v20081125.jar");
Map<String, ArtifactDescriptor> artifact = platform.getArtifact(bundlePath);
assertNotNull(artifact);
}
Aggregations