Encode all compiler plugin arguments for Android Extensions in kapt
Commas in option values breaks the option parsing in daemon (KT-20235).
This commit is contained in:
@@ -30,4 +30,14 @@ interface CommandLineProcessor {
|
||||
paths.add(value)
|
||||
put(option, paths)
|
||||
}
|
||||
|
||||
fun CompilerConfiguration.applyOptionsFrom(map: Map<String, List<String>>, pluginOptions: Collection<CliOption>) {
|
||||
for ((key, values) in map) {
|
||||
val option = pluginOptions.firstOrNull { it.name == key } ?: continue
|
||||
|
||||
for (value in values) {
|
||||
processOption(option, value, this)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Xplugin=dist/kotlinc/lib/android-extensions-compiler.jar
|
||||
-P
|
||||
plugin\:org.jetbrains.kotlin.android\:package=com.myapp
|
||||
$TESTDATA_DIR$/pluginSimple.kt
|
||||
$TESTDATA_DIR$/androidPlugin/androidApp.kt
|
||||
$TESTDATA_DIR$/androidPlugin/androidView.kt
|
||||
$TESTDATA_DIR$/androidPlugin/androidWidget.kt
|
||||
$TESTDATA_DIR$/androidPlugin/fakeAppwidgetPackage.kt
|
||||
$TESTDATA_DIR$/androidPlugin/fakeInputMethodServicePackage.kt
|
||||
$TESTDATA_DIR$/androidPlugin/fakeOpenglPackage.kt
|
||||
$TESTDATA_DIR$/androidPlugin/fakeWebkitPackage.kt
|
||||
@@ -1,8 +0,0 @@
|
||||
import android.view.*
|
||||
import android.app.*
|
||||
import android.widget.*
|
||||
import kotlinx.android.synthetic.main.layout.*
|
||||
|
||||
class MyActivity : Activity() {
|
||||
{ textView.setText("Some text") }
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
error: required plugin option not present: org.jetbrains.kotlin.android:variant
|
||||
|
||||
Plugin "org.jetbrains.kotlin.android" usage:
|
||||
variant <name;path> Android build variant (required, multiple)
|
||||
package <fq name> Application package (required)
|
||||
experimental true/false Enable experimental features
|
||||
defaultCacheImplementation hashMap/sparseArray/none
|
||||
Default cache implementation for module
|
||||
|
||||
COMPILATION_ERROR
|
||||
@@ -398,12 +398,6 @@ public class CliTestGenerated extends AbstractCliTest {
|
||||
doJvmTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("pluginSimpleUsage.args")
|
||||
public void testPluginSimpleUsage() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/pluginSimpleUsage.args");
|
||||
doJvmTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("returnAsWhenKey.args")
|
||||
public void testReturnAsWhenKey() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/cli/jvm/returnAsWhenKey.args");
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.utils
|
||||
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.ObjectInputStream
|
||||
import java.util.*
|
||||
|
||||
fun decodePluginOptions(options: String): Map<String, List<String>> {
|
||||
val map = LinkedHashMap<String, List<String>>()
|
||||
|
||||
val decodedBytes = Base64.getDecoder().decode(options)
|
||||
val bis = ByteArrayInputStream(decodedBytes)
|
||||
val ois = ObjectInputStream(bis)
|
||||
|
||||
val n = ois.readInt()
|
||||
|
||||
repeat(n) {
|
||||
val key = ois.readUTF()
|
||||
|
||||
val valueCount = ois.readInt()
|
||||
val values = mutableListOf<String>()
|
||||
|
||||
repeat(valueCount) {
|
||||
values += ois.readUTF()
|
||||
}
|
||||
|
||||
map[key] = values
|
||||
}
|
||||
|
||||
return map
|
||||
}
|
||||
Reference in New Issue
Block a user