use of org.eclipse.equinox.p2.metadata.Version in project tycho by eclipse.
the class AbstractDependenciesAction method getVersionRange.
/**
* @see org.eclipse.tycho.artifacts.DependencyArtifacts.getArtifact(String, String, String)
*/
protected VersionRange getVersionRange(Version version) {
if (version == null || OSGi_versionMin.equals(version)) {
return VersionRange.emptyRange;
}
org.osgi.framework.Version osgiVersion = PublisherHelper.toOSGiVersion(version);
String qualifier = osgiVersion.getQualifier();
if (qualifier == null || "".equals(qualifier) || ANY_QUALIFIER.equals(qualifier)) {
Version from = Version.createOSGi(osgiVersion.getMajor(), osgiVersion.getMinor(), osgiVersion.getMicro());
Version to = Version.createOSGi(osgiVersion.getMajor(), osgiVersion.getMinor(), osgiVersion.getMicro() + 1);
return new VersionRange(from, true, to, false);
}
return new VersionRange(version, true, version, true);
}
use of org.eclipse.equinox.p2.metadata.Version in project tycho by eclipse.
the class ArtifactMatcher method getRangeOfEquivalentVersions.
/**
* Returns a version range which includes "equivalent" versions, i.e. versions with the same
* major, minor, and micro version.
*/
private static VersionRange getRangeOfEquivalentVersions(Version version) {
Integer major = (Integer) version.getSegment(0);
Integer minor = (Integer) version.getSegment(1);
Integer micro = (Integer) version.getSegment(2);
VersionRange range = new VersionRange(Version.createOSGi(major, minor, micro), true, Version.createOSGi(major, minor, micro + 1), false);
return range;
}
use of org.eclipse.equinox.p2.metadata.Version in project tycho by eclipse.
the class TargetPlatformBundlePublisherTest method testPomDependencyOnOtherType.
@Test
public void testPomDependencyOnOtherType() throws Exception {
File otherFile = resourceFile("platformbuilder/pom-dependencies/other-type.xml");
IArtifactFacade otherArtifact = new ArtifactMock(otherFile, GROUP_ID, ARTIFACT_ID, VERSION, "pom");
IInstallableUnit unit = subject.attemptToPublishBundle(otherArtifact);
assertNull(unit);
}
use of org.eclipse.equinox.p2.metadata.Version in project tycho by eclipse.
the class SourcesBundleDependencyMetadataGenerator method getPublisherActions.
@Override
protected List<IPublisherAction> getPublisherActions(IArtifactFacade artifact, List<TargetEnvironment> environments, OptionalResolutionAction optionalAction) {
ArrayList<IPublisherAction> actions = new ArrayList<>();
String id = artifact.getArtifactId();
String version = toCanonicalVersion(artifact.getVersion());
try {
// generated source bundle is not available at this point in filesystem yet, need to create
// in-memory BundleDescription instead
Dictionary<String, String> manifest = new Hashtable<>();
manifest.put("Manifest-Version", "1.0");
manifest.put("Bundle-ManifestVersion", "2");
String sourceBundleSymbolicName = id + ".source";
manifest.put("Bundle-SymbolicName", sourceBundleSymbolicName);
manifest.put("Bundle-Version", version);
manifest.put("Eclipse-SourceBundle", id + ";version=" + version + ";roots:=\".\"");
StateObjectFactory factory = StateObjectFactory.defaultFactory;
BundleDescription bundleDescription = factory.createBundleDescription(factory.createState(false), manifest, artifact.getLocation().getAbsolutePath(), createId(sourceBundleSymbolicName, version));
bundleDescription.setUserObject(manifest);
actions.add(new BundlesAction(new BundleDescription[] { bundleDescription }) {
@Override
protected void createAdviceFileAdvice(BundleDescription bundleDescription, IPublisherInfo publisherInfo) {
// 367255 p2.inf is not applicable to sources bundles
}
});
} catch (BundleException e) {
throw new RuntimeException(e);
}
return actions;
}
use of org.eclipse.equinox.p2.metadata.Version in project knime-core by knime.
the class InvokeUpdateAction method openWizard.
@Override
protected void openWizard(final LoadMetadataRepositoryJob job, final ProvisioningUI provUI) {
final UpdateOperation operation = provUI.getUpdateOperation(null, null);
// check for updates
operation.resolveModal(null);
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
Shell shell = PlatformUI.getWorkbench().getModalDialogShellProvider().getShell();
if (!operation.hasResolved()) {
MessageDialog.openInformation(shell, "Update KNIME...", "No updates were found");
} else if (provUI.getPolicy().continueWorkingWithOperation(operation, shell)) {
if (UpdateSingleIUWizard.validFor(operation)) {
// Special case for only updating a single root
UpdateSingleIUWizard wizard = new UpdateSingleIUWizard(provUI, operation);
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.create();
if (dialog.open() == 0) {
clearOsgiAreaBeforeRestart();
}
} else {
// Open the normal version of the update wizard
if (provUI.openUpdateWizard(false, operation, job) == 0) {
clearOsgiAreaBeforeRestart();
}
}
}
}
});
}
Aggregations