From a0d2f2d58676a0511d813af771a6bac3f7294f09 Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Fri, 6 Sep 2024 16:59:05 +0200 Subject: [PATCH] FIx build --- .../build/lib/bazel/repository/PatchUtil.java | 12 ++++++++++++ .../starlark/StarlarkRepositoryContext.java | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/PatchUtil.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/PatchUtil.java index d45bd0855cd138..7f75c40a3ed4b7 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/repository/PatchUtil.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/PatchUtil.java @@ -412,6 +412,18 @@ private static void checkFilesStatusForPatching( } } + /** + * Apply a patch file under a directory + * + * @param patchFile the patch file to apply + * @param strip the number of leading components to strip from file path in the patch file + * @param outputDirectory the directory to apply the patch file to + */ + public static void apply(Path patchFile, int strip, Path outputDirectory) + throws IOException, PatchFailedException { + apply(patchFile, strip, outputDirectory, /* singleFile= */ null); + } + /** * Apply a patch file under a directory * diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkRepositoryContext.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkRepositoryContext.java index 24bc327a72c576..4c5ed3d3a6f040 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkRepositoryContext.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/starlark/StarlarkRepositoryContext.java @@ -455,7 +455,7 @@ public void patch(Object patchFile, StarlarkInt stripI, String watchPatch, Starl } maybeWatch(starlarkPath, ShouldWatch.fromString(watchPatch)); try { - PatchUtil.apply(starlarkPath.getPath(), strip, workingDirectory, /* singleFile= */ null); + PatchUtil.apply(starlarkPath.getPath(), strip, workingDirectory); } catch (PatchFailedException e) { throw new RepositoryFunctionException( Starlark.errorf("Error applying patch %s: %s", starlarkPath, e.getMessage()),