Skip to content

Commit

Permalink
Gradle Configuration Cache fails to caches run task (#1064)
Browse files Browse the repository at this point in the history
* refactor: replace usage of Project and SourceSet in tasks to allow configuration cache to be used

* Fix incorrect version in test

---------

Co-authored-by: Cedric Champeau <[email protected]>
  • Loading branch information
Argannor and melix authored Jan 6, 2025
1 parent b9874a5 commit 61f0604
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class RuntimeDependenciesSpec extends AbstractEagerConfiguringFunctionalTest {
}
micronaut {
version "$shadowVersion"
version "$micronautVersion"
runtime "$runtime"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ private void configureJavaExecTasks(Project project, Configuration developmentOn
Map<String, Object> sysProps = new LinkedHashMap<>();
sysProps.put("micronaut.io.watch.restart", true);
sysProps.put("micronaut.io.watch.enabled", true);
FileCollection sourceDirectories = sourceSet.getAllSource().getSourceDirectories();
//noinspection Convert2Lambda
javaExec.doFirst(new Action<>() {
@Override
public void execute(Task workaroundEagerSystemProps) {
String watchPaths = sourceSet
.getAllSource()
.getSrcDirs()
String watchPaths = sourceDirectories
.getFiles()
.stream()
.map(File::getPath)
.collect(Collectors.joining(","));
Expand Down Expand Up @@ -205,12 +205,12 @@ private void configureGoogleCloudFunctionRuntime(Project project, Project p, Dep
"--target", "io.micronaut.gcp.function.http.HttpFunction",
"--port", 8080
));
SourceSet sourceSet = PluginsHelper.findSourceSets(p).getByName("main");
SourceSetOutput output = sourceSet.getOutput();
String runtimeClasspath = project.files(project.getConfigurations().getByName("runtimeClasspath"),
output
).getAsPath();
run.doFirst(t -> {
SourceSet sourceSet = PluginsHelper.findSourceSets(p).getByName("main");
SourceSetOutput output = sourceSet.getOutput();
String runtimeClasspath = project.files(project.getConfigurations().getByName("runtimeClasspath"),
output
).getAsPath();
((JavaExec) t).args("--classpath",
runtimeClasspath
);
Expand Down

0 comments on commit 61f0604

Please sign in to comment.