Skip to content

Commit

Permalink
Consider the classpath file as an alternative for build output
Browse files Browse the repository at this point in the history
Actually each source.<jar> should have a corresponding output.<jar> but
there are some cases where this is not true... lets cheat and look at
the classpath instead...

Fix #3019
  • Loading branch information
laeubi committed Nov 9, 2023
1 parent 92502e0 commit e3d7619
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,32 @@ private Map<String, String> computeOutputJars(IProject project) throws CoreExcep
for (String token : entry.getTokens()) {
outputJars.put(token, key);
}
} else if (name.startsWith(IBuildEntry.JAR_PREFIX)) {
// Actually each source.<jar> should have a corresponding output.<jar> but there
// are some cases where this is not true... lets cheat and look at the
// classpath instead...
String key = name.substring(IBuildEntry.JAR_PREFIX.length());
IJavaProject javaProject = JavaCore.create(project);
if (javaProject != null) {
IClasspathEntry[] rawClasspath = javaProject.getRawClasspath();
for (String token : entry.getTokens()) {
IPath srcPath = project.getFolder(token).getFullPath();
for (IClasspathEntry classpathEntry : rawClasspath) {
if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
IPath path = classpathEntry.getPath();
if (srcPath.equals(path)) {
IPath outputLocation = classpathEntry.getOutputLocation();
if (outputLocation == null) {
outputLocation = javaProject.getOutputLocation();
}
IFolder folder = getProjectFolder(outputLocation);
String output = folder.getProjectRelativePath().toString();
outputJars.putIfAbsent(output, key);
}
}
}
}
}
}
}
}
Expand Down

0 comments on commit e3d7619

Please sign in to comment.