fix(java): improve identification for org.eclipse.platform artifacts (#2349)

Signed-off-by: Weston Steimel <weston.steimel@proton.me>
This commit is contained in:
Weston Steimel 2023-11-30 21:02:03 +00:00 committed by GitHub
parent 4adfbeb5f0
commit 5d42a349e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 321 additions and 7 deletions

View file

@ -1200,4 +1200,296 @@ var DefaultArtifactIDToGroupID = map[string]string{
"spring-ws": "org.springframework.ws",
"spring-xml": "org.springframework.ws",
"xalan": "xalan", // see https://mvnrepository.com/artifact/xalan/xalan/2.7.2
"org.eclipse.ant.core": "org.eclipse.platform",
"org.eclipse.ant.launching": "org.eclipse.platform",
"org.eclipse.ant.optional.junit": "org.eclipse.platform",
"org.eclipse.ant.ui": "org.eclipse.platform",
"org.eclipse.compare": "org.eclipse.platform",
"org.eclipse.compare.core": "org.eclipse.platform",
"org.eclipse.compare.examples": "org.eclipse.platform",
"org.eclipse.compare.examples.xml": "org.eclipse.platform",
"org.eclipse.compare.win32": "org.eclipse.platform",
"org.eclipse.core.commands": "org.eclipse.platform",
"org.eclipse.core.contenttype": "org.eclipse.platform",
"org.eclipse.core.databinding": "org.eclipse.platform",
"org.eclipse.core.databinding.beans": "org.eclipse.platform",
"org.eclipse.core.databinding.observable": "org.eclipse.platform",
"org.eclipse.core.databinding.property": "org.eclipse.platform",
"org.eclipse.core.expressions": "org.eclipse.platform",
"org.eclipse.core.externaltools": "org.eclipse.platform",
"org.eclipse.core.filebuffers": "org.eclipse.platform",
"org.eclipse.core.filesystem": "org.eclipse.platform",
"org.eclipse.core.filesystem.aix.ppc": "org.eclipse.platform",
"org.eclipse.core.filesystem.aix.ppc64": "org.eclipse.platform",
"org.eclipse.core.filesystem.hpux.ia64": "org.eclipse.platform",
"org.eclipse.core.filesystem.linux.aarch64": "org.eclipse.platform",
"org.eclipse.core.filesystem.linux.ppc": "org.eclipse.platform",
"org.eclipse.core.filesystem.linux.ppc64": "org.eclipse.platform",
"org.eclipse.core.filesystem.linux.ppc64le": "org.eclipse.platform",
"org.eclipse.core.filesystem.linux.x86": "org.eclipse.platform",
"org.eclipse.core.filesystem.linux.x86_64": "org.eclipse.platform",
"org.eclipse.core.filesystem.macosx": "org.eclipse.platform",
"org.eclipse.core.filesystem.win32.x86": "org.eclipse.platform",
"org.eclipse.core.filesystem.win32.x86_64": "org.eclipse.platform",
"org.eclipse.core.jobs": "org.eclipse.platform",
"org.eclipse.core.net": "org.eclipse.platform",
"org.eclipse.core.net.linux": "org.eclipse.platform",
"org.eclipse.core.net.linux.x86": "org.eclipse.platform",
"org.eclipse.core.net.linux.x86_64": "org.eclipse.platform",
"org.eclipse.core.net.win32": "org.eclipse.platform",
"org.eclipse.core.net.win32.x86": "org.eclipse.platform",
"org.eclipse.core.net.win32.x86_64": "org.eclipse.platform",
"org.eclipse.core.resources": "org.eclipse.platform",
"org.eclipse.core.resources.win32.x86": "org.eclipse.platform",
"org.eclipse.core.resources.win32.x86_64": "org.eclipse.platform",
"org.eclipse.core.runtime": "org.eclipse.platform",
"org.eclipse.core.variables": "org.eclipse.platform",
"org.eclipse.cvs": "org.eclipse.platform",
"org.eclipse.debug.core": "org.eclipse.platform",
"org.eclipse.debug.examples.core": "org.eclipse.platform",
"org.eclipse.debug.examples.ui": "org.eclipse.platform",
"org.eclipse.debug.ui": "org.eclipse.platform",
"org.eclipse.debug.ui.launchview": "org.eclipse.platform",
"org.eclipse.e4.core.commands": "org.eclipse.platform",
"org.eclipse.e4.core.contexts": "org.eclipse.platform",
"org.eclipse.e4.core.di": "org.eclipse.platform",
"org.eclipse.e4.core.di.annotations": "org.eclipse.platform",
"org.eclipse.e4.core.di.extensions": "org.eclipse.platform",
"org.eclipse.e4.core.di.extensions.supplier": "org.eclipse.platform",
"org.eclipse.e4.core.services": "org.eclipse.platform",
"org.eclipse.e4.emf.xpath": "org.eclipse.platform",
"org.eclipse.e4.tools": "org.eclipse.platform",
"org.eclipse.e4.tools.compat": "org.eclipse.platform",
"org.eclipse.e4.tools.compatibility.migration": "org.eclipse.platform",
"org.eclipse.e4.tools.emf.editor3x": "org.eclipse.platform",
"org.eclipse.e4.tools.emf.ui": "org.eclipse.platform",
"org.eclipse.e4.tools.jdt.templates": "org.eclipse.platform",
"org.eclipse.e4.tools.persistence": "org.eclipse.platform",
"org.eclipse.e4.tools.services": "org.eclipse.platform",
"org.eclipse.e4.ui.bindings": "org.eclipse.platform",
"org.eclipse.e4.ui.css.core": "org.eclipse.platform",
"org.eclipse.e4.ui.css.swt": "org.eclipse.platform",
"org.eclipse.e4.ui.css.swt.theme": "org.eclipse.platform",
"org.eclipse.e4.ui.di": "org.eclipse.platform",
"org.eclipse.e4.ui.dialogs": "org.eclipse.platform",
"org.eclipse.e4.ui.ide": "org.eclipse.platform",
"org.eclipse.e4.ui.model.workbench": "org.eclipse.platform",
"org.eclipse.e4.ui.progress": "org.eclipse.platform",
"org.eclipse.e4.ui.services": "org.eclipse.platform",
"org.eclipse.e4.ui.swt.gtk": "org.eclipse.platform",
"org.eclipse.e4.ui.swt.win32": "org.eclipse.platform",
"org.eclipse.e4.ui.widgets": "org.eclipse.platform",
"org.eclipse.e4.ui.workbench": "org.eclipse.platform",
"org.eclipse.e4.ui.workbench.addons.swt": "org.eclipse.platform",
"org.eclipse.e4.ui.workbench.renderers.swt": "org.eclipse.platform",
"org.eclipse.e4.ui.workbench.renderers.swt.cocoa": "org.eclipse.platform",
"org.eclipse.e4.ui.workbench.swt": "org.eclipse.platform",
"org.eclipse.e4.ui.workbench3": "org.eclipse.platform",
"org.eclipse.equinox.app": "org.eclipse.platform",
"org.eclipse.equinox.bidi": "org.eclipse.platform",
"org.eclipse.equinox.cm": "org.eclipse.platform",
"org.eclipse.equinox.common": "org.eclipse.platform",
"org.eclipse.equinox.concurrent": "org.eclipse.platform",
"org.eclipse.equinox.console": "org.eclipse.platform",
"org.eclipse.equinox.console.jaas.fragment": "org.eclipse.platform",
"org.eclipse.equinox.console.ssh": "org.eclipse.platform",
"org.eclipse.equinox.coordinator": "org.eclipse.platform",
"org.eclipse.equinox.device": "org.eclipse.platform",
"org.eclipse.equinox.ds": "org.eclipse.platform",
"org.eclipse.equinox.event": "org.eclipse.platform",
"org.eclipse.equinox.frameworkadmin": "org.eclipse.platform",
"org.eclipse.equinox.frameworkadmin.equinox": "org.eclipse.platform",
"org.eclipse.equinox.http.jetty": "org.eclipse.platform",
"org.eclipse.equinox.http.registry": "org.eclipse.platform",
"org.eclipse.equinox.http.servlet": "org.eclipse.platform",
"org.eclipse.equinox.http.servletbridge": "org.eclipse.platform",
"org.eclipse.equinox.io": "org.eclipse.platform",
"org.eclipse.equinox.ip": "org.eclipse.platform",
"org.eclipse.equinox.jsp.jasper": "org.eclipse.platform",
"org.eclipse.equinox.jsp.jasper.registry": "org.eclipse.platform",
"org.eclipse.equinox.launcher": "org.eclipse.platform",
"org.eclipse.equinox.launcher.cocoa.macosx": "org.eclipse.platform",
"org.eclipse.equinox.launcher.cocoa.macosx.aarch64": "org.eclipse.platform",
"org.eclipse.equinox.launcher.cocoa.macosx.x86_64": "org.eclipse.platform",
"org.eclipse.equinox.launcher.gtk.aix.ppc": "org.eclipse.platform",
"org.eclipse.equinox.launcher.gtk.aix.ppc64": "org.eclipse.platform",
"org.eclipse.equinox.launcher.gtk.hpux.ia64": "org.eclipse.platform",
"org.eclipse.equinox.launcher.gtk.linux.aarch64": "org.eclipse.platform",
"org.eclipse.equinox.launcher.gtk.linux.ppc": "org.eclipse.platform",
"org.eclipse.equinox.launcher.gtk.linux.ppc64": "org.eclipse.platform",
"org.eclipse.equinox.launcher.gtk.linux.ppc64le": "org.eclipse.platform",
"org.eclipse.equinox.launcher.gtk.linux.s390": "org.eclipse.platform",
"org.eclipse.equinox.launcher.gtk.linux.s390x": "org.eclipse.platform",
"org.eclipse.equinox.launcher.gtk.linux.x86": "org.eclipse.platform",
"org.eclipse.equinox.launcher.gtk.linux.x86_64": "org.eclipse.platform",
"org.eclipse.equinox.launcher.gtk.solaris.sparcv9": "org.eclipse.platform",
"org.eclipse.equinox.launcher.gtk.solaris.x86_64": "org.eclipse.platform",
"org.eclipse.equinox.launcher.win32.win32.x86": "org.eclipse.platform",
"org.eclipse.equinox.launcher.win32.win32.x86_64": "org.eclipse.platform",
"org.eclipse.equinox.log.stream": "org.eclipse.platform",
"org.eclipse.equinox.metatype": "org.eclipse.platform",
"org.eclipse.equinox.p2.artifact.repository": "org.eclipse.platform",
"org.eclipse.equinox.p2.console": "org.eclipse.platform",
"org.eclipse.equinox.p2.core": "org.eclipse.platform",
"org.eclipse.equinox.p2.director": "org.eclipse.platform",
"org.eclipse.equinox.p2.director.app": "org.eclipse.platform",
"org.eclipse.equinox.p2.directorywatcher": "org.eclipse.platform",
"org.eclipse.equinox.p2.discovery": "org.eclipse.platform",
"org.eclipse.equinox.p2.discovery.compatibility": "org.eclipse.platform",
"org.eclipse.equinox.p2.engine": "org.eclipse.platform",
"org.eclipse.equinox.p2.extensionlocation": "org.eclipse.platform",
"org.eclipse.equinox.p2.garbagecollector": "org.eclipse.platform",
"org.eclipse.equinox.p2.installer": "org.eclipse.platform",
"org.eclipse.equinox.p2.jarprocessor": "org.eclipse.platform",
"org.eclipse.equinox.p2.metadata": "org.eclipse.platform",
"org.eclipse.equinox.p2.metadata.repository": "org.eclipse.platform",
"org.eclipse.equinox.p2.operations": "org.eclipse.platform",
"org.eclipse.equinox.p2.publisher": "org.eclipse.platform",
"org.eclipse.equinox.p2.publisher.eclipse": "org.eclipse.platform",
"org.eclipse.equinox.p2.reconciler.dropins": "org.eclipse.platform",
"org.eclipse.equinox.p2.repository": "org.eclipse.platform",
"org.eclipse.equinox.p2.repository.tools": "org.eclipse.platform",
"org.eclipse.equinox.p2.touchpoint.eclipse": "org.eclipse.platform",
"org.eclipse.equinox.p2.touchpoint.natives": "org.eclipse.platform",
"org.eclipse.equinox.p2.transport.ecf": "org.eclipse.platform",
"org.eclipse.equinox.p2.ui": "org.eclipse.platform",
"org.eclipse.equinox.p2.ui.admin": "org.eclipse.platform",
"org.eclipse.equinox.p2.ui.admin.rcp": "org.eclipse.platform",
"org.eclipse.equinox.p2.ui.discovery": "org.eclipse.platform",
"org.eclipse.equinox.p2.ui.importexport": "org.eclipse.platform",
"org.eclipse.equinox.p2.ui.sdk": "org.eclipse.platform",
"org.eclipse.equinox.p2.ui.sdk.scheduler": "org.eclipse.platform",
"org.eclipse.equinox.p2.updatechecker": "org.eclipse.platform",
"org.eclipse.equinox.p2.updatesite": "org.eclipse.platform",
"org.eclipse.equinox.preferences": "org.eclipse.platform",
"org.eclipse.equinox.region": "org.eclipse.platform",
"org.eclipse.equinox.registry": "org.eclipse.platform",
"org.eclipse.equinox.security": "org.eclipse.platform",
"org.eclipse.equinox.security.linux": "org.eclipse.platform",
"org.eclipse.equinox.security.linux.x86_64": "org.eclipse.platform",
"org.eclipse.equinox.security.macosx": "org.eclipse.platform",
"org.eclipse.equinox.security.ui": "org.eclipse.platform",
"org.eclipse.equinox.security.win32.x86": "org.eclipse.platform",
"org.eclipse.equinox.security.win32.x86_64": "org.eclipse.platform",
"org.eclipse.equinox.servletbridge": "org.eclipse.platform",
"org.eclipse.equinox.simpleconfigurator": "org.eclipse.platform",
"org.eclipse.equinox.simpleconfigurator.manipulator": "org.eclipse.platform",
"org.eclipse.equinox.supplement": "org.eclipse.platform",
"org.eclipse.equinox.transforms.hook": "org.eclipse.platform",
"org.eclipse.equinox.transforms.xslt": "org.eclipse.platform",
"org.eclipse.equinox.useradmin": "org.eclipse.platform",
"org.eclipse.equinox.util": "org.eclipse.platform",
"org.eclipse.equinox.weaving.caching": "org.eclipse.platform",
"org.eclipse.equinox.weaving.caching.j9": "org.eclipse.platform",
"org.eclipse.equinox.weaving.hook": "org.eclipse.platform",
"org.eclipse.equinox.wireadmin": "org.eclipse.platform",
"org.eclipse.help": "org.eclipse.platform",
"org.eclipse.help.base": "org.eclipse.platform",
"org.eclipse.help.ui": "org.eclipse.platform",
"org.eclipse.help.webapp": "org.eclipse.platform",
"org.eclipse.jface": "org.eclipse.platform",
"org.eclipse.jface.databinding": "org.eclipse.platform",
"org.eclipse.jface.examples.databinding": "org.eclipse.platform",
"org.eclipse.jface.notifications": "org.eclipse.platform",
"org.eclipse.jface.text": "org.eclipse.platform",
"org.eclipse.jsch.core": "org.eclipse.platform",
"org.eclipse.jsch.ui": "org.eclipse.platform",
"org.eclipse.ltk.core.refactoring": "org.eclipse.platform",
"org.eclipse.ltk.ui.refactoring": "org.eclipse.platform",
"org.eclipse.osgi": "org.eclipse.platform",
"org.eclipse.osgi.compatibility.plugins": "org.eclipse.platform",
"org.eclipse.osgi.compatibility.state": "org.eclipse.platform",
"org.eclipse.osgi.services": "org.eclipse.platform",
"org.eclipse.osgi.util": "org.eclipse.platform",
"org.eclipse.platform": "org.eclipse.platform",
"org.eclipse.platform.doc.isv": "org.eclipse.platform",
"org.eclipse.platform.doc.user": "org.eclipse.platform",
"org.eclipse.rcp": "org.eclipse.platform",
"org.eclipse.releng.tools": "org.eclipse.platform",
"org.eclipse.sdk": "org.eclipse.platform",
"org.eclipse.sdk.examples": "org.eclipse.platform",
"org.eclipse.search": "org.eclipse.platform",
"org.eclipse.swt": "org.eclipse.platform",
"org.eclipse.swt.browser.chromium.cocoa.macosx.x86_64": "org.eclipse.platform",
"org.eclipse.swt.browser.chromium.gtk.linux.x86_64": "org.eclipse.platform",
"org.eclipse.swt.browser.chromium.win32.win32.x86_64": "org.eclipse.platform",
"org.eclipse.swt.cocoa.macosx.aarch64": "org.eclipse.platform",
"org.eclipse.swt.cocoa.macosx.x86_64": "org.eclipse.platform",
"org.eclipse.swt.examples": "org.eclipse.platform",
"org.eclipse.swt.examples.browser.demos": "org.eclipse.platform",
"org.eclipse.swt.examples.launcher": "org.eclipse.platform",
"org.eclipse.swt.examples.ole.win32": "org.eclipse.platform",
"org.eclipse.swt.examples.views": "org.eclipse.platform",
"org.eclipse.swt.gtk.aix.ppc": "org.eclipse.platform",
"org.eclipse.swt.gtk.aix.ppc64": "org.eclipse.platform",
"org.eclipse.swt.gtk.hpux.ia64": "org.eclipse.platform",
"org.eclipse.swt.gtk.linux.aarch64": "org.eclipse.platform",
"org.eclipse.swt.gtk.linux.ppc": "org.eclipse.platform",
"org.eclipse.swt.gtk.linux.ppc64": "org.eclipse.platform",
"org.eclipse.swt.gtk.linux.ppc64le": "org.eclipse.platform",
"org.eclipse.swt.gtk.linux.s390": "org.eclipse.platform",
"org.eclipse.swt.gtk.linux.s390x": "org.eclipse.platform",
"org.eclipse.swt.gtk.linux.x86": "org.eclipse.platform",
"org.eclipse.swt.gtk.linux.x86_64": "org.eclipse.platform",
"org.eclipse.swt.gtk.solaris.sparcv9": "org.eclipse.platform",
"org.eclipse.swt.gtk.solaris.x86_64": "org.eclipse.platform",
"org.eclipse.swt.tools": "org.eclipse.platform",
"org.eclipse.swt.tools.base": "org.eclipse.platform",
"org.eclipse.swt.tools.spies": "org.eclipse.platform",
"org.eclipse.swt.win32.win32.x86": "org.eclipse.platform",
"org.eclipse.swt.win32.win32.x86_64": "org.eclipse.platform",
"org.eclipse.team.core": "org.eclipse.platform",
"org.eclipse.team.cvs.core": "org.eclipse.platform",
"org.eclipse.team.cvs.ssh2": "org.eclipse.platform",
"org.eclipse.team.cvs.ui": "org.eclipse.platform",
"org.eclipse.team.examples.filesystem": "org.eclipse.platform",
"org.eclipse.team.genericeditor.diff.extension": "org.eclipse.platform",
"org.eclipse.team.ui": "org.eclipse.platform",
"org.eclipse.text": "org.eclipse.platform",
"org.eclipse.text.quicksearch": "org.eclipse.platform",
"org.eclipse.tips.core": "org.eclipse.platform",
"org.eclipse.tips.ide": "org.eclipse.platform",
"org.eclipse.tips.json": "org.eclipse.platform",
"org.eclipse.tips.ui": "org.eclipse.platform",
"org.eclipse.tools.layout.spy": "org.eclipse.platform",
"org.eclipse.ui": "org.eclipse.platform",
"org.eclipse.ui.browser": "org.eclipse.platform",
"org.eclipse.ui.cheatsheets": "org.eclipse.platform",
"org.eclipse.ui.cocoa": "org.eclipse.platform",
"org.eclipse.ui.console": "org.eclipse.platform",
"org.eclipse.ui.editors": "org.eclipse.platform",
"org.eclipse.ui.examples.contributions": "org.eclipse.platform",
"org.eclipse.ui.examples.fieldassist": "org.eclipse.platform",
"org.eclipse.ui.examples.filesystem": "org.eclipse.platform",
"org.eclipse.ui.examples.javaeditor": "org.eclipse.platform",
"org.eclipse.ui.examples.multipageeditor": "org.eclipse.platform",
"org.eclipse.ui.examples.propertysheet": "org.eclipse.platform",
"org.eclipse.ui.examples.readmetool": "org.eclipse.platform",
"org.eclipse.ui.examples.undo": "org.eclipse.platform",
"org.eclipse.ui.examples.uriSchemeHandler": "org.eclipse.platform",
"org.eclipse.ui.examples.views.properties.tabbed.article": "org.eclipse.platform",
"org.eclipse.ui.externaltools": "org.eclipse.platform",
"org.eclipse.ui.forms": "org.eclipse.platform",
"org.eclipse.ui.genericeditor": "org.eclipse.platform",
"org.eclipse.ui.genericeditor.examples": "org.eclipse.platform",
"org.eclipse.ui.ide": "org.eclipse.platform",
"org.eclipse.ui.ide.application": "org.eclipse.platform",
"org.eclipse.ui.intro": "org.eclipse.platform",
"org.eclipse.ui.intro.quicklinks": "org.eclipse.platform",
"org.eclipse.ui.intro.universal": "org.eclipse.platform",
"org.eclipse.ui.monitoring": "org.eclipse.platform",
"org.eclipse.ui.navigator": "org.eclipse.platform",
"org.eclipse.ui.navigator.resources": "org.eclipse.platform",
"org.eclipse.ui.net": "org.eclipse.platform",
"org.eclipse.ui.themes": "org.eclipse.platform",
"org.eclipse.ui.trace": "org.eclipse.platform",
"org.eclipse.ui.views": "org.eclipse.platform",
"org.eclipse.ui.views.log": "org.eclipse.platform",
"org.eclipse.ui.views.properties.tabbed": "org.eclipse.platform",
"org.eclipse.ui.win32": "org.eclipse.platform",
"org.eclipse.ui.workbench": "org.eclipse.platform",
"org.eclipse.ui.workbench.texteditor": "org.eclipse.platform",
"org.eclipse.update.configurator": "org.eclipse.platform",
"org.eclipse.update.core": "org.eclipse.platform",
"org.eclipse.urischeme": "org.eclipse.platform",
}

View file

@ -153,6 +153,22 @@ func extractNameFromApacheMavenBundlePlugin(manifest *pkg.JavaManifest) string {
return ""
}
func extractNameFromArchiveFilename(a archiveFilename) string {
if strings.Contains(a.name, ".") {
// special case: this *might* be a group id + artifact id. By convention artifact ids do not have "." in them;
// however, there are some specific exceptions like with the artifacts under
// https://repo1.maven.org/maven2/org/eclipse/platform/
if strings.HasPrefix(a.name, "org.eclipse.") {
return a.name
}
fields := strings.Split(a.name, ".")
return fields[len(fields)-1]
}
return a.name
}
func selectName(manifest *pkg.JavaManifest, filenameObj archiveFilename) string {
name := extractNameFromApacheMavenBundlePlugin(manifest)
if name != "" {
@ -160,13 +176,9 @@ func selectName(manifest *pkg.JavaManifest, filenameObj archiveFilename) string
}
// the filename tends to be the next-best reference for the package name
if filenameObj.name != "" {
if strings.Contains(filenameObj.name, ".") {
// special case: this *might* be a group id + artifact id. By convention artifact ids do not have "." in them.
fields := strings.Split(filenameObj.name, ".")
return fields[len(fields)-1]
}
return filenameObj.name
name = extractNameFromArchiveFilename(filenameObj)
if name != "" {
return name
}
// remaining fields in the manifest is a bit of a free-for-all depending on the build tooling used and package maintainer preferences

View file

@ -209,6 +209,16 @@ func TestSelectName(t *testing.T) {
archive: newJavaArchiveFilename("/something/com.atlassian.gadgets.atlassian-gadgets-api.jar"),
expected: "atlassian-gadgets-api",
},
{
desc: "Skip stripping groupId prefix from archive filename for org.eclipse",
manifest: pkg.JavaManifest{
Main: map[string]string{
"Automatic-Module-Name": "org.eclipse.ant.core",
},
},
archive: newJavaArchiveFilename("/something/org.eclipse.ant.core-3.7.0.jar"),
expected: "org.eclipse.ant.core",
},
{
// example: pkg:maven/com.google.oauth-client/google-oauth-client@1.25.0
desc: "skip Apache Maven Bundle Plugin logic if symbolic name is same as vendor id",