use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.
the class AbstractArtifactDependencyWalker method traverseFeature.
protected void traverseFeature(File location, Feature feature, FeatureRef featureRef, ArtifactDependencyVisitor visitor, WalkbackPath visited) {
ArtifactDescriptor artifact = getArtifact(location, feature.getId());
if (artifact == null) {
// ah?
throw new IllegalStateException("Feature " + location + " with id " + feature.getId() + " is not part of the project build target platform");
}
ArtifactKey key = artifact.getKey();
ReactorProject project = artifact.getMavenProject();
String classifier = artifact.getClassifier();
Set<Object> installableUnits = artifact.getInstallableUnits();
DefaultFeatureDescription description = new DefaultFeatureDescription(key, location, project, classifier, feature, featureRef, installableUnits);
if (visitor.visitFeature(description)) {
for (PluginRef ref : feature.getPlugins()) {
traversePlugin(ref, visitor, visited);
}
for (FeatureRef ref : feature.getIncludedFeatures()) {
traverseFeature(ref, visitor, visited);
}
}
}
use of org.eclipse.tycho.ArtifactKey in project tycho by eclipse.
the class AbstractArtifactDependencyWalker method traverseProduct.
protected void traverseProduct(ProductConfiguration product, ArtifactDependencyVisitor visitor, WalkbackPath visited) {
if (product.useFeatures()) {
for (FeatureRef ref : product.getFeatures()) {
traverseFeature(ref, visitor, visited);
}
} else {
for (PluginRef ref : product.getPlugins()) {
traversePlugin(ref, visitor, visited);
}
}
Set<String> bundles = new HashSet<>();
for (ArtifactDescriptor artifact : visited.getVisited()) {
ArtifactKey key = artifact.getKey();
if (ArtifactType.TYPE_ECLIPSE_PLUGIN.equals(key.getType())) {
bundles.add(key.getId());
}
}
if (environments != null && product.includeLaunchers()) {
for (TargetEnvironment environment : environments) {
String os = environment.getOs();
String ws = environment.getWs();
String arch = environment.getArch();
String id;
// see http://jira.codehaus.org/browse/MNGECLIPSE-1075
if (PlatformPropertiesUtils.OS_MACOSX.equals(os) && (PlatformPropertiesUtils.ARCH_X86.equals(arch) || PlatformPropertiesUtils.ARCH_PPC.equals(arch))) {
id = "org.eclipse.equinox.launcher." + ws + "." + os;
} else {
id = "org.eclipse.equinox.launcher." + ws + "." + os + "." + arch;
}
if (!bundles.contains(id)) {
PluginRef ref = new PluginRef("plugin");
ref.setId(id);
ref.setOs(os);
ref.setWs(ws);
ref.setArch(arch);
ref.setUnpack(true);
traversePlugin(ref, visitor, visited);
}
}
}
}
use of org.eclipse.tycho.ArtifactKey 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.ArtifactKey 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.ArtifactKey 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);
}
Aggregations