aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skylarkbuildapi
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2018-07-03 09:12:47 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-07-03 09:14:29 -0700
commitffc192f0bfb240711ceab874258810f6d3671a23 (patch)
treef79244702c75c0a3bc3794a7b351e8a96355694d /src/main/java/com/google/devtools/build/lib/skylarkbuildapi
parent1ee159adf2ef18590872f8c0478af441e24e8268 (diff)
First cl for verbose workspaces (ability to log certain potentially non-hermetic events that happen as part of repository rules).
In the interest of smaller cls, adding plumbing first with the rest to follow. Creates and posts a new EventBus message for workspace rule events (only execution for now); conditional on a flag, registers a listener to output those events. In the future: - Better structure for the events: will create a proto with appropriate messages and more information per event - Add more events - Allowing to specify log file rather than dumping to INFO - Log levels, full or alerts only RELNOTES: None PiperOrigin-RevId: 203132761
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skylarkbuildapi')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skylarkbuildapi/repository/BUILD1
-rw-r--r--src/main/java/com/google/devtools/build/lib/skylarkbuildapi/repository/SkylarkRepositoryContextApi.java64
2 files changed, 33 insertions, 32 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/repository/BUILD b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/repository/BUILD
index 52c66e945d..251d0c25bd 100644
--- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/repository/BUILD
+++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/repository/BUILD
@@ -19,6 +19,7 @@ java_library(
name = "repository",
srcs = glob(["*.java"]),
deps = [
+ "//src/main/java/com/google/devtools/build/lib:events",
"//src/main/java/com/google/devtools/build/lib:skylarkinterface",
"//src/main/java/com/google/devtools/build/lib:syntax",
"//src/main/java/com/google/devtools/build/lib/cmdline",
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/repository/SkylarkRepositoryContextApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/repository/SkylarkRepositoryContextApi.java
index 09bd1760f8..698f307ba0 100644
--- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/repository/SkylarkRepositoryContextApi.java
+++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/repository/SkylarkRepositoryContextApi.java
@@ -15,6 +15,7 @@
package com.google.devtools.build.lib.skylarkbuildapi.repository;
import com.google.devtools.build.lib.cmdline.Label;
+import com.google.devtools.build.lib.events.Location;
import com.google.devtools.build.lib.skylarkbuildapi.StructApi;
import com.google.devtools.build.lib.skylarkinterface.Param;
import com.google.devtools.build.lib.skylarkinterface.ParamType;
@@ -197,40 +198,39 @@ public interface SkylarkRepositoryContextApi<RepositoryFunctionExceptionT extend
+ " returns an <code>exec_result</code> structure containing the output of the"
+ " command. The <code>environment</code> map can be used to override some"
+ " environment variables to be passed to the process.",
+ useLocation = true,
parameters = {
- @Param(
- name = "arguments",
- type = SkylarkList.class,
- doc =
- "List of arguments, the first element should be the path to the program to "
- + "execute."
- ),
- @Param(
- name = "timeout",
- type = Integer.class,
- named = true,
- defaultValue = "600",
- doc = "maximum duration of the command in seconds (default is 600 seconds)."
- ),
- @Param(
- name = "environment",
- type = SkylarkDict.class,
- defaultValue = "{}",
- named = true,
- doc = "force some environment variables to be set to be passed to the process."
- ),
- @Param(
- name = "quiet",
- type = Boolean.class,
- defaultValue = "True",
- named = true,
- doc = "If stdout and stderr should be printed to the terminal."
- ),
- }
- )
+ @Param(
+ name = "arguments",
+ type = SkylarkList.class,
+ doc =
+ "List of arguments, the first element should be the path to the program to "
+ + "execute."),
+ @Param(
+ name = "timeout",
+ type = Integer.class,
+ named = true,
+ defaultValue = "600",
+ doc = "maximum duration of the command in seconds (default is 600 seconds)."),
+ @Param(
+ name = "environment",
+ type = SkylarkDict.class,
+ defaultValue = "{}",
+ named = true,
+ doc = "force some environment variables to be set to be passed to the process."),
+ @Param(
+ name = "quiet",
+ type = Boolean.class,
+ defaultValue = "True",
+ named = true,
+ doc = "If stdout and stderr should be printed to the terminal."),
+ })
public SkylarkExecutionResultApi execute(
- SkylarkList<Object> arguments, Integer timeout, SkylarkDict<String, String> environment,
- boolean quiet)
+ SkylarkList<Object> arguments,
+ Integer timeout,
+ SkylarkDict<String, String> environment,
+ boolean quiet,
+ Location location)
throws EvalException, RepositoryFunctionExceptionT;
@SkylarkCallable(