Search in sources :

Example 6 with Options

use of com.sun.tools.javac.util.Options in project ceylon-compiler by ceylon.

the class T6838467 method createFileManager.

JavacFileManager createFileManager(boolean useOptimizedZip) {
    Context ctx = new Context();
    Options options = Options.instance(ctx);
    options.put("useOptimizedZip", Boolean.toString(useOptimizedZip));
    return new JavacFileManager(ctx, false, null);
}
Also used : Context(com.sun.tools.javac.util.Context) JavacFileManager(com.sun.tools.javac.file.JavacFileManager) Options(com.sun.tools.javac.util.Options)

Example 7 with Options

use of com.sun.tools.javac.util.Options in project ceylon-compiler by ceylon.

the class T6877206 method createFileManager.

JavacFileManager createFileManager(boolean useOptimizedZip, boolean useSymbolFile) {
    Context ctx = new Context();
    Options options = Options.instance(ctx);
    options.put("useOptimizedZip", Boolean.toString(useOptimizedZip));
    if (!useSymbolFile) {
        options.put("ignore.symbol.file", "true");
    }
    return new JavacFileManager(ctx, false, null);
}
Also used : Context(com.sun.tools.javac.util.Context) JavacFileManager(com.sun.tools.javac.file.JavacFileManager) Options(com.sun.tools.javac.util.Options)

Example 8 with Options

use of com.sun.tools.javac.util.Options in project ceylon-compiler by ceylon.

the class CeylonCompileTool method addJavacArguments.

private void addJavacArguments(List<String> arguments) {
    Options options = Options.instance(new Context());
    for (String argument : javac) {
        HELPER.lastError = null;
        String value = null;
        int index = argument.indexOf('=');
        if (index != -1) {
            value = index < argument.length() ? argument.substring(index + 1) : "";
            argument = argument.substring(0, index);
        }
        JavacOption javacOpt = getJavacOpt(argument.replaceAll(":.*", ":"));
        if (javacOpt == null) {
            throw new IllegalArgumentException(CeylonCompileMessages.msg("option.error.javac", argument));
        }
        if (value != null) {
            if (!javacOpt.hasArg()) {
                throw new IllegalArgumentException(CeylonCompileMessages.msg("option.error.syntax.javac", argument, "Unexpected argument given"));
            }
            if (!javacOpt.matches(argument)) {
                throw new IllegalArgumentException(CeylonCompileMessages.msg("option.error.javac", argument));
            }
            if (javacOpt.process(options, argument, value)) {
                throw new IllegalArgumentException(CeylonCompileMessages.msg("option.error.syntax.javac", argument, HELPER.lastError));
            }
        } else {
            if (javacOpt.hasArg()) {
                throw new IllegalArgumentException(CeylonCompileMessages.msg("option.error.syntax.javac", argument, "Missing expected argument"));
            }
            if (!javacOpt.matches(argument)) {
                throw new IllegalArgumentException(CeylonCompileMessages.msg("option.error.javac", argument));
            }
            if (javacOpt.process(options, argument)) {
                throw new IllegalArgumentException(CeylonCompileMessages.msg("option.error.syntax.javac", argument, HELPER.lastError));
            }
        }
        arguments.add(argument);
        if (value != null) {
            arguments.add(value);
        }
    }
}
Also used : Context(com.sun.tools.javac.util.Context) DefaultToolOptions(com.redhat.ceylon.common.config.DefaultToolOptions) RecognizedOptions(com.sun.tools.javac.main.RecognizedOptions) Options(com.sun.tools.javac.util.Options) JavacOption(com.sun.tools.javac.main.JavacOption)

Example 9 with Options

use of com.sun.tools.javac.util.Options in project ceylon-compiler by ceylon.

the class CeyloncCompilerDelegate method getStatusPrinter.

private StatusPrinter getStatusPrinter() {
    Options options = Options.instance(context);
    boolean isProgressPrinted = options.get(OptionName.CEYLONPROGRESS) != null && StatusPrinter.canPrint();
    if (isProgressPrinted) {
        return LanguageCompiler.getStatusPrinterInstance(context);
    } else {
        return null;
    }
}
Also used : Options(com.sun.tools.javac.util.Options)

Example 10 with Options

use of com.sun.tools.javac.util.Options in project ceylon-compiler by ceylon.

the class CompilerConfig method instance.

public static CeylonConfig instance(Context context) {
    CeylonConfig instance = context.get(CeylonConfig.class);
    if (instance == null) {
        Options options = Options.instance(context);
        String cwd = options.get(OptionName.CEYLONCWD);
        if (cwd == null) {
            cwd = ".";
        }
        instance = CeylonConfig.createFromLocalDir(new File(cwd));
        context.put(CeylonConfig.class, instance);
    }
    return instance;
}
Also used : Options(com.sun.tools.javac.util.Options) CeylonConfig(com.redhat.ceylon.common.config.CeylonConfig) File(java.io.File)

Aggregations

Options (com.sun.tools.javac.util.Options)19 Context (com.sun.tools.javac.util.Context)8 JavacFileManager (com.sun.tools.javac.file.JavacFileManager)4 DefaultToolOptions (com.redhat.ceylon.common.config.DefaultToolOptions)3 JavacOption (com.sun.tools.javac.main.JavacOption)3 RecognizedOptions (com.sun.tools.javac.main.RecognizedOptions)3 File (java.io.File)3 IOException (java.io.IOException)3 ListBuffer (com.sun.tools.javac.util.ListBuffer)2 FileNotFoundException (java.io.FileNotFoundException)2 CeylonConfig (com.redhat.ceylon.common.config.CeylonConfig)1 ToolUsageError (com.redhat.ceylon.common.tool.ToolUsageError)1 Main (com.redhat.ceylon.compiler.java.launcher.Main)1 Lint (com.sun.tools.javac.code.Lint)1 Source (com.sun.tools.javac.code.Source)1 Target (com.sun.tools.javac.jvm.Target)1 JavaCompiler (com.sun.tools.javac.main.JavaCompiler)1 COption (com.sun.tools.javac.main.JavacOption.COption)1 HiddenOption (com.sun.tools.javac.main.JavacOption.HiddenOption)1 Option (com.sun.tools.javac.main.JavacOption.Option)1