pw_presubmit: Use --full argument
Use the --full argument when not using --base.
Bug: 588
Change-Id: I0a359ac55b37959692a945765f10ed6ed015de05
Reviewed-on: https://pigweed-review.googlesource.com/c/infra/recipes/+/76103
Reviewed-by: Marc-Antoine Ruel <maruel@google.com>
Commit-Queue: Rob Mohr <mohrr@google.com>
diff --git a/recipe_modules/pw_presubmit/api.py b/recipe_modules/pw_presubmit/api.py
index 6069427..efc8323 100644
--- a/recipe_modules/pw_presubmit/api.py
+++ b/recipe_modules/pw_presubmit/api.py
@@ -43,6 +43,7 @@
self._input_steps = list(props.step)
self._input_programs = list(props.program)
self._only_on_changed_files = props.only_on_changed_files
+ self._use_full_argument = not props.do_not_use_full_argument
self._export_dir_name = props.export_dir_name
self._root = None
self._checkout_root = None
@@ -167,6 +168,8 @@
if self._only_on_changed_files:
args.extend(('--base', 'HEAD~1'))
+ elif self._use_full_argument:
+ args.append('--full')
args.extend(('--step', step.name))
diff --git a/recipe_modules/pw_presubmit/properties.proto b/recipe_modules/pw_presubmit/properties.proto
index 6b5a526..8cc856b 100644
--- a/recipe_modules/pw_presubmit/properties.proto
+++ b/recipe_modules/pw_presubmit/properties.proto
@@ -37,4 +37,8 @@
// Subdirectory of the build directory to upload to GCS. Required to upload
// build artifacts.
string export_dir_name = 5;
+
+ // Do not use the --full argument when only_on_changed_files is False. This is
+ // only here for backwards compatibility.
+ bool do_not_use_full_argument = 6;
}
diff --git a/recipe_modules/pw_presubmit/tests/full.expected/step.json b/recipe_modules/pw_presubmit/tests/full.expected/step.json
index 651bd89..a19e6fc 100644
--- a/recipe_modules/pw_presubmit/tests/full.expected/step.json
+++ b/recipe_modules/pw_presubmit/tests/full.expected/step.json
@@ -17,6 +17,7 @@
"[CACHE]",
"--output-directory",
"[START_DIR]/presubmit",
+ "--full",
"--step",
"step1"
],
@@ -188,6 +189,7 @@
"[CACHE]",
"--output-directory",
"[START_DIR]/presubmit",
+ "--full",
"--step",
"step2"
],
diff --git a/recipes/pw_presubmit.expected/sign-nobuildid.json b/recipes/pw_presubmit.expected/sign-nobuildid.json
index 9554c65..b085e7e 100644
--- a/recipes/pw_presubmit.expected/sign-nobuildid.json
+++ b/recipes/pw_presubmit.expected/sign-nobuildid.json
@@ -1140,6 +1140,7 @@
"[CACHE]",
"--output-directory",
"[START_DIR]/presubmit",
+ "--full",
"--step",
"release"
],
diff --git a/recipes/pw_presubmit.expected/sign.json b/recipes/pw_presubmit.expected/sign.json
index fd7ec23..2d51a54 100644
--- a/recipes/pw_presubmit.expected/sign.json
+++ b/recipes/pw_presubmit.expected/sign.json
@@ -1140,6 +1140,7 @@
"[CACHE]",
"--output-directory",
"[START_DIR]/presubmit",
+ "--full",
"--step",
"release"
],
diff --git a/recipes/pw_presubmit.expected/step.json b/recipes/pw_presubmit.expected/step.json
index 8ec72c4..4cc6535 100644
--- a/recipes/pw_presubmit.expected/step.json
+++ b/recipes/pw_presubmit.expected/step.json
@@ -1464,6 +1464,7 @@
"[CACHE]",
"--output-directory",
"[START_DIR]/presubmit",
+ "--full",
"--step",
"step1"
],
@@ -1687,6 +1688,7 @@
"[CACHE]",
"--output-directory",
"[START_DIR]/presubmit",
+ "--full",
"--step",
"step2"
],
diff --git a/recipes/target_to_cipd.expected/pw-presubmit.json b/recipes/target_to_cipd.expected/pw-presubmit.json
index 505da5e..9b867e0 100644
--- a/recipes/target_to_cipd.expected/pw-presubmit.json
+++ b/recipes/target_to_cipd.expected/pw-presubmit.json
@@ -714,6 +714,7 @@
"[CACHE]",
"--output-directory",
"[START_DIR]/presubmit",
+ "--full",
"--step",
"step"
],