Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Commit

Permalink
Fixed: JRT FS not being created for Android; Tests always fail due to…
Browse files Browse the repository at this point in the history
… incorrect classpath
  • Loading branch information
itsaky committed Aug 4, 2022
1 parent e2f213f commit 379a103
Show file tree
Hide file tree
Showing 9 changed files with 2,474 additions and 1,896 deletions.
10 changes: 1 addition & 9 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,11 @@

set -e

ant_dir=./make/langtools/netbeans/nb-javac

# Build langtools
cd make/langtools
ant build
cd -

# Build nb-javac-android
JDK_8="/usr/lib/jvm/java-8-openjdk-amd64"
if [ -d "$JDK_8" ]; then
export JAVA_HOME=$JDK_8
fi

echo "Using JAVA_HOME: $JAVA_HOME"
source $(dirname $0)/setup.sh

ant -f $ant_dir -Dmaven.groupId=io.github.itsaky "$@"
7 changes: 4 additions & 3 deletions make/langtools/netbeans/nb-javac/nbproject/project.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
debug.modulepath=${run.modulepath}
debug.test.modulepath=${run.test.modulepath}
javac.modulepath=
Expand All @@ -9,7 +10,7 @@ jlink.launcher.name=nb-javac
#Thu Nov 12 15:02:26 CET 2015
jnlp.offline-allowed=false
javadoc.splitindex=true
run.jvmargs=-Xbootclasspath/p:${dist.dir}/nb-javac-${nb-javac-ver}-api.jar
run.jvmargs=-Xbootclasspath/p:${dist.dir}/nb-javac-${nb-javac-ver}-android.jar
run.modulepath=${javac.modulepath}:${build.classes.dir}
run.test.modulepath=${javac.test.modulepath}
test.test.dir=test
Expand Down Expand Up @@ -59,7 +60,7 @@ file.reference.share-classes-1=${nb.javac.dir}/src/java.base/share/classes
src.classes3.dir=${file.reference.share-classes-3}
platform.active=default_platform
annotation.processing.enabled=true
main.class=com.sun.tools.doclint.DocLint
main.class=com.sun.tools.javac.Main
dist.javadoc.dir=${dist.dir}/javadoc
javadoc.additionalparam=
javac.classpath=
Expand Down Expand Up @@ -91,4 +92,4 @@ javac.test.classpath=${javac.classpath}:${build.classes.dir}:${build.dir}/lib/ju
debug.classpath=${run.classpath}
jnlp.enabled=false
nb-javac-ver=17.0.0.3
nb.javac.mvn.ver=17.0.0.3
nb.javac.mvn.ver=17.0.0.3

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

export ant_dir=./make/langtools/netbeans/nb-javac

# Build nb-javac-android
JDK_8="/usr/lib/jvm/java-8-openjdk-amd64"
if [ -d "$JDK_8" ]; then
export JAVA_HOME=$JDK_8
fi

echo "Using JAVA_HOME: $JAVA_HOME"
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.itsaky.androidide.config;

import javax.lang.model.SourceVersion;
import java.lang.reflect.Field;

public class JavacConfigProvider {

Expand All @@ -13,18 +14,48 @@ public class JavacConfigProvider {
/**
* The latest source version that can be modeled.
*/
private static SourceVersion latestSourceVersion = SourceVersion.RELEASE_11;
private static SourceVersion latestSourceVersion;

/**
* The latest source version supported by the compiler.
*/
private static SourceVersion latestSupportedSourceVersion = latestSourceVersion;
private static SourceVersion latestSupportedSourceVersion;

/**
* Whether Java 9+ modules are enabled.
*/
private static boolean modulesEnabled = true;

static {
try {
Field latest = tryGetRelease("RELEASE_17");
if (latest == null) {
latest = tryGetRelease("RELEASE_11");
}

if (latest == null) {
latest = tryGetRelease("RELEASE_8");
}

if (latest == null) {
throw new IllegalStateException();
}

latestSourceVersion = (SourceVersion)latest.get(null);
latestSupportedSourceVersion = latestSourceVersion;
} catch (Throwable e) {
throw new RuntimeException(e);
}
}

static Field tryGetRelease(String release) {
try {
return SourceVersion.class.getDeclaredField(release);
} catch (NoSuchFieldException e) {
return null;
}
}

/**
* Gets the <code>androidide.java.home</code> property if it has been specified
* else fallbacks to the <code>java.home</code> property.
Expand Down
Loading

0 comments on commit 379a103

Please sign in to comment.