diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECoreMessages.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECoreMessages.java index e3b1af9979..40031f4a05 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECoreMessages.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDECoreMessages.java @@ -222,6 +222,7 @@ public class PDECoreMessages extends NLS { public static String BundleErrorReporter_unecessaryDependencyDueToFragmentHost; public static String BundleErrorReporter_missingPackagesInProject; public static String BundleErrorReporter_noExecutionEnvironmentSet; + public static String BundleErrorReporter_deprecatedBundle; public static String BundleErrorReporter_startHeader_autoStartDeprecated; diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/BundleErrorReporter.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/BundleErrorReporter.java index e299944874..7ecd900a35 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/BundleErrorReporter.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/builders/BundleErrorReporter.java @@ -55,6 +55,7 @@ import org.eclipse.jdt.launching.JavaRuntime; import org.eclipse.jdt.launching.environments.IExecutionEnvironment; import org.eclipse.jdt.launching.environments.IExecutionEnvironmentsManager; +import org.eclipse.osgi.service.resolver.BaseDescription; import org.eclipse.osgi.service.resolver.BundleDescription; import org.eclipse.osgi.service.resolver.BundleSpecification; import org.eclipse.osgi.service.resolver.ExportPackageDescription; @@ -97,6 +98,7 @@ import org.osgi.framework.InvalidSyntaxException; import org.osgi.framework.Version; import org.osgi.framework.VersionRange; +import org.osgi.framework.wiring.BundleCapability; public class BundleErrorReporter extends JarManifestErrorReporter { @@ -184,6 +186,36 @@ protected void validate(IProgressMonitor monitor) { validateEclipseGenericCapability(); validateEclipseGenericRequire(); validateServiceComponent(); + if (isCheckDeprecated()) { + validateDeprecated(); + } + } + + private void validateDeprecated() { + IHeader header = getHeader(Constants.REQUIRE_BUNDLE); + if (header == null) { + return; + } + BundleDescription desc = fModel.getBundleDescription(); + if (desc == null) { + return; + } + BundleSpecification[] requiredBundles = desc.getRequiredBundles(); + for (BundleSpecification bundleSpecification : requiredBundles) { + BaseDescription bundle = bundleSpecification.getSupplier(); + if (bundle != null) { + BundleCapability capability = bundle.getCapability(); + if (capability != null) { + String deprecatedDirective = capability.getDirectives().get("deprecated"); //$NON-NLS-1$ + if (deprecatedDirective != null) { + report(NLS.bind(PDECoreMessages.BundleErrorReporter_deprecatedBundle, bundle.getName(), + deprecatedDirective), header.getLineNumber(), CompilerFlags.WARNING, + PDEMarkerFactory.CAT_DEPRECATION); + } + } + } + } + } diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/pderesources.properties b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/pderesources.properties index 9e2049f9b0..bd5452e3e3 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/pderesources.properties +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/pderesources.properties @@ -198,6 +198,7 @@ BundleErrorReporter_eclipse_genericRequireDeprecated=''{0}'' header is deprecate BundleErrorReporter_unecessaryDependencyDueToFragmentHost=The ''{0}'' dependency is not necessary as it is already specified in Fragment-Host header BundleErrorReporter_localization_properties_file_not_exist=no valid properties files exist in the localization directory specified BundleErrorReporter_illegalManifestVersion=The bundle manifest version is invalid. Valid ranges are 1-2. +BundleErrorReporter_deprecatedBundle=The bundle {0} is deprecated: {1} BundleErrorReporter_serviceComponentLazyStart=Bundles with a Service-Component should set the Bundle-ActivationPolicy to lazy. BundleManifestSourceLocationManager_problemProcessBundleManifestHeaderAttributeMissing=Problem processing bundle manifest header in source bundle {0}, plugin name and version must both be specified. BundleValidationOperation_multiple_singletons={0} versions of singleton ''{1}'' exist