001    /*
002     * Copyright 2010-2013 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.jet.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.jet.cli.common.arguments.K2JsArgumentConstants.CALL;
024    import static org.jetbrains.jet.cli.common.arguments.K2JsArgumentConstants.NO_CALL;
025    
026    /**
027     * NOTE: for now K2JSCompiler supports only minimal amount of parameters required to launch it from the plugin.
028     */
029    public class K2JSCompilerArguments extends CommonCompilerArguments {
030        @Argument(value = "output", description = "Output file path")
031        @ValueDescription("<path>")
032        public String outputFile;
033    
034        @Argument(value = "libraryFiles", description = "Path to zipped library sources or kotlin files separated by commas")
035        @ValueDescription("<path[,]>")
036        public String[] libraryFiles;
037    
038        @Argument(value = "sourceFiles", description = "Source files or directories separated by commas")
039        @ValueDescription("<path[,]>")
040        public String[] sourceFiles;
041    
042        @Argument(value = "sourcemap", description = "Generate SourceMap")
043        public boolean sourcemap;
044    
045        @Argument(value = "target", description = "Generate JS files for specific ECMA version (only ECMA 5 is supported)")
046        @ValueDescription("<version>")
047        public String target;
048    
049        @Nullable
050        @Argument(value = "main", description = "Whether a main function should be called; default '" + CALL + "' (main function will be auto detected)")
051        @ValueDescription("{" + CALL + "," + NO_CALL + "}")
052        public String main;
053    
054        @Argument(value = "outputPrefix", description = "Path to file which will be added to the beginning of output file")
055        @ValueDescription("<path>")
056        public String outputPrefix;
057    
058        @Argument(value = "outputPostfix", description = "Path to file which will be added to the end of output file")
059        @ValueDescription("<path>")
060        public String outputPostfix;
061    
062        @Override
063        @NotNull
064        public String executableScriptFileName() {
065            return "kotlinc-js";
066        }
067    }