Skip to content

Commit 5c59d79

Browse files
committed
Handle test projects that are using the default output location
If the only source folder in a project is a test folder it is allowed by JDT to use the standard output location. In such case currently nothing is added to the project jar. This now checks for this case and also includes compile classfiles from there. It also makes sure that test-only classpath entries are not added if not include test is given.
1 parent c9f02f0 commit 5c59d79

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/bnd/PdeProjectAnalyzer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public PdeProjectAnalyzer(IProject project, boolean includeTest) throws Exceptio
3737
IJavaProject javaProject = JavaCore.create(project);
3838
IClasspathEntry[] classpath = javaProject.getResolvedClasspath(true);
3939
for (IClasspathEntry cp : classpath) {
40-
if (cp.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
40+
if (cp.getEntryKind() == IClasspathEntry.CPE_LIBRARY && (includeTest || !cp.isTest())) {
4141
IPath path = cp.getPath();
4242
File file = path.toFile();
4343
if (file != null && file.getName().endsWith(".jar") && !file.getName().equals("jrt-fs.jar") //$NON-NLS-1$ //$NON-NLS-2$

ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/bnd/PdeTestProjectJar.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ public PdeTestProjectJar(IProject project) throws CoreException {
3838
for (IClasspathEntry cp : classpath) {
3939
if (cp.getEntryKind() == IClasspathEntry.CPE_SOURCE && cp.isTest()) {
4040
IPath location = cp.getOutputLocation();
41-
if (location != null) {
41+
if (location == null) {
42+
IPath defaultOutputLocation = javaProject.getOutputLocation();
43+
FileResource.addResources(this, workspaceRoot.getFolder(defaultOutputLocation), null);
44+
} else {
4245
IFolder otherOutputFolder = workspaceRoot.getFolder(location);
4346
FileResource.addResources(this, otherOutputFolder, null);
4447
}

0 commit comments

Comments
 (0)