mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
Moved javac to a separate module; Fixed test failures
This commit is contained in:
Generated
+1
-1
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="11">
|
||||
<bytecodeTargetLevel target="1.8">
|
||||
<module name="AndroidIDE.gradle-tooling" target="1.8" />
|
||||
<module name="AndroidIDE.gradle-tooling.plugin" target="1.8" />
|
||||
</bytecodeTargetLevel>
|
||||
|
||||
Generated
+1
-1
@@ -141,7 +141,7 @@
|
||||
</option>
|
||||
</component>
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
/build
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is part of AndroidIDE.
|
||||
*
|
||||
* AndroidIDE is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* AndroidIDE is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
plugins {
|
||||
id 'java-library'
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
dependencies {
|
||||
api files ('libs/nb-javac-17.0.0.0-android.jar')
|
||||
}
|
||||
+18
-17
@@ -20,24 +20,24 @@ apply plugin: 'kotlin-android'
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.compileSdk
|
||||
buildToolsVersion rootProject.ext.buildTools
|
||||
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.minSdk
|
||||
targetSdkVersion rootProject.ext.targetSdk
|
||||
}
|
||||
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
proguardFiles getDefaultProguardFile ('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
|
||||
testOptions {
|
||||
unitTests {
|
||||
includeAndroidResources = true
|
||||
@@ -55,21 +55,22 @@ dependencies {
|
||||
|
||||
implementation 'com.google.auto.value:auto-value-annotations:1.9'
|
||||
annotationProcessor 'com.google.auto.value:auto-value:1.9'
|
||||
|
||||
|
||||
compileOnly androidx.appcompat
|
||||
compileOnly google.material
|
||||
compileOnly project(':actions')
|
||||
compileOnly project(':common')
|
||||
|
||||
implementation project(path: ':lsp:api')
|
||||
implementation files ("libs/nb-javac-17.0.0.0-android.jar")
|
||||
|
||||
compileOnly project (':actions')
|
||||
compileOnly project (':common')
|
||||
|
||||
implementation project (path: ':lsp:api')
|
||||
implementation project (path: ':javac')
|
||||
|
||||
implementation "androidx.core:core-ktx:1.7.0"
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
|
||||
testImplementation project(':lsp:testing')
|
||||
testImplementation project(':common')
|
||||
testImplementation project(':actions')
|
||||
|
||||
testImplementation project (':lsp:testing')
|
||||
testImplementation project (':common')
|
||||
testImplementation project (':actions')
|
||||
testImplementation project (':javac')
|
||||
testImplementation tests.junit
|
||||
testImplementation tests.google_truth
|
||||
testImplementation tests.robolectric
|
||||
@@ -79,5 +80,5 @@ dependencies {
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenCentral ()
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
package com.itsaky.lsp.java.compiler;
|
||||
|
||||
import com.itsaky.androidide.utils.Logger;
|
||||
import com.itsaky.lsp.java.utils.TestUtils;
|
||||
import com.sun.source.tree.Tree;
|
||||
import com.sun.source.util.JavacTask;
|
||||
import com.sun.source.util.TaskEvent;
|
||||
@@ -205,7 +206,9 @@ public class ReusableCompiler {
|
||||
NBMemberEnter.preRegister(this, false);
|
||||
NBClassFinder.preRegister(this);
|
||||
|
||||
put(LazyTreeLoader.lazyTreeLoaderKey, new IDELazyTreeLoader());
|
||||
if (!TestUtils.isTestEnvironment()) {
|
||||
put(LazyTreeLoader.lazyTreeLoaderKey, new IDELazyTreeLoader());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of AndroidIDE.
|
||||
*
|
||||
* AndroidIDE is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* AndroidIDE is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with AndroidIDE. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.itsaky.lsp.java.utils
|
||||
|
||||
/**
|
||||
* Utility related to tests.
|
||||
*
|
||||
* @author Akash Yadav
|
||||
*/
|
||||
class TestUtils {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun isTestEnvironment (): Boolean {
|
||||
return try {
|
||||
Class.forName("org.robolectric.RobolectricTestRunner")
|
||||
true
|
||||
} catch (error: ClassNotFoundException) {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,11 +42,7 @@ public class NBJavacTrees extends JavacTrees {
|
||||
private final Map<Element, TreePath> element2paths = new HashMap<>();
|
||||
|
||||
public static void preRegister(Context context) {
|
||||
context.put(JavacTrees.class, new Context.Factory<JavacTrees>() {
|
||||
public JavacTrees make(Context c) {
|
||||
return new NBJavacTrees(c);
|
||||
}
|
||||
});
|
||||
context.put(JavacTrees.class, (Context.Factory<JavacTrees>) NBJavacTrees::new);
|
||||
}
|
||||
protected NBJavacTrees(Context context) {
|
||||
super(context);
|
||||
@@ -80,5 +76,4 @@ public class NBJavacTrees extends JavacTrees {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,3 +13,4 @@ include ':lsp:java'
|
||||
include ':lsp:xml'
|
||||
include ':lsp:testing'
|
||||
include ':actions'
|
||||
include ':javac'
|
||||
|
||||
Reference in New Issue
Block a user