diff --git a/plugins/android-jps-plugin/src/KotlinAndroidJpsPlugin.kt b/plugins/android-jps-plugin/src/KotlinAndroidJpsPlugin.kt index b02c9135c7d..274f0a29803 100644 --- a/plugins/android-jps-plugin/src/KotlinAndroidJpsPlugin.kt +++ b/plugins/android-jps-plugin/src/KotlinAndroidJpsPlugin.kt @@ -33,36 +33,41 @@ public class KotlinAndroidJpsPlugin : KotlinJpsCompilerArgumentsProvider { override fun getExtraArguments(moduleBuildTarget: ModuleBuildTarget, context: CompileContext): List { val module = moduleBuildTarget.getModule() val pluginId = AndroidCommandLineProcessor.ANDROID_COMPILER_PLUGIN_ID - return listOf( - getPluginOptionString(pluginId, AndroidCommandLineProcessor.RESOURCE_PATH_OPTION.name, getAndroidResPath(module)), - getPluginOptionString(pluginId, AndroidCommandLineProcessor.MANIFEST_FILE_OPTION.name, getAndroidManifest(module)) - ) + val resPath = getAndroidResPath(module) + val manifestFile = getAndroidManifest(module) + return if (resPath != null && manifestFile != null) listOf( + getPluginOptionString(pluginId, AndroidCommandLineProcessor.RESOURCE_PATH_OPTION.name, resPath), + getPluginOptionString(pluginId, AndroidCommandLineProcessor.MANIFEST_FILE_OPTION.name, manifestFile)) + else listOf() } override fun getClasspath(moduleBuildTarget: ModuleBuildTarget, context: CompileContext): List { val inJar = PathUtil.getJarPathForClass(javaClass).isFile() - return listOf( - if (inJar) { - val libDirectory = PathUtil.getJarPathForClass(javaClass).getParentFile().getParentFile() - File(libDirectory, jarFileName).getAbsolutePath() - } else { - // We're in tests now (in out/production/android-jps-plugin) - val kotlinProjectDirectory = PathUtil.getJarPathForClass(javaClass).getParentFile().getParentFile().getParentFile() - File(kotlinProjectDirectory, "dist/kotlinc/lib/$jarFileName").getAbsolutePath() - } - ) + val manifestFile = getAndroidManifest(moduleBuildTarget.getModule()) + return if (manifestFile != null) { + listOf( + if (inJar) { + val libDirectory = PathUtil.getJarPathForClass(javaClass).getParentFile().getParentFile() + File(libDirectory, jarFileName).getAbsolutePath() + } else { + // We're in tests now (in out/production/android-jps-plugin) + val kotlinProjectDirectory = PathUtil.getJarPathForClass(javaClass).getParentFile().getParentFile().getParentFile() + File(kotlinProjectDirectory, "dist/kotlinc/lib/$jarFileName").getAbsolutePath() + }) + } + else listOf() } - private fun getAndroidResPath(module: JpsModule): String { + private fun getAndroidResPath(module: JpsModule): String? { val extension = AndroidJpsUtil.getExtension(module) - if (extension == null) return "" + if (extension == null) return null val path = AndroidJpsUtil.getResourceDirForCompilationPath(extension) return File(path!!.getAbsolutePath() + "/layout").getAbsolutePath() } - private fun getAndroidManifest(module: JpsModule): String { + private fun getAndroidManifest(module: JpsModule): String? { val extension = AndroidJpsUtil.getExtension(module) - if (extension == null) return "" + if (extension == null) return null return AndroidJpsUtil.getManifestFileForCompilationPath(extension)!!.getAbsolutePath() } } \ No newline at end of file