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 = "libraries", description = "Paths to Kotlin libraries with .meta.js and .kjsm files, separated by system file separator")
039 @ValueDescription("<path>")
040 public String libraries;
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 .meta.js and .kjsm files with metadata. Use to create a library")
048 public boolean metaInfo;
049
050 @GradleOption(DefaultValues.JsEcmaVersions.class)
051 @Argument(value = "target", description = "Generate JS files for specific ECMA version")
052 @ValueDescription("{ v5 }")
053 public String target;
054
055 @GradleOption(DefaultValues.JsModuleKinds.class)
056 @Argument(value = "module-kind", description = "Kind of a module generated by compiler")
057 @ValueDescription("{ plain, amd, commonjs, umd }")
058 public String moduleKind;
059
060 @GradleOption(DefaultValues.JsMain.class)
061 @Nullable
062 @Argument(value = "main", description = "Whether a main function should be called")
063 @ValueDescription("{" + CALL + "," + NO_CALL + "}")
064 public String main;
065
066 @Argument(value = "output-prefix", description = "Path to file which will be added to the beginning of output file")
067 @ValueDescription("<path>")
068 public String outputPrefix;
069
070 @Argument(value = "output-postfix", description = "Path to file which will be added to the end of output file")
071 @ValueDescription("<path>")
072 public String outputPostfix;
073
074 @Override
075 @NotNull
076 public String executableScriptFileName() {
077 return "kotlinc-js";
078 }
079 }