use of org.eclipse.tycho.ArtifactDescriptor in project tycho by eclipse.
the class AbstractArtifactDependencyWalker method traversePlugin.
private void traversePlugin(PluginRef ref, ArtifactDependencyVisitor visitor, WalkbackPath visited) {
if (!matchTargetEnvironment(ref)) {
return;
}
ArtifactDescriptor artifact = artifacts.getArtifact(ArtifactType.TYPE_ECLIPSE_PLUGIN, ref.getId(), ref.getVersion());
if (artifact != null) {
ArtifactKey key = artifact.getKey();
if (visited.visited(key)) {
return;
}
File location = artifact.getLocation();
ReactorProject project = artifact.getMavenProject();
String classifier = artifact.getClassifier();
Set<Object> installableUnits = artifact.getInstallableUnits();
PluginDescription description = new DefaultPluginDescription(key, location, project, classifier, ref, installableUnits);
visited.enter(description);
try {
visitor.visitPlugin(description);
} finally {
visited.leave(description);
}
} else {
visitor.missingPlugin(ref, visited.getWalkback());
}
}
use of org.eclipse.tycho.ArtifactDescriptor in project tycho by eclipse.
the class OsgiBundleProject method getDependencyWalker.
@Override
public ArtifactDependencyWalker getDependencyWalker(MavenProject project) {
final DependencyArtifacts artifacts = getDependencyArtifacts(project);
final List<ClasspathEntry> cp = getClasspath(project);
return new ArtifactDependencyWalker() {
@Override
public void walk(ArtifactDependencyVisitor visitor) {
for (ClasspathEntry entry : cp) {
ArtifactDescriptor artifact = artifacts.getArtifact(entry.getArtifactKey());
ArtifactKey key = artifact.getKey();
File location = artifact.getLocation();
ReactorProject project = artifact.getMavenProject();
String classifier = artifact.getClassifier();
Set<Object> installableUnits = artifact.getInstallableUnits();
PluginDescription plugin = new DefaultPluginDescription(key, location, project, classifier, null, installableUnits);
visitor.visitPlugin(plugin);
}
}
@Override
public void traverseFeature(File location, Feature feature, ArtifactDependencyVisitor visitor) {
}
@Override
public void traverseUpdateSite(UpdateSite site, ArtifactDependencyVisitor artifactDependencyVisitor) {
}
@Override
public void traverseProduct(ProductConfiguration productConfiguration, ArtifactDependencyVisitor visitor) {
}
};
}
use of org.eclipse.tycho.ArtifactDescriptor in project tycho by eclipse.
the class GeneratePomsMojo method generatePluginPom.
private void generatePluginPom(Model parent, File basedir) throws MojoExecutionException {
ArtifactDescriptor bundle = getArtifact(basedir);
ArtifactKey key = bundle.getKey();
Model model;
if ((testSuffix != null && basedir.getName().endsWith(testSuffix)) || (testSuite != null && key.getId().equals(testSuite))) {
model = readPomTemplate("test-plugin-pom.xml");
} else {
model = readPomTemplate("plugin-pom.xml");
}
String groupId = this.groupId;
if (groupId == null) {
groupId = key.getId();
}
setParentOrAddTychoExtension(basedir, model, parent);
model.setGroupId(groupId);
model.setArtifactId(key.getId());
model.setVersion(toMavenVersion(key.getVersion().toString()));
writePom(basedir, model);
}
use of org.eclipse.tycho.ArtifactDescriptor in project tycho by eclipse.
the class BuildQualifierTest method testAggregateAttachedFeatureQualifier.
public void testAggregateAttachedFeatureQualifier() throws Exception {
File basedir = getBasedir("projects/stablebuildqualifier/attachedfeature");
List<MavenProject> projects = getSortedProjects(basedir, new File(basedir, "targetplatform"));
MavenProject project = getProject(projects, "attachedfeature");
ReactorProject reactorProject = DefaultReactorProject.adapt(project);
DefaultDependencyArtifacts dependencyArtifacts = (DefaultDependencyArtifacts) TychoProjectUtils.getDependencyArtifacts(project);
// replace target platform dependencies with fake attached feature and bundle atrifacts
ArtifactDescriptor attachedFeature = dependencyArtifacts.getArtifact(ArtifactType.TYPE_ECLIPSE_FEATURE, "attachedfeature.attached.feature", null);
dependencyArtifacts.removeAll(attachedFeature.getKey().getType(), attachedFeature.getKey().getId());
dependencyArtifacts.addReactorArtifact(attachedFeature.getKey(), reactorProject, "attached-feature", attachedFeature.getInstallableUnits());
ArtifactDescriptor attachedBundle = dependencyArtifacts.getArtifact(ArtifactType.TYPE_ECLIPSE_PLUGIN, "attachedfeature.attached.bundle", null);
dependencyArtifacts.removeAll(attachedBundle.getKey().getType(), attachedBundle.getKey().getId());
dependencyArtifacts.addReactorArtifact(attachedBundle.getKey(), reactorProject, "attached-bundle", attachedBundle.getInstallableUnits());
MavenSession session = newMavenSession(projects.get(0), projects);
executeMojo(session, project, "build-qualifier-aggregator");
assertQualifier("201206180600", projects, "attachedfeature");
}
use of org.eclipse.tycho.ArtifactDescriptor in project tycho by eclipse.
the class PublishProductMojo method getExpandedLauncherBinaries.
private File getExpandedLauncherBinaries() 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 feature 'org.eclipse.equinox.executable'. This feature is required for native product launchers.");
}
checkMacOSLauncherCompatibility(artifact);
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);
}
}
}
Aggregations