[CLI] Introduce new compiler arguments for registering compiler plugins
With new syntax each plugin should be registered in separate argument with syntax `-Xcompiler-plugin=classpath1,classpath2[=argument1=value1,argument2=value2]`
This commit is contained in:
committed by
teamcity
parent
8919703448
commit
928416c9c5
+2
@@ -93,6 +93,8 @@ where advanced options include:
|
||||
-Xphases-to-validate-after Validate backend state after these phases
|
||||
-Xphases-to-validate-before Validate backend state before these phases
|
||||
-Xplugin=<path> Load plugins from the given classpath
|
||||
-Xcompiler-plugin=<path1>,<path2>:<optionName>=<value>,<optionName>=<value>
|
||||
Register compiler plugin
|
||||
-Xprofile-phases Profile backend phases
|
||||
-Xproper-ieee754-comparisons Generate proper IEEE 754 comparisons in all cases if values are statically known to be of primitive numeric types
|
||||
-Xread-deserialized-contracts Enable reading of contracts from metadata
|
||||
|
||||
+2
@@ -200,6 +200,8 @@ where advanced options include:
|
||||
-Xphases-to-validate-after Validate backend state after these phases
|
||||
-Xphases-to-validate-before Validate backend state before these phases
|
||||
-Xplugin=<path> Load plugins from the given classpath
|
||||
-Xcompiler-plugin=<path1>,<path2>:<optionName>=<value>,<optionName>=<value>
|
||||
Register compiler plugin
|
||||
-Xprofile-phases Profile backend phases
|
||||
-Xproper-ieee754-comparisons Generate proper IEEE 754 comparisons in all cases if values are statically known to be of primitive numeric types
|
||||
-Xread-deserialized-contracts Enable reading of contracts from metadata
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Xcompiler-plugin=dist/kotlinc/lib/allopen-compiler-plugin.jar=annotation=foo.AllOpen
|
||||
$TESTDATA_DIR$/firAllOpenPlugin.kt
|
||||
@@ -0,0 +1 @@
|
||||
OK
|
||||
@@ -0,0 +1,9 @@
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Xcompiler-plugin=dist/kotlinc/lib/noarg-compiler-plugin.jar=annotation=foo.NoArg
|
||||
|
||||
-Xplugin=dist/kotlinc/lib/allopen-compiler-plugin.jar
|
||||
-P
|
||||
plugin\:org.jetbrains.kotlin.allopen\:annotation=foo.AllOpen
|
||||
|
||||
$TESTDATA_DIR$/mixingModernAndLegacyArgs.kt
|
||||
@@ -0,0 +1 @@
|
||||
fun main() {}
|
||||
@@ -0,0 +1,8 @@
|
||||
error: mixing legacy and modern plugin arguments is prohibited. Please use only one syntax
|
||||
Legacy arguments:
|
||||
-Xplugin=dist/kotlinc/lib/allopen-compiler-plugin.jar
|
||||
-P plugin:org.jetbrains.kotlin.allopen:annotation=foo.AllOpen
|
||||
Modern arguments:
|
||||
-Xcompiler-plugin=dist/kotlinc/lib/noarg-compiler-plugin.jar=annotation=foo.NoArg
|
||||
|
||||
COMPILATION_ERROR
|
||||
@@ -0,0 +1,4 @@
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Xcompiler-plugin=dist/kotlinc/lib/allopen-compiler-plugin.jar=annotation=foo.AllOpen1,annotation=foo.AllOpen2
|
||||
$TESTDATA_DIR$/multipleOptionsForOnePlugin.kt
|
||||
@@ -0,0 +1,12 @@
|
||||
package foo
|
||||
|
||||
annotation class AllOpen1
|
||||
annotation class AllOpen2
|
||||
|
||||
@AllOpen1
|
||||
class Base1
|
||||
class Derived1 : Base1()
|
||||
|
||||
@AllOpen2
|
||||
class Base2
|
||||
class Derived2 : Base2()
|
||||
@@ -0,0 +1 @@
|
||||
OK
|
||||
@@ -0,0 +1,5 @@
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Xcompiler-plugin=dist/kotlinc/lib/allopen-compiler-plugin.jar=annotation=foo.AllOpen
|
||||
-Xcompiler-plugin=dist/kotlinc/lib/noarg-compiler-plugin.jar=annotation=foo.NoArg
|
||||
$TESTDATA_DIR$/multiplePlugins.kt
|
||||
@@ -0,0 +1,12 @@
|
||||
package foo
|
||||
|
||||
annotation class NoArg
|
||||
annotation class AllOpen
|
||||
|
||||
@AllOpen
|
||||
class Base(val s: String)
|
||||
|
||||
class Derived(s: String) : Base(s) {
|
||||
@NoArg
|
||||
inner class Inner(val s: String)
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
compiler/testData/cli/jvm/plugins/multiplePlugins.kt:11:17: error: noarg constructor generation is not possible for inner classes
|
||||
inner class Inner(val s: String)
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
@@ -0,0 +1,4 @@
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Xcompiler-plugin=dist/kotlinc/lib/allopen-compiler-plugin.jar,dist/kotlinc/lib/noarg-compiler-plugin.jar=annotation=foo.AllOpen
|
||||
$TESTDATA_DIR$/multiplePluginsInSameArg.kt
|
||||
@@ -0,0 +1,10 @@
|
||||
package foo
|
||||
|
||||
annotation class NoArg
|
||||
annotation class AllOpen
|
||||
|
||||
@AllOpen
|
||||
class Base(val s: String)
|
||||
|
||||
@NoArg
|
||||
class Derived(s: String) : Base(s)
|
||||
@@ -0,0 +1,3 @@
|
||||
error: multiple plugins found in given classpath: org.jetbrains.kotlin.allopen.AllOpenComponentRegistrar, org.jetbrains.kotlin.noarg.NoArgComponentRegistrar
|
||||
Plugin configuration is: dist/kotlinc/lib/allopen-compiler-plugin.jar,dist/kotlinc/lib/noarg-compiler-plugin.jar=annotation=foo.AllOpen
|
||||
COMPILATION_ERROR
|
||||
@@ -0,0 +1,4 @@
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Xcompiler-plugin=dist/kotlinc/lib/kotlin-reflect.jar
|
||||
$TESTDATA_DIR$/noPluginInClasspath.kt
|
||||
@@ -0,0 +1 @@
|
||||
fun main() {}
|
||||
@@ -0,0 +1,2 @@
|
||||
error: no plugins found in given classpath: dist/kotlinc/lib/kotlin-reflect.jar
|
||||
COMPILATION_ERROR
|
||||
@@ -0,0 +1,5 @@
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Xcompiler-plugin=dist/kotlinc/lib/android-extensions-compiler.jar=package=com.myapp,variant=main;$TESTDATA_DIR$/../androidPlugin/res
|
||||
$TESTDATA_DIR$/pluginSimple.kt
|
||||
$TESTDATA_DIR$/../androidPlugin
|
||||
@@ -0,0 +1 @@
|
||||
OK
|
||||
@@ -0,0 +1,6 @@
|
||||
-d
|
||||
$TEMP_DIR$
|
||||
-Xcompiler-plugin=dist/kotlinc/lib/android-extensions-compiler.jar=package=com.myapp,variant=main;$TESTDATA_DIR$/../androidPlugin/res
|
||||
$TESTDATA_DIR$/pluginSimple.kt
|
||||
$TESTDATA_DIR$/../androidPlugin
|
||||
-Xuse-k2
|
||||
@@ -0,0 +1,7 @@
|
||||
warning: ATTENTION!
|
||||
This build uses experimental K2 compiler:
|
||||
-Xuse-k2
|
||||
error: there are some plugins incompatible with K2 compiler:
|
||||
org.jetbrains.kotlin.android.synthetic.AndroidComponentRegistrar
|
||||
Please remove -Xuse-k2
|
||||
COMPILATION_ERROR
|
||||
Reference in New Issue
Block a user