use of org.eclipse.tycho.core.ArtifactDependencyVisitor in project tycho by eclipse.
the class AbstractArtifactBasedProject method checkForMissingDependencies.
@Override
public void checkForMissingDependencies(MavenProject project) {
TargetPlatformConfiguration configuration = TychoProjectUtils.getTargetPlatformConfiguration(project);
// this throws exceptions when dependencies are missing
getDependencyWalker(project).walk(new ArtifactDependencyVisitor() {
});
}
use of org.eclipse.tycho.core.ArtifactDependencyVisitor 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.core.ArtifactDependencyVisitor in project tycho by eclipse.
the class EclipseFeatureProject method newDependencyWalker.
@Override
protected ArtifactDependencyWalker newDependencyWalker(MavenProject project, TargetEnvironment environment) {
final File location = project.getBasedir();
final Feature feature = Feature.loadFeature(location);
return new AbstractArtifactDependencyWalker(getDependencyArtifacts(project, environment), getEnvironments(project, environment)) {
@Override
public void walk(ArtifactDependencyVisitor visitor) {
traverseFeature(location, feature, visitor);
}
};
}
use of org.eclipse.tycho.core.ArtifactDependencyVisitor in project tycho by eclipse.
the class ProductExportMojo method getBundles.
private Map<String, PluginDescription> getBundles(TargetEnvironment environment) {
final Map<String, PluginDescription> bundles = new LinkedHashMap<>();
getDependencyWalker(environment).walk(new ArtifactDependencyVisitor() {
@Override
public void visitPlugin(PluginDescription plugin) {
bundles.put(plugin.getKey().getId(), plugin);
}
});
return bundles;
}
use of org.eclipse.tycho.core.ArtifactDependencyVisitor in project tycho by eclipse.
the class UpdateSiteMojo method execute.
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
target.mkdirs();
try {
// remove content collected in former builds.
// Even without clean goal the build result must not assembly out dated content
FileUtils.cleanDirectory(target);
} catch (IOException e) {
throw new MojoFailureException("Unable to delete old update site content: " + target.getAbsolutePath(), e);
}
try {
UpdateSite site = UpdateSite.read(new File(basedir, UpdateSite.SITE_XML));
UpdateSiteAssembler assembler = new UpdateSiteAssembler(session, target);
if (inlineArchives) {
assembler.setArchives(site.getArchives());
}
getDependencyWalker().walk(assembler);
getDependencyWalker().traverseUpdateSite(site, new ArtifactDependencyVisitor() {
@Override
public boolean visitFeature(FeatureDescription feature) {
FeatureRef featureRef = feature.getFeatureRef();
String id = featureRef.getId();
ReactorProject otherProject = feature.getMavenProject();
String version;
if (otherProject != null) {
version = otherProject.getExpandedVersion();
} else {
version = feature.getKey().getVersion();
}
String url = UpdateSiteAssembler.FEATURES_DIR + id + "_" + version + ".jar";
((SiteFeatureRef) featureRef).setUrl(url);
featureRef.setVersion(version);
// don't traverse included features
return false;
}
});
if (inlineArchives) {
site.removeArchives();
}
File file = new File(target, "site.xml");
UpdateSite.write(site, file);
// Copy the associate sites file, if necessary
if (site.getAssociateSitesUrl() != null) {
File srcAssociateSitesFile = new File(basedir, site.getAssociateSitesUrl());
if (srcAssociateSitesFile.exists()) {
FileUtils.copyFile(srcAssociateSitesFile, new File(target + File.separator + site.getAssociateSitesUrl()));
}
}
} catch (Exception e) {
throw new MojoExecutionException(e.getMessage(), e);
}
}
Aggregations