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