use of org.eclipse.tycho.model.Category in project tycho by eclipse.
the class CategoryXmlManipulator method writeMetadata.
@Override
public void writeMetadata(ProjectMetadata project) throws IOException {
File basedir = project.getBasedir();
Category categoryXml = project.getMetadata(Category.class);
if (categoryXml != null) {
Category.write(categoryXml, new File(basedir, Category.CATEGORY_XML));
}
}
use of org.eclipse.tycho.model.Category in project tycho by eclipse.
the class EclipseRepositoryProject method newDependencyWalker.
@Override
protected ArtifactDependencyWalker newDependencyWalker(MavenProject project, TargetEnvironment environment) {
final List<ProductConfiguration> products = loadProducts(project);
final List<Category> categories = loadCategories(project);
return new AbstractArtifactDependencyWalker(getDependencyArtifacts(project, environment), getEnvironments(project, environment)) {
@Override
public void walk(ArtifactDependencyVisitor visitor) {
WalkbackPath visited = new WalkbackPath();
for (ProductConfiguration product : products) {
traverseProduct(product, visitor, visited);
}
for (Category category : categories) {
for (FeatureRef feature : category.getFeatures()) {
traverseFeature(feature, visitor, visited);
}
}
}
};
}
use of org.eclipse.tycho.model.Category in project tycho by eclipse.
the class CategoryXmlManipulator method getCategoryXml.
private Category getCategoryXml(ProjectMetadata project) {
Category categoryXml = project.getMetadata(Category.class);
if (categoryXml == null) {
File file = new File(project.getBasedir(), Category.CATEGORY_XML);
if (!file.isFile()) {
return null;
}
try {
categoryXml = Category.read(file);
project.putMetadata(categoryXml);
} catch (IOException e) {
throw new IllegalArgumentException("Could not read categories from " + file, e);
}
}
return categoryXml;
}
use of org.eclipse.tycho.model.Category in project tycho by eclipse.
the class CategoryXmlManipulator method updateFeatureReferences.
private void updateFeatureReferences(PomVersionChange featureVersionChange, ProjectMetadata project) {
Category categoryXml = getCategoryXml(project);
if (categoryXml == null) {
return;
}
for (SiteFeatureRef feature : categoryXml.getFeatures()) {
String featureId = featureVersionChange.getArtifactId();
String srcFeatureId = featureId + SOURCE_FEATURE_SUFFIX;
if ((featureId.equals(feature.getId()) || srcFeatureId.equals(feature.getId())) && featureVersionChange.getVersion().equals(feature.getVersion())) {
logger.info(" category.xml//site/feature[@id=" + feature.getId() + "]/@version: " + featureVersionChange.getVersion() + " => " + featureVersionChange.getNewVersion());
feature.setVersion(featureVersionChange.getNewVersion());
String oldUrl = feature.getUrl();
if (oldUrl != null) {
String newUrl = rewriteFeatureUrl(oldUrl, featureVersionChange);
logger.info(" category.xml//site/feature[@id=" + feature.getId() + "]/@url: " + oldUrl + " => " + newUrl);
feature.setUrl(newUrl);
}
}
}
}
use of org.eclipse.tycho.model.Category in project tycho by eclipse.
the class CategoryXmlManipulator method updatePluginReferences.
private void updatePluginReferences(PomVersionChange pluginVersionChange, ProjectMetadata project) {
Category categoryXml = getCategoryXml(project);
if (categoryXml == null) {
return;
}
for (PluginRef plugin : categoryXml.getPlugins()) {
if (pluginVersionChange.getArtifactId().equals(plugin.getId()) && pluginVersionChange.getVersion().equals(plugin.getVersion())) {
logger.info(" category.xml//site/bundle[@id=" + plugin.getId() + "]/@version: " + pluginVersionChange.getVersion() + " => " + pluginVersionChange.getNewVersion());
plugin.setVersion(pluginVersionChange.getNewVersion());
}
}
}
Aggregations