<commit_before>/*
 * Copyright 2009 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.gradle.api.tasks.scala;

import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableMap;
import org.gradle.language.scala.tasks.BaseScalaCompileOptions;
import org.gradle.util.CollectionUtils;
import org.gradle.util.SingleMessageLogger;

/**
 * Options for Scala compilation, including the use of the Ant-backed compiler.
 */
public class ScalaCompileOptions extends BaseScalaCompileOptions {
    private static final ImmutableMap<String, String> FIELD_NAMES_TO_ANT_PROPERTIES = new ImmutableMap.Builder<String, String>()
            .put("loggingLevel", "logging")
            .put("loggingPhases", "logphase")
            .put("targetCompatibility", "target")
            .put("optimize", "optimise")
            .put("daemonServer", "server")
            .put("listFiles", "scalacdebugging")
            .put("debugLevel", "debuginfo")
            .put("additionalParameters", "addparams")
            .build();

    private boolean fork = true;

    private boolean useAnt;

    private boolean useCompileDaemon;

    private String daemonServer;

    /**
     * Tells whether to use Ant for compilation. If {@code true}, the standard Ant scalac (or fsc) task will be used for
     * Scala and Java joint compilation. If {@code false}, the Zinc incremental compiler will be used
     * instead. The latter can be significantly faster, especially if there are few source code changes
     * between compiler runs. Defaults to {@code true}.
     */
    public boolean isUseAnt() {
        return useAnt;
    }


    @Deprecated
    @SuppressWarnings("deprecation")
    public void setUseAnt(boolean useAnt) {
        SingleMessageLogger.nagUserOfDeprecated("useAnt",
            "The Ant-Based Scala compiler is deprecated, please see "
            + "https://docs.gradle.org/current/userguide/scala_plugin.html");
        this.useAnt = useAnt;
        if (useAnt == fork) {
            setFork(!useAnt);
        }
    }

    /**
     * Whether to run the Scala compiler in a separate process. Defaults to {@code false}
     * for the Ant based compiler ({@code useAnt = true}), and to {@code true} for the Zinc
     * based compiler ({@code useAnt = false}).
     */
    public boolean isFork() {
        return fork;
    }

    @Deprecated
    @SuppressWarnings("deprecation")
    public void setFork(boolean fork) {
        SingleMessageLogger.nagUserOfDeprecated("fork",
            "The fork option for the scala compiler is deprecated, please see "
                + "https://docs.gradle.org/current/userguide/scala_plugin.html");
        this.fork = fork;
        if (fork == useAnt) {
            setUseAnt(!fork);
        }
    }

    /**
     * Whether to use the fsc compile daemon.
     */
    public boolean isUseCompileDaemon() {
        return useCompileDaemon;
    }

    public void setUseCompileDaemon(boolean useCompileDaemon) {
        this.useCompileDaemon = useCompileDaemon;
    }

    // NOTE: Does not work for scalac 2.7.1 due to a bug in the Ant task
    /**
     * Server (host:port) on which the compile daemon is running.
     * The host must share disk access with the client process.
     * If not specified, launches the daemon on the localhost.
     * This parameter can only be specified if useCompileDaemon is true.
     */
    public String getDaemonServer() {
        return daemonServer;
    }

    public void setDaemonServer(String daemonServer) {<commit_msg>Setting 'useAnt' should take precedence over 'fork'<commit_after>/*
 * Copyright 2009 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.gradle.api.tasks.scala;

import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableMap;
import org.gradle.language.scala.tasks.BaseScalaCompileOptions;
import org.gradle.util.CollectionUtils;
import org.gradle.util.SingleMessageLogger;

/**
 * Options for Scala compilation, including the use of the Ant-backed compiler.
 */
public class ScalaCompileOptions extends BaseScalaCompileOptions {
    private static final ImmutableMap<String, String> FIELD_NAMES_TO_ANT_PROPERTIES = new ImmutableMap.Builder<String, String>()
            .put("loggingLevel", "logging")
            .put("loggingPhases", "logphase")
            .put("targetCompatibility", "target")
            .put("optimize", "optimise")
            .put("daemonServer", "server")
            .put("listFiles", "scalacdebugging")
            .put("debugLevel", "debuginfo")
            .put("additionalParameters", "addparams")
            .build();

    private boolean fork = true;

    private boolean useAnt;

    private boolean useCompileDaemon;

    private String daemonServer;

    /**
     * Tells whether to use Ant for compilation. If {@code true}, the standard Ant scalac (or fsc) task will be used for
     * Scala and Java joint compilation. If {@code false}, the Zinc incremental compiler will be used
     * instead. The latter can be significantly faster, especially if there are few source code changes
     * between compiler runs. Defaults to {@code true}.
     */
    public boolean isUseAnt() {
        return useAnt;
    }


    @Deprecated
    @SuppressWarnings("deprecation")
    public void setUseAnt(boolean useAnt) {
        SingleMessageLogger.nagUserOfDeprecated("useAnt",
            "The Ant-Based Scala compiler is deprecated, please see "
            + "https://docs.gradle.org/current/userguide/scala_plugin.html");
        this.useAnt = useAnt;
        if (useAnt == fork) {
            setFork(!useAnt);
        }
    }

    /**
     * Whether to run the Scala compiler in a separate process. Defaults to {@code false}
     * for the Ant based compiler ({@code useAnt = true}), and to {@code true} for the Zinc
     * based compiler ({@code useAnt = false}).
     */
    public boolean isFork() {
        return fork;
    }

    @Deprecated
    @SuppressWarnings("deprecation")
    public void setFork(boolean fork) {
        SingleMessageLogger.nagUserOfDeprecated("fork",
            "The fork option for the scala compiler is deprecated, please see "
                + "https://docs.gradle.org/current/userguide/scala_plugin.html");
        this.fork = fork;
    }

    /**
     * Whether to use the fsc compile daemon.
     */
    public boolean isUseCompileDaemon() {
        return useCompileDaemon;
    }

    public void setUseCompileDaemon(boolean useCompileDaemon) {
        this.useCompileDaemon = useCompileDaemon;
    }

    // NOTE: Does not work for scalac 2.7.1 due to a bug in the Ant task
    /**
     * Server (host:port) on which the compile daemon is running.
     * The host must share disk access with the client process.
     * If not specified, launches the daemon on the localhost.
     * This parameter can only be specified if useCompileDaemon is true.
     */
    public String getDaemonServer() {
        return daemonServer;
    }

    public void setDaemonServer(String daemonServer) {
{'fraction_non_alphanumeric': 0.09160493827160494, 'fraction_numerical': 0.0027160493827160493, 'mean_word_length': 2.835700757575758, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4158110', 'n_tokens_mistral': 2251, 'n_tokens_neox': 2150, 'n_words': 766}