Skip to content

Commit

Permalink
Refactor the dev setup scripts to avoid duplication
Browse files Browse the repository at this point in the history
Summary:
I recently added a third script (setup_lfs_server.sh) on top of the existing two, and that introduced even more copy and pasta; reviewers flagged that.
Duplication also makes it hard to add new common functionality (e.g. using configerator vs local files).

This diff introduces two more functions that let us cut down individual scripts by ~60%. The price for that is some complexity in the functions: consuming and filtering command-line flags pretty much requires arrays; reading and saving configuration requires references.
I tried to make future maintenance easier by adding good comments and unit tests.

Differential Revision: D54945927

fbshipit-source-id: c58a5b7b6110bc7f789d331d609fb802f08be6f0
  • Loading branch information
andreacampi authored and facebook-github-bot committed Mar 15, 2024
1 parent 6040e9e commit b2822df
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions eden/mononoke/facebook/scripts/TARGETS
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@fbcode_macros//build_defs:custom_unittest.bzl", "custom_unittest")
load("@fbcode_macros//build_defs:native_rules.bzl", "buck_filegroup")
load("@fbsource//tools/build_defs:glob_defs.bzl", "glob")
load("//antlir/fbpkg:fbpkg.bzl", "fbpkg")
Expand Down Expand Up @@ -28,3 +29,11 @@ fbpkg.builder(
"scripts": ":scripts",
},
)

custom_unittest(
name = "setup_common_test",
command = [
"eden/mononoke/facebook/scripts/setup_common_test.sh",
],
type = "simple",
)

0 comments on commit b2822df

Please sign in to comment.