Do not tell about Android compiler plugin in JPS in case of non-Android project
This commit is contained in:
@@ -33,36 +33,41 @@ public class KotlinAndroidJpsPlugin : KotlinJpsCompilerArgumentsProvider {
|
||||
override fun getExtraArguments(moduleBuildTarget: ModuleBuildTarget, context: CompileContext): List<String> {
|
||||
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<String> {
|
||||
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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user