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); }
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()); }
// TODO implement at eclipse: have product publisher take the executables from the context // repositories private File getEquinoxExecutableFeature() throws MojoExecutionException, MojoFailureException { // TODO 364134 take the executable feature from the target platform instead DependencyArtifacts dependencyArtifacts = TychoProjectUtils.getDependencyArtifacts(getProject()); ArtifactDescriptor artifact = dependencyArtifacts.getArtifact( ArtifactType.TYPE_ECLIPSE_FEATURE, "org.eclipse.equinox.executable", null); if (artifact == null) { throw new MojoExecutionException( "Unable to locate the equinox launcher feature (aka delta-pack)"); } File equinoxExecFeature = artifact.getLocation(); if (equinoxExecFeature.isDirectory()) { return equinoxExecFeature.getAbsoluteFile(); } else { File unzipped = new File( getProject().getBuild().getDirectory(), artifact.getKey().getId() + "-" + artifact.getKey().getVersion()); if (unzipped.exists()) { return unzipped.getAbsoluteFile(); } try { FileLocker locker = fileLockService.getFileLocker(equinoxExecFeature); locker.lock(); try { // unzip now then: unzipped.mkdirs(); deflater.setSourceFile(equinoxExecFeature); deflater.setDestDirectory(unzipped); deflater.extract(); return unzipped.getAbsoluteFile(); } finally { locker.release(); } } catch (ArchiverException e) { throw new MojoFailureException("Unable to unzip the eqiuinox executable feature", e); } } }