Skip to content

Consider only artifacts with "osgi.bundle" classifier #156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## [Unreleased]

### Fixed
- Fix version parsing in eclipseMavenCentral ([#156](https://github.com/diffplug/goomph/pull/156))

## [3.32.0] - 2021-09-03
### Added
- New plugin `com.diffplug.configuration-cache-for-platform-specific-build` which makes the `OS.getNative()` and `SwtPlatform.xxx` methods work without breaking the Gradle configuration cache. ([#153](https://github.com/diffplug/goomph/pull/153))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class MavenCentralMapping {
private static final String JDT = "org.eclipse.jdt";
private static final String PDE = "org.eclipse.pde";
private static final String EMF = "org.eclipse.emf";

public static boolean isEclipseGroup(String group) {
return group.equals(PLATFORM) || group.equals(JDT) || group.equals(PDE) || group.equals(EMF);
}
Expand Down Expand Up @@ -72,10 +72,13 @@ static Map<String, String> parse(InputStream inputStream) throws ParserConfigura
for (int i = 0; i < artifacts.getChildNodes().getLength(); ++i) {
Node artifact = artifacts.getChildNodes().item(i);
if ("artifact".equals(artifact.getNodeName())) {
String id = artifact.getAttributes().getNamedItem("id").getNodeValue();
String version = artifact.getAttributes().getNamedItem("version").getNodeValue();
Version parsed = Version.parseVersion(version);
map.put(id, parsed.getMajor() + "." + parsed.getMinor() + "." + parsed.getMicro());
String classifier = artifact.getAttributes().getNamedItem("classifier").getNodeValue();
if ("osgi.bundle".equals(classifier)) {
String id = artifact.getAttributes().getNamedItem("id").getNodeValue();
String version = artifact.getAttributes().getNamedItem("version").getNodeValue();
Version parsed = Version.parseVersion(version);
map.put(id, parsed.getMajor() + "." + parsed.getMinor() + "." + parsed.getMicro());
}
}
}
return map;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015-2020 DiffPlug
* Copyright (C) 2015-2021 DiffPlug
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,7 +27,7 @@

public class MavenCentralMappingTest {
@Test
public void testParsing() throws IOException, ParserConfigurationException, SAXException {
public void testParsing463() throws IOException, ParserConfigurationException, SAXException {
try (InputStream input = MavenCentralMappingTest.class.getResourceAsStream("/artifacts-4.6.3.xml")) {
assert463(MavenCentralMapping.parse(input));
}
Expand All @@ -42,7 +42,23 @@ private void assert463(Map<String, String> bundleToVersion) {
Assertions.assertThat(bundleToVersion)
.containsEntry("org.eclipse.debug.core", "3.10.100")
.containsEntry("org.eclipse.equinox.p2.metadata", "2.3.100")
.hasSize(895);
.containsEntry("org.eclipse.help", "3.7.0")
.hasSize(743);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

743 is also the size returned bnd when listing the content of the
https://download.eclipse.org/eclipse/updates/4.6/

Output: https://github.com/jmini/ecentral/blob/master/data/4.6/bnd-output.txt


Approach described on stackoverflow:
How to programmatically query a p2 repository for information and artifacts?

}

@Test
public void testParsing4140() throws IOException, ParserConfigurationException, SAXException {
try (InputStream input = MavenCentralMappingTest.class.getResourceAsStream("/artifacts-4.14.0.xml")) {
assert4140(MavenCentralMapping.parse(input));
}
}

private void assert4140(Map<String, String> bundleToVersion) {
Assertions.assertThat(bundleToVersion)
.containsEntry("org.eclipse.debug.core", "3.14.100")
.containsEntry("org.eclipse.equinox.p2.metadata", "2.4.600")
.containsEntry("org.eclipse.help", "3.8.600")
.hasSize(785);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

785 is also the size returned bnd when listing the content of the
https://download.eclipse.org/eclipse/updates/4.14/

Output: https://github.com/jmini/ecentral/blob/master/data/4.14/bnd-output.txt


Approach described on stackoverflow:
How to programmatically query a p2 repository for information and artifacts?

}

@Test
Expand Down
Loading