use of org.eclipse.tycho.versions.engine.PomVersionChange in project tycho by eclipse.
the class BundleManifestManipulator method updateRequireBundleVersions.
private void updateRequireBundleVersions(ProjectMetadata project, VersionChangesDescriptor versionChangeContext) {
MutableBundleManifest mf = getBundleManifest(project);
Map<String, String> requiredBundleVersions = mf.getRequiredBundleVersions();
Map<String, String> versionsToUpdate = new HashMap<>();
for (PomVersionChange versionChange : versionChangeContext.getVersionChanges()) {
String bundleSymbolicName = versionChange.getArtifactId();
if (requiredBundleVersions.containsKey(bundleSymbolicName)) {
String originalVersionRange = requiredBundleVersions.get(bundleSymbolicName);
versionsToUpdate.put(bundleSymbolicName, versionChangeContext.getVersionRangeUpdateStrategy().computeNewVersionRange(originalVersionRange, versionChange.getVersion(), versionChange.getNewVersion()));
}
}
mf.updateRequiredBundleVersions(versionsToUpdate);
}
use of org.eclipse.tycho.versions.engine.PomVersionChange in project tycho by eclipse.
the class FeatureXmlManipulator method applyChanges.
@Override
public void applyChanges(ProjectMetadata project, VersionChangesDescriptor versionChangeContext) {
if (isFeature(project)) {
Feature feature = getFeatureXml(project);
for (PomVersionChange change : versionChangeContext.getVersionChanges()) {
if (isFeature(change.getProject().getPackaging())) {
if (change.getArtifactId().equals(feature.getId()) && change.getVersion().equals(feature.getVersion())) {
logger.info(" feature.xml//feature/@version: " + change.getVersion() + " => " + change.getNewVersion());
feature.setVersion(change.getNewVersion());
}
changeLicenseFeature(change, feature);
// could be included feature
changeIncludedFeatures(change, feature);
changeRequiredFeatures(change, feature, versionChangeContext.getVersionRangeUpdateStrategy());
} else if (isBundle(change.getProject())) {
changeIncludedPlugins(change, feature);
changeRequiredPlugins(change, feature, versionChangeContext.getVersionRangeUpdateStrategy());
}
}
}
}
use of org.eclipse.tycho.versions.engine.PomVersionChange in project tycho by eclipse.
the class PomManipulator method applyChanges.
@Override
public void applyChanges(ProjectMetadata project, VersionChangesDescriptor versionChangeContext) {
PomFile pom = project.getMetadata(PomFile.class);
// e.g. not for polyglot pom files
if (!pom.isMutable()) {
return;
}
for (PomVersionChange change : versionChangeContext.getVersionChanges()) {
String version = Versions.toMavenVersion(change.getVersion());
String newVersion = Versions.toMavenVersion(change.getNewVersion());
if (isGavEquals(pom, change)) {
logger.info(" pom.xml//project/version: " + version + " => " + newVersion);
pom.setVersion(newVersion);
} else {
GAV parent = pom.getParent();
if (parent != null && isGavEquals(parent, change)) {
logger.info(" pom.xml//project/parent/version: " + version + " => " + newVersion);
parent.setVersion(newVersion);
}
}
//
// Dependencies and entries inside dependencyManagement sections are not
// OSGI related. Nevertheless it might happen that dependencies like this
// does occur inside OSGI related project. Hence we must be able to handle
// it.
//
changeDependencies(" pom.xml//project/dependencies", pom.getDependencies(), change, version, newVersion);
changeDependencyManagement(" pom.xml//project/dependencyManagement", pom.getDependencyManagement(), change, version, newVersion);
changeBuild(" pom.xml//project/build", pom.getBuild(), change, version, newVersion);
for (Profile profile : pom.getProfiles()) {
String profileId = profile.getId() != null ? profile.getId() : "<null>";
String pomPath = " pom.xml//project/profiles/profile[ " + profileId + " ]";
changeDependencies(pomPath + "/dependencies", profile.getDependencies(), change, version, newVersion);
changeDependencyManagement(pomPath + "/dependencyManagement", profile.getDependencyManagement(), change, version, newVersion);
changeBuild(pomPath + "/build", profile.getBuild(), change, version, newVersion);
}
}
}
use of org.eclipse.tycho.versions.engine.PomVersionChange in project tycho by eclipse.
the class PomManipulator method addMoreChanges.
@Override
public boolean addMoreChanges(ProjectMetadata project, VersionChangesDescriptor versionChangeContext) {
PomFile pom = project.getMetadata(PomFile.class);
GAV parent = pom.getParent();
boolean moreChanges = false;
for (PomVersionChange change : versionChangeContext.getVersionChanges()) {
if (parent != null && isGavEquals(parent, change)) {
if (isVersionEquals(pom.getVersion(), change.getVersion())) {
moreChanges |= versionChangeContext.addVersionChange(new PomVersionChange(pom, change.getVersion(), change.getNewVersion()));
}
}
}
return moreChanges;
}
use of org.eclipse.tycho.versions.engine.PomVersionChange in project tycho by eclipse.
the class SiteXmlManipulator method applyChanges.
@Override
public void applyChanges(ProjectMetadata project, VersionChangesDescriptor versionChangeContext) {
if (isSite(project)) {
for (PomVersionChange change : versionChangeContext.getVersionChanges()) {
if (isFeature(change.getProject().getPackaging())) {
UpdateSite site = getSiteXml(project);
for (FeatureRef feature : site.getFeatures()) {
if (change.getArtifactId().equals(feature.getId()) && change.getVersion().equals(feature.getVersion())) {
logger.info(" site.xml//site/feature/@id=" + feature.getId() + "/@version: " + change.getVersion() + " => " + change.getNewVersion());
feature.setVersion(change.getNewVersion());
SiteFeatureRef siteFeature = (SiteFeatureRef) feature;
String oldUrl = siteFeature.getUrl();
String newUrl = rewriteFeatureUrl(oldUrl, change);
logger.info(" site.xml//site/feature/@id=" + feature.getId() + "/@url: " + oldUrl + " => " + newUrl);
siteFeature.setUrl(newUrl);
}
}
}
}
}
}
Aggregations