From 9f23fe47544cf51df856ac57448d17eecebab9ba Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Mar 2026 06:15:36 +0000 Subject: [PATCH 1/3] Initial plan From 158d7a696fcfd390e9f241dec88dac38aa3314f7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Mar 2026 06:40:54 +0000 Subject: [PATCH 2/3] Fix DS annotation test setup reliability issues - Replace unreliable File.renameTo() with Files.move() for test.project rename, which throws on failure instead of failing silently - Fix afterAll() cleanup bug: project names were incorrectly doubled ("ds.annotations." + "ds.annotations.testN" instead of just the key) - Add workspace job result status checking after join to properly propagate setup errors - Increase build iterations from 2 to 3 for more reliable annotation processor output generation on all platforms Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com> --- .../tests/WorkspaceSetupExtension.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/WorkspaceSetupExtension.java b/ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/WorkspaceSetupExtension.java index 703b1dab60..5fa2f51fe6 100644 --- a/ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/WorkspaceSetupExtension.java +++ b/ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/WorkspaceSetupExtension.java @@ -1,6 +1,5 @@ package org.eclipse.pde.ds.internal.annotations.tests; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; @@ -55,7 +54,7 @@ public void beforeAll(ExtensionContext context) throws Exception { Job wsJob = new WorkspaceJob("Test Workspace Setup") { @Override public IStatus runInWorkspace(IProgressMonitor m) throws CoreException { - SubMonitor monitor = SubMonitor.convert(m, PROJECTS.size() * 8); + SubMonitor monitor = SubMonitor.convert(m, PROJECTS.size() * 11); // import test projects Path wsRoot = ws.getRoot().getLocation().toPath(); for (Map.Entry entry : PROJECTS.entrySet()) { @@ -64,16 +63,17 @@ public IStatus runInWorkspace(IProgressMonitor m) throws CoreException { Path projectLocation = Files.createDirectories(wsRoot.resolve(project.getName())); copyResources(bundle, entry.getValue(), projectLocation); Files.createDirectories(projectLocation.resolve("OSGI-INF")); - File projectFile = projectLocation.resolve("test.project").toFile(); - if (projectFile.isFile()) { - projectFile.renameTo(projectLocation.resolve(".project").toFile()); + Path projectFile = projectLocation.resolve("test.project"); + if (Files.isRegularFile(projectFile)) { + Files.move(projectFile, projectLocation.resolve(".project"), + StandardCopyOption.REPLACE_EXISTING); } } catch (IOException e) { throw new CoreException(Status.error("Error copying test project content.", e)); } project.create(monitor.split(1)); project.open(monitor.split(1)); - for (int i = 0; i < 2; i++) { // Build twice. Sometimes the setup is unstable + for (int i = 0; i < 3; i++) { // Build multiple times as setup can be unstable project.build(IncrementalProjectBuilder.FULL_BUILD, monitor.split(2)); project.refreshLocal(IResource.DEPTH_INFINITE, monitor.split(1)); } @@ -84,6 +84,10 @@ public IStatus runInWorkspace(IProgressMonitor m) throws CoreException { wsJob.schedule(); wsJob.join(); + IStatus result = wsJob.getResult(); + if (result != null && !result.isOK()) { + throw new CoreException(result); + } } @Override @@ -97,7 +101,7 @@ public void afterAll(ExtensionContext context) throws Exception { @Override public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { for (String projectId : PROJECTS.keySet()) { - IProject project = wsRoot.getProject("ds.annotations." + projectId); + IProject project = wsRoot.getProject(projectId); if (project.exists()) { project.delete(true, true, monitor); } From 297414eb5d7b8dbc29287f855b0fcb744af983ec Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 1 Mar 2026 06:41:44 +0000 Subject: [PATCH 3/3] Address code review: add comments explaining work unit calculation and build loop rationale Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com> --- .../ds/internal/annotations/tests/WorkspaceSetupExtension.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/WorkspaceSetupExtension.java b/ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/WorkspaceSetupExtension.java index 5fa2f51fe6..13d423dfd5 100644 --- a/ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/WorkspaceSetupExtension.java +++ b/ds/org.eclipse.pde.ds.annotations.tests/src/org/eclipse/pde/ds/internal/annotations/tests/WorkspaceSetupExtension.java @@ -54,6 +54,7 @@ public void beforeAll(ExtensionContext context) throws Exception { Job wsJob = new WorkspaceJob("Test Workspace Setup") { @Override public IStatus runInWorkspace(IProgressMonitor m) throws CoreException { + // Per project: create(1) + open(1) + 3*(build(2) + refresh(1)) = 11 SubMonitor monitor = SubMonitor.convert(m, PROJECTS.size() * 11); // import test projects Path wsRoot = ws.getRoot().getLocation().toPath(); @@ -73,7 +74,7 @@ public IStatus runInWorkspace(IProgressMonitor m) throws CoreException { } project.create(monitor.split(1)); project.open(monitor.split(1)); - for (int i = 0; i < 3; i++) { // Build multiple times as setup can be unstable + for (int i = 0; i < 3; i++) { // Annotation processor may need multiple builds to generate all outputs project.build(IncrementalProjectBuilder.FULL_BUILD, monitor.split(2)); project.refreshLocal(IResource.DEPTH_INFINITE, monitor.split(1)); }