Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public Class<? extends Plugin<? extends Project>> getPluginClass() {
@Override
public void execute(Project project) {
ProtobufExtension protobuf = project.getExtensions().getByType(ProtobufExtension.class);
configureProtobuf(protobuf);
protobuf.protoc(this::configureProtoc);
protobuf.plugins(this::configurePlugins);
protobuf.generateProtoTasks(this::configureGenerateProtoTasks);
Expand All @@ -69,6 +70,13 @@ public void execute(Project project) {
.configureEach((configuration) -> configureProtobufToolsLocator(project, configuration));
}

private void configureProtobuf(ProtobufExtension protobuf) {
// Clears javaExecutablePath to prevent build cache misses across machines.
// This is safe as long as the Protobuf tool is NOT configured as a JAR.
// See: https://github.com/google/protobuf-gradle-plugin/issues/785
protobuf.getJavaExecutablePath().set("");
}

private void configureProtoc(ExecutableLocator protoc) {
protoc.setArtifact(protocDependency.asDependencySpec());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.springframework.boot.build;

import java.net.URI;
import java.nio.file.Path;

import dev.detekt.gradle.Detekt;
import dev.detekt.gradle.extensions.DetektExtension;
Expand Down Expand Up @@ -106,9 +107,19 @@ private void configureDetekt(Project project) {
project.getPlugins().apply(DetektPlugin.class);
DetektExtension detekt = project.getExtensions().getByType(DetektExtension.class);
detekt.getConfig().setFrom(project.getRootProject().file("config/detekt/config.yml"));
project.getTasks()
.withType(Detekt.class)
.configureEach((task) -> task.getJvmTarget().set(JVM_TARGET.getTarget()));
project.getTasks().withType(Detekt.class).configureEach((task) -> {
task.getJvmTarget().set(JVM_TARGET.getTarget());

// Relativize basePath to prevent build cache misses across different machines
// See: https://github.com/detekt/detekt/issues/7170
task.getBasePath().set(getProjectPathRelativeToRootProject(task.getProject()).toString());
});
}

private static Path getProjectPathRelativeToRootProject(Project project) {
Path rootProjectDirectory = project.getIsolated().getRootProject().getProjectDirectory().getAsFile().toPath();
Path projectDirectory = project.getLayout().getProjectDirectory().getAsFile().toPath();
return projectDirectory.relativize(rootProjectDirectory);
}

}
Loading