summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberto Sartori <alberto.sartori@huawei.com>2022-04-26 21:35:36 +0200
committerAlberto Sartori <alberto.sartori@huawei.com>2022-04-27 15:10:54 +0200
commit29eeaa489c5836fbbb37a83abe50f752c62b6b7c (patch)
tree549a5b872b0feb3b6ec446a4a5b6d9221b196844
parent216d5f27b08b7e8820f2b3caacbe732c188d54ac (diff)
downloadjustbuild-29eeaa489c5836fbbb37a83abe50f752c62b6b7c.tar.gz
use kebab-case for all cmd line args
-rwxr-xr-xbin/bootstrap-traverser.py4
-rwxr-xr-xbin/bootstrap.py10
-rwxr-xr-xbin/just-mr.py8
-rw-r--r--src/buildtool/common/cli.hpp68
-rw-r--r--src/buildtool/execution_api/local/config.hpp2
-rw-r--r--src/buildtool/main/main.cpp2
-rwxr-xr-xtest/end-to-end/actions/action-equality.sh4
-rwxr-xr-xtest/end-to-end/actions/nested-trees.sh4
-rwxr-xr-xtest/end-to-end/generated-binary/compiled.sh4
-rwxr-xr-xtest/end-to-end/generated-binary/shell-script.sh2
-rwxr-xr-xtest/end-to-end/targets/repo_names.sh4
-rwxr-xr-xtest/end-to-end/targets/upwards.sh10
-rwxr-xr-xtest/end-to-end/user-errors/flat-stage.sh4
13 files changed, 63 insertions, 63 deletions
diff --git a/bin/bootstrap-traverser.py b/bin/bootstrap-traverser.py
index 0d820f1c..1839eaa3 100755
--- a/bin/bootstrap-traverser.py
+++ b/bin/bootstrap-traverser.py
@@ -108,11 +108,11 @@ def main():
parser.add_argument("-o",
dest="output_directory",
help="Directory to place output to")
- parser.add_argument("--local_build_root",
+ parser.add_argument("--local-build-root",
dest="local_build_root",
help="Root for storing intermediate outputs",
metavar="PATH")
- parser.add_argument("--default_workspace",
+ parser.add_argument("--default-workspace",
dest="default_workspace",
help="Workspace root to use if none is specified",
metavar="PATH")
diff --git a/bin/bootstrap.py b/bin/bootstrap.py
index 13d8004e..b2c9547c 100755
--- a/bin/bootstrap.py
+++ b/bin/bootstrap.py
@@ -140,26 +140,26 @@ def bootstrap():
LOCAL_ROOT = os.path.join(WRKDIR, ".just")
os.makedirs(LOCAL_ROOT, exist_ok=True)
run(["sh", "-c",
- "cp `./bin/just-mr.py --always_file -C %s --local_build_root=%s setup just` %s"
+ "cp `./bin/just-mr.py --always-file -C %s --local-build-root=%s setup just` %s"
% (REPOS, LOCAL_ROOT, CONF_FILE)],
cwd=src_wrkdir)
GRAPH = os.path.join(WRKDIR, "graph.json")
TO_BUILD = os.path.join(WRKDIR, "to_build.json")
run([bootstrap_just, "analyse",
"-C", CONF_FILE,
- "--dump_graph", GRAPH,
- "--dump_artifacts_to_build", TO_BUILD,
+ "--dump-graph", GRAPH,
+ "--dump-artifacts-to-build", TO_BUILD,
MAIN_MODULE, MAIN_TARGET],
cwd=src_wrkdir)
run(["./bin/bootstrap-traverser.py",
"-C", CONF_FILE,
- "--default_workspace", src_wrkdir,
+ "--default-workspace", src_wrkdir,
GRAPH, TO_BUILD],
cwd=src_wrkdir)
OUT = os.path.join(WRKDIR, "out")
run(["./out-boot/%s" % (MAIN_STAGE,),
"install", "-C", CONF_FILE,
- "-o", OUT, "--local_build_root", LOCAL_ROOT,
+ "-o", OUT, "--local-build-root", LOCAL_ROOT,
MAIN_MODULE, MAIN_TARGET],
cwd=src_wrkdir)
diff --git a/bin/just-mr.py b/bin/just-mr.py
index d6859380..5c8109e3 100755
--- a/bin/just-mr.py
+++ b/bin/just-mr.py
@@ -421,7 +421,7 @@ def build(*, config, args):
if len(args) != 3:
fail("Usage: %s build <repo> <moudle> <target>" % (sys.argv[0],))
config = setup(config=config, args=[args[0]])
- cmd = [JUST, "build", "-C", config, "--local_build_root", ROOT,
+ cmd = [JUST, "build", "-C", config, "--local-build-root", ROOT,
args[1], args[2]]
log("Setup finished, exec %s" % (cmd,))
os.execvp(JUST, cmd)
@@ -430,7 +430,7 @@ def install(*, config, args):
if len(args) != 4:
fail("Usage: %s install <repo> <moudle> <target> <install-path>" % (sys.argv[0],))
config = setup(config=config, args=[args[0]])
- cmd = [JUST, "install", "-C", config, "--local_build_root", ROOT,
+ cmd = [JUST, "install", "-C", config, "--local-build-root", ROOT,
"-o", args[3], args[1], args[2]]
log("Setup finished, exec %s" % (cmd,))
os.execvp(JUST, cmd)
@@ -483,7 +483,7 @@ def main():
parser.add_argument("-L",
dest="checkout_location",
help="Specification file for checkout locations")
- parser.add_argument("--local_build_root",
+ parser.add_argument("--local-build-root",
dest="local_build_root",
help="Root for CAS, repository space, etc",
metavar="PATH")
@@ -496,7 +496,7 @@ def main():
dest="just",
help="Path to the just binary",
metavar="PATH")
- parser.add_argument("--always_file",
+ parser.add_argument("--always-file",
dest="always_file",
action="store_true",
default=False,
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp
index c00b7b1b..afa6cffd 100644
--- a/src/buildtool/common/cli.hpp
+++ b/src/buildtool/common/cli.hpp
@@ -97,7 +97,7 @@ struct GraphArguments {
static inline auto SetupCommonArguments(
gsl::not_null<CLI::App*> const& app,
gsl::not_null<CommonArguments*> const& clargs) {
- app->add_option("-C,--repository_config",
+ app->add_option("-C,--repository-config",
clargs->repository_config,
"Path to configuration file for multi-repository builds.")
->type_name("PATH");
@@ -105,7 +105,7 @@ static inline auto SetupCommonArguments(
"--main", clargs->main, "The repository to take the target from.")
->type_name("NAME");
app->add_option_function<std::string>(
- "-w,--workspace_root",
+ "-w,--workspace-root",
[clargs](auto const& workspace_root_raw) {
clargs->workspace_root = std::filesystem::canonical(
std::filesystem::absolute(workspace_root_raw));
@@ -153,36 +153,36 @@ static inline auto SetupAnalysisArguments(
"Module and target name to build.\n"
"Assumes current module if module name is omitted.")
->expected(2);
- app->add_option("--target_root",
+ app->add_option("--target-root",
clargs->target_root,
"Path of the target files' root directory.\n"
- "Default: Same as --workspace_root")
+ "Default: Same as --workspace-root")
->type_name("PATH");
- app->add_option("--rule_root",
+ app->add_option("--rule-root",
clargs->rule_root,
"Path of the rule files' root directory.\n"
- "Default: Same as --target_root")
+ "Default: Same as --target-root")
->type_name("PATH");
- app->add_option("--expression_root",
+ app->add_option("--expression-root",
clargs->expression_root,
"Path of the expression files' root directory.\n"
- "Default: Same as --rule_root")
+ "Default: Same as --rule-root")
->type_name("PATH");
- app->add_option("--target_file_name",
+ app->add_option("--target-file-name",
clargs->target_file_name,
"Name of the targets file.");
app->add_option(
- "--rule_file_name", clargs->rule_file_name, "Name of the rules file.");
- app->add_option("--expression_file_name",
+ "--rule-file-name", clargs->rule_file_name, "Name of the rules file.");
+ app->add_option("--expression-file-name",
clargs->expression_file_name,
"Name of the expressions file.");
if (with_graph) {
app->add_option(
- "--dump_graph",
+ "--dump-graph",
clargs->graph_file,
"File path for writing the action graph description to.")
->type_name("PATH");
- app->add_option("--dump_artifacts_to_build",
+ app->add_option("--dump-artifacts-to-build",
clargs->artifacts_to_build_file,
"File path for writing the artifacts to build to.")
->type_name("PATH");
@@ -192,27 +192,27 @@ static inline auto SetupAnalysisArguments(
static inline auto SetupDiagnosticArguments(
gsl::not_null<CLI::App*> const& app,
gsl::not_null<DiagnosticArguments*> const& clargs) {
- app->add_option("--dump_actions",
+ app->add_option("--dump-actions",
clargs->dump_actions,
"Dump actions to file (use - for stdout).")
->type_name("PATH");
- app->add_option("--dump_trees",
+ app->add_option("--dump-trees",
clargs->dump_trees,
"Dump trees to file (use - for stdout).")
->type_name("PATH");
- app->add_option("--dump_blobs",
+ app->add_option("--dump-blobs",
clargs->dump_blobs,
"Dump blobs to file (use - for stdout).")
->type_name("PATH");
- app->add_option("--dump_targets",
+ app->add_option("--dump-targets",
clargs->dump_targets,
"Dump targets to file (use - for stdout).")
->type_name("PATH");
- app->add_option("--dump_anonymous",
+ app->add_option("--dump-anonymous",
clargs->dump_anonymous,
"Dump anonymous targets to file (use - for stdout).")
->type_name("PATH");
- app->add_option("--dump_nodes",
+ app->add_option("--dump-nodes",
clargs->dump_nodes,
"Dump nodes of target to file (use - for stdout).")
->type_name("PATH");
@@ -222,7 +222,7 @@ static inline auto SetupEndpointArguments(
gsl::not_null<CLI::App*> const& app,
gsl::not_null<EndpointArguments*> const& clargs) {
app->add_option_function<std::string>(
- "--local_build_root",
+ "--local-build-root",
[clargs](auto const& build_root_raw) {
clargs->local_root = std::filesystem::weakly_canonical(
std::filesystem::absolute(build_root_raw));
@@ -230,7 +230,7 @@ static inline auto SetupEndpointArguments(
"Root for local CAS, cache, and build directories.")
->type_name("PATH");
- app->add_option("-r,--remote_execution_address",
+ app->add_option("-r,--remote-execution-address",
clargs->remote_execution_address,
"Address of the remote execution service.")
->type_name("NAME:PORT");
@@ -244,7 +244,7 @@ static inline auto SetupBuildArguments(
"Do not clean build directory after execution.");
app->add_option_function<std::string>(
- "-L,--local_launcher",
+ "-L,--local-launcher",
[clargs](auto const& launcher_raw) {
clargs->local_launcher =
nlohmann::json::parse(launcher_raw)
@@ -256,7 +256,7 @@ static inline auto SetupBuildArguments(
->default_val(nlohmann::json{"env", "--"}.dump());
app->add_option_function<std::string>(
- "--remote_execution_property",
+ "--remote-execution-property",
[clargs](auto const& property) {
std::istringstream pss(property);
std::string key;
@@ -264,7 +264,7 @@ static inline auto SetupBuildArguments(
if (not std::getline(pss, key, ':') or
not std::getline(pss, val, ':')) {
throw CLI::ConversionError{property,
- "--remote_execution_property"};
+ "--remote-execution-property"};
}
clargs->platform_properties.emplace(std::move(key),
std::move(val));
@@ -275,7 +275,7 @@ static inline auto SetupBuildArguments(
->expected(1, 1);
app->add_option_function<unsigned int>(
- "--action_timeout",
+ "--action-timeout",
[clargs](auto const& seconds) {
clargs->timeout = seconds * std::chrono::seconds{1};
},
@@ -283,20 +283,20 @@ static inline auto SetupBuildArguments(
->type_name("NUM");
app->add_option(
- "-J,--build_jobs",
+ "-J,--build-jobs",
clargs->build_jobs,
"Number of jobs to run during build phase (Default: same as jobs).")
->type_name("NUM");
- app->add_option("--dump_artifacts",
+ app->add_option("--dump-artifacts",
clargs->dump_artifacts,
"Dump artifacts to file (use - for stdout).")
->type_name("PATH");
- app->add_flag("-s,--show_runfiles",
+ app->add_flag("-s,--show-runfiles",
clargs->show_runfiles,
"Do not omit runfiles in build report.");
- app->add_option("-P,--print_to_stdout",
+ app->add_option("-P,--print-to-stdout",
clargs->print_to_stdout,
"After building, print the specified artifact to stdout.")
->type_name("LOGICAL_PATH");
@@ -306,7 +306,7 @@ static inline auto SetupStageArguments(
gsl::not_null<CLI::App*> const& app,
gsl::not_null<StageArguments*> const& clargs) {
app->add_option_function<std::string>(
- "-o,--output_dir",
+ "-o,--output-dir",
[clargs](auto const& output_dir_raw) {
clargs->output_dir = std::filesystem::weakly_canonical(
std::filesystem::absolute(output_dir_raw));
@@ -328,7 +328,7 @@ static inline auto SetupRebuildArguments(
->type_name("NAME:PORT|\"local\"");
app->add_option(
- "--dump_flaky", clargs->dump_flaky, "Dump flaky actions to file.")
+ "--dump-flaky", clargs->dump_flaky, "Dump flaky actions to file.")
->type_name("PATH");
}
@@ -342,7 +342,7 @@ static inline auto SetupFetchArguments(
->required();
app->add_option_function<std::string>(
- "-o,--output_path",
+ "-o,--output-path",
[clargs](auto const& output_path_raw) {
clargs->output_path = std::filesystem::weakly_canonical(
std::filesystem::absolute(output_path_raw));
@@ -363,13 +363,13 @@ static inline auto SetupGraphArguments(
"artifact is to be copied and the description of the artifact as json "
"object as well.");
- app->add_option("-g,--graph_file",
+ app->add_option("-g,--graph-file",
clargs->graph_file,
"Path of the file containing the description of the "
"actions.")
->required();
- app->add_option("--git_cas",
+ app->add_option("--git-cas",
clargs->git_cas,
"Path to a Git repository, containing blobs of potentially "
"missing KNOWN artifacts.");
diff --git a/src/buildtool/execution_api/local/config.hpp b/src/buildtool/execution_api/local/config.hpp
index c65f7d17..2dc4466b 100644
--- a/src/buildtool/execution_api/local/config.hpp
+++ b/src/buildtool/execution_api/local/config.hpp
@@ -24,7 +24,7 @@ class LocalExecutionConfig {
// Build root directory. All the cache dirs are subdirs of build_root.
// By default, build_root is set to $HOME/.cache/just.
- // If the user uses --local_build_root PATH,
+ // If the user uses --local-build-root PATH,
// then build_root will be set to PATH.
std::filesystem::path build_root{};
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index 687cc888..2e54b025 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -1255,7 +1255,7 @@ auto main(int argc, char* argv[]) -> int {
Logger::Log(LogLevel::Error,
"Command line options {} and {} cannot be used "
"together.",
- "--git_cas",
+ "--git-cas",
"--compatible");
std::exit(EXIT_FAILURE);
}
diff --git a/test/end-to-end/actions/action-equality.sh b/test/end-to-end/actions/action-equality.sh
index ffe841f4..083dbb6d 100755
--- a/test/end-to-end/actions/action-equality.sh
+++ b/test/end-to-end/actions/action-equality.sh
@@ -46,14 +46,14 @@ cat > TARGETS <<'EOI'
EOI
-bin/tool-under-test build -J 1 --local_build_root .tool-root -f build.log --log-limit 2 2>&1
+bin/tool-under-test build -J 1 --local-build-root .tool-root -f build.log --log-limit 2 2>&1
cat build.log
echo
grep 'Processed.* 4 actions' build.log
grep '1 cache hit' build.log
echo
-bin/tool-under-test analyse --dump_graph graph.json 2>&1
+bin/tool-under-test analyse --dump-graph graph.json 2>&1
echo
matching_targets=$(cat graph.json | jq -acM '.actions | [ .[] | .origins | [ .[] | .target]] | sort')
echo "${matching_targets}"
diff --git a/test/end-to-end/actions/nested-trees.sh b/test/end-to-end/actions/nested-trees.sh
index 70d69ee5..de5ce567 100755
--- a/test/end-to-end/actions/nested-trees.sh
+++ b/test/end-to-end/actions/nested-trees.sh
@@ -90,7 +90,7 @@ echo
echo Analysis
echo
../bin/tool-under-test analyse data \
- --dump_trees ../trees.json --dump_blobs ../blobs.json 2>&1
+ --dump-trees ../trees.json --dump-blobs ../blobs.json 2>&1
echo
echo Blobs
echo
@@ -104,7 +104,7 @@ cat ../trees.json
echo
echo Build
echo
-../bin/tool-under-test install -o ../out --local_build_root ../tool-root 2>&1
+../bin/tool-under-test install -o ../out --local-build-root ../tool-root 2>&1
echo
echo Index
echo
diff --git a/test/end-to-end/generated-binary/compiled.sh b/test/end-to-end/generated-binary/compiled.sh
index 572e8187..9372a54c 100755
--- a/test/end-to-end/generated-binary/compiled.sh
+++ b/test/end-to-end/generated-binary/compiled.sh
@@ -16,8 +16,8 @@ EOI
echo
echo "Analysing"
-bin/tool-under-test analyse --dump_graph graph.json 2>&1
+bin/tool-under-test analyse --dump-graph graph.json 2>&1
echo
echo "Building"
-bin/tool-under-test install -o out --local_build_root .tool-root -J 16 2>&1
+bin/tool-under-test install -o out --local-build-root .tool-root -J 16 2>&1
diff --git a/test/end-to-end/generated-binary/shell-script.sh b/test/end-to-end/generated-binary/shell-script.sh
index 62dd11fd..33545588 100755
--- a/test/end-to-end/generated-binary/shell-script.sh
+++ b/test/end-to-end/generated-binary/shell-script.sh
@@ -44,6 +44,6 @@ cat > TARGETS <<'EOI'
EOI
-bin/tool-under-test install -o out --local_build_root .tool-root 2>&1
+bin/tool-under-test install -o out --local-build-root .tool-root 2>&1
grep Hello out/out.txt
grep Good out/out.txt
diff --git a/test/end-to-end/targets/repo_names.sh b/test/end-to-end/targets/repo_names.sh
index 2e9ba579..adf03054 100755
--- a/test/end-to-end/targets/repo_names.sh
+++ b/test/end-to-end/targets/repo_names.sh
@@ -74,7 +74,7 @@ EOF
mkdir -p .root
echo == Building in A ==
-./bin/tool-under-test install -C bindings.json -o . --local_build_root .root --main A . back 2>&1
+./bin/tool-under-test install -C bindings.json -o . --local-build-root .root --main A . back 2>&1
cat back.txt
grep -q 'I am A' back.txt
grep -q 'This is B' back.txt
@@ -82,7 +82,7 @@ grep -q 'Hello A' back.txt
rm -f back.txt
echo == Building in B ==
-./bin/tool-under-test install -C bindings.json -o . --local_build_root .root --main B . back 2>&1
+./bin/tool-under-test install -C bindings.json -o . --local-build-root .root --main B . back 2>&1
cat back.txt
grep -q 'I am B' back.txt
grep -q 'This is A' back.txt
diff --git a/test/end-to-end/targets/upwards.sh b/test/end-to-end/targets/upwards.sh
index 5d6b7e39..0e281cfe 100755
--- a/test/end-to-end/targets/upwards.sh
+++ b/test/end-to-end/targets/upwards.sh
@@ -23,8 +23,8 @@ cat > src/TARGETS <<'EOF'
}
EOF
-./bin/tool-under-test install -o out --workspace_root src \
- --local_build_root .root . it 2>&1
+./bin/tool-under-test install -o out --workspace-root src \
+ --local-build-root .root . it 2>&1
grep OK out/out
grep BAD out/out && exit 1 || :
@@ -46,8 +46,8 @@ cat > src/deep/TARGETS <<'EOF'
EOF
-./bin/tool-under-test install -o out2 --workspace_root src \
- --local_build_root .root deep 'OK up' 2>&1
+./bin/tool-under-test install -o out2 --workspace-root src \
+ --local-build-root .root deep 'OK up' 2>&1
grep OK out2/out
# Upwards refernces and targets outside the repo are not OK
@@ -73,7 +73,7 @@ EOF
cat src/TARGETS
-./bin/tool-under-test analyse --workspace_root src . it 2>&1 && exit 1 || :
+./bin/tool-under-test analyse --workspace-root src . it 2>&1 && exit 1 || :
done
diff --git a/test/end-to-end/user-errors/flat-stage.sh b/test/end-to-end/user-errors/flat-stage.sh
index e0ee2780..8d29716a 100755
--- a/test/end-to-end/user-errors/flat-stage.sh
+++ b/test/end-to-end/user-errors/flat-stage.sh
@@ -51,12 +51,12 @@ cat > TARGETS <<'EOI'
EOI
-bin/tool-under-test build --local_build_root .tool-root -f build.log full 2>&1
+bin/tool-under-test build --local-build-root .tool-root -f build.log full 2>&1
echo
grep 'DataRuleSpecificErrorMessage' build.log && exit 1 || :
grep 'DeBuG-InFoRmAtIoN' build.log && exit 1 || :
-bin/tool-under-test build --local_build_root .tool-root -f build.log flat 2>&1 && exit 1 || :
+bin/tool-under-test build --local-build-root .tool-root -f build.log flat 2>&1 && exit 1 || :
echo
grep 'DataRuleSpecificErrorMessage' build.log
grep "DeBuG-InFoRmAtIoN" build.log