use of org.eclipse.tycho.versions.engine.PackageVersionChange 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.PackageVersionChange 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;
}
use of org.eclipse.tycho.versions.engine.PackageVersionChange in project tycho by eclipse.
the class BundleManifestManipulator method updateImportPackageVersions.
private void updateImportPackageVersions(ProjectMetadata project, VersionChangesDescriptor versionChangeContext) {
MutableBundleManifest mf = getBundleManifest(project);
Map<String, String> importedPackageNewVersions = new HashMap<>();
for (Entry<String, String> importPackageVersions : mf.getImportPackagesVersions().entrySet()) {
String packageName = importPackageVersions.getKey();
String importVersionRange = importPackageVersions.getValue();
if (importVersionRange != null) {
PackageVersionChange versionChange = versionChangeContext.findPackageVersionChange(packageName);
if (versionChange != null) {
String newVersionRange = versionChangeContext.getVersionRangeUpdateStrategy().computeNewVersionRange(importVersionRange, versionChange.getVersion(), versionChange.getNewVersion());
logger.info(" META-INF/MANIFEST.MF//Import-Package//" + packageName + ";version: " + importVersionRange + " => " + newVersionRange);
importedPackageNewVersions.put(packageName, newVersionRange);
}
}
}
mf.updateImportedPackageVersions(importedPackageNewVersions);
}
Aggregations