use of org.eclipse.tycho.versions.engine.VersionChange in project tycho by eclipse.
the class BundleManifestManipulator method findVersionChangeForProject.
private VersionChange findVersionChangeForProject(ProjectMetadata project, VersionChangesDescriptor versionChangeContext) {
MutableBundleManifest mf = getBundleManifest(project);
VersionChange versionChangeForProject = versionChangeContext.findVersionChangeByArtifactId(mf.getSymbolicName());
if (versionChangeForProject != null && versionChangeForProject.getVersion().equals(mf.getVersion())) {
return versionChangeForProject;
} else {
return null;
}
}
use of org.eclipse.tycho.versions.engine.VersionChange in project tycho by eclipse.
the class BundleManifestManipulator method updateBundleAndExportPackageVersions.
private void updateBundleAndExportPackageVersions(ProjectMetadata project, VersionChangesDescriptor versionChangeContext) {
MutableBundleManifest mf = getBundleManifest(project);
VersionChange versionChangeForProject = findVersionChangeForProject(project, versionChangeContext);
if (versionChangeForProject != null) {
logger.info(" META-INF/MANIFEST.MF//Bundle-Version: " + versionChangeForProject.getVersion() + " => " + versionChangeForProject.getNewVersion());
mf.setVersion(versionChangeForProject.getNewVersion());
Map<String, String> exportPackagesNewVersion = new HashMap<>();
for (PackageVersionChange packageVersionChange : versionChangeContext.getPackageVersionChanges()) {
if (packageVersionChange.getBundleSymbolicName().equals(mf.getSymbolicName())) {
logger.info(" META-INF/MANIFEST.MF//Export-Package//" + packageVersionChange.getPackageName() + ";version: " + packageVersionChange.getVersion() + " => " + packageVersionChange.getNewVersion());
exportPackagesNewVersion.put(packageVersionChange.getPackageName(), packageVersionChange.getNewVersion());
}
}
mf.updateExportedPackageVersions(exportPackagesNewVersion);
}
}
use of org.eclipse.tycho.versions.engine.VersionChange in project tycho by eclipse.
the class P2iuXmlManipulator method applyChanges.
@Override
public void applyChanges(ProjectMetadata project, VersionChangesDescriptor versionChangeContext) {
if (!isIu(project)) {
return;
}
IU iu = getIU(project);
VersionChange change = versionChangeContext.findVersionChangeByArtifactId(iu.getId());
if (change != null && change.getVersion().equals(iu.getVersion())) {
logger.info(" p2iu.xml//unit/@version: " + change.getVersion() + " => " + change.getNewVersion());
iu.setVersion(change.getNewVersion());
// version changed, so put the iu into the metadata so that the writeMetadata method can pick it up
project.putMetadata(iu);
}
}
use of org.eclipse.tycho.versions.engine.VersionChange in project tycho by eclipse.
the class BundleManifestManipulator method updateFragmentHostVersion.
private void updateFragmentHostVersion(ProjectMetadata project, VersionChangesDescriptor versionChangeContext) {
MutableBundleManifest mf = getBundleManifest(project);
if (mf.isFragment()) {
VersionChange versionChange = versionChangeContext.findVersionChangeByArtifactId(mf.getFragmentHostSymbolicName());
if (versionChange != null) {
String newVersionRange = versionChangeContext.getVersionRangeUpdateStrategy().computeNewVersionRange(mf.getFragmentHostVersion(), versionChange.getVersion(), versionChange.getNewVersion());
logger.info(" META-INF/MANIFEST.MF//Fragment-Host//" + mf.getFragmentHostSymbolicName() + ";bundle-version: " + newVersionRange + " => " + newVersionRange);
mf.setFragmentHostVersion(newVersionRange);
}
}
}
use of org.eclipse.tycho.versions.engine.VersionChange in project tycho by eclipse.
the class BundleManifestManipulator method computeExportedPackageChanges.
private Set<PackageVersionChange> computeExportedPackageChanges(ProjectMetadata project, VersionChangesDescriptor versionChangeContext) {
VersionChange versionChangeForProject = findVersionChangeForProject(project, versionChangeContext);
if (versionChangeForProject == null) {
return Collections.emptySet();
}
MutableBundleManifest mf = getBundleManifest(project);
// ignore ".qualifier" literals in package versions
String versionToReplace = Versions.toBaseVersion(versionChangeForProject.getVersion());
String newVersion = Versions.toBaseVersion(versionChangeForProject.getNewVersion());
Set<PackageVersionChange> packageVersionChanges = new HashSet<>();
for (Entry<String, String> exportedPackageVersion : mf.getExportedPackagesVersion().entrySet()) {
String packageName = exportedPackageVersion.getKey();
String packageVersion = exportedPackageVersion.getValue();
if (packageVersion != null && packageVersion.equals(versionToReplace)) {
packageVersionChanges.add(new PackageVersionChange(mf.getSymbolicName(), packageName, packageVersion, newVersion));
}
}
return packageVersionChanges;
}
Aggregations