add compiler key for providing android resources path
This commit is contained in:
committed by
Yan Zhulanow
parent
afee95a37c
commit
ec6f9c9fc5
@@ -51,4 +51,7 @@ public class JVMConfigurationKeys {
|
||||
|
||||
public static final CompilerConfigurationKey<List<String>> MODULE_IDS =
|
||||
CompilerConfigurationKey.create("module id strings");
|
||||
|
||||
public static final CompilerConfigurationKey<String> ANDROID_RES_PATH =
|
||||
CompilerConfigurationKey.create("android resources search path");
|
||||
}
|
||||
|
||||
@@ -90,6 +90,10 @@ public class K2JVMCompiler extends CLICompiler<K2JVMCompilerArguments> {
|
||||
return INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
if (arguments.androidRes != null) {
|
||||
configuration.put(JVMConfigurationKeys.ANDROID_RES_PATH, arguments.androidRes);
|
||||
}
|
||||
|
||||
if (arguments.script) {
|
||||
if (arguments.freeArgs.isEmpty()) {
|
||||
messageCollector.report(CompilerMessageSeverity.ERROR, "Specify script source path to evaluate",
|
||||
|
||||
@@ -56,6 +56,8 @@ import kotlin.Function1;
|
||||
import kotlin.Unit;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.jet.lang.resolve.android.AndroidUIXmlPathProvider;
|
||||
import org.jetbrains.jet.lang.resolve.android.CliAndroidUIXmlPathProvider;
|
||||
import org.jetbrains.kotlin.asJava.JavaElementFinder;
|
||||
import org.jetbrains.kotlin.asJava.KotlinLightClassForPackage;
|
||||
import org.jetbrains.kotlin.asJava.LightClassGenerationSupport;
|
||||
@@ -293,6 +295,9 @@ public class JetCoreEnvironment {
|
||||
configuration.getList(CommonConfigurationKeys.SCRIPT_DEFINITIONS_KEY)
|
||||
);
|
||||
|
||||
String s = configuration.get(JVMConfigurationKeys.ANDROID_RES_PATH);
|
||||
project.registerService(AndroidUIXmlPathProvider.class, new CliAndroidUIXmlPathProvider(s));
|
||||
|
||||
project.registerService(VirtualFileFinderFactory.class, new CliVirtualFileFinderFactory(classPath));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user