dev.gradleplugins.runnerkit.providers.WorkingDirectoryProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-runner-kit-impl Show documentation
Show all versions of gradle-runner-kit-impl Show documentation
Gradle runner kit implementation.
package dev.gradleplugins.runnerkit.providers;
import dev.gradleplugins.fixtures.file.FileSystemUtils;
import dev.gradleplugins.runnerkit.GradleExecutionContext;
import java.io.File;
import java.util.function.Function;
import java.util.function.Supplier;
public final class WorkingDirectoryProvider extends AbstractGradleExecutionProvider {
public static WorkingDirectoryProvider unset() {
return noValue(WorkingDirectoryProvider.class);
}
public static WorkingDirectoryProvider of(File workingDirectory) {
return fixed(WorkingDirectoryProvider.class, workingDirectory);
}
public static WorkingDirectoryProvider of(Supplier workingDirectorySupplier) {
return supplied(WorkingDirectoryProvider.class, workingDirectorySupplier);
}
public static Function relativeToWorkingDirectory(String path) {
return context -> {
((GradleExecutionProviderInternal) context.getWorkingDirectory()).calculateValue(context);
return FileSystemUtils.file(context.getWorkingDirectory().get(), path);
};
}
}