Skip to content

Commit

Permalink
LPS-0 Optional annotation (see gradle/gradle#2016)
Browse files Browse the repository at this point in the history
  • Loading branch information
petershin committed May 18, 2022
1 parent 9a18c29 commit 7ac7393
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.util.Map;

import org.gradle.api.DefaultTask;
import org.gradle.api.Project;
import org.gradle.api.logging.Logger;
import org.gradle.api.tasks.CacheableTask;
import org.gradle.api.tasks.Input;
Expand Down Expand Up @@ -133,7 +134,17 @@ public String getCommand() {
@Optional
@PathSensitive(PathSensitivity.RELATIVE)
public File getNodeDir() {
return _nodeExecutor.getNodeDir();
File dir = _nodeExecutor.getNodeDir();

if (dir == null) {
return null;
}

Project project = getProject();

project.mkdir(dir);

return dir;
}

@Input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,17 @@ public void executeNode() throws Exception {
@Optional
@PathSensitive(PathSensitivity.RELATIVE)
public File getCacheDir() {
return GradleUtil.toFile(getProject(), _cacheDir);
File dir = GradleUtil.toFile(getProject(), _cacheDir);

if (dir == null) {
return null;
}

Project project = getProject();

project.mkdir(dir);

return dir;
}

@Input
Expand Down

0 comments on commit 7ac7393

Please sign in to comment.