001 /*
002 * Copyright 2010-2015 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 import org.jetbrains.annotations.Nullable;
022
023 import static org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.CALL;
024 import static org.jetbrains.kotlin.cli.common.arguments.K2JsArgumentConstants.NO_CALL;
025
026 public class K2JSCompilerArguments extends CommonCompilerArguments {
027 public static final long serialVersionUID = 0L;
028
029 @GradleOption(DefaultValues.StringNullDefault.class)
030 @Argument(value = "output", description = "Output file path")
031 @ValueDescription("<path>")
032 public String outputFile;
033
034 @GradleOption(DefaultValues.BooleanTrueDefault.class)
035 @Argument(value = "no-stdlib", description = "Don't use bundled Kotlin stdlib")
036 public boolean noStdlib;
037
038 @Argument(value = "library-files", description = "Path to zipped library sources or kotlin files separated by commas")
039 @ValueDescription("<path[,]>")
040 public String[] libraryFiles;
041
042 @GradleOption(DefaultValues.BooleanFalseDefault.class)
043 @Argument(value = "source-map", description = "Generate source map")
044 public boolean sourceMap;
045
046 @GradleOption(DefaultValues.BooleanTrueDefault.class)
047 @Argument(value = "meta-info", description = "Generate metadata")
048 public boolean metaInfo;
049
050 @GradleOption(DefaultValues.BooleanTrueDefault.class)
051 @Argument(value = "kjsm", description = "Generate kjsm-files (for creating libraries)")
052 public boolean kjsm;
053
054 @GradleOption(DefaultValues.JsEcmaVersions.class)
055 @Argument(value = "target", description = "Generate JS files for specific ECMA version")
056 @ValueDescription("{ v5 }")
057 public String target;
058
059 @GradleOption(DefaultValues.JsModuleKinds.class)
060 @Argument(value = "module-kind", description = "Kind of a module generated by compiler")
061 @ValueDescription("{ plain, amd, commonjs, umd }")
062 public String moduleKind;
063
064 @GradleOption(DefaultValues.JsMain.class)
065 @Nullable
066 @Argument(value = "main", description = "Whether a main function should be called")
067 @ValueDescription("{" + CALL + "," + NO_CALL + "}")
068 public String main;
069
070 @Argument(value = "output-prefix", description = "Path to file which will be added to the beginning of output file")
071 @ValueDescription("<path>")
072 public String outputPrefix;
073
074 @Argument(value = "output-postfix", description = "Path to file which will be added to the end of output file")
075 @ValueDescription("<path>")
076 public String outputPostfix;
077
078 @Override
079 @NotNull
080 public String executableScriptFileName() {
081 return "kotlinc-js";
082 }
083 }