Skip to content
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

feat - Extract classes.jar from *.aar #1594

Merged
merged 7 commits into from
Sep 5, 2024
Merged
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -513,30 +513,32 @@ private void setProjectJdk(Map<IPath, IClasspathEntry> classpathMap, List<BuildT
javaProject.setOption(JavaCore.COMPILER_COMPLIANCE, targetCompatibility);
}

String highestJavaVersion = getHighestCompatibleJavaVersion(jvmBuildTarget.getGradleVersion());
try {
IVMInstall vm = EclipseVmUtil.findOrRegisterStandardVM(
targetCompatibility, // expectedVersion
sourceCompatibility, // lowestVersion
highestJavaVersion,
new File(new URI(jvmBuildTarget.getJavaHome())) // fallback jdk
);
if (!StringUtils.isEmpty(jvmBuildTarget.getJavaHome())) {
jdneo marked this conversation as resolved.
Show resolved Hide resolved
String highestJavaVersion = getHighestCompatibleJavaVersion(jvmBuildTarget.getGradleVersion());
try {
IVMInstall vm = EclipseVmUtil.findOrRegisterStandardVM(
targetCompatibility, // expectedVersion
sourceCompatibility, // lowestVersion
highestJavaVersion,
new File(new URI(jvmBuildTarget.getJavaHome())) // fallback jdk
);

List<IClasspathAttribute> classpathAttributes = new LinkedList<>();
if (isModular) {
classpathAttributes.add(modularAttribute);
List<IClasspathAttribute> classpathAttributes = new LinkedList<>();
if (isModular) {
classpathAttributes.add(modularAttribute);
}
classpathAttributes.add(buildServerAttribute);
IClasspathEntry jdkEntry = JavaCore.newContainerEntry(
JavaRuntime.newJREContainerPath(vm),
ClasspathEntry.NO_ACCESS_RULES,
classpathAttributes.toArray(new IClasspathAttribute[0]),
false /*isExported*/
);
classpathMap.putIfAbsent(jdkEntry.getPath(), jdkEntry);
} catch (URISyntaxException e) {
throw new CoreException(new Status(IStatus.ERROR, ImporterPlugin.PLUGIN_ID,
"Invalid Java home: " + jvmBuildTarget.getJavaHome(), e));
}
classpathAttributes.add(buildServerAttribute);
IClasspathEntry jdkEntry = JavaCore.newContainerEntry(
JavaRuntime.newJREContainerPath(vm),
ClasspathEntry.NO_ACCESS_RULES,
classpathAttributes.toArray(new IClasspathAttribute[0]),
false /*isExported*/
);
classpathMap.putIfAbsent(jdkEntry.getPath(), jdkEntry);
} catch (URISyntaxException e) {
throw new CoreException(new Status(IStatus.ERROR, ImporterPlugin.PLUGIN_ID,
"Invalid Java home: " + jvmBuildTarget.getJavaHome(), e));
}
}

Expand Down Expand Up @@ -585,8 +587,10 @@ private JvmBuildTargetEx getJvmTarget(List<BuildTarget> buildTargets) throws Cor
}

if (StringUtils.isBlank(jvmTarget.getJavaHome()) || StringUtils.isBlank(jvmTarget.getGradleVersion())) {
throw new CoreException(new Status(IStatus.ERROR, ImporterPlugin.PLUGIN_ID,
"Invalid JVM build target: " + jvmTarget.toString()));
JavaLanguageServerPlugin.logException(
new CoreException(new Status(IStatus.WARNING, ImporterPlugin.PLUGIN_ID,
"Invalid JVM build target: Missing JavaHome or GradleVersion."))
jdneo marked this conversation as resolved.
Show resolved Hide resolved
);
}

return jvmTarget;
Expand Down