use of org.eclipse.tycho.versions.bundle.MutableBundleManifest in project tycho by eclipse.
the class MutableBundleManifestTest method updateRequiredBundleVersions.
@Test
public void updateRequiredBundleVersions() throws IOException {
MutableBundleManifest mf = getManifest("/manifests/updateRequiredBundleVersions.mf");
Map<String, String> requiredBundleVersionChanges = new HashMap<>();
requiredBundleVersionChanges.put("bundle1", "1.0.1");
requiredBundleVersionChanges.put("bundle2", "1.1.1");
mf.updateRequiredBundleVersions(requiredBundleVersionChanges);
assertContents(mf, "/manifests/updateRequiredBundleVersions.mf_expected");
}
use of org.eclipse.tycho.versions.bundle.MutableBundleManifest 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.bundle.MutableBundleManifest 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.bundle.MutableBundleManifest 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