All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.gradle.nativeplatform.toolchain.internal.DefaultMutableCommandLineToolContext Maven / Gradle / Ivy

There is a newer version: 8.11.1
Show newest version
/*
 * Copyright 2015 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.nativeplatform.toolchain.internal;

import org.gradle.api.Action;
import org.gradle.internal.Actions;
import org.gradle.internal.operations.logging.BuildOperationLogger;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class DefaultMutableCommandLineToolContext implements MutableCommandLineToolContext {
    private Action> postArgsAction = Actions.doNothing();
    private final Map environment = new HashMap();
    private final List path = new ArrayList();

    @Override
    public void setArgAction(Action> argAction) {
        postArgsAction = argAction;
    }

    @Override
    public void addPath(File pathEntry) {
        this.path.add(pathEntry);
    }

    @Override
    public void addPath(List path) {
        this.path.addAll(path);
    }

    @Override
    public List getPath() {
        return path;
    }

    @Override
    public Map getEnvironment() {
        return environment;
    }

    @Override
    public Action> getArgAction() {
        return postArgsAction;
    }

    @Override
    public void addEnvironmentVar(String key, String value) {
        this.environment.put(key, value);
    }

    @Override
    public CommandLineToolInvocation createInvocation(String description, File workDirectory, Iterable args, BuildOperationLogger oplogger) {
        return new DefaultCommandLineToolInvocation(description, workDirectory, args, this, oplogger);
    }

    @Override
    public CommandLineToolInvocation createInvocation(String description, Iterable args, BuildOperationLogger oplogger) {
        File currentWorkingDirectory = null;
        return createInvocation(description, currentWorkingDirectory, args, oplogger);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy