Generate gradle options from compiler arguments
#KT-13633 fixed
This commit is contained in:
+3
@@ -25,13 +25,16 @@ import java.util.List;
|
||||
public abstract class CommonCompilerArguments {
|
||||
public static final String PLUGIN_OPTION_FORMAT = "plugin:<pluginId>:<optionName>=<value>";
|
||||
|
||||
@GradleOption(defaultValue = "\"1.0\"", possibleValues = { "\"1.0\"" })
|
||||
@Argument(value = "language-version", description = "Provide source compatibility with specified language version")
|
||||
@ValueDescription("<version>")
|
||||
public String languageVersion;
|
||||
|
||||
@GradleOption(defaultValue = "false")
|
||||
@Argument(value = "nowarn", description = "Generate no warnings")
|
||||
public boolean suppressWarnings;
|
||||
|
||||
@GradleOption(defaultValue = "false")
|
||||
@Argument(value = "verbose", description = "Enable verbose logging output")
|
||||
public boolean verbose;
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.cli.common.arguments
|
||||
|
||||
@Retention(AnnotationRetention.RUNTIME)
|
||||
annotation class GradleOption(val defaultValue: String,
|
||||
val possibleValues: Array<String> = arrayOf())
|
||||
+13
-5
@@ -24,10 +24,12 @@ import static org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.CA
|
||||
import static org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.NO_CALL;
|
||||
|
||||
public class K2JSCompilerArguments extends CommonCompilerArguments {
|
||||
@GradleOption(defaultValue = "null")
|
||||
@Argument(value = "output", description = "Output file path")
|
||||
@ValueDescription("<path>")
|
||||
public String outputFile;
|
||||
|
||||
@GradleOption(defaultValue = "true")
|
||||
@Argument(value = "no-stdlib", description = "Don't use bundled Kotlin stdlib")
|
||||
public boolean noStdlib;
|
||||
|
||||
@@ -35,25 +37,31 @@ public class K2JSCompilerArguments extends CommonCompilerArguments {
|
||||
@ValueDescription("<path[,]>")
|
||||
public String[] libraryFiles;
|
||||
|
||||
@GradleOption(defaultValue = "false")
|
||||
@Argument(value = "source-map", description = "Generate source map")
|
||||
public boolean sourceMap;
|
||||
|
||||
@GradleOption(defaultValue = "true")
|
||||
@Argument(value = "meta-info", description = "Generate metadata")
|
||||
public boolean metaInfo;
|
||||
|
||||
@GradleOption(defaultValue = "true")
|
||||
@Argument(value = "kjsm", description = "Generate kjsm-files (for creating libraries)")
|
||||
public boolean kjsm;
|
||||
|
||||
@Argument(value = "target", description = "Generate JS files for specific ECMA version (only ECMA 5 is supported)")
|
||||
@ValueDescription("<version>")
|
||||
@GradleOption(defaultValue = "\"v5\"", possibleValues = { "\"v5\"" })
|
||||
@Argument(value = "target", description = "Generate JS files for specific ECMA version)")
|
||||
@ValueDescription("{ v5 }")
|
||||
public String target;
|
||||
|
||||
@Argument(value = "module-kind", description = "Kind of a module generated by compiler. Supported values are: plain (by default), " +
|
||||
"amd, commonjs, umd.")
|
||||
@GradleOption(defaultValue = "\"plain\"", possibleValues = { "\"plain\"", "\"amd\"", "\"commonjs\"", "\"umd\"" })
|
||||
@Argument(value = "module-kind", description = "Kind of a module generated by compiler")
|
||||
@ValueDescription("{ plain, amd, commonjs, umd }")
|
||||
public String moduleKind;
|
||||
|
||||
@GradleOption(defaultValue = "\"" + NO_CALL + "\"", possibleValues = { "\"" + CALL + "\"", "\"" + NO_CALL + "\"" })
|
||||
@Nullable
|
||||
@Argument(value = "main", description = "Whether a main function should be called; default '" + CALL + "' (main function will be auto detected)")
|
||||
@Argument(value = "main", description = "Whether a main function should be called")
|
||||
@ValueDescription("{" + CALL + "," + NO_CALL + "}")
|
||||
public String main;
|
||||
|
||||
|
||||
+6
@@ -28,19 +28,24 @@ public class K2JVMCompilerArguments extends CommonCompilerArguments {
|
||||
@ValueDescription("<path>")
|
||||
public String classpath;
|
||||
|
||||
@GradleOption(defaultValue = "false")
|
||||
@Argument(value = "include-runtime", description = "Include Kotlin runtime in to resulting .jar")
|
||||
public boolean includeRuntime;
|
||||
|
||||
@GradleOption(defaultValue = "null")
|
||||
@Argument(value = "jdk-home", description = "Path to JDK home directory to include into classpath, if differs from default JAVA_HOME")
|
||||
@ValueDescription("<path>")
|
||||
public String jdkHome;
|
||||
|
||||
@GradleOption(defaultValue = "false")
|
||||
@Argument(value = "no-jdk", description = "Don't include Java runtime into classpath")
|
||||
public boolean noJdk;
|
||||
|
||||
@GradleOption(defaultValue = "true")
|
||||
@Argument(value = "no-stdlib", description = "Don't include Kotlin runtime into classpath")
|
||||
public boolean noStdlib;
|
||||
|
||||
@GradleOption(defaultValue = "true")
|
||||
@Argument(value = "no-reflect", description = "Don't include Kotlin reflection implementation into classpath")
|
||||
public boolean noReflect;
|
||||
|
||||
@@ -62,6 +67,7 @@ public class K2JVMCompilerArguments extends CommonCompilerArguments {
|
||||
@Argument(value = "module-name", description = "Module name")
|
||||
public String moduleName;
|
||||
|
||||
@GradleOption(defaultValue = "\"1.6\"", possibleValues = { "\"1.6\"", "\"1.8\"" })
|
||||
@Argument(value = "jvm-target", description = "Target version of the generated JVM bytecode (1.6 or 1.8), default is 1.6")
|
||||
@ValueDescription("<version>")
|
||||
public String jvmTarget;
|
||||
|
||||
Reference in New Issue
Block a user