001 /*
002 * Copyright 2010-2016 JetBrains s.r.o.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 package org.jetbrains.kotlin.cli.common.arguments;
018
019 import com.sampullara.cli.Argument;
020 import org.jetbrains.annotations.NotNull;
021
022 public class K2JVMCompilerArguments extends CommonCompilerArguments {
023 @Argument(value = "d", description = "Destination for generated class files")
024 @ValueDescription("<directory|jar>")
025 public String destination;
026
027 @Argument(value = "classpath", alias = "cp", description = "Paths where to find user class files")
028 @ValueDescription("<path>")
029 public String classpath;
030
031 @GradleOption(DefaultValues.BooleanFalseDefault.class)
032 @Argument(value = "include-runtime", description = "Include Kotlin runtime in to resulting .jar")
033 public boolean includeRuntime;
034
035 @GradleOption(DefaultValues.StringNullDefault.class)
036 @Argument(value = "jdk-home", description = "Path to JDK home directory to include into classpath, if differs from default JAVA_HOME")
037 @ValueDescription("<path>")
038 public String jdkHome;
039
040 @GradleOption(DefaultValues.BooleanFalseDefault.class)
041 @Argument(value = "no-jdk", description = "Don't include Java runtime into classpath")
042 public boolean noJdk;
043
044 @GradleOption(DefaultValues.BooleanTrueDefault.class)
045 @Argument(value = "no-stdlib", description = "Don't include Kotlin runtime into classpath")
046 public boolean noStdlib;
047
048 @GradleOption(DefaultValues.BooleanTrueDefault.class)
049 @Argument(value = "no-reflect", description = "Don't include Kotlin reflection implementation into classpath")
050 public boolean noReflect;
051
052 @Argument(value = "module", description = "Path to the module file to compile")
053 @ValueDescription("<path>")
054 public String module;
055
056 @Argument(value = "script", description = "Evaluate the script file")
057 public boolean script;
058
059 @Argument(value = "kotlin-home", description = "Path to Kotlin compiler home directory, used for runtime libraries discovery")
060 @ValueDescription("<path>")
061 public String kotlinHome;
062
063 @Argument(value = "module-name", description = "Module name")
064 public String moduleName;
065
066 @GradleOption(DefaultValues.JvmTargetVersions.class)
067 @Argument(value = "jvm-target", description = "Target version of the generated JVM bytecode, only 1.6 is supported")
068 @ValueDescription("<version>")
069 public String jvmTarget;
070
071 // Advanced options
072 @Argument(value = "Xno-call-assertions", description = "Don't generate not-null assertion after each invocation of method returning not-null")
073 public boolean noCallAssertions;
074
075 @Argument(value = "Xno-param-assertions", description = "Don't generate not-null assertions on parameters of methods accessible from Java")
076 public boolean noParamAssertions;
077
078 @Argument(value = "Xno-optimize", description = "Disable optimizations")
079 public boolean noOptimize;
080
081 @Argument(value = "Xreport-perf", description = "Report detailed performance statistics")
082 public boolean reportPerf;
083
084 @Argument(value = "Xmultifile-parts-inherit", description = "Compile multifile classes as a hierarchy of parts and facade")
085 public boolean inheritMultifileParts;
086
087 @Argument(value = "Xallow-kotlin-package", description = "Allow compiling code in package 'kotlin'")
088 public boolean allowKotlinPackage;
089
090 @Argument(value = "Xskip-metadata-version-check", description = "Try loading binary incompatible classes, may cause crashes")
091 public boolean skipMetadataVersionCheck;
092
093 @Argument(value = "Xdump-declarations-to", description = "Path to JSON file to dump Java to Kotlin declaration mappings")
094 @ValueDescription("<path>")
095 public String declarationsOutputPath;
096
097 // Paths to output directories for friend modules.
098 public String[] friendPaths;
099
100 @Override
101 @NotNull
102 public String executableScriptFileName() {
103 return "kotlinc-jvm";
104 }
105
106 }