Skip to content

Commit 52dff29

Browse files
Merge pull request #28 from OpenNTF/feature/issue-24-d14-source
Add support for fetching source from Eclipse 2021-12 (fixes #27)
2 parents 978f42c + f680798 commit 52dff29

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

generate-domino-update-site/src/main/java/org/openntf/p2/domino/updatesite/tasks/GenerateUpdateSiteTask.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,19 @@ public class GenerateUpdateSiteTask implements Runnable {
8080
}
8181

8282
/**
83-
* This is the public Eclipse update site that best matches what's found in 9.0.1FP10 to current (11.0.1).
83+
* This is the public Eclipse update site that best matches what's found in 9.0.1FP10 through 12.0.2.
8484
*/
85-
public static final String NEON_UPDATE_SITE = "https://download.eclipse.org/releases/neon/201612211000"; //$NON-NLS-1$
85+
public static final String UPDATE_SITE_NEON = "https://download.eclipse.org/releases/neon/201612211000"; //$NON-NLS-1$
86+
/**
87+
* This is the public Eclipse update site that best matches what's found in 14.0.0.
88+
*/
89+
public static final String UPDATE_SITE_202112 = "https://download.eclipse.org/releases/2021-12/202112081000/"; //$NON-NLS-1$
8690

8791
private final Path dominoDir;
8892
private final Path destDir;
8993
private final boolean flattenEmbeds;
9094
private final Log log;
95+
private String eclipseUpdateSite = UPDATE_SITE_NEON;
9196

9297
public GenerateUpdateSiteTask(Path dominoDir, Path destDir, boolean flattenEmbeds, Log log) {
9398
super();
@@ -106,6 +111,17 @@ public void run() {
106111
.orElseThrow(() -> new IllegalArgumentException(Messages.getString("GenerateUpdateSiteTask.unableToLocateLibExtJar", "Notes.jar", domino))); //$NON-NLS-1$ //$NON-NLS-2$
107112

108113
try {
114+
// Attempt to glean the active version based on the known Eclipse core version
115+
for(Path eclipse : eclipsePaths) {
116+
Path plugins = eclipse.resolve("plugins"); //$NON-NLS-1$
117+
if(Files.isDirectory(plugins)) {
118+
Path coreRuntime = plugins.resolve("org.eclipse.core.runtime_3.24.0.v20210910-0750.jar"); //$NON-NLS-1$
119+
if(Files.isRegularFile(coreRuntime)) {
120+
this.eclipseUpdateSite = UPDATE_SITE_202112;
121+
}
122+
}
123+
}
124+
109125
Document eclipseArtifacts = fetchEclipseArtifacts();
110126

111127
Path dest = mkDir(destDir);
@@ -657,7 +673,7 @@ private Optional<Path> findXspBootstrap(Path domino) {
657673
* @since 3.3.0
658674
*/
659675
private Document fetchEclipseArtifacts() throws MalformedURLException {
660-
String urlString = PathUtil.concat(NEON_UPDATE_SITE, "artifacts.xml.xz", '/'); //$NON-NLS-1$
676+
String urlString = PathUtil.concat(this.eclipseUpdateSite, "artifacts.xml.xz", '/'); //$NON-NLS-1$
661677
URL artifactsUrl = new URL(urlString);
662678
try(InputStream is = artifactsUrl.openStream()) {
663679
try(XZInputStream zis = new XZInputStream(is)) {
@@ -690,7 +706,7 @@ private void downloadSource(Path artifact, Path destDir, Document artifacts) thr
690706
String bundleName = StringUtil.format("{0}_{1}.jar", symbolicName, version); //$NON-NLS-1$
691707
Path dest = destDir.resolve(bundleName);
692708

693-
String urlString = PathUtil.concat(NEON_UPDATE_SITE, "plugins", '/'); //$NON-NLS-1$
709+
String urlString = PathUtil.concat(this.eclipseUpdateSite, "plugins", '/'); //$NON-NLS-1$
694710
urlString = PathUtil.concat(urlString, bundleName, '/');
695711
URL bundleUrl = new URL(urlString);
696712
try(InputStream is = bundleUrl.openStream()) {

0 commit comments

Comments
 (0)