├── .circleci ├── config.yml ├── http_cache_test.sh ├── perf_test.sh ├── release.sh ├── rex_test.sh └── setup_osx.sh ├── .cirrus.yml ├── .gitattributes ├── .github ├── stale.yml └── workflows │ ├── codeql-analysis.yml │ ├── golangci-lint.yml │ └── plugindocs-update.yml ├── .gitignore ├── .golangci.yml ├── .plzconfig ├── .plzconfig.alpine ├── .plzconfig.ci ├── .plzconfig.ci-alt ├── .plzconfig.ci_remote ├── .plzconfig.localcache ├── .plzconfig.localremote ├── .plzconfig.sandbox ├── .plzconfig_freebsd_amd64 ├── ADOPTERS.md ├── BUILD ├── CONTRIBUTING.md ├── ChangeLog ├── LICENSE ├── README.md ├── VERSION ├── bootstrap.sh ├── build_defs ├── BUILD └── benchmark.build_defs ├── default.pgo ├── docs ├── BUILD ├── acknowledgements.html ├── action.js ├── basics.html ├── build_defs │ ├── BUILD │ ├── codelab_template.html │ └── docs.build_defs ├── build_rules.html ├── cache.html ├── codelabs │ ├── BUILD │ ├── codelab.js │ ├── codelab_template.go │ ├── genrule.md │ ├── github_actions.md │ ├── go_intro.md │ ├── go_module.md │ ├── k8s.md │ ├── plz_query.md │ ├── python_intro.md │ ├── style.css │ ├── template.html │ └── using_plugins.md ├── commands.html ├── config.html ├── cross_compiling.html ├── dependencies.html ├── error.html ├── faq.html ├── favicon │ ├── android-chrome-192x192.png │ ├── android-chrome-512x512.png │ ├── apple-touch-icon.png │ ├── browserconfig.xml │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── favicon.ico │ ├── mstile-150x150.png │ ├── safari-pinned-tab.svg │ └── site.webmanifest ├── fonts.css ├── grammar.txt ├── images │ ├── circle_b.png │ ├── circle_c.png │ ├── circle_g.png │ ├── circle_p.png │ ├── circle_r.png │ ├── circle_t.png │ ├── circle_v.png │ ├── circle_y.png │ ├── hexagon_b.png │ ├── hexagon_c.png │ ├── hexagon_g.png │ ├── hexagon_p.png │ ├── hexagon_r.png │ ├── hexagon_t.png │ ├── hexagon_v.png │ ├── hexagon_y.png │ ├── lockup2.png │ ├── pentagon_b.png │ ├── pentagon_c.png │ ├── pentagon_g.png │ ├── pentagon_p.png │ ├── pentagon_r.png │ ├── pentagon_t.png │ ├── pentagon_v.png │ ├── pentagon_y.png │ ├── please_build_p.png │ ├── please_build_t.png │ ├── please_og.png │ ├── square_b.png │ ├── square_c.png │ ├── square_g.png │ ├── square_p.png │ ├── square_r.png │ ├── square_t.png │ ├── square_v.png │ ├── square_y.png │ ├── thoughtmachine.png │ ├── triangle_b.png │ ├── triangle_c.png │ ├── triangle_g.png │ ├── triangle_p.png │ ├── triangle_r.png │ ├── triangle_t.png │ ├── triangle_v.png │ └── triangle_y.png ├── index.html ├── language.html ├── lexicon.html ├── lexicon_entry.html ├── milestones │ ├── 15.9.1.html │ ├── 16.0.0.html │ └── 17.0.0.html ├── performance.html ├── pleasings.html ├── plugins.html ├── plz-recording.json ├── post_build.html ├── quickstart.html ├── quickstart_dropoff.html ├── remote_builds.html ├── require_provide.html ├── styles.css ├── tabs.js ├── tachyons-4.12.0.min.css ├── template.html ├── test │ ├── BUILD │ └── docs_test.go ├── tests.html └── tools │ ├── config_templater │ ├── BUILD │ └── template_config.go │ ├── grammar_templater │ ├── BUILD │ └── template_grammar.go │ ├── lexicon_templater │ ├── BUILD │ ├── rules │ │ ├── BUILD │ │ └── rules.go │ └── template_lexicon.go │ ├── plugin_config_tool │ ├── BUILD │ ├── plugin │ │ ├── BUILD │ │ └── plugin.go │ └── plugin_config_tool.go │ ├── plugin_templater │ ├── BUILD │ └── main.go │ └── templater │ ├── BUILD │ └── template.go ├── go.mod ├── go.sum ├── install.sh ├── log.sh ├── package └── BUILD ├── please-servers-token.txt ├── pleasew ├── plugins └── BUILD ├── rules ├── BUILD ├── README.md ├── bazel │ ├── BUILD │ ├── bazel.go │ └── http.build_defs ├── builtins.build_defs ├── config_rules.build_defs ├── misc_rules.build_defs ├── rules.go ├── rules_test.go └── subrepo_rules.build_defs ├── src ├── BUILD.plz ├── README.md ├── assets │ ├── BUILD │ ├── assets.go │ ├── assets_test.go │ ├── pleasew │ └── plz_complete.sh ├── build │ ├── BUILD │ ├── README.md │ ├── build_step.go │ ├── build_step_stress_test.go │ ├── build_step_test.go │ ├── filegroup.go │ ├── incrementality.go │ ├── incrementality_test.go │ ├── remote_file_test.go │ └── test_data │ │ ├── hash_test │ │ └── BUILD_FILE │ │ ├── local_remote_file.txt │ │ ├── package1 │ │ ├── BUILD_FILE │ │ ├── package2 │ │ │ ├── BUILD_FILE │ │ │ └── file1.py │ │ └── src5 │ │ ├── plz-out │ │ └── gen │ │ │ ├── hash_test │ │ │ ├── bar.txt │ │ │ └── foo.txt │ │ │ ├── package1 │ │ │ ├── file2 │ │ │ ├── file3 │ │ │ ├── file4 │ │ │ └── file5 │ │ │ └── package3 │ │ │ ├── file1 │ │ │ └── file2 │ │ ├── pypkg │ │ ├── __init__.py │ │ └── file1.py │ │ └── secret ├── cache │ ├── BUILD │ ├── async_cache.go │ ├── async_cache_test.go │ ├── cache.go │ ├── cmd_cache.go │ ├── cmd_cache_test.go │ ├── dir_cache.go │ ├── dir_cache_test.go │ ├── http_cache.go │ ├── http_cache_test.go │ ├── noop.go │ └── test_data │ │ ├── ca.pem │ │ ├── cert.pem │ │ ├── cert_signed.pem │ │ ├── darwin_amd64 │ │ └── pkg │ │ │ └── name │ │ │ └── label_name │ │ │ └── dGVzdF9rZXk │ │ │ └── testfile │ │ ├── freebsd_amd64 │ │ └── pkg │ │ │ └── name │ │ │ └── label_name │ │ │ └── dGVzdF9rZXk │ │ │ └── testfile │ │ ├── key.pem │ │ ├── linux_amd64 │ │ └── pkg │ │ │ └── name │ │ │ └── label_name │ │ │ └── dGVzdF9rZXk │ │ │ └── testfile │ │ └── plz-out │ │ └── gen │ │ └── pkg │ │ └── name │ │ ├── testfile2 │ │ ├── testfile3 │ │ └── testfile4 ├── clean │ ├── BUILD │ ├── clean.go │ └── clean_test.go ├── cli │ ├── BUILD │ ├── flags.go │ ├── flags_test.go │ ├── logging.go │ ├── logging │ │ ├── BUILD │ │ └── logging.go │ ├── logging_test.go │ ├── process.go │ ├── progress.go │ ├── prompt.go │ ├── replacements.go │ ├── suggest.go │ ├── winch_other.go │ ├── winch_windows.go │ └── window.go ├── cmap │ ├── BUILD │ ├── cerrmap.go │ ├── cerrmap_test.go │ ├── cmap.go │ ├── cmap_test.go │ ├── hash.go │ └── hash_test.go ├── core │ ├── BUILD │ ├── README.md │ ├── atomic_float32.go │ ├── build_env.go │ ├── build_env_test.go │ ├── build_input.go │ ├── build_input_test.go │ ├── build_label.go │ ├── build_label_fuzz_test.go │ ├── build_label_test.go │ ├── build_target.go │ ├── build_target_benchmark_test.go │ ├── build_target_test.go │ ├── cache.go │ ├── command_replacements.go │ ├── command_replacements_test.go │ ├── config.go │ ├── config_flags.go │ ├── config_test.go │ ├── cycle_detector.go │ ├── cycle_detector_test.go │ ├── graph.go │ ├── graph_benchmark_test.go │ ├── graph_test.go │ ├── label_parse_test.go │ ├── lock.go │ ├── lock_test.go │ ├── package.go │ ├── package_test.go │ ├── previous_op.go │ ├── previous_op_test.go │ ├── resources.go │ ├── stamp.go │ ├── stamp_test.go │ ├── state.go │ ├── state_test.go │ ├── subrepo.go │ ├── subrepo_test.go │ ├── target_set.go │ ├── target_set_test.go │ ├── test_data │ │ ├── BUILD_FILE │ │ ├── alias.plzconfig │ │ ├── buildenv.plzconfig │ │ ├── bytesize_bad.plzconfig │ │ ├── bytesize_good.plzconfig │ │ ├── duration_bad.plzconfig │ │ ├── duration_good.plzconfig │ │ ├── failing.plzconfig │ │ ├── hashcheckers.plzconfig │ │ ├── metrics.plzconfig │ │ ├── passenv.plzconfig │ │ ├── passunsafeenv.plzconfig │ │ ├── plugin.plzconfig │ │ ├── project │ │ │ ├── BUILD_FILE │ │ │ ├── project.file │ │ │ └── sub_package │ │ │ │ ├── BUILD_FILE │ │ │ │ └── sub_package.file │ │ ├── slices.plzconfig │ │ ├── testrunner_bad.plzconfig │ │ ├── testrunner_good.plzconfig │ │ ├── version_bad.plzconfig │ │ ├── version_good.plzconfig │ │ ├── working.plzconfig │ │ └── working.plzconfig.dev │ ├── test_results.go │ ├── test_results_test.go │ ├── utils.go │ ├── utils_benchmark_test.go │ └── utils_test.go ├── debug │ ├── BUILD │ └── debug.go ├── exec │ ├── BUILD │ ├── exec.go │ └── exec_test.go ├── export │ ├── BUILD │ └── export.go ├── format │ ├── BUILD │ ├── fmt.go │ ├── fmt_test.go │ └── test_data │ │ ├── build_target.after.build │ │ ├── build_target.before.build │ │ ├── function_types_aliases.after.build │ │ ├── function_types_aliases.before.build │ │ ├── is_precedence.after.build │ │ ├── is_precedence.before.build │ │ ├── param_sort_order_tag.after.build │ │ ├── param_sort_order_tag.before.build │ │ ├── subincludes.after.build │ │ └── subincludes.before.build ├── fs │ ├── BUILD │ ├── attr.go │ ├── copy.go │ ├── copy_test.go │ ├── executable.go │ ├── fs.go │ ├── fs_test.go │ ├── glob.go │ ├── glob_integration_test.go │ ├── glob_test.go │ ├── hash.go │ ├── hash_benchmark_test.go │ ├── hash_test.go │ ├── home.go │ ├── home_test.go │ ├── iofs.go │ ├── sort.go │ ├── sort_test.go │ ├── test_data │ │ ├── .test │ │ ├── test.txt │ │ ├── test_subfolder++ │ │ │ └── test.txt │ │ ├── test_subfolder1 │ │ │ ├── a.txt │ │ │ └── sub_sub_folder │ │ │ │ └── b.txt │ │ ├── test_subfolder3 │ │ │ ├── Zest.py │ │ │ ├── best.py │ │ │ └── test.py │ │ └── test_subfolder4 │ │ │ ├── TEST_BUILD │ │ │ └── test.py │ └── walk.go ├── gc │ ├── BUILD │ ├── gc.go │ ├── gc_test.go │ ├── rewrite_test.go │ └── test_data │ │ ├── after.build │ │ └── before.build ├── generate │ ├── BUILD │ └── generate.go ├── hashes │ ├── BUILD │ ├── hash_rewriter_test.go │ ├── rewrite_hashes.go │ └── test_data │ │ ├── after.build │ │ └── before.build ├── help │ ├── BUILD │ ├── completion.go │ ├── config.go │ ├── help.go │ ├── help_test.go │ ├── misc_topics.go │ ├── rules.go │ └── rules_test.go ├── metrics │ ├── BUILD │ └── prometheus.go ├── output │ ├── BUILD │ ├── interactive_display.go │ ├── interactive_display_test.go │ ├── print.go │ ├── shell_output.go │ ├── shell_output_test.go │ ├── targets.go │ └── trace.go ├── parse │ ├── BUILD │ ├── README.md │ ├── asp │ │ ├── BUILD │ │ ├── README.md │ │ ├── builtins.go │ │ ├── builtins_bench_test.go │ │ ├── builtins_test.go │ │ ├── config.go │ │ ├── config_test.go │ │ ├── errors.go │ │ ├── exec.go │ │ ├── file_position.go │ │ ├── file_position_test.go │ │ ├── grammar.go │ │ ├── grammar_parse.go │ │ ├── interpreter.go │ │ ├── interpreter_test.go │ │ ├── label_context_test.go │ │ ├── lexer.go │ │ ├── lexer_test.go │ │ ├── logging_test.go │ │ ├── main │ │ │ ├── BUILD │ │ │ └── main.go │ │ ├── objects.go │ │ ├── parser.go │ │ ├── parser_test.go │ │ ├── targets.go │ │ ├── targets_test.go │ │ ├── test_data │ │ │ ├── assert.build │ │ │ ├── assignments.build │ │ │ ├── aug_assign.build │ │ │ ├── basic.build │ │ │ ├── benchmark_parse_file.build │ │ │ ├── comprehension.build │ │ │ ├── constant_assign.build │ │ │ ├── default_arguments.build │ │ │ ├── destructuring_assign.build │ │ │ ├── double_unindent.build │ │ │ ├── else.build │ │ │ ├── environment.build │ │ │ ├── example.build │ │ │ ├── example_1.build │ │ │ ├── example_2.build │ │ │ ├── example_3.build │ │ │ ├── example_4.build │ │ │ ├── example_5.build │ │ │ ├── example_6.build │ │ │ ├── file_position.build │ │ │ ├── file_position_simple.build │ │ │ ├── for_statement.build │ │ │ ├── fstring.build │ │ │ ├── function_call.build │ │ │ ├── function_def.build │ │ │ ├── if_statement.build │ │ │ ├── indexing.build │ │ │ ├── inline_if.build │ │ │ ├── interpreter │ │ │ │ ├── aliases.build │ │ │ │ ├── all.build │ │ │ │ ├── any.build │ │ │ │ ├── argument_compatibility.build │ │ │ │ ├── arguments.build │ │ │ │ ├── break_loop.build │ │ │ │ ├── builtins.build │ │ │ │ ├── chr.build │ │ │ │ ├── chr_bounds_high.build │ │ │ │ ├── chr_bounds_low.build │ │ │ │ ├── chr_wrong_type.build │ │ │ │ ├── collections.build │ │ │ │ ├── comprehensions.build │ │ │ │ ├── config.build │ │ │ │ ├── continue.build │ │ │ │ ├── dict_union.build │ │ │ │ ├── divide.build │ │ │ │ ├── double_index.build │ │ │ │ ├── equality.build │ │ │ │ ├── filter.build │ │ │ │ ├── format.build │ │ │ │ ├── fstring_optimisation.build │ │ │ │ ├── fstrings.build │ │ │ │ ├── index_string.build │ │ │ │ ├── interpolation.build │ │ │ │ ├── is_semver.build │ │ │ │ ├── isnot.build │ │ │ │ ├── len.build │ │ │ │ ├── list_concat.build │ │ │ │ ├── log.build │ │ │ │ ├── map.build │ │ │ │ ├── max.build │ │ │ │ ├── min.build │ │ │ │ ├── multiply.build │ │ │ │ ├── mutable_arguments.build │ │ │ │ ├── operator_precedence.build │ │ │ │ ├── operators.build │ │ │ │ ├── optimisations.build │ │ │ │ ├── optimise_config.build │ │ │ │ ├── optimise_join.build │ │ │ │ ├── ord.build │ │ │ │ ├── ord_empty.build │ │ │ │ ├── ord_multiple.build │ │ │ │ ├── ord_wrong_type.build │ │ │ │ ├── parentheses.build │ │ │ │ ├── partition.build │ │ │ │ ├── paths.build │ │ │ │ ├── precedence.build │ │ │ │ ├── precedence2.build │ │ │ │ ├── reduce.build │ │ │ │ ├── remove_affixes.build │ │ │ │ ├── reversed.build │ │ │ │ ├── semver_check.build │ │ │ │ ├── semver_check_invalid_constraint.build │ │ │ │ ├── semver_check_invalid_version.build │ │ │ │ ├── slicing.build │ │ │ │ ├── sorted.build │ │ │ │ ├── strings.build │ │ │ │ ├── subinclude_all.build │ │ │ │ ├── subinclude_config.build │ │ │ │ ├── subrepo_name.build │ │ │ │ ├── system_srcs.build │ │ │ │ ├── unpacking.build │ │ │ │ └── zip.build │ │ │ ├── json.build │ │ │ ├── literal_methods.build │ │ │ ├── log_config.build │ │ │ ├── multiline_string_double_in_double.build │ │ │ ├── multiline_string_double_in_single.build │ │ │ ├── multiline_string_single_in_double.build │ │ │ ├── multiline_string_single_in_single.build │ │ │ ├── multiple_action.build │ │ │ ├── no_newline.build │ │ │ ├── operators.build │ │ │ ├── optimise.build │ │ │ ├── optimise_join.build │ │ │ ├── precedence.build │ │ │ ├── raise.build │ │ │ ├── repeated_arguments.build │ │ │ ├── return_type.build │ │ │ └── unary_op.build │ │ ├── util.go │ │ └── util_test.go │ ├── init.go │ ├── internal.tmpl │ ├── internal_package.go │ ├── parse_step.go │ └── parse_step_test.go ├── please.go ├── plz │ ├── BUILD │ ├── plz.go │ └── plz_test.go ├── plzinit │ ├── BUILD │ ├── go.go │ ├── init.go │ ├── init_test.go │ ├── pleasings.go │ ├── plugin_go.go │ └── plugins.go ├── process │ ├── BUILD │ ├── exec_linux.go │ ├── exec_other.go │ ├── output.go │ ├── process.go │ ├── process_test.go │ ├── progress.go │ └── progress_test.go ├── query │ ├── BUILD │ ├── alltargets.go │ ├── changes.go │ ├── changes_test.go │ ├── completions.go │ ├── completions_test.go │ ├── completions_test_repo │ │ ├── BUILD_FILE │ │ ├── bing │ │ │ └── net │ │ │ │ └── thoughtmachine │ │ │ │ └── please │ │ │ │ └── BUILD_FILE │ │ └── foo │ │ │ ├── BUILD_FILE │ │ │ ├── bar │ │ │ ├── BUILD_FILE │ │ │ └── net │ │ │ │ └── thoughtmachine │ │ │ │ └── please │ │ │ │ ├── BUILD_FILE │ │ │ │ └── main │ │ │ │ └── BUILD_FILE │ │ │ └── baz │ │ │ └── BUILD_FILE │ ├── config.go │ ├── deps.go │ ├── deps_test.go │ ├── filter.go │ ├── graph.go │ ├── graph_test.go │ ├── inputs.go │ ├── outputs.go │ ├── print.go │ ├── print_test.go │ ├── query_step.go │ ├── reverse_deps.go │ ├── reverse_deps_test.go │ ├── somepath.go │ ├── whatinputs.go │ ├── whatinputs_test.go │ ├── whatoutputs.go │ └── whatoutputs_test.go ├── remote │ ├── BUILD │ ├── README.md │ ├── action.go │ ├── blobs.go │ ├── build_metadata_store.go │ ├── fs │ │ ├── BUILD │ │ ├── cache │ │ │ ├── BUILD │ │ │ └── cache_client.go │ │ ├── fs.go │ │ ├── fs_test.go │ │ └── info.go │ ├── impl_test.go │ ├── remote.go │ ├── remote_test.go │ ├── stats.go │ ├── test_data │ │ ├── package │ │ │ ├── src1.txt │ │ │ └── src2.txt │ │ └── plz-out │ │ │ ├── bin │ │ │ ├── package │ │ │ │ └── remote_test │ │ │ └── package2 │ │ │ │ ├── .test_results_target2 │ │ │ │ ├── 1.xml │ │ │ │ ├── 2.xml │ │ │ │ └── results │ │ │ │ │ └── 2.xml │ │ │ │ ├── 1.xml │ │ │ │ └── target2 │ │ │ └── gen │ │ │ └── package │ │ │ └── out1.txt │ └── utils.go ├── run │ ├── BUILD │ ├── run_step.go │ ├── run_test.go │ └── test_data │ │ └── plz-out │ │ └── bin │ │ ├── false │ │ └── true ├── sandbox │ ├── BUILD │ ├── sandbox_linux.go │ └── sandbox_other.go ├── scm │ ├── BUILD │ ├── git.go │ ├── git_test.go │ ├── scm.go │ ├── stub.go │ └── test_data │ │ └── git.diff ├── test │ ├── BUILD │ ├── README.md │ ├── coverage.go │ ├── coverage_test.go │ ├── gcov_coverage.go │ ├── go_coverage.go │ ├── go_results.go │ ├── go_test_panic.go │ ├── istanbul_coverage.go │ ├── results.go │ ├── results_test.go │ ├── surefire.go │ ├── test_data │ │ ├── gcov_coverage.gcov │ │ ├── go_coverage.txt │ │ ├── go_coverage_2.txt │ │ ├── go_coverage_3.txt │ │ ├── go_empty_test.txt │ │ ├── go_multiple_failure.txt │ │ ├── go_subtests.txt │ │ ├── go_test_fail_1_14.txt │ │ ├── go_test_failure.txt │ │ ├── go_test_ignore_logs.txt │ │ ├── go_test_logging.txt │ │ ├── go_test_pass.txt │ │ ├── go_test_skip.txt │ │ ├── go_test_skip_1_14.txt │ │ ├── go_test_suite.txt │ │ ├── istanbul_coverage.json │ │ ├── istanbul_coverage_2.json │ │ ├── junit.xml │ │ ├── karma-junit.xml │ │ ├── python-coverage.xml │ │ ├── unittest.xml │ │ ├── xmlrunner-junit.xml │ │ └── xmlrunner-skipped.xml │ ├── test_step.go │ ├── xml_coverage.go │ ├── xml_results.go │ └── xml_results_test.go ├── tool │ ├── BUILD │ ├── tool.go │ └── tool_test.go ├── update │ ├── BUILD │ ├── clean.go │ ├── key.pub │ ├── test │ │ ├── BUILD │ │ └── test_main.go │ ├── test_data │ │ ├── bad.pem │ │ ├── bad.txt │ │ ├── bad.txt.asc │ │ ├── good.pem │ │ ├── good.pub.pem │ │ ├── test.txt │ │ └── test.txt.asc │ ├── update.go │ ├── update_test.go │ ├── verify.go │ └── verify_test.go ├── version │ ├── BUILD │ └── version.go └── watch │ ├── BUILD │ └── watch.go ├── test.sh ├── test ├── BUILD ├── affectedtests_test.go ├── basic_completions.txt ├── build_defs │ ├── .plzconfig.e2e │ ├── .plzconfig_freebsd_amd64 │ ├── BUILD │ ├── cc_embed_binary.build_defs │ ├── test.build_defs │ └── test_file_content.sh ├── build_outdir │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ └── foo │ │ └── BUILD_FILE ├── cli │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ └── package │ │ └── BUILD_FILE ├── completion │ ├── BUILD │ ├── bin.cc │ ├── binary_only │ │ ├── BUILD │ │ └── binary_only │ │ │ ├── BUILD │ │ │ └── tests │ │ │ └── BUILD │ └── lib.cc ├── completions │ └── BUILD ├── config_rules │ ├── BUILD │ ├── config │ │ └── BUILD │ └── config_test.py ├── container_data.txt ├── coverage_output_test.py ├── cross_compile │ ├── BUILD │ ├── README.md │ ├── bin_test.sh │ ├── lib │ │ ├── BUILD │ │ ├── lib.c │ │ ├── lib.h │ │ └── main.go │ ├── location_test.sh │ ├── main.c │ ├── select_test.sh │ └── test_arch.sh ├── cycle │ └── TEST_BUILD ├── data_files_test.sh ├── double_local_subinclude │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ ├── a │ │ ├── 1.build_defs │ │ ├── 2.build_defs │ │ └── BUILD_FILE │ │ ├── b │ │ └── BUILD_FILE │ │ └── c │ │ └── BUILD_FILE ├── entry_point │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ ├── foo │ │ └── BUILD_FILE │ │ ├── plugins │ │ └── BUILD_FILE │ │ ├── puku.json │ │ ├── third_party │ │ └── go │ │ │ └── BUILD_FILE │ │ └── tools │ │ ├── BUILD_FILE │ │ └── file_printer.go ├── env_test │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ └── BUILD_FILE ├── exec │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ └── BUILD_FILE ├── export │ └── BUILD ├── extra_test_output_test.go ├── filegroup │ ├── BUILD │ ├── hash_filegroup_test.sh │ ├── hash_filegroup_test.txt │ ├── many │ │ └── BUILD │ ├── named_test.sh │ └── output_hash │ │ ├── BUILD │ │ └── test_repo │ │ ├── .plzconfig │ │ └── srcs │ │ ├── BUILD_FILE │ │ ├── file1 │ │ └── file2 ├── flakiness_test.py ├── flaky_test.py ├── get_entry_points │ └── BUILD ├── get_outs │ └── BUILD ├── glob │ ├── BUILD │ ├── glob_build_test.sh │ ├── glob_build_test_symlink.sh │ ├── test.txt │ └── test.txt.symlink ├── go.mod ├── include │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ ├── BUILD_FILE │ │ └── plugins │ │ └── BUILD_FILE ├── individual_test_run.py ├── internal_pkg_test │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ └── src │ │ ├── BUILD_FILE │ │ └── input.zip ├── keep_going │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ ├── package │ │ └── BUILD_FILE │ │ ├── package2 │ │ └── BUILD_FILE │ │ └── parse_failure │ │ └── BUILD_FILE ├── local_subinclude_test │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ ├── local │ │ ├── BUILD_FILE │ │ ├── constant.build_defs │ │ └── foo │ │ │ └── BUILD_FILE │ │ └── subrepo │ │ ├── BUILD_FILE │ │ └── dir │ │ └── BUILD_FILE ├── manual_label │ └── BUILD ├── misc_rules │ ├── BUILD │ ├── a.txt │ ├── filegroup_not_require_test.sh │ └── filegroup_require_test.sh ├── moar │ └── BUILD ├── name_conflict.go ├── num_runs_test.go ├── optional_outs_test │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ └── foo │ │ └── BUILD_FILE ├── parse │ ├── BUILD │ ├── inline_subinclude │ │ ├── BUILD.test │ │ └── constant.build_defs │ ├── label_list_subinclude │ │ ├── BUILD.test │ │ ├── constant1.build_defs │ │ ├── constant2.build_defs │ │ ├── constant3.build_defs │ │ └── constant4.build_defs │ ├── namedout_subinclude │ │ ├── BUILD.test │ │ └── constant.build_defs │ ├── pre_post_build_config │ │ ├── BUILD.test │ │ └── build_defs │ │ │ ├── BUILD.test │ │ │ └── build_foo.build_defs │ └── subinclude_visibility │ │ └── BUILD.test ├── parse_test │ ├── BUILD │ ├── additional_output_test.go │ └── require_provide_test.py ├── pass_env_test.sh ├── please_shim │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ ├── .plzconfig.update_version │ │ └── please │ │ └── README.md ├── plugins │ ├── BUILD │ ├── config_field_value_plugin │ │ ├── .plzconfig │ │ └── build_defs │ │ │ ├── BUILD_FILE │ │ │ └── defs.build_defs │ ├── config_field_value_test_repo │ │ ├── .plzconfig │ │ ├── plugins │ │ │ └── BUILD_FILE │ │ └── test │ │ │ └── BUILD_FILE │ ├── foo_plugin │ │ ├── .plzconfig │ │ ├── build_defs │ │ │ ├── BUILD_FILE │ │ │ └── foolang.build_defs │ │ ├── test │ │ │ ├── BUILD_FILE │ │ │ └── test.foo │ │ └── tools │ │ │ └── BUILD_FILE │ ├── init_plugin_test │ │ └── .plzconfig │ ├── nested_subrepo │ │ ├── .plzconfig │ │ ├── README │ │ └── test │ │ │ ├── BUILD_FILE │ │ │ └── test.foo │ ├── self_referencing_plugin │ │ ├── .plzconfig │ │ ├── BUILD_FILE │ │ ├── build_defs │ │ │ ├── BUILD_FILE │ │ │ └── foo.build_defs │ │ ├── plugins │ │ │ └── BUILD_FILE │ │ ├── test │ │ │ └── BUILD_FILE │ │ └── tools │ │ │ └── BUILD_FILE │ ├── test_repo │ │ ├── .plzconfig │ │ ├── .plzconfig.dev │ │ ├── .plzconfig_foo_bar66 │ │ ├── BUILD_FILE │ │ ├── override │ │ │ └── BUILD_FILE │ │ ├── plugins │ │ │ └── BUILD_FILE │ │ └── test │ │ │ ├── BUILD_FILE │ │ │ └── test.foo │ └── tools │ │ ├── BUILD │ │ └── fooc.go ├── plz_debug │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ ├── BUILD_FILE │ │ └── file1.txt ├── plz_exec │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ ├── .plzconfig.sandbox │ │ ├── BUILD_FILE │ │ ├── network_test.go │ │ ├── plugins │ │ └── BUILD_FILE │ │ └── puku.json ├── plz_format │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ └── src │ │ ├── BUILD_FILE │ │ └── FORMATTED_BUILD_FILE ├── plz_generate │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ ├── .plzconfig.auto │ │ └── src │ │ ├── BUILD_FILE │ │ └── bar │ │ ├── BUILD_FILE │ │ └── baz │ │ └── BUILD_FILE ├── plz_query │ └── config │ │ └── BUILD ├── plz_run │ ├── BUILD │ ├── temp.txt │ └── test_repo │ │ ├── .plzconfig │ │ ├── plugins │ │ └── BUILD_FILE │ │ └── src │ │ ├── BUILD_FILE │ │ ├── arg_printer.sh │ │ ├── dummydata.txt │ │ ├── env_printer.sh │ │ └── wibble.txt ├── preloaded_subinc │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ ├── build_defs │ │ ├── BUILD_FILE │ │ ├── bar.build_defs │ │ └── foo.build_defs │ │ ├── plugins │ │ └── BUILD_FILE │ │ ├── src │ │ ├── BUILD_FILE │ │ ├── build_defs │ │ │ ├── BUILD_FILE │ │ │ └── empty.build_defs │ │ ├── service.yaml │ │ └── test.sh │ │ └── third_party │ │ └── go │ │ └── BUILD_FILE ├── proto_plugin │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ ├── BUILD_FILE │ │ ├── plugins │ │ └── BUILD_FILE │ │ ├── puku.json │ │ ├── test │ │ ├── BUILD_FILE │ │ ├── proto │ │ │ ├── BUILD_FILE │ │ │ └── service.proto │ │ └── proto_test.go │ │ └── third_party │ │ └── go │ │ └── BUILD_FILE ├── pytype │ └── BUILD ├── query_affectedtests_test.txt ├── query_alltargets_1.txt ├── query_alltargets_2.txt ├── query_output_test.txt ├── query_print_test.txt ├── query_somepath_nopath_test.txt ├── query_somepath_test.txt ├── remote │ └── BUILD ├── require_provide_test.txt ├── require_provides │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ └── BUILD_FILE ├── revdeps │ ├── BUILD │ ├── hidden_test │ │ ├── BUILD │ │ ├── lvl1.txt │ │ ├── lvl2.txt │ │ ├── lvl3.txt │ │ ├── lvl4.txt │ │ └── lvl4_hidden.txt │ ├── query_revdeps_branch_test.txt │ ├── query_revdeps_multiple_paths_test.txt │ ├── query_revdeps_no_level_test.txt │ ├── query_revdeps_root_test.txt │ ├── query_revdeps_single_level_test.txt │ └── require_provide │ │ ├── BUILD │ │ ├── revdeps.txt │ │ └── somepath.txt ├── run_completions.txt ├── secrets │ └── BUILD ├── select │ └── BUILD ├── sh_rules │ ├── BUILD │ ├── no_shebang.sh │ ├── sh_binary.sh │ ├── sh_lib.sh │ └── shebang.sh ├── stamp │ ├── BUILD │ ├── lib │ │ ├── BUILD │ │ └── lib.go │ ├── main.go │ └── stamp_test.sh ├── subrepo │ ├── BUILD │ └── test_repo │ │ ├── .plzconfig │ │ ├── BUILD_FILE │ │ └── subrepo │ │ └── BUILD_FILE ├── symlink_test.txt ├── test_completions.txt ├── test_output_test_1.txt ├── test_output_test_2.xml ├── test_tools │ ├── BUILD │ └── tool.sh ├── text_file │ └── BUILD └── whatinputs │ ├── BUILD │ ├── multiple_sources.txt │ └── test_package │ ├── BUILD │ └── foo.txt ├── third_party ├── binary │ └── BUILD ├── cc │ ├── BUILD │ └── gtest.build ├── go │ ├── BUILD │ ├── glog_disable.patch │ └── spew_omit_empty.patch ├── js │ ├── BUILD │ ├── asciinema-player.css │ └── asciinema-player.js └── python │ ├── BUILD │ └── importlib_metadata.patch └── tools ├── build_langserver ├── BUILD ├── langserver_main.go ├── lsp │ ├── BUILD │ ├── astutils │ │ ├── BUILD │ │ └── ast_utils.go │ ├── completion.go │ ├── definition.go │ ├── definition_test.go │ ├── diagnostics.go │ ├── lsp.go │ ├── lsp_test.go │ ├── symbols.go │ ├── symbols_test.go │ ├── test_data │ │ ├── .plzconfig │ │ ├── build_defs │ │ │ ├── go_bindata.build_defs │ │ │ └── test.build │ │ ├── plugins │ │ │ └── test.build │ │ ├── puku.json │ │ ├── src │ │ │ └── core │ │ │ │ ├── config_test.go │ │ │ │ └── test.build │ │ └── third_party │ │ │ └── go │ │ │ └── test.build │ └── text.go └── outline.txt ├── http_cache ├── BUILD ├── README.md ├── cache │ ├── BUILD │ └── cache.go └── main.go ├── images ├── README.md ├── alpine │ ├── Dockerfile │ └── README.md ├── build.sh ├── freebsd_builder │ ├── Dockerfile │ └── README.md ├── ubuntu │ ├── Dockerfile │ ├── README.md │ └── motd.txt └── ubuntu_alt │ ├── Dockerfile │ ├── README.md │ ├── motd.txt │ └── plzconfig ├── misc ├── BUILD ├── apparmor_profile ├── bb_storage.json ├── bb_storage.sh ├── bootstrap_stress_test.sh ├── data │ └── linux_amd64 │ │ └── release_asset_13.2.7 ├── gen_release.py ├── gen_release_test.py ├── get_plz.sh ├── lint.sh ├── please-mode.el ├── plz_ci.sh └── plz_complete.sh ├── performance ├── BUILD ├── benchmark │ ├── BUILD │ └── main.go ├── gen_parse_tree.py └── parse_perf_test.py ├── please_shim ├── BUILD └── main.go ├── release_signer ├── BUILD ├── main.go └── signer │ ├── BUILD │ ├── signer.go │ ├── signer_test.go │ └── test_data │ ├── bad.txt │ ├── key.pem │ ├── pub.gpg │ ├── sec.gpg │ └── test.txt └── sandbox ├── BUILD ├── main.c ├── nonet_main.c ├── sandbox.c ├── sandbox.h └── sandbox_test.cc /.circleci/setup_osx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -eu 4 | 5 | # /usr/local/go might get cached. 6 | if [ ! -d "/usr/local/go" ]; then 7 | curl -fsSL https://dl.google.com/go/go1.23.1.darwin-arm64.tar.gz | sudo tar -xz -C /usr/local 8 | fi 9 | sudo ln -s /usr/local/go/bin/go /usr/local/bin/go 10 | 11 | # xz might also. 12 | if ! command -v xz &> /dev/null; then 13 | brew install xz 14 | fi 15 | sudo ln -s /opt/homebrew/bin/xz /usr/local/bin/xz 16 | -------------------------------------------------------------------------------- /.cirrus.yml: -------------------------------------------------------------------------------- 1 | freebsd_instance: 2 | image_family: freebsd-14-2 3 | 4 | env: 5 | GOPROXY: https://proxy.golang.org 6 | 7 | task: 8 | install_script: 9 | "pkg install -y bash protobuf git python3 && python3 -m ensurepip && curl -L https://go.dev/dl/go1.24.2.freebsd-amd64.tar.gz | tar -C /usr/local -zx && ln -s /usr/local/go/bin/go /usr/local/bin/go" 10 | build_script: ./bootstrap.sh --exclude pip --exclude py2 --exclude=py3 --exclude=python3 --exclude no_cirrus 11 | always: 12 | log_artifacts: 13 | path: plz-out/log/*.log 14 | type: text/plain 15 | test_artifacts: 16 | path: plz-out/log/test_results.xml 17 | type: text/xml 18 | format: junit 19 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.build_defs linguist-language=Starlark diff=python 2 | BUILD.plz linguist-language=Starlark diff=python 3 | docs/* linguist-documentation 4 | *_bindata.go linguist-generated 5 | third_party/go/zip/* linguist-vendored 6 | -------------------------------------------------------------------------------- /.github/workflows/golangci-lint.yml: -------------------------------------------------------------------------------- 1 | name: golangci-lint 2 | on: 3 | push: 4 | tags: 5 | - v* 6 | branches: 7 | - master 8 | pull_request: 9 | jobs: 10 | golangci: 11 | name: lint 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v4 15 | - uses: actions/setup-go@v4 16 | with: 17 | go-version: '^1.23' 18 | - name: golangci-lint 19 | uses: golangci/golangci-lint-action@v4 20 | with: 21 | version: v1.61 22 | args: src/... tools/... 23 | skip-pkg-cache: true 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .bootstrap 2 | # Local config file 3 | .plzconfig.local 4 | 5 | /plz-out 6 | /.plz-cache 7 | /.plz-http-cache 8 | *.pyc 9 | __pycache__ 10 | 11 | .idea 12 | *.iml 13 | /venv 14 | /out 15 | *.sw? 16 | 17 | .DS_Store 18 | # For local testing 19 | .local 20 | 21 | # The parse perf test repo 22 | /tree 23 | -------------------------------------------------------------------------------- /.plzconfig.alpine: -------------------------------------------------------------------------------- 1 | [Plugin "go"] 2 | DefaultStatic = true 3 | GoTool = go 4 | Stdlib = //third_party/go:std 5 | 6 | [buildconfig] 7 | static-sandbox = true 8 | -------------------------------------------------------------------------------- /.plzconfig.ci: -------------------------------------------------------------------------------- 1 | ; Config file used for CI. 2 | [cache] 3 | dir = .plz-cache 4 | dircompress = true 5 | 6 | [buildconfig] 7 | ci = true 8 | 9 | ; CI should disable all feature flags so we're actually testing the default distribution. 10 | [featureflags] 11 | -------------------------------------------------------------------------------- /.plzconfig.ci-alt: -------------------------------------------------------------------------------- 1 | ; Config file used for CI. 2 | [cache] 3 | dir = .plz-cache 4 | dircompress = true 5 | 6 | [buildconfig] 7 | ci = true 8 | 9 | -------------------------------------------------------------------------------- /.plzconfig.ci_remote: -------------------------------------------------------------------------------- 1 | ; This is used for CI of the remote execution code. 2 | [remote] 3 | url = localhost:7778 4 | casurl = localhost:7777 5 | asseturl = localhost:7776 6 | instance = mettle 7 | secure = false 8 | numexecutors = 10 9 | 10 | [build] 11 | hashfunction = sha256 12 | 13 | [please] 14 | location = ~/.please 15 | -------------------------------------------------------------------------------- /.plzconfig.localcache: -------------------------------------------------------------------------------- 1 | [cache] 2 | httpurl = http://127.0.0.1:1771 3 | httpwriteable = true -------------------------------------------------------------------------------- /.plzconfig.localremote: -------------------------------------------------------------------------------- 1 | # Steps to build with remote execution locally: 2 | # 1) git clone https://github.com/thought-machine/please-servers 3 | # 2) cd please-servers && plz localremote 4 | # 3) you can then build and run with --profile localremote in this repo 5 | 6 | [Remote] 7 | URL = 127.0.0.1:7772 8 | CasUrl = 127.0.0.1:7777 9 | AssetUrl = 127.0.0.1:7776 10 | NumExecutors = 20 11 | # This file should be kept up to date with the file in grpcutil/token.txt from please-servers 12 | TokenFile = please-servers-token.txt 13 | Secure = false 14 | DisplayUrl = http://localhost:7779 15 | Instance = mettle 16 | 17 | [Plugin "go"] 18 | GoTool = go ; This is way too slow otherwise 19 | -------------------------------------------------------------------------------- /.plzconfig.sandbox: -------------------------------------------------------------------------------- 1 | [sandbox] 2 | build = true 3 | test = true 4 | namespace = never 5 | tool = please_sandbox 6 | ExcludeableTargets = //third_party/... 7 | ExcludeableTargets = //tools/please_go:all 8 | ExcludeableTargets = //tools/java:toolchain 9 | ExcludeableTargets = //:pleasings 10 | ExcludeableTargets = //docs:rules 11 | ExcludeableTargets = //test/... -------------------------------------------------------------------------------- /.plzconfig_freebsd_amd64: -------------------------------------------------------------------------------- 1 | [Plugin "cc"] 2 | cctool = cc 3 | cpptool = c++ 4 | 5 | 6 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 17.17.0 2 | -------------------------------------------------------------------------------- /bootstrap.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | 5 | source ./log.sh 6 | 7 | # PLZ_ARGS can be set to pass arguments to all plz invocations in this script. 8 | PLZ_ARGS="${PLZ_ARGS:-}" 9 | 10 | # Now invoke Go to run Please to build itself. 11 | notice "Bootstrapping please..." 12 | go run -race src/please.go -p -v2 $PLZ_ARGS --log_file plz-out/log/bootstrap_build.log build //src:please 13 | 14 | if [ $# -gt 0 ] && [ "$1" == "--skip_tests" ]; then 15 | notice "Skipping tests... done." 16 | exit 0 17 | fi 18 | 19 | exec ./test.sh $@ -------------------------------------------------------------------------------- /build_defs/BUILD: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "benchmark", 3 | srcs = ["benchmark.build_defs"], 4 | visibility = ["PUBLIC"], 5 | ) 6 | 7 | genrule( 8 | name = "version", 9 | srcs = ["//:version"], 10 | outs = ["version.build_defs"], 11 | cmd = "echo \"VERSION = '`cat $SRCS`'\" > \"$OUT\"", 12 | visibility = ["PUBLIC"], 13 | ) 14 | -------------------------------------------------------------------------------- /default.pgo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/default.pgo -------------------------------------------------------------------------------- /docs/build_defs/BUILD: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "build_defs", 3 | srcs = ["docs.build_defs"], 4 | visibility = ["//docs/..."], 5 | ) 6 | 7 | filegroup( 8 | name = "codelab_template", 9 | srcs = ["codelab_template.html"], 10 | visibility = ["//docs/..."], 11 | ) 12 | -------------------------------------------------------------------------------- /docs/codelabs/codelab.js: -------------------------------------------------------------------------------- 1 | document.addEventListener("DOMContentLoaded", function(event) { 2 | // TODO(jpoole): not this 3 | const arrBack = document.querySelector("#arrow-back") 4 | arrBack.href = "/codelabs.html" 5 | arrBack.innerHTML = "" 6 | 7 | const done = document.querySelector("#done") 8 | done.href = "/codelabs.html" 9 | }); 10 | -------------------------------------------------------------------------------- /docs/favicon/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/favicon/android-chrome-192x192.png -------------------------------------------------------------------------------- /docs/favicon/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/favicon/android-chrome-512x512.png -------------------------------------------------------------------------------- /docs/favicon/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/favicon/apple-touch-icon.png -------------------------------------------------------------------------------- /docs/favicon/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #da532c 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/favicon/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/favicon/favicon-16x16.png -------------------------------------------------------------------------------- /docs/favicon/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/favicon/favicon-32x32.png -------------------------------------------------------------------------------- /docs/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/favicon/favicon.ico -------------------------------------------------------------------------------- /docs/favicon/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/favicon/mstile-150x150.png -------------------------------------------------------------------------------- /docs/favicon/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "name": "", 3 | "short_name": "", 4 | "icons": [ 5 | { 6 | "src": "/android-chrome-192x192.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "/android-chrome-512x512.png", 12 | "sizes": "512x512", 13 | "type": "image/png" 14 | } 15 | ], 16 | "theme_color": "#ffffff", 17 | "background_color": "#ffffff", 18 | "display": "standalone" 19 | } 20 | -------------------------------------------------------------------------------- /docs/images/circle_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/circle_b.png -------------------------------------------------------------------------------- /docs/images/circle_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/circle_c.png -------------------------------------------------------------------------------- /docs/images/circle_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/circle_g.png -------------------------------------------------------------------------------- /docs/images/circle_p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/circle_p.png -------------------------------------------------------------------------------- /docs/images/circle_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/circle_r.png -------------------------------------------------------------------------------- /docs/images/circle_t.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/circle_t.png -------------------------------------------------------------------------------- /docs/images/circle_v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/circle_v.png -------------------------------------------------------------------------------- /docs/images/circle_y.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/circle_y.png -------------------------------------------------------------------------------- /docs/images/hexagon_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/hexagon_b.png -------------------------------------------------------------------------------- /docs/images/hexagon_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/hexagon_c.png -------------------------------------------------------------------------------- /docs/images/hexagon_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/hexagon_g.png -------------------------------------------------------------------------------- /docs/images/hexagon_p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/hexagon_p.png -------------------------------------------------------------------------------- /docs/images/hexagon_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/hexagon_r.png -------------------------------------------------------------------------------- /docs/images/hexagon_t.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/hexagon_t.png -------------------------------------------------------------------------------- /docs/images/hexagon_v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/hexagon_v.png -------------------------------------------------------------------------------- /docs/images/hexagon_y.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/hexagon_y.png -------------------------------------------------------------------------------- /docs/images/lockup2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/lockup2.png -------------------------------------------------------------------------------- /docs/images/pentagon_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/pentagon_b.png -------------------------------------------------------------------------------- /docs/images/pentagon_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/pentagon_c.png -------------------------------------------------------------------------------- /docs/images/pentagon_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/pentagon_g.png -------------------------------------------------------------------------------- /docs/images/pentagon_p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/pentagon_p.png -------------------------------------------------------------------------------- /docs/images/pentagon_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/pentagon_r.png -------------------------------------------------------------------------------- /docs/images/pentagon_t.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/pentagon_t.png -------------------------------------------------------------------------------- /docs/images/pentagon_v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/pentagon_v.png -------------------------------------------------------------------------------- /docs/images/pentagon_y.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/pentagon_y.png -------------------------------------------------------------------------------- /docs/images/please_build_p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/please_build_p.png -------------------------------------------------------------------------------- /docs/images/please_build_t.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/please_build_t.png -------------------------------------------------------------------------------- /docs/images/please_og.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/please_og.png -------------------------------------------------------------------------------- /docs/images/square_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/square_b.png -------------------------------------------------------------------------------- /docs/images/square_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/square_c.png -------------------------------------------------------------------------------- /docs/images/square_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/square_g.png -------------------------------------------------------------------------------- /docs/images/square_p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/square_p.png -------------------------------------------------------------------------------- /docs/images/square_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/square_r.png -------------------------------------------------------------------------------- /docs/images/square_t.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/square_t.png -------------------------------------------------------------------------------- /docs/images/square_v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/square_v.png -------------------------------------------------------------------------------- /docs/images/square_y.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/square_y.png -------------------------------------------------------------------------------- /docs/images/thoughtmachine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/thoughtmachine.png -------------------------------------------------------------------------------- /docs/images/triangle_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/triangle_b.png -------------------------------------------------------------------------------- /docs/images/triangle_c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/triangle_c.png -------------------------------------------------------------------------------- /docs/images/triangle_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/triangle_g.png -------------------------------------------------------------------------------- /docs/images/triangle_p.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/triangle_p.png -------------------------------------------------------------------------------- /docs/images/triangle_r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/triangle_r.png -------------------------------------------------------------------------------- /docs/images/triangle_t.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/triangle_t.png -------------------------------------------------------------------------------- /docs/images/triangle_v.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/triangle_v.png -------------------------------------------------------------------------------- /docs/images/triangle_y.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/docs/images/triangle_y.png -------------------------------------------------------------------------------- /docs/tools/config_templater/BUILD: -------------------------------------------------------------------------------- 1 | go_binary( 2 | name = "config_templater", 3 | srcs = ["template_config.go"], 4 | visibility = ["//docs/..."], 5 | deps = ["//src/core"], 6 | ) 7 | -------------------------------------------------------------------------------- /docs/tools/grammar_templater/BUILD: -------------------------------------------------------------------------------- 1 | go_binary( 2 | name = "grammar_templater", 3 | srcs = ["template_grammar.go"], 4 | visibility = ["//docs/..."], 5 | ) 6 | -------------------------------------------------------------------------------- /docs/tools/lexicon_templater/BUILD: -------------------------------------------------------------------------------- 1 | go_binary( 2 | name = "lexicon_templater", 3 | srcs = ["template_lexicon.go"], 4 | visibility = ["//docs/..."], 5 | deps = [ 6 | "///third_party/go/github.com_peterebden_go-cli-init_v5//flags", 7 | "//docs/tools/lexicon_templater/rules", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /docs/tools/lexicon_templater/rules/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "rules", 3 | srcs = ["rules.go"], 4 | visibility = ["//docs/..."], 5 | ) 6 | -------------------------------------------------------------------------------- /docs/tools/plugin_config_tool/BUILD: -------------------------------------------------------------------------------- 1 | go_binary( 2 | name = "plugin_config_tool", 3 | srcs = ["plugin_config_tool.go"], 4 | visibility = ["//docs/..."], 5 | deps = [ 6 | "///third_party/go/github.com_peterebden_go-cli-init_v5//flags", 7 | "///third_party/go/github.com_please-build_gcfg//:gcfg", 8 | "//docs/tools/lexicon_templater/rules", 9 | "//docs/tools/plugin_config_tool/plugin", 10 | "//src/core", 11 | ], 12 | ) 13 | -------------------------------------------------------------------------------- /docs/tools/plugin_config_tool/plugin/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "plugin", 3 | srcs = ["plugin.go"], 4 | visibility = ["//docs/..."], 5 | deps = ["//docs/tools/lexicon_templater/rules"], 6 | ) 7 | -------------------------------------------------------------------------------- /docs/tools/plugin_config_tool/plugin/plugin.go: -------------------------------------------------------------------------------- 1 | package plugin 2 | 3 | import "github.com/thought-machine/please/docs/tools/lexicon_templater/rules" 4 | 5 | type Plugin struct { 6 | Name, ID, Help, Codelab, Github string 7 | 8 | Config []*ConfigField 9 | Rules *rules.Rules 10 | } 11 | 12 | type ConfigField struct { 13 | Name, Type, Help, DefaultValue string 14 | Inherit, Repeatable, Defaults, Optional bool 15 | } 16 | -------------------------------------------------------------------------------- /docs/tools/plugin_templater/BUILD: -------------------------------------------------------------------------------- 1 | go_binary( 2 | name = "plugin_templater", 3 | srcs = ["main.go"], 4 | visibility = ["//docs/..."], 5 | deps = [ 6 | "///third_party/go/github.com_peterebden_go-cli-init_v5//flags", 7 | "//docs/tools/lexicon_templater/rules", 8 | "//docs/tools/plugin_config_tool/plugin", 9 | ], 10 | ) 11 | -------------------------------------------------------------------------------- /docs/tools/templater/BUILD: -------------------------------------------------------------------------------- 1 | go_binary( 2 | name = "templater", 3 | srcs = ["template.go"], 4 | visibility = ["//docs/..."], 5 | deps = ["///third_party/go/github.com_peterebden_go-cli-init_v5//flags"], 6 | ) 7 | -------------------------------------------------------------------------------- /log.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | 5 | function notice { 6 | >&2 echo -e "\033[32m$1\033[0m" 7 | } 8 | function warn { 9 | >&2 echo -e "\033[33m$1\033[0m" 10 | } 11 | -------------------------------------------------------------------------------- /please-servers-token.txt: -------------------------------------------------------------------------------- 1 | ovES3eR7-nBs5pgCpyrfY0kzepyrKK7w 2 | -------------------------------------------------------------------------------- /plugins/BUILD: -------------------------------------------------------------------------------- 1 | plugin_repo( 2 | name = "go", 3 | plugin = "go-rules", 4 | revision = "v1.21.5", 5 | ) 6 | 7 | plugin_repo( 8 | name = "cc", 9 | plugin = "cc-rules", 10 | revision = "v0.3.2", 11 | ) 12 | 13 | plugin_repo( 14 | name = "shell", 15 | plugin = "shell-rules", 16 | revision = "v0.1.1", 17 | ) 18 | 19 | plugin_repo( 20 | name = "python", 21 | plugin = "python-rules", 22 | revision = "v1.7.4", 23 | ) 24 | -------------------------------------------------------------------------------- /rules/BUILD: -------------------------------------------------------------------------------- 1 | build_defs = glob(["*.build_defs"]) 2 | 3 | go_library( 4 | name = "rules", 5 | srcs = ["rules.go"], 6 | resources = build_defs, 7 | visibility = ["PUBLIC"], 8 | ) 9 | 10 | go_test( 11 | name = "rules_test", 12 | srcs = ["rules_test.go"], 13 | resources = build_defs, 14 | visibility = ["PUBLIC"], 15 | deps = [ 16 | ":rules", 17 | "///third_party/go/github.com_stretchr_testify//assert", 18 | ], 19 | ) 20 | -------------------------------------------------------------------------------- /rules/README.md: -------------------------------------------------------------------------------- 1 | Built-in build rules 2 | -------------------- 3 | 4 | This directory contains the various built-in build rules for Please. 5 | They are mostly split up by language; `builtins.build_defs` contains the 6 | lowest-level builtin functions, many of which are known to the interpreter 7 | and have custom implementations. 8 | 9 | All of them are written in [the BUILD language](https://please.build/language.html). 10 | -------------------------------------------------------------------------------- /rules/bazel/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "bazel", 3 | srcs = ["bazel.go"], 4 | resources = glob(["*.build_defs"]), 5 | visibility = [ 6 | "//src/parse/...", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /rules/bazel/bazel.go: -------------------------------------------------------------------------------- 1 | // Package bazel provides some Bazel compatibility shims. 2 | package bazel 3 | 4 | import "embed" 5 | 6 | //go:embed *.build_defs 7 | var files embed.FS 8 | 9 | // AllFiles returns all the embedded files as a map of name to contents. 10 | func AllFiles() map[string][]byte { 11 | m := map[string][]byte{} 12 | entries, err := files.ReadDir(".") 13 | if err != nil { 14 | panic(err) 15 | } 16 | for _, entry := range entries { 17 | name := entry.Name() 18 | data, err := files.ReadFile(name) 19 | if err != nil { 20 | panic(err) 21 | } 22 | m[name] = data 23 | } 24 | return m 25 | } 26 | -------------------------------------------------------------------------------- /rules/bazel/http.build_defs: -------------------------------------------------------------------------------- 1 | """Contains some Bazel compatibility shims.""" 2 | -------------------------------------------------------------------------------- /src/assets/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "assets", 3 | srcs = ["assets.go"], 4 | pgo_file = "//:pgo", 5 | resources = [":resources"], 6 | visibility = ["//src/..."], 7 | ) 8 | 9 | go_test( 10 | name = "assets_test", 11 | srcs = ["assets_test.go"], 12 | # Has to be external (or provide the same resources as above) 13 | external = True, 14 | deps = [":assets"], 15 | ) 16 | 17 | filegroup( 18 | name = "resources", 19 | srcs = [ 20 | "//:pleasew", 21 | "//tools/misc:completion_script", 22 | ], 23 | ) 24 | -------------------------------------------------------------------------------- /src/assets/assets.go: -------------------------------------------------------------------------------- 1 | package assets 2 | 3 | import ( 4 | // need to be imported to trigger go embed 5 | _ "embed" 6 | ) 7 | 8 | // Pleasew is the please wrapper script 9 | // 10 | //go:embed pleasew 11 | var Pleasew []byte 12 | 13 | // PlzComplete is the plz completion script 14 | // 15 | //go:embed plz_complete.sh 16 | var PlzComplete []byte 17 | -------------------------------------------------------------------------------- /src/assets/assets_test.go: -------------------------------------------------------------------------------- 1 | package assets_test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/thought-machine/please/src/assets" 7 | ) 8 | 9 | func TestAssets(t *testing.T) { 10 | if len(assets.Pleasew) == 0 && string(assets.Pleasew) != "dummy" { 11 | panic("Pleasew was not set via embed") 12 | } 13 | if len(assets.PlzComplete) == 0 && string(assets.PlzComplete) != "dummy" { 14 | panic("PlzComplete was not set via embed") 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/assets/pleasew: -------------------------------------------------------------------------------- 1 | needed for `go build src/please.go` -------------------------------------------------------------------------------- /src/assets/plz_complete.sh: -------------------------------------------------------------------------------- 1 | needed for `go build src/please.go` -------------------------------------------------------------------------------- /src/build/test_data/hash_test/BUILD_FILE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/build/test_data/hash_test/BUILD_FILE -------------------------------------------------------------------------------- /src/build/test_data/local_remote_file.txt: -------------------------------------------------------------------------------- 1 | How much wood could a woodchuck chuck if a woodchuck could chuck wood? 2 | -------------------------------------------------------------------------------- /src/build/test_data/package1/BUILD_FILE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/build/test_data/package1/BUILD_FILE -------------------------------------------------------------------------------- /src/build/test_data/package1/package2/BUILD_FILE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/build/test_data/package1/package2/BUILD_FILE -------------------------------------------------------------------------------- /src/build/test_data/package1/package2/file1.py: -------------------------------------------------------------------------------- 1 | """test file for build_step_test""" 2 | -------------------------------------------------------------------------------- /src/build/test_data/package1/src5: -------------------------------------------------------------------------------- 1 | test file for build_step_test 2 | -------------------------------------------------------------------------------- /src/build/test_data/plz-out/gen/hash_test/bar.txt: -------------------------------------------------------------------------------- 1 | bar -------------------------------------------------------------------------------- /src/build/test_data/plz-out/gen/hash_test/foo.txt: -------------------------------------------------------------------------------- 1 | foo -------------------------------------------------------------------------------- /src/build/test_data/plz-out/gen/package1/file2: -------------------------------------------------------------------------------- 1 | test file for build_step_test 2 | -------------------------------------------------------------------------------- /src/build/test_data/plz-out/gen/package1/file3: -------------------------------------------------------------------------------- 1 | test file for build_step_test 2 | -------------------------------------------------------------------------------- /src/build/test_data/plz-out/gen/package1/file4: -------------------------------------------------------------------------------- 1 | test file for build_step_test 2 | -------------------------------------------------------------------------------- /src/build/test_data/plz-out/gen/package1/file5: -------------------------------------------------------------------------------- 1 | test file for build_step_test 2 | -------------------------------------------------------------------------------- /src/build/test_data/plz-out/gen/package3/file1: -------------------------------------------------------------------------------- 1 | test1 2 | -------------------------------------------------------------------------------- /src/build/test_data/plz-out/gen/package3/file2: -------------------------------------------------------------------------------- 1 | test2 2 | -------------------------------------------------------------------------------- /src/build/test_data/pypkg/__init__.py: -------------------------------------------------------------------------------- 1 | """output from //pypkg:target2""" 2 | -------------------------------------------------------------------------------- /src/build/test_data/pypkg/file1.py: -------------------------------------------------------------------------------- 1 | """test file for build_step_test""" 2 | -------------------------------------------------------------------------------- /src/build/test_data/secret: -------------------------------------------------------------------------------- 1 | secret val -------------------------------------------------------------------------------- /src/cache/noop.go: -------------------------------------------------------------------------------- 1 | package cache 2 | 3 | import ( 4 | "github.com/thought-machine/please/src/core" 5 | ) 6 | 7 | type noopCache struct { 8 | } 9 | 10 | func (n *noopCache) Store(*core.BuildTarget, []byte, []string) { 11 | 12 | } 13 | 14 | func (n *noopCache) Retrieve(*core.BuildTarget, []byte, []string) bool { 15 | return false 16 | } 17 | 18 | func (n *noopCache) Clean(*core.BuildTarget) { 19 | } 20 | 21 | func (n *noopCache) CleanAll() { 22 | } 23 | 24 | func (n *noopCache) Shutdown() { 25 | } 26 | -------------------------------------------------------------------------------- /src/cache/test_data/darwin_amd64/pkg/name/label_name/dGVzdF9rZXk/testfile: -------------------------------------------------------------------------------- 1 | test file for http cache 2 | -------------------------------------------------------------------------------- /src/cache/test_data/freebsd_amd64/pkg/name/label_name/dGVzdF9rZXk/testfile: -------------------------------------------------------------------------------- 1 | test file for http cache 2 | -------------------------------------------------------------------------------- /src/cache/test_data/linux_amd64/pkg/name/label_name/dGVzdF9rZXk/testfile: -------------------------------------------------------------------------------- 1 | test file for http cache 2 | -------------------------------------------------------------------------------- /src/cache/test_data/plz-out/gen/pkg/name/testfile2: -------------------------------------------------------------------------------- 1 | test file to be stored for rpc cache 2 | 3 | -------------------------------------------------------------------------------- /src/cache/test_data/plz-out/gen/pkg/name/testfile3: -------------------------------------------------------------------------------- 1 | test file to be stored & retrieved for rpc cache 2 | -------------------------------------------------------------------------------- /src/cache/test_data/plz-out/gen/pkg/name/testfile4: -------------------------------------------------------------------------------- 1 | test file to be stored & retrieved for rpc cache 2 | -------------------------------------------------------------------------------- /src/clean/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "clean", 3 | srcs = ["clean.go"], 4 | pgo_file = "//:pgo", 5 | visibility = ["PUBLIC"], 6 | deps = [ 7 | "//src/build", 8 | "//src/cli/logging", 9 | "//src/core", 10 | "//src/fs", 11 | "//src/test", 12 | ], 13 | ) 14 | 15 | go_test( 16 | name = "clean_test", 17 | srcs = ["clean_test.go"], 18 | deps = [ 19 | ":clean", 20 | "///third_party/go/github.com_stretchr_testify//assert", 21 | "//src/fs", 22 | ], 23 | ) 24 | -------------------------------------------------------------------------------- /src/cli/logging/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "logging", 3 | srcs = ["logging.go"], 4 | pgo_file = "//:pgo", 5 | visibility = ["PUBLIC"], 6 | deps = ["///third_party/go/gopkg.in_op_go-logging.v1//:go-logging.v1"], 7 | ) 8 | -------------------------------------------------------------------------------- /src/cli/winch_other.go: -------------------------------------------------------------------------------- 1 | //go:build !windows 2 | // +build !windows 3 | 4 | package cli 5 | 6 | import ( 7 | "os" 8 | "os/signal" 9 | "syscall" 10 | ) 11 | 12 | // notifyOnWindowResize calls the given function whenever the size of the terminal window changes 13 | // (when receiving a SIGWINCH on most platforms). 14 | func notifyOnWindowResize(f func()) { 15 | sig := make(chan os.Signal, 10) 16 | signal.Notify(sig, syscall.SIGWINCH) 17 | for range sig { 18 | f() 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/cli/winch_windows.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | // notifyOnWindowResize is a no-op on Windows. 4 | func notifyOnWindowResize(f func()) { 5 | } 6 | -------------------------------------------------------------------------------- /src/cli/window.go: -------------------------------------------------------------------------------- 1 | package cli 2 | 3 | import ( 4 | "os" 5 | 6 | "golang.org/x/term" 7 | ) 8 | 9 | // WindowSize finds and returns the size of the console window as (rows, columns) 10 | func WindowSize() (int, int, error) { 11 | cols, rows, err := term.GetSize(int(os.Stderr.Fd())) 12 | if err != nil { 13 | return 25, 80, err 14 | } 15 | return rows, cols, err 16 | } 17 | -------------------------------------------------------------------------------- /src/cmap/hash.go: -------------------------------------------------------------------------------- 1 | package cmap 2 | 3 | import ( 4 | "github.com/cespare/xxhash/v2" 5 | ) 6 | 7 | // XXHash calculates xxHash for a string, which is a fast high-quality hash function for a Map. 8 | func XXHash(s string) uint64 { 9 | return xxhash.Sum64String(s) 10 | } 11 | 12 | // XXHashes calculates the xxHash for a series of strings. 13 | func XXHashes(s ...string) uint64 { 14 | var result uint64 15 | for _, x := range s { 16 | result ^= xxhash.Sum64String(x) 17 | } 18 | return result 19 | } 20 | -------------------------------------------------------------------------------- /src/core/atomic_float32.go: -------------------------------------------------------------------------------- 1 | package core 2 | 3 | import ( 4 | "math" 5 | "sync/atomic" 6 | ) 7 | 8 | // Inspired by the go.uber.org/atomic Float32 type 9 | 10 | type atomicFloat32 struct { 11 | v uint32 12 | } 13 | 14 | func (f *atomicFloat32) Load() float32 { 15 | return math.Float32frombits(atomic.LoadUint32(&f.v)) 16 | } 17 | 18 | func (f *atomicFloat32) Store(val float32) { 19 | atomic.StoreUint32(&f.v, math.Float32bits(val)) 20 | } 21 | -------------------------------------------------------------------------------- /src/core/build_input_test.go: -------------------------------------------------------------------------------- 1 | package core 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestStringifyAnnotatedOutputLabel(t *testing.T) { 10 | l := AnnotatedOutputLabel{BuildLabel: BuildLabel{PackageName: "src/core", Name: "build_input_test"}} 11 | assert.Equal(t, "//src/core:build_input_test", l.String()) 12 | l.Annotation = "thing" 13 | assert.Equal(t, "//src/core:build_input_test|thing", l.String()) 14 | } 15 | -------------------------------------------------------------------------------- /src/core/previous_op_test.go: -------------------------------------------------------------------------------- 1 | package core 2 | 3 | import ( 4 | "os" 5 | "strings" 6 | "testing" 7 | 8 | "github.com/stretchr/testify/assert" 9 | ) 10 | 11 | func TestStoreCurrentOperation(t *testing.T) { 12 | StoreCurrentOperation() 13 | 14 | contents, err := os.ReadFile(previousOpFilePath) 15 | assert.Equal(t, os.Args[1:], strings.Split(strings.TrimSpace(string(contents)), " ")) 16 | assert.NoError(t, err) 17 | } 18 | 19 | func TestReadPreviousOperation(t *testing.T) { 20 | StoreCurrentOperation() 21 | assert.Equal(t, os.Args[1:], ReadPreviousOperationOrDie()) 22 | } 23 | -------------------------------------------------------------------------------- /src/core/subrepo_test.go: -------------------------------------------------------------------------------- 1 | package core 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/stretchr/testify/assert" 7 | ) 8 | 9 | func TestDir(t *testing.T) { 10 | s := &Subrepo{Name: "repo", Root: "plz-out/gen/repo"} 11 | assert.Equal(t, "plz-out/gen/repo/package", s.Dir("package")) 12 | } 13 | -------------------------------------------------------------------------------- /src/core/test_data/BUILD_FILE: -------------------------------------------------------------------------------- 1 | # Not a real BUILD file, used in interpreter_test. 2 | -------------------------------------------------------------------------------- /src/core/test_data/alias.plzconfig: -------------------------------------------------------------------------------- 1 | [alias "auth"] 2 | cmd = run //infra:auth -- 3 | desc = Authenticates you. 4 | subcommand = gcp 5 | subcommand = aws k8s 6 | subcommand = aws ecr 7 | flag = --host 8 | flag = --repo 9 | 10 | [alias "query owners"] 11 | cmd = run //query:owners -- 12 | desc = Queries owners of a thing. 13 | -------------------------------------------------------------------------------- /src/core/test_data/buildenv.plzconfig: -------------------------------------------------------------------------------- 1 | [buildenv] 2 | foo-bar = second 3 | bar-bar = first 4 | -------------------------------------------------------------------------------- /src/core/test_data/bytesize_bad.plzconfig: -------------------------------------------------------------------------------- 1 | [cache] 2 | dircachehighwatermark = 500mabob 3 | -------------------------------------------------------------------------------- /src/core/test_data/bytesize_good.plzconfig: -------------------------------------------------------------------------------- 1 | [cache] 2 | dircachehighwatermark = 500MB 3 | -------------------------------------------------------------------------------- /src/core/test_data/duration_bad.plzconfig: -------------------------------------------------------------------------------- 1 | [build] 2 | timeout = 500eons 3 | -------------------------------------------------------------------------------- /src/core/test_data/duration_good.plzconfig: -------------------------------------------------------------------------------- 1 | [build] 2 | timeout = 500ms 3 | [test] 4 | timeout = 5 5 | -------------------------------------------------------------------------------- /src/core/test_data/failing.plzconfig: -------------------------------------------------------------------------------- 1 | ==[python] 2 | pext 3 | 4 | [java] 5 | javactool = javac 6 | sourceversion = 7 7 | targetversion = 7 -------------------------------------------------------------------------------- /src/core/test_data/hashcheckers.plzconfig: -------------------------------------------------------------------------------- 1 | [build] 2 | hashcheckers = blake3 3 | -------------------------------------------------------------------------------- /src/core/test_data/metrics.plzconfig: -------------------------------------------------------------------------------- 1 | [metrics] 2 | pushgatewayurl = http://localhost:9091 3 | 4 | [custommetriclabels] 5 | branch = git rev-parse --abbrev-ref HEAD 6 | -------------------------------------------------------------------------------- /src/core/test_data/passenv.plzconfig: -------------------------------------------------------------------------------- 1 | [Build] 2 | PassEnv = FOO 3 | PassEnv = BAR 4 | PassEnv = PATH 5 | -------------------------------------------------------------------------------- /src/core/test_data/passunsafeenv.plzconfig: -------------------------------------------------------------------------------- 1 | [Build] 2 | PassUnsafeEnv = FOO 3 | PassUnsafeEnv = BAR 4 | PassUnsafeEnv = PATH 5 | -------------------------------------------------------------------------------- /src/core/test_data/plugin.plzconfig: -------------------------------------------------------------------------------- 1 | [Plugin "foo"] 2 | FoocTool = fooc 3 | 4 | -------------------------------------------------------------------------------- /src/core/test_data/project/BUILD_FILE: -------------------------------------------------------------------------------- 1 | # Not a real BUILD file, used in interpreter_test. 2 | -------------------------------------------------------------------------------- /src/core/test_data/project/project.file: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/core/test_data/project/project.file -------------------------------------------------------------------------------- /src/core/test_data/project/sub_package/BUILD_FILE: -------------------------------------------------------------------------------- 1 | # Not a real BUILD file, used in interpreter_test. 2 | -------------------------------------------------------------------------------- /src/core/test_data/project/sub_package/sub_package.file: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/core/test_data/project/sub_package/sub_package.file -------------------------------------------------------------------------------- /src/core/test_data/slices.plzconfig: -------------------------------------------------------------------------------- 1 | [build] 2 | path = /sbin -------------------------------------------------------------------------------- /src/core/test_data/testrunner_bad.plzconfig: -------------------------------------------------------------------------------- 1 | [build] 2 | hashfunction = md5 3 | -------------------------------------------------------------------------------- /src/core/test_data/testrunner_good.plzconfig: -------------------------------------------------------------------------------- 1 | [build] 2 | hashfunction = sha256 3 | [python] 4 | testrunner = pytest 5 | -------------------------------------------------------------------------------- /src/core/test_data/version_bad.plzconfig: -------------------------------------------------------------------------------- 1 | [please] 2 | version = not_a_semver -------------------------------------------------------------------------------- /src/core/test_data/version_good.plzconfig: -------------------------------------------------------------------------------- 1 | [please] 2 | version = 2.3.4 -------------------------------------------------------------------------------- /src/core/test_data/working.plzconfig: -------------------------------------------------------------------------------- 1 | [please] 2 | location = ./plz-out/please 3 | 4 | [python] 5 | pextool = pexmabob 6 | 7 | [java] 8 | javactool = javac 9 | jlinktool = jlink 10 | javahome = /path/to/java/home 11 | sourcelevel = 8 12 | targetlevel = 7 13 | releaseLevel = 10 14 | -------------------------------------------------------------------------------- /src/core/test_data/working.plzconfig.dev: -------------------------------------------------------------------------------- 1 | [java] 2 | javactool = /opt/java/bin/javac 3 | targetlevel = 8 4 | -------------------------------------------------------------------------------- /src/debug/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "debug", 3 | srcs = ["debug.go"], 4 | pgo_file = "//:pgo", 5 | visibility = ["PUBLIC"], 6 | deps = [ 7 | "//src/cli/logging", 8 | "//src/core", 9 | "//src/exec", 10 | "//src/process", 11 | ], 12 | ) 13 | -------------------------------------------------------------------------------- /src/exec/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "exec", 3 | srcs = ["exec.go"], 4 | pgo_file = "//:pgo", 5 | visibility = ["PUBLIC"], 6 | deps = [ 7 | "///third_party/go/golang.org_x_sync//errgroup", 8 | "//src/cli/logging", 9 | "//src/core", 10 | "//src/process", 11 | ], 12 | ) 13 | 14 | go_test( 15 | name = "exec_test", 16 | srcs = ["exec_test.go"], 17 | deps = [ 18 | ":exec", 19 | "///third_party/go/github.com_stretchr_testify//assert", 20 | "//src/build", 21 | "//src/core", 22 | "//src/fs", 23 | "//src/process", 24 | ], 25 | ) 26 | -------------------------------------------------------------------------------- /src/export/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "export", 3 | srcs = ["export.go"], 4 | pgo_file = "//:pgo", 5 | visibility = ["PUBLIC"], 6 | deps = [ 7 | "//src/cli/logging", 8 | "//src/core", 9 | "//src/fs", 10 | "//src/gc", 11 | "//src/parse", 12 | ], 13 | ) 14 | -------------------------------------------------------------------------------- /src/format/test_data/build_target.after.build: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = f"{name}_lib", 3 | srcs = glob(["*.go"]), 4 | visibility = ["PUBLIC"], 5 | deps = ["//src/core"], 6 | ) 7 | -------------------------------------------------------------------------------- /src/format/test_data/build_target.before.build: -------------------------------------------------------------------------------- 1 | go_library( 2 | deps = ["//src/core"], 3 | name=f'{name}_lib', 4 | visibility =["PUBLIC"], 5 | srcs =glob(["*.go"]), 6 | ) 7 | -------------------------------------------------------------------------------- /src/format/test_data/function_types_aliases.after.build: -------------------------------------------------------------------------------- 1 | def no_type(arg): 2 | pass 3 | 4 | def one_type(arg:str): 5 | pass 6 | 7 | def multiple_types(arg:int|str): 8 | pass 9 | 10 | def one_type_default(arg:str=10): 11 | pass 12 | 13 | def multiple_types_default(arg:int|str=10): 14 | pass 15 | 16 | def one_alias(arg:int|str&oldarg): 17 | pass 18 | 19 | def multiple_aliases(arg:int|str&oldarg&oldarg2): 20 | pass 21 | 22 | def one_alias_with_default(arg:int|str&oldarg=10): 23 | pass 24 | 25 | def multiple_aliases_with_default(arg:int|str&oldarg&oldarg2=10): 26 | pass 27 | -------------------------------------------------------------------------------- /src/format/test_data/function_types_aliases.before.build: -------------------------------------------------------------------------------- 1 | def no_type(arg): 2 | pass 3 | 4 | def one_type(arg: str): 5 | pass 6 | 7 | def multiple_types(arg: int | str): 8 | pass 9 | 10 | def one_type_default(arg: str = 10): 11 | pass 12 | 13 | def multiple_types_default(arg: int | str = 10): 14 | pass 15 | 16 | def one_alias(arg: int | str & oldarg): 17 | pass 18 | 19 | def multiple_aliases(arg: int | str & oldarg & oldarg2): 20 | pass 21 | 22 | def one_alias_with_default(arg: int | str & oldarg = 10): 23 | pass 24 | 25 | def multiple_aliases_with_default(arg: int | str & oldarg & oldarg2 = 10): 26 | pass 27 | -------------------------------------------------------------------------------- /src/format/test_data/is_precedence.after.build: -------------------------------------------------------------------------------- 1 | x = (y is not None) 2 | -------------------------------------------------------------------------------- /src/format/test_data/is_precedence.before.build: -------------------------------------------------------------------------------- 1 | x = ((y is not None)) 2 | -------------------------------------------------------------------------------- /src/format/test_data/subincludes.after.build: -------------------------------------------------------------------------------- 1 | subinclude("//build_defs:go", "///python//build_defs:python", "///cc//build_defs:cc", "//build_defs:test") 2 | 3 | python_library( 4 | name = "lib", 5 | srcs = glob(["*.py"]), 6 | ) 7 | -------------------------------------------------------------------------------- /src/format/test_data/subincludes.before.build: -------------------------------------------------------------------------------- 1 | subinclude("//build_defs:go") 2 | 3 | subinclude("///python//build_defs:python") 4 | 5 | subinclude("///cc//build_defs:cc", "//build_defs:test") 6 | 7 | python_library( 8 | name = "lib", 9 | srcs = glob(["*.py"]), 10 | ) 11 | -------------------------------------------------------------------------------- /src/fs/home.go: -------------------------------------------------------------------------------- 1 | package fs 2 | 3 | import ( 4 | "os" 5 | "strings" 6 | 7 | "github.com/peterebden/go-deferred-regex" 8 | ) 9 | 10 | var homeRex = deferredregex.DeferredRegex{Re: "(?:^|:)(~(?:[/:]|$))"} 11 | 12 | // ExpandHomePath expands all prefixes of ~ without a user specifier to $HOME. 13 | func ExpandHomePath(path string) string { 14 | return ExpandHomePathTo(path, os.Getenv("HOME")) 15 | } 16 | 17 | // ExpandHomePathTo expands all prefixes of ~ without a user specifier to the given string. 18 | func ExpandHomePathTo(path, to string) string { 19 | return homeRex.ReplaceAllStringFunc(path, func(subpath string) string { 20 | return strings.ReplaceAll(subpath, "~", to) 21 | }) 22 | } 23 | -------------------------------------------------------------------------------- /src/fs/home_test.go: -------------------------------------------------------------------------------- 1 | package fs 2 | 3 | import ( 4 | "os" 5 | "testing" 6 | 7 | "github.com/stretchr/testify/assert" 8 | ) 9 | 10 | func TestExpandHomePath(t *testing.T) { 11 | HOME := os.Getenv("HOME") 12 | cases := []struct { 13 | in, want string 14 | }{ 15 | {"", ""}, 16 | {"~", HOME}, 17 | {"~username", "~username"}, 18 | {"~:/bin/~:/usr/local", HOME + ":/bin/~:/usr/local"}, 19 | {"/bin:~/bin:~/script:/usr/local/bin", 20 | "/bin:" + HOME + "/bin:" + HOME + "/script:/usr/local/bin"}, 21 | } 22 | for _, c := range cases { 23 | assert.Equal(t, c.want, ExpandHomePath(c.in)) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/fs/iofs.go: -------------------------------------------------------------------------------- 1 | package fs 2 | 3 | import ( 4 | iofs "io/fs" 5 | "os" 6 | ) 7 | 8 | type osFS struct{} 9 | 10 | func (osFS) ReadDir(name string) ([]iofs.DirEntry, error) { 11 | return os.ReadDir(name) 12 | } 13 | 14 | func (osFS) Open(name string) (iofs.File, error) { 15 | return os.Open(name) 16 | } 17 | 18 | // HostFS returns an io/fs.FS that behaves the same as the host OS i.e. the same way os.Open works. 19 | var HostFS = osFS{} 20 | -------------------------------------------------------------------------------- /src/fs/test_data/.test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/fs/test_data/.test -------------------------------------------------------------------------------- /src/fs/test_data/test.txt: -------------------------------------------------------------------------------- 1 | Test file for glob_test 2 | -------------------------------------------------------------------------------- /src/fs/test_data/test_subfolder++/test.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/fs/test_data/test_subfolder++/test.txt -------------------------------------------------------------------------------- /src/fs/test_data/test_subfolder1/a.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/fs/test_data/test_subfolder1/a.txt -------------------------------------------------------------------------------- /src/fs/test_data/test_subfolder1/sub_sub_folder/b.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/fs/test_data/test_subfolder1/sub_sub_folder/b.txt -------------------------------------------------------------------------------- /src/fs/test_data/test_subfolder3/Zest.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/fs/test_data/test_subfolder3/Zest.py -------------------------------------------------------------------------------- /src/fs/test_data/test_subfolder3/best.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/fs/test_data/test_subfolder3/best.py -------------------------------------------------------------------------------- /src/fs/test_data/test_subfolder3/test.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/fs/test_data/test_subfolder3/test.py -------------------------------------------------------------------------------- /src/fs/test_data/test_subfolder4/TEST_BUILD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/fs/test_data/test_subfolder4/TEST_BUILD -------------------------------------------------------------------------------- /src/fs/test_data/test_subfolder4/test.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/fs/test_data/test_subfolder4/test.py -------------------------------------------------------------------------------- /src/gc/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "gc", 3 | srcs = ["gc.go"], 4 | pgo_file = "//:pgo", 5 | visibility = ["PUBLIC"], 6 | deps = [ 7 | "//src/cli", 8 | "//src/cli/logging", 9 | "//src/core", 10 | "//src/parse/asp", 11 | "//src/scm", 12 | ], 13 | ) 14 | 15 | go_test( 16 | name = "gc_test", 17 | srcs = [ 18 | "gc_test.go", 19 | "rewrite_test.go", 20 | ], 21 | data = [ 22 | "test_data", 23 | ], 24 | deps = [ 25 | ":gc", 26 | "///third_party/go/github.com_stretchr_testify//assert", 27 | "//src/core", 28 | "//src/fs", 29 | ], 30 | ) 31 | -------------------------------------------------------------------------------- /src/generate/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "generate", 3 | srcs = ["generate.go"], 4 | pgo_file = "//:pgo", 5 | visibility = ["//src/..."], 6 | deps = [ 7 | "//src/cli/logging", 8 | "//src/core", 9 | "//src/fs", 10 | "//src/scm", 11 | ], 12 | ) 13 | -------------------------------------------------------------------------------- /src/hashes/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "hashes", 3 | srcs = ["rewrite_hashes.go"], 4 | pgo_file = "//:pgo", 5 | visibility = ["PUBLIC"], 6 | deps = [ 7 | "//src/cli/logging", 8 | "//src/core", 9 | "//src/parse/asp", 10 | ], 11 | ) 12 | 13 | go_test( 14 | name = "hash_rewriter_test", 15 | srcs = ["hash_rewriter_test.go"], 16 | data = [ 17 | "test_data", 18 | ], 19 | deps = [ 20 | ":hashes", 21 | "///third_party/go/github.com_stretchr_testify//assert", 22 | "//src/core", 23 | "//src/fs", 24 | ], 25 | ) 26 | -------------------------------------------------------------------------------- /src/metrics/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "metrics", 3 | srcs = ["prometheus.go"], 4 | pgo_file = "//:pgo", 5 | visibility = ["PUBLIC"], 6 | deps = [ 7 | "///third_party/go/github.com_prometheus_client_golang//prometheus", 8 | "///third_party/go/github.com_prometheus_client_golang//prometheus/push", 9 | "///third_party/go/github.com_prometheus_common//expfmt", 10 | "//src/cli", 11 | "//src/cli/logging", 12 | "//src/version", 13 | ], 14 | ) 15 | -------------------------------------------------------------------------------- /src/parse/asp/main/BUILD: -------------------------------------------------------------------------------- 1 | go_binary( 2 | name = "asp", 3 | srcs = ["main.go"], 4 | deps = [ 5 | "///third_party/go/github.com_davecgh_go-spew//spew", 6 | "//rules", 7 | "//src/cli", 8 | "//src/cli/logging", 9 | "//src/core", 10 | "//src/fs", 11 | "//src/parse/asp", 12 | ], 13 | ) 14 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/assert.build: -------------------------------------------------------------------------------- 1 | assert isinstance(name, str), "Argument name to cc_library must be a str" 2 | 3 | def test_assert(): 4 | assert 1 == 1 5 | 6 | assert True, "True is %s" % True 7 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/assignments.build: -------------------------------------------------------------------------------- 1 | x = { 2 | 'mickey': 3, 3 | 'donald': 'sora', 4 | 'goofy': riku, 5 | } 6 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/aug_assign.build: -------------------------------------------------------------------------------- 1 | hdrs += src_hdrs 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/basic.build: -------------------------------------------------------------------------------- 1 | # Extremely basic file to test parser. 2 | def test(x): 3 | pass 4 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/comprehension.build: -------------------------------------------------------------------------------- 1 | a = [x for x in y if x == 5] 2 | 3 | b = {x + y: y for x, y in y.items() if x == 5} 4 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/constant_assign.build: -------------------------------------------------------------------------------- 1 | # This should fail, you shouldn't be able to assign to constants or keywords. 2 | False = True 3 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/default_arguments.build: -------------------------------------------------------------------------------- 1 | def test(name='name', timeout=10, 2 | args=None): 3 | pass 4 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/destructuring_assign.build: -------------------------------------------------------------------------------- 1 | x, y = something() 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/double_unindent.build: -------------------------------------------------------------------------------- 1 | for y in x: 2 | for z in y: 3 | genrule( 4 | name = 'name', 5 | ) 6 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/else.build: -------------------------------------------------------------------------------- 1 | if x: 2 | pass 3 | elif y: 4 | pass 5 | elif z: 6 | pass 7 | else: 8 | pass 9 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/environment.build: -------------------------------------------------------------------------------- 1 | def rust_library(name:str, srcs:list, deps:list=None): 2 | """Totally builds a Rust library, yeah?""" 3 | pass 4 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/example_1.build: -------------------------------------------------------------------------------- 1 | def cc_library(): 2 | """Generate a C or C++ library target.""" 3 | if x: 4 | pass 5 | 6 | return 1 7 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/example_2.build: -------------------------------------------------------------------------------- 1 | subinclude('//build_defs:version') 2 | 3 | ################################################################# 4 | 5 | go_binary( 6 | name = 'bin', 7 | ) 8 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/example_3.build: -------------------------------------------------------------------------------- 1 | y = visibility.get( 2 | x, 3 | ['PUBLIC'], 4 | ) 5 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/example_4.build: -------------------------------------------------------------------------------- 1 | return ' '.join(compiler_flags) + ' ' 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/example_5.build: -------------------------------------------------------------------------------- 1 | go_compile_tool = 'compile' if CONFIG.GO_VERSION >= "1.5" else '6g' 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/example_6.build: -------------------------------------------------------------------------------- 1 | options = ' '.join(['-o ' + option for option in optional]) if optional else '' 2 | 3 | Myfunc( 4 | name = "{time}-{message}".format(time='today', message='msg') 5 | ) 6 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/file_position_simple.build: -------------------------------------------------------------------------------- 1 | # This 2 | # is a fairly 3 | # short file to 4 | # test file position code 5 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/for_statement.build: -------------------------------------------------------------------------------- 1 | LANGUAGES = [ 2 | 'python', 3 | 'go', 4 | ] 5 | 6 | for language in LANGUAGES: 7 | name = language 8 | proto_library( 9 | name = name, 10 | srcs = ['test.proto'], 11 | languages = [language], # This makes no sense really, but it's just a test so who cares. 12 | ) 13 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/fstring.build: -------------------------------------------------------------------------------- 1 | x = 'a' 2 | y = f'{x}' 3 | z = f'x: {x} y: {y} fin' 4 | 5 | def fstring(): 6 | y = f'{x}' 7 | 8 | 9 | nested = { 10 | "outside": { 11 | "inside": 6, 12 | }, 13 | } 14 | 15 | 16 | nest_test = f"{nested.outside.inside}" -------------------------------------------------------------------------------- /src/parse/asp/test_data/function_call.build: -------------------------------------------------------------------------------- 1 | package() 2 | package() 3 | package(default_visibility = ['PUBLIC']) 4 | 5 | python_library( 6 | name = 'lib', 7 | srcs = [ 8 | 'lib1.py', 9 | 'lib2.py', 10 | ], 11 | ) 12 | 13 | subinclude('//build_defs:version') 14 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/function_def.build: -------------------------------------------------------------------------------- 1 | def cc_library(name, srcs=None, hdrs=None, private_hdrs=None, deps=None, visibility=None, test_only=False, 2 | compiler_flags=None, linker_flags=None, pkg_config_libs=None, includes=None, defines=None, 3 | alwayslink=False, _c=False): 4 | """Generate a C or C++ library target.""" 5 | srcs = srcs or [] 6 | 7 | hdrs = hdrs or [] 8 | 9 | deps = deps or [] 10 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/if_statement.build: -------------------------------------------------------------------------------- 1 | if condition_a and condition_b: 2 | genrule( 3 | name = 'rule', 4 | ) 5 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/indexing.build: -------------------------------------------------------------------------------- 1 | x = 'test' 2 | 3 | y = x[2] 4 | 5 | z = x[1:-1] 6 | 7 | a = x[2:] 8 | 9 | b = x[:2] 10 | 11 | c = x[y] 12 | 13 | b = x[0].startswith('hello') 14 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/inline_if.build: -------------------------------------------------------------------------------- 1 | x = ['default'] if y is None else [y] 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/aliases.build: -------------------------------------------------------------------------------- 1 | def f(x:int, y:int&z&w): 2 | return x + y 3 | 4 | v = f(x=40, z=2) 5 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/all.build: -------------------------------------------------------------------------------- 1 | # true: 2 | t1 = all([True]) 3 | t2 = all([1]) 4 | t3 = all(["1"]) 5 | t4 = all([{"1": "one"}]) 6 | t5 = all([[1]]) 7 | t6 = all([True, True]) 8 | t7 = all([1, 1]) 9 | t8 = all(["1", "1"]) 10 | t9 = all([[1], [1]]) 11 | 12 | # false: 13 | f1 = all([False]) 14 | f2 = all([0]) 15 | f3 = all([""]) 16 | f4 = all([{}]) 17 | f5 = all([[]]) 18 | f6 = all([True, True, False]) 19 | f7 = all([1, 1, 0]) 20 | f8 = all(["1", "1", ""]) 21 | f9 = all([[1], [1], []]) 22 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/any.build: -------------------------------------------------------------------------------- 1 | # true: 2 | t1 = any([True]) 3 | t2 = any([1]) 4 | t3 = any(["1"]) 5 | t4 = any([{"1": "one"}]) 6 | t5 = any([[1]]) 7 | t6 = any([False, True]) 8 | t7 = any([0, 1]) 9 | t8 = any(["0", "1"]) 10 | t9 = any([[0], [1]]) 11 | 12 | # false: 13 | f1 = any([False]) 14 | f2 = any([0]) 15 | f3 = any([""]) 16 | f4 = any([{}]) 17 | f5 = any([[]]) 18 | f6 = any([False, False, False]) 19 | f7 = any([0, 0, 0]) 20 | f8 = any(["", "", ""]) 21 | f9 = any([[], [], []]) 22 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/argument_compatibility.build: -------------------------------------------------------------------------------- 1 | def test(y:list=[]): 2 | return y + [1] 3 | 4 | x = test(y = None) 5 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/arguments.build: -------------------------------------------------------------------------------- 1 | def test(a, b, c=True): 2 | return '%s:%s:%s' % (a, b, c) 3 | 4 | 5 | x = test('a', 'b') 6 | 7 | y = test(b='b', a='a', c='c') 8 | 9 | z = test('a', 'b', c='c') 10 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/break_loop.build: -------------------------------------------------------------------------------- 1 | for i in range(1, 3): 2 | break 3 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/builtins.build: -------------------------------------------------------------------------------- 1 | build_rule( 2 | name = 'lib', 3 | cmd = 'true', 4 | ) 5 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/chr.build: -------------------------------------------------------------------------------- 1 | null = chr(0) 2 | a = chr(97) 3 | euro = chr(8364) 4 | maximum = chr(1114111) 5 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/chr_bounds_high.build: -------------------------------------------------------------------------------- 1 | x = chr(1114112) 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/chr_bounds_low.build: -------------------------------------------------------------------------------- 1 | x = chr(-1) 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/chr_wrong_type.build: -------------------------------------------------------------------------------- 1 | x = chr("x") 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/collections.build: -------------------------------------------------------------------------------- 1 | l = [1, 2, 3] 2 | 3 | x = 2 in l 4 | 5 | d = {'a': 1, 'b': 2} 6 | 7 | y = 'a' in d 8 | z = 'z' in d 9 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/comprehensions.build: -------------------------------------------------------------------------------- 1 | file_srcs = [src for src in ['file1', 'file2', ':rule1'] if src[0] not in [':', '/']] 2 | 3 | file_numbers = {src: src[-1] for src in file_srcs} 4 | 5 | pairs = [file_src + '+' + src for file_src in file_srcs for src in ['file1', 'file2', ':rule1']] 6 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/config.build: -------------------------------------------------------------------------------- 1 | g = CONFIG.get("ARCAT_TOOL") == "/////_please:arcat" 2 | 3 | keys = CONFIG.keys() 4 | k1 = "ARCAT_TOOL" in keys 5 | keys_sorted = sorted(keys) 6 | k2 = keys == keys_sorted 7 | 8 | v = "/////_please:arcat" in CONFIG.values() 9 | 10 | i = False 11 | for key, val in CONFIG.items(): 12 | if key == "ARCAT_TOOL" and val == "/////_please:arcat": 13 | i = True 14 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/continue.build: -------------------------------------------------------------------------------- 1 | a = [] 2 | 3 | for x in range(6): 4 | if x < 4: 5 | continue 6 | a += [x] 7 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/dict_union.build: -------------------------------------------------------------------------------- 1 | x = {"goofy": 3, "donald": 5} 2 | y = {"donald": 2, "mickey": 1} 3 | z = x | y 4 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/divide.build: -------------------------------------------------------------------------------- 1 | i = 6 / 7 2 | j = 42 / 6 3 | k = 4 / -2 4 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/double_index.build: -------------------------------------------------------------------------------- 1 | x = [[1], [2]] 2 | y = x[0][0] 3 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/equality.build: -------------------------------------------------------------------------------- 1 | # Bools are singletons so 'is' works as expected 2 | x = True 3 | y = True 4 | z = False 5 | 6 | a = x == y 7 | b = x is y 8 | c = x == z 9 | d = x is z 10 | 11 | # Ints aren't. 12 | x = 1 13 | y = 1 14 | z = 2 15 | 16 | e = x == y 17 | f = x is y 18 | g = x == z 19 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/filter.build: -------------------------------------------------------------------------------- 1 | # identity 2 | f1 = filter(lambda x: x, [0, 1, 2, 3]) 3 | 4 | # odd numbers 5 | f2 = filter(lambda x: (x % 2) == 0, [0, 1, 2, 3]) 6 | 7 | # context 8 | need = 5 9 | f3 = filter(lambda x: x == need, [0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 0]) 10 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/format.build: -------------------------------------------------------------------------------- 1 | arch = "LLVM_NATIVE_ARCH=\\\"{}\\\"".format('x86') 2 | arch2 = "ARCH=\"{}_{}\"".format('linux', 'amd64') 3 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/fstring_optimisation.build: -------------------------------------------------------------------------------- 1 | x = f'test' 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/fstrings.build: -------------------------------------------------------------------------------- 1 | x = 'mickey' 2 | y = 'donald' 3 | z = f'{x} {y} ${goofy} {{sora}}' 4 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/interpolation.build: -------------------------------------------------------------------------------- 1 | x = '//%s:%d' % ('abc', 123) 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/isnot.build: -------------------------------------------------------------------------------- 1 | x = [] is not None -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/list_concat.build: -------------------------------------------------------------------------------- 1 | fruit = [ 2 | "apple", 3 | "banana", 4 | ] 5 | 6 | fruit_and_veg = fruit + [ 7 | "edamame", 8 | "fennel", 9 | ] 10 | 11 | fruit_veg_and_canned_food = fruit_and_veg + [ 12 | "tuna", 13 | "baked beans", 14 | ] 15 | 16 | fruit_veg_canned_food_and_sweets = fruit_veg_and_canned_food + [ 17 | "haribo", 18 | ] 19 | 20 | fruit_veg_canned_food_and_drinks = fruit_veg_and_canned_food + [ 21 | "matcha latte", 22 | ] 23 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/log.build: -------------------------------------------------------------------------------- 1 | log.debug('debug') 2 | 3 | log.info('info') 4 | 5 | log.notice('notice') 6 | 7 | log.warning('warning') 8 | 9 | log.error('error') 10 | 11 | # We can't test log.fatal here because it terminates the test, even with a fake log backend. 12 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/map.build: -------------------------------------------------------------------------------- 1 | # identity 2 | m1 = map(lambda x: x, [0, 1, 2, 3]) 3 | 4 | # add 1 5 | m2 = map(lambda x: x + 1, [0, 1, 2, 3]) 6 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/max.build: -------------------------------------------------------------------------------- 1 | # 5 2 | i1 = max([5]) 3 | i2 = max([1, 2, 3, 4, 5]) 4 | i3 = max([5, 4, 3, 2, 1]) 5 | 6 | # "two" 7 | s1 = max(["two"]) 8 | s2 = max(["one", "two", "three", "four", "five"]) 9 | s3 = max(["five", "four", "three", "two", "one"]) 10 | 11 | # "three" 12 | s4 = max(["three"], len) 13 | s5 = max(["one", "two", "three", "four", "five"], len) 14 | s6 = max(["five", "four", "three", "two", "one"], len) 15 | 16 | # "one" (for stability) 17 | s7 = max(["one", "two", "ten"], len) 18 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/min.build: -------------------------------------------------------------------------------- 1 | # 1 2 | i1 = min([1]) 3 | i2 = min([1, 2, 3, 4, 5]) 4 | i3 = min([5, 4, 3, 2, 1]) 5 | 6 | # "five" 7 | s1 = min(["five"]) 8 | s2 = min(["one", "two", "three", "four", "five"]) 9 | s3 = min(["five", "four", "three", "two", "one"]) 10 | 11 | # "ten" 12 | s4 = min(["ten"], len) 13 | s5 = min(["ten", "eleven", "twelve", "thirteen", "fourteen"], len) 14 | s6 = min(["fourteen", "thirteen", "twelve", "eleven", "ten"], len) 15 | 16 | # "one" (for stability) 17 | s7 = min(["one", "two", "ten"], len) 18 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/multiply.build: -------------------------------------------------------------------------------- 1 | i1 = 6 * 7 2 | i2 = 7 * 6 3 | s1 = 'abc' * 3 4 | s2 = 3 * 'abc' 5 | l1 = ['a', 'b'] * 2 6 | l2 = 2 * ['a', 'b'] 7 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/mutable_arguments.build: -------------------------------------------------------------------------------- 1 | def test(a, b=x): 2 | return a + b 3 | 4 | x = 5 5 | 6 | y = test(3) 7 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/operator_precedence.build: -------------------------------------------------------------------------------- 1 | a = 15 / 3 + 10 2 | b = 3 + 10 * 5 3 | c = 4 / 2 + 5 * 6 4 | d = 2 + 3 < 4 5 | e = 2 + 3 < 2 + 2 6 | f = 1 + 2 - 3 == 4 * 5 - 20 7 | g = 4 / 1 + 1 8 | h = 4 / (1 + 1) 9 | i = '' or 'b' + 'c' 10 | j = 'a' or 'b' + 'c' 11 | k = 0 and 0 or 1 12 | l = 1 or 0 and 0 13 | m = not "a" in ["a", "b", "c"] 14 | n = not "a" in ["b", "c", "d"] 15 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/operators.build: -------------------------------------------------------------------------------- 1 | def x(a, b): 2 | return a + b 3 | 4 | y = x(3, 4) 5 | 6 | z = True if y < 10 else False 7 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/optimisations.build: -------------------------------------------------------------------------------- 1 | _PARSER_BINARIES = { 2 | 'python27': 'python2.7', 3 | 'python34': 'python3.4', 4 | 'python35': 'python3.5', 5 | 'python36': 'python3.6', 6 | } 7 | 8 | PARSER_TOOL = _PARSER_BINARIES[CONFIG.PARSER_ENGINE] 9 | PARSER_LIB_NAME = PARSER_TOOL # Happens to be the same for now. 10 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/optimise_config.build: -------------------------------------------------------------------------------- 1 | x = CONFIG.GO_TOOL 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/optimise_join.build: -------------------------------------------------------------------------------- 1 | x = ' '.join(['1', '2', '3']) 2 | y = ' '.join([z for z in ['1', '2', '3']]) 3 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/ord.build: -------------------------------------------------------------------------------- 1 | a = ord("a") 2 | euro = ord("€") 3 | cmd = ord("⌘") 4 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/ord_empty.build: -------------------------------------------------------------------------------- 1 | x = ord("") 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/ord_multiple.build: -------------------------------------------------------------------------------- 1 | # U+0069 : LATIN SMALL LETTER I 2 | # U+0301 : COMBINING ACUTE ACCENT {stress mark; Greek oxia, tonos} 3 | x = ord("í") 4 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/ord_wrong_type.build: -------------------------------------------------------------------------------- 1 | x = ord(42) 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/parentheses.build: -------------------------------------------------------------------------------- 1 | x = (1 if True else 2) 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/partition.build: -------------------------------------------------------------------------------- 1 | major, mid, minor = '27.0.3'.partition('.0.') 2 | start, sep, end = "begin sep end".rpartition("sep") -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/paths.build: -------------------------------------------------------------------------------- 1 | a = join_path('a', 'b', 'c') 2 | b = join_path('a', '', 'c') 3 | c = split_path('a/b/c') 4 | d = split_path('a') 5 | e = splitext('a/test.txt') 6 | f = splitext('a/test') 7 | g = basename('a/b/c') 8 | h = basename('a') 9 | i = dirname('a/b/c') 10 | j = dirname('a') 11 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/precedence.build: -------------------------------------------------------------------------------- 1 | srcs = ['a.go', ':b'] 2 | file_srcs = [src for src in srcs if not src.startswith('/') and not src.startswith(':')] 3 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/precedence2.build: -------------------------------------------------------------------------------- 1 | labels = ['a', 'b', 'c'] 2 | 3 | y = 'x' in labels or 'b' in labels 4 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/reduce.build: -------------------------------------------------------------------------------- 1 | # acc 2 | r1 = reduce(lambda x, y: x + y, [0, 1, 2, 3]) 3 | 4 | # with init 5 | r2 = reduce( 6 | reducer=lambda x, y: x + y, 7 | seq=[0, 1, 2, 3], 8 | initializer=10, 9 | ) 10 | 11 | # dict 12 | r3 = reduce(lambda x, y: x | y, [{"a": 2, "b": 3}, {"c": 4, "d": 5}], initializer={"e": 0}) 13 | 14 | r4 = reduce(lambda x, y: x + y, []) 15 | r5 = reduce(lambda x, y: x + y, [], initializer=5) 16 | r6 = reduce(lambda x, y: x + y, [1], initializer=5) 17 | r7 = reduce(lambda x, y: x + y, [7]) 18 | 19 | # string (non-commutative) 20 | r8 = reduce(lambda x, y: ''.join((x, y)), ["a", "b", "c", "d", "e"]) -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/remove_affixes.build: -------------------------------------------------------------------------------- 1 | x = "PEP 616: New removeprefix() and removesuffix() string methods" 2 | y = x.removeprefix("PEP 616: ").removeprefix("wibble") 3 | z = y.removesuffix("string methods").removeprefix("New ") 4 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/reversed.build: -------------------------------------------------------------------------------- 1 | r1 = reversed([]) 2 | 3 | # Odd number of items: 4 | r2 = reversed([1, 2, 3]) 5 | 6 | # Even number of items: 7 | r3 = reversed([1, 2, 3, 4]) 8 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/semver_check.build: -------------------------------------------------------------------------------- 1 | c1 = semver_check("v1.5.0", ">=1.4.0") 2 | c2 = semver_check("v1.3.0", ">=1.4.0") 3 | c3 = semver_check("v1.0.5", "~1.0.0") 4 | c4 = semver_check("v1.1.0", "^1.0.0") 5 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/semver_check_invalid_constraint.build: -------------------------------------------------------------------------------- 1 | c1 = semver_check("v1.5.0", ">=one.four.zero") 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/semver_check_invalid_version.build: -------------------------------------------------------------------------------- 1 | c1 = semver_check("one.five.zero", ">=1.4.0") 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/slicing.build: -------------------------------------------------------------------------------- 1 | x = [1, 2, 3] 2 | a = x[1] 3 | b = x[1:] 4 | c = x[:1] 5 | d = x[1:2] 6 | e = x[-1] 7 | f = x[:-1] 8 | g = x[:3] 9 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/sorted.build: -------------------------------------------------------------------------------- 1 | x = [3, 2, 1] 2 | y = sorted(x) 3 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/strings.build: -------------------------------------------------------------------------------- 1 | TOYS = """ 2 | acpi base64 basename blkid blockdev bunzip2 bzcat cal cat catv chattr 3 | whoami xargs xxd yes 4 | """ 5 | 6 | TOYS2 = TOYS.strip().replace('\n', ' ').split(' ') 7 | 8 | TOYS3 = TOYS.strip() 9 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/subinclude_all.build: -------------------------------------------------------------------------------- 1 | subinclude("@pleasings//python:all") -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/subinclude_config.build: -------------------------------------------------------------------------------- 1 | CONFIG.setdefault("test", "test test") 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/subrepo_name.build: -------------------------------------------------------------------------------- 1 | subrepo = subrepo_name() -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/system_srcs.build: -------------------------------------------------------------------------------- 1 | build_rule( 2 | name = "system_srcs_set", 3 | cmd = "touch foo", 4 | local = False, 5 | system_srcs = ["foo"], 6 | ) 7 | 8 | build_rule( 9 | name = "system_srcs_unset", 10 | local = False, 11 | ) 12 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/unpacking.build: -------------------------------------------------------------------------------- 1 | a, b, c = 'a:b:c'.split(':') 2 | 3 | d, e, f = 'abc.def'.partition('.') 4 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/interpreter/zip.build: -------------------------------------------------------------------------------- 1 | x = zip([1, 2, 3], [4, 5, 6], [7, 8, 9]) 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/json.build: -------------------------------------------------------------------------------- 1 | json_dict = json(some_dict) 2 | json_list = json(some_list) 3 | json_frozen_dict = json(some_frozen_dict) 4 | json_frozen_list = json(some_frozen_list) 5 | json_config = json(some_config) 6 | json_frozen_config = json(some_frozen_config) 7 | json_range = json(range(4)) 8 | json_pretty = json(some_dict, pretty=True) 9 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/literal_methods.build: -------------------------------------------------------------------------------- 1 | x = ' '.join([ 2 | 'a', 3 | 'b', 4 | 'c', 5 | ]) 6 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/log_config.build: -------------------------------------------------------------------------------- 1 | log.info("%s", CONFIG) -------------------------------------------------------------------------------- /src/parse/asp/test_data/multiline_string_double_in_double.build: -------------------------------------------------------------------------------- 1 | s = """ 2 | multiline string containing "double quotes" 3 | """ 4 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/multiline_string_double_in_single.build: -------------------------------------------------------------------------------- 1 | s = ''' 2 | multiline string containing "double quotes" 3 | ''' 4 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/multiline_string_single_in_double.build: -------------------------------------------------------------------------------- 1 | s = """ 2 | multiline string containing 'single quotes' 3 | """ 4 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/multiline_string_single_in_single.build: -------------------------------------------------------------------------------- 1 | s = ''' 2 | multiline string containing 'single quotes' 3 | ''' 4 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/multiple_action.build: -------------------------------------------------------------------------------- 1 | x = y[5:].replace('-', '_').replace('/', '_').replace(':', '_') 2 | 3 | z['test'] = 5 4 | 5 | l.append(x) 6 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/no_newline.build: -------------------------------------------------------------------------------- 1 | package() -------------------------------------------------------------------------------- /src/parse/asp/test_data/operators.build: -------------------------------------------------------------------------------- 1 | genrule( 2 | name = 'rule', 3 | srcs = ['//something:test_go'] + glob(['*.go']), 4 | ) 5 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/optimise.build: -------------------------------------------------------------------------------- 1 | """Test file for optimise() function.""" 2 | 3 | def x(): 4 | """Function that doesn't do anything.""" 5 | 6 | def y(): 7 | pass 8 | 9 | def z(): 10 | l.append('x') 11 | 12 | def a(): 13 | return 14 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/optimise_join.build: -------------------------------------------------------------------------------- 1 | x = ' '.join(['1', '2', '3']) 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/precedence.build: -------------------------------------------------------------------------------- 1 | x = 'abc%s' % 'd' if True else 'e' 2 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/raise.build: -------------------------------------------------------------------------------- 1 | raise Exception("message") 2 | 3 | def mytest(): 4 | raise Exception("message") 5 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/repeated_arguments.build: -------------------------------------------------------------------------------- 1 | def test(a, b): 2 | pass 3 | 4 | 5 | test(a=5, b=3, a=3) 6 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/return_type.build: -------------------------------------------------------------------------------- 1 | def foo() -> str: 2 | return "hello" 3 | 4 | def subinclude(target:str, hash:str=None): 5 | pass 6 | 7 | def conf() -> config: 8 | pass 9 | 10 | def dict_val() -> dict: 11 | return "blah" 12 | 13 | dict_val() 14 | -------------------------------------------------------------------------------- /src/parse/asp/test_data/unary_op.build: -------------------------------------------------------------------------------- 1 | x = -len('.build') 2 | 3 | y = not x 4 | 5 | z = x.replace('-', '_') 6 | -------------------------------------------------------------------------------- /src/process/exec_other.go: -------------------------------------------------------------------------------- 1 | //go:build !linux 2 | // +build !linux 3 | 4 | package process 5 | 6 | import ( 7 | "os/exec" 8 | "syscall" 9 | ) 10 | 11 | // ExecCommand executes an external command. 12 | // N.B. This does not start the command - the caller must handle that (or use one 13 | // of the other functions which are higher-level interfaces). 14 | func (e *Executor) ExecCommand(sandbox SandboxConfig, foreground bool, command string, args ...string) *exec.Cmd { 15 | cmd := exec.Command(command, args...) 16 | cmd.SysProcAttr = &syscall.SysProcAttr{ 17 | Setpgid: true, 18 | Foreground: foreground, 19 | } 20 | return cmd 21 | } 22 | -------------------------------------------------------------------------------- /src/query/alltargets.go: -------------------------------------------------------------------------------- 1 | package query 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | 7 | "github.com/thought-machine/please/src/core" 8 | ) 9 | 10 | // AllTargets simply prints all the targets according to some expression. 11 | func AllTargets(graph *core.BuildGraph, labels core.BuildLabels, showHidden bool) { 12 | for _, label := range labels { 13 | if showHidden || !strings.HasPrefix(label.Name, "_") { 14 | fmt.Printf("%s\n", label) 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/query/completions_test_repo/BUILD_FILE: -------------------------------------------------------------------------------- 1 | genrule( 2 | name = "root_target", 3 | cmd = "", 4 | ) -------------------------------------------------------------------------------- /src/query/completions_test_repo/bing/net/thoughtmachine/please/BUILD_FILE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/query/completions_test_repo/bing/net/thoughtmachine/please/BUILD_FILE -------------------------------------------------------------------------------- /src/query/completions_test_repo/foo/BUILD_FILE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/query/completions_test_repo/foo/BUILD_FILE -------------------------------------------------------------------------------- /src/query/completions_test_repo/foo/bar/BUILD_FILE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/query/completions_test_repo/foo/bar/BUILD_FILE -------------------------------------------------------------------------------- /src/query/completions_test_repo/foo/bar/net/thoughtmachine/please/BUILD_FILE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/query/completions_test_repo/foo/bar/net/thoughtmachine/please/BUILD_FILE -------------------------------------------------------------------------------- /src/query/completions_test_repo/foo/bar/net/thoughtmachine/please/main/BUILD_FILE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/query/completions_test_repo/foo/bar/net/thoughtmachine/please/main/BUILD_FILE -------------------------------------------------------------------------------- /src/query/completions_test_repo/foo/baz/BUILD_FILE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/src/query/completions_test_repo/foo/baz/BUILD_FILE -------------------------------------------------------------------------------- /src/query/filter.go: -------------------------------------------------------------------------------- 1 | package query 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | 7 | "github.com/thought-machine/please/src/core" 8 | ) 9 | 10 | // Filter takes the list of BuildLabels and checks which ones match the label selectors passed in. 11 | func Filter(state *core.BuildState, labels core.BuildLabels, showHidden bool) { 12 | // Eventually this could be more clever... 13 | matcher := state.ShouldInclude 14 | 15 | for _, label := range labels { 16 | if showHidden || !strings.HasPrefix(label.Name, "_") { 17 | if matcher(state.Graph.TargetOrDie(label)) { 18 | fmt.Println(label) 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/query/inputs.go: -------------------------------------------------------------------------------- 1 | package query 2 | 3 | import ( 4 | "fmt" 5 | "sort" 6 | 7 | "golang.org/x/exp/maps" 8 | 9 | "github.com/thought-machine/please/src/core" 10 | ) 11 | 12 | // TargetInputs prints all inputs for a single target. 13 | func TargetInputs(graph *core.BuildGraph, labels []core.BuildLabel) { 14 | inputPaths := map[string]bool{} 15 | for _, label := range labels { 16 | for sourcePath := range core.IterInputPaths(graph, graph.TargetOrDie(label)) { 17 | inputPaths[sourcePath] = true 18 | } 19 | } 20 | 21 | keys := maps.Keys(inputPaths) 22 | sort.Strings(keys) 23 | for _, path := range keys { 24 | fmt.Printf("%s\n", path) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/remote/fs/cache/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "cache", 3 | srcs = ["cache_client.go"], 4 | visibility = ["//src/remote:all"], 5 | deps = [ 6 | "///third_party/go/github.com_bazelbuild_remote-apis-sdks//go/pkg/client", 7 | "///third_party/go/github.com_bazelbuild_remote-apis-sdks//go/pkg/digest", 8 | "//src/cli/logging", 9 | "//src/remote/fs", 10 | ], 11 | ) 12 | -------------------------------------------------------------------------------- /src/remote/test_data/package/src1.txt: -------------------------------------------------------------------------------- 1 | I am forced into speech because men of science have refused to 2 | follow my advice without knowing why. It is altogether against my 3 | will that I tell my reasons for opposing this contemplated invasion 4 | of the antarctic - with its vast fossil hunt and its wholesale 5 | boring and melting of the ancient ice caps. And I am the more 6 | reluctant because my warning may be in vain. 7 | -------------------------------------------------------------------------------- /src/remote/test_data/plz-out/bin/package/remote_test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo hello 3 | 4 | -------------------------------------------------------------------------------- /src/remote/test_data/plz-out/bin/package2/.test_results_target2/1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/remote/test_data/plz-out/bin/package2/.test_results_target2/2.xml: -------------------------------------------------------------------------------- 1 | results/2.xml -------------------------------------------------------------------------------- /src/remote/test_data/plz-out/bin/package2/.test_results_target2/results/2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/remote/test_data/plz-out/bin/package2/1.xml: -------------------------------------------------------------------------------- 1 | .test_results_target2/1.xml -------------------------------------------------------------------------------- /src/remote/test_data/plz-out/bin/package2/target2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | -------------------------------------------------------------------------------- /src/run/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "run", 3 | srcs = ["run_step.go"], 4 | pgo_file = "//:pgo", 5 | visibility = ["PUBLIC"], 6 | deps = [ 7 | "///third_party/go/golang.org_x_sync//errgroup", 8 | "//src/cli", 9 | "//src/cli/logging", 10 | "//src/core", 11 | "//src/fs", 12 | "//src/output", 13 | "//src/process", 14 | ], 15 | ) 16 | 17 | go_test( 18 | name = "run_test", 19 | srcs = ["run_test.go"], 20 | data = ["test_data"], 21 | deps = [ 22 | ":run", 23 | "///third_party/go/github.com_stretchr_testify//assert", 24 | "//src/core", 25 | "//src/process", 26 | ], 27 | ) 28 | -------------------------------------------------------------------------------- /src/run/test_data/plz-out/bin/false: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exit 1 3 | -------------------------------------------------------------------------------- /src/run/test_data/plz-out/bin/true: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exit 0 3 | -------------------------------------------------------------------------------- /src/sandbox/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "sandbox", 3 | srcs = [ 4 | "sandbox_linux.go", 5 | "sandbox_other.go", 6 | ], 7 | pgo_file = "//:pgo", 8 | visibility = ["//src/..."], 9 | deps = [ 10 | "///third_party/go/golang.org_x_sys//unix", 11 | "//src/core", 12 | ], 13 | ) 14 | -------------------------------------------------------------------------------- /src/sandbox/sandbox_other.go: -------------------------------------------------------------------------------- 1 | //go:build !linux 2 | // +build !linux 3 | 4 | package sandbox 5 | 6 | import ( 7 | "os" 8 | "os/exec" 9 | ) 10 | 11 | func Sandbox(args []string) error { 12 | cmd := exec.Command(args[0], args[1:]...) 13 | 14 | cmd.Stdout = os.Stdout 15 | cmd.Stdin = os.Stdin 16 | cmd.Stderr = os.Stderr 17 | 18 | return cmd.Run() 19 | } 20 | -------------------------------------------------------------------------------- /src/scm/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "scm", 3 | srcs = [ 4 | "git.go", 5 | "scm.go", 6 | "stub.go", 7 | ], 8 | pgo_file = "//:pgo", 9 | visibility = ["PUBLIC"], 10 | deps = [ 11 | "///third_party/go/github.com_sourcegraph_go-diff//diff", 12 | "//src/cli/logging", 13 | "//src/fs", 14 | ], 15 | ) 16 | 17 | go_test( 18 | name = "git_test", 19 | srcs = ["git_test.go"], 20 | data = ["test_data"], 21 | deps = [ 22 | ":scm", 23 | "///third_party/go/github.com_stretchr_testify//assert", 24 | ], 25 | ) 26 | -------------------------------------------------------------------------------- /src/test/go_test_panic.go: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | import ( 4 | "fmt" 5 | "testing" 6 | ) 7 | 8 | func foo() { 9 | fmt.Println("hello world") 10 | panic("goodbye world") 11 | } 12 | 13 | func TestFoo(t *testing.T) { //nolint 14 | foo() 15 | } 16 | -------------------------------------------------------------------------------- /src/test/test_data/go_empty_test.txt: -------------------------------------------------------------------------------- 1 | PASS 2 | 3 | -------------------------------------------------------------------------------- /src/test/test_data/go_multiple_failure.txt: -------------------------------------------------------------------------------- 1 | === RUN TestPlzConfigWorking-6 2 | --- FAIL: TestPlzConfigWorking-6 (0.00s) 3 | config_test.go:12: Failed to parse Python.PexTool correctly. 4 | config_test.go:21: Failed to parse Java.TargetLevel correctly. 5 | === RUN TestPlzConfigFailing-6 6 | --- FAIL: TestPlzConfigFailing-6 (0.00s) 7 | config_test.go:30: No error reported reading config file. 8 | FAIL 9 | -------------------------------------------------------------------------------- /src/test/test_data/go_subtests.txt: -------------------------------------------------------------------------------- 1 | === RUN TestSubTests 2 | === RUN TestSubTests/subtest1 3 | === RUN TestSubTests/subtest1/subsubtest1 4 | === RUN TestSubTests/subtest1/subsubtest2 5 | === RUN TestSubTests/subtest2 6 | === RUN TestSubTests/subtest2/subsubtest3 7 | === RUN TestSubTests/subtest2/subsubtest4 8 | --- PASS: TestSubTests (0.00s) 9 | --- PASS: TestSubTests/subtest1 (0.00s) 10 | --- PASS: TestSubTests/subtest1/subsubtest1 (0.00s) 11 | --- PASS: TestSubTests/subtest1/subsubtest2 (0.00s) 12 | --- PASS: TestSubTests/subtest2 (0.00s) 13 | --- PASS: TestSubTests/subtest2/subsubtest3 (0.00s) 14 | --- PASS: TestSubTests/subtest2/subsubtest4 (0.00s) 15 | PASS 16 | -------------------------------------------------------------------------------- /src/test/test_data/go_test_fail_1_14.txt: -------------------------------------------------------------------------------- 1 | === RUN TestSomething 2 | TestSomething: my_test.go:8: This thing is also here 3 | TestSomething: my_test.go:9: This test is skipped 4 | --- SKIP: TestSomething (0.00s) 5 | === RUN TestPass 6 | TestPass: my_test.go:13: This is passing 7 | --- PASS: TestPass (0.00s) 8 | === RUN TestFail 9 | TestFail: my_test.go:17: This test is going to fail. 10 | --- FAIL: TestFail (0.00s) 11 | FAIL -------------------------------------------------------------------------------- /src/test/test_data/go_test_failure.txt: -------------------------------------------------------------------------------- 1 | === RUN TestJSONExpectedFailure-6 2 | results_test.go:11: Unable to parse file: EOF 3 | --- FAIL: TestJSONExpectedFailure-6 (0.00s) 4 | === RUN TestJSONSkipped-6 5 | results_test.go:24: Unable to parse file: EOF 6 | --- FAIL: TestJSONSkipped-6 (0.00s) 7 | === RUN TestBuckXML-6 8 | --- PASS: TestBuckXML-6 (0.00s) 9 | === RUN TestJUnitXML-6 10 | --- PASS: TestJUnitXML-6 (0.00s) 11 | FAIL 12 | -------------------------------------------------------------------------------- /src/test/test_data/go_test_ignore_logs.txt: -------------------------------------------------------------------------------- 1 | === RUN TestA 2 | log: some output 3 | log: some more output 4 | --- PASS: TestA (0.00s) 5 | === RUN TestB 6 | log: log 7 | log: log 8 | --- PASS: TestB (0.00s) 9 | === RUN TestC 10 | --- PASS: TestC (0.00s) 11 | === RUN TestD 12 | --- PASS: TestD (0.00s) 13 | PASS 14 | coverage: 22.9% of statements 15 | -------------------------------------------------------------------------------- /src/test/test_data/go_test_pass.txt: -------------------------------------------------------------------------------- 1 | === RUN TestJSONExpectedFailure-6 2 | --- PASS: TestJSONExpectedFailure-6 (0.00s) 3 | === RUN TestJSONSkipped-6 4 | --- PASS: TestJSONSkipped-6 (0.00s) 5 | === RUN TestBuckXML-6 6 | --- PASS: TestBuckXML-6 (0.00s) 7 | === RUN TestJUnitXML-6 8 | --- PASS: TestJUnitXML-6 (0.00s) 9 | PASS 10 | -------------------------------------------------------------------------------- /src/test/test_data/go_test_skip.txt: -------------------------------------------------------------------------------- 1 | === RUN TestLimitedPrintfSimple 2 | --- PASS: TestLimitedPrintfSimple (0.00s) 3 | === RUN TestLimitedPrintfMore 4 | --- PASS: TestLimitedPrintfMore (0.00s) 5 | === RUN TestLimitedPrintfAnsi 6 | --- PASS: TestLimitedPrintfAnsi (0.00s) 7 | === RUN TestLimitedPrintfAnsiNotCountedWhenReducing 8 | interactive_display_test.go:21: haven't written proper support for this yet 9 | --- SKIP: TestLimitedPrintfAnsiNotCountedWhenReducing (0.00s) 10 | PASS 11 | coverage: 1.7% of statements 12 | -------------------------------------------------------------------------------- /src/test/test_data/go_test_skip_1_14.txt: -------------------------------------------------------------------------------- 1 | === RUN TestSomething 2 | TestSomething: my_test.go:9: This test is skipped 3 | --- SKIP: TestSomething (0.00s) 4 | === RUN TestPass 5 | TestPass: my_test.go:13: This is passing 6 | --- PASS: TestPass (0.00s) 7 | === RUN TestFail 8 | TestFail: my_test.go:17: This test is going to fail. 9 | --- FAIL: TestFail (0.00s) 10 | FAIL 11 | -------------------------------------------------------------------------------- /src/test/test_data/go_test_suite.txt: -------------------------------------------------------------------------------- 1 | === RUN TestExampleTestSuite 2 | === RUN TestA 3 | --- PASS: TestA (0.00s) 4 | === RUN TestB 5 | --- PASS: TestB (0.00s) 6 | === RUN TestC 7 | --- PASS: TestC (0.00s) 8 | === RUN TestD 9 | --- PASS: TestD (0.00s) 10 | === RUN TestF 11 | --- FAIL: TestF (0.00s) 12 | config_test.go:12: Failed to parse Python.PexTool correctly. 13 | config_test.go:21: Failed to parse Java.TargetLevel correctly. 14 | === RUN TestS 15 | --- SKIP: TestS (0.00s) 16 | interactive_display_test.go:21: haven't written proper support for this yet 17 | --- PASS: TestExampleTestSuite (1.21s) 18 | PASS 19 | coverage: 22.9% of statements 20 | -------------------------------------------------------------------------------- /src/test/test_data/junit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/test/test_data/unittest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/test/test_data/xmlrunner-skipped.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/tool/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "tool", 3 | srcs = ["tool.go"], 4 | pgo_file = "//:pgo", 5 | visibility = ["PUBLIC"], 6 | deps = [ 7 | "///third_party/go/github.com_thought-machine_go-flags//:go-flags", 8 | "//src/cli/logging", 9 | "//src/core", 10 | "//src/fs", 11 | ], 12 | ) 13 | 14 | go_test( 15 | name = "tool_test", 16 | srcs = ["tool_test.go"], 17 | deps = [ 18 | ":tool", 19 | "///third_party/go/github.com_stretchr_testify//assert", 20 | "//src/core", 21 | "//src/fs", 22 | ], 23 | ) 24 | -------------------------------------------------------------------------------- /src/update/key.pub: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAED9iFpam9HkHR0wNWyAb2zlpy6HQF 3 | a0GMlTpEC+eGCVbxpdrzIvQ8MZcQqma4GCXflPLc6rBQB4WA0GoBxmoXKQ== 4 | -----END PUBLIC KEY----- -------------------------------------------------------------------------------- /src/update/test/BUILD: -------------------------------------------------------------------------------- 1 | subinclude("//build_defs:version") 2 | 3 | go_binary( 4 | name = "please", 5 | srcs = ["test_main.go"], 6 | definitions = {"main.pleaseVersion": VERSION}, 7 | test_only = True, 8 | visibility = ["//src/update:all"], 9 | ) 10 | -------------------------------------------------------------------------------- /src/update/test/test_main.go: -------------------------------------------------------------------------------- 1 | // Package main implements a very simple binary that does basically nothing. 2 | // It's simply a very small executable that we can pack into a tarball (which is 3 | // faster at test time than packaging plz itself which is relatively big). 4 | package main 5 | 6 | import "os" 7 | 8 | var pleaseVersion = "1.0.9999" 9 | 10 | func main() { 11 | os.Stdout.Write([]byte("Please version " + pleaseVersion + "\n")) 12 | } 13 | -------------------------------------------------------------------------------- /src/update/test_data/bad.txt: -------------------------------------------------------------------------------- 1 | Test file for verifying incorrect release signatures. 2 | -------------------------------------------------------------------------------- /src/update/test_data/good.pub.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlv4bSEw2Obiigw9ACYbU 3 | pKjKNIBEHePSBKAQgdItitDy5qr/UWN468uSsxWqs/yQprHiyVAExRqWCwsqE2WS 4 | X3x6ggx0JEClnE+3JqKKLqBkiry16T4zavlDgej9VceqJPy48VTd/n95SzVBoYmY 5 | zh1A8brhEn6o8CJZYBpKc3xq2KThIJcIlcVRCnLOaKl7ooND84kWeUKzGTIEH9Kd 6 | gVOLTbHqXaEM7vu02KgWIajoL8BYLaLerf9h0Pmw3LMlmkSdAJUZ5n6e7nSwxPi2 7 | YJo+NsgZ09mieyBK74X5x8zCVhoTlKVzKfNtDpQZYs2Q3wDWpdIMOLjsq2uu0gz7 8 | YwIDAQAB 9 | -----END PUBLIC KEY----- 10 | -------------------------------------------------------------------------------- /src/update/test_data/test.txt: -------------------------------------------------------------------------------- 1 | Test file for verifying release signatures. 2 | -------------------------------------------------------------------------------- /src/version/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "version", 3 | srcs = [ 4 | "version.go", 5 | ], 6 | pgo_file = "//:pgo", 7 | visibility = ["PUBLIC"], 8 | ) 9 | -------------------------------------------------------------------------------- /src/version/version.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | // PleaseVersion is the current version of Please. 4 | // Note that non-bootstrap builds replace this interim version with a real one. 5 | var PleaseVersion = "99.0.9999" 6 | -------------------------------------------------------------------------------- /src/watch/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "watch", 3 | srcs = ["watch.go"], 4 | pgo_file = "//:pgo", 5 | visibility = ["PUBLIC"], 6 | deps = [ 7 | "///third_party/go/github.com_fsnotify_fsnotify//:fsnotify", 8 | "//src/cli", 9 | "//src/cli/logging", 10 | "//src/core", 11 | "//src/fs", 12 | "//src/process", 13 | "//src/run", 14 | ], 15 | ) 16 | -------------------------------------------------------------------------------- /test/affectedtests_test.go: -------------------------------------------------------------------------------- 1 | // Dummy test for testing 'plz query affectedtests. 2 | 3 | package test 4 | 5 | import "testing" 6 | 7 | func TestAffectedTests(t *testing.T) { 8 | } 9 | -------------------------------------------------------------------------------- /test/basic_completions.txt: -------------------------------------------------------------------------------- 1 | //test/completions:all 2 | //test/completions:binary 3 | //test/completions:library 4 | //test/completions:test 5 | -------------------------------------------------------------------------------- /test/build_defs/.plzconfig.e2e: -------------------------------------------------------------------------------- 1 | ; Don't download tools. Tests should use the tools from this repo. 2 | [sandbox] 3 | Tool = please_sandbox 4 | 5 | ; Set this so we don't pick up the test BUILD files in the main repo 6 | [parse] 7 | BuildFileName = BUILD_FILE 8 | 9 | [remote] 10 | url = 11 | -------------------------------------------------------------------------------- /test/build_defs/.plzconfig_freebsd_amd64: -------------------------------------------------------------------------------- 1 | # Binary downloads are not available for FreeBSD - will have to be added with 'pkg install protobuf'. 2 | [proto] 3 | protoctool = protoc 4 | -------------------------------------------------------------------------------- /test/build_defs/test_file_content.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | file=$1 4 | 5 | if ! test -f "$file"; then 6 | echo "$file" doesnt exist 7 | exit 1 8 | fi 9 | 10 | CONTENT=$(<"$file") 11 | shift 1 12 | CHECK=$(< <(printf '%s\n' "$@")) 13 | 14 | if [[ "$CONTENT" != "$CHECK" ]]; then 15 | printf '%s\n%s\n%s\n%s\n%s\n' \ 16 | "${file} doesnt contain" \ 17 | "${CHECK}" \ 18 | "---- it contains ----" \ 19 | "${CONTENT}" \ 20 | "---- EOF ----" 21 | exit 1 22 | fi 23 | -------------------------------------------------------------------------------- /test/build_outdir/BUILD: -------------------------------------------------------------------------------- 1 | subinclude("//test/build_defs") 2 | 3 | please_repo_e2e_test( 4 | name = "out_dir_test", 5 | expected_output = {"bar/foo/testy": "wibble wibble wibble"}, 6 | plz_command = "plz build //foo:testy --out_dir=bar", 7 | repo = "test_repo", 8 | ) 9 | -------------------------------------------------------------------------------- /test/build_outdir/test_repo/.plzconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/test/build_outdir/test_repo/.plzconfig -------------------------------------------------------------------------------- /test/build_outdir/test_repo/foo/BUILD_FILE: -------------------------------------------------------------------------------- 1 | text_file( 2 | name = "testy", 3 | content = "wibble wibble wibble", 4 | ) -------------------------------------------------------------------------------- /test/cli/BUILD: -------------------------------------------------------------------------------- 1 | subinclude("//test/build_defs") 2 | 3 | please_repo_e2e_test( 4 | name = "test_rerun_test", 5 | expected_output = { 6 | "wibble_test.txt": "wibble wibble wibble\nwibble wibble wibble", 7 | }, 8 | plz_command = "plz test --show_all_output //package:wibble 2>&1 | grep 'wibble wibble wibble' > wibble_test.txt && plz test --rerun --show_all_output //package:wibble 2>&1 | grep 'wibble wibble wibble' >> wibble_test.txt", 9 | repo = "test_repo", 10 | ) 11 | -------------------------------------------------------------------------------- /test/cli/test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [Parse] 2 | BuildFileName = BUILD_FILE -------------------------------------------------------------------------------- /test/cli/test_repo/package/BUILD_FILE: -------------------------------------------------------------------------------- 1 | gentest( 2 | name = "wibble", 3 | no_test_output = True, 4 | test_cmd = "echo wibble wibble wibble", 5 | ) 6 | -------------------------------------------------------------------------------- /test/completion/bin.cc: -------------------------------------------------------------------------------- 1 | int main(int argc, char* argv[]) { 2 | return 0; 3 | } 4 | -------------------------------------------------------------------------------- /test/completion/binary_only/BUILD: -------------------------------------------------------------------------------- 1 | genrule( 2 | name = "binary", 3 | cmd = "", 4 | ) 5 | -------------------------------------------------------------------------------- /test/completion/binary_only/binary_only/BUILD: -------------------------------------------------------------------------------- 1 | genrule( 2 | name = "binary", 3 | cmd = "", 4 | ) 5 | -------------------------------------------------------------------------------- /test/completion/binary_only/binary_only/tests/BUILD: -------------------------------------------------------------------------------- 1 | gentest( 2 | name = "test", 3 | no_test_output = True, 4 | test_cmd = "true", 5 | ) 6 | -------------------------------------------------------------------------------- /test/completion/lib.cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/test/completion/lib.cc -------------------------------------------------------------------------------- /test/completions/BUILD: -------------------------------------------------------------------------------- 1 | # A little suite of targets that we use to test completions. 2 | 3 | genrule( 4 | name = "library", 5 | outs = ["lib.txt"], 6 | cmd = 'touch "$OUT"', 7 | ) 8 | 9 | genrule( 10 | name = "binary", 11 | outs = ["bin.sh"], 12 | binary = True, 13 | cmd = 'touch "$OUT"', 14 | ) 15 | 16 | gentest( 17 | name = "test", 18 | outs = ["test.sh"], 19 | cmd = 'touch "$OUT"', 20 | labels = ["manual"], 21 | test_cmd = "true", 22 | ) 23 | -------------------------------------------------------------------------------- /test/config_rules/BUILD: -------------------------------------------------------------------------------- 1 | # This is a (fairly contrived) example of using select(). 2 | python_test( 3 | name = "config_test", 4 | srcs = ["config_test.py"], 5 | flags = select({ 6 | "//test/config_rules/config:x86_64": "--word_size=64", 7 | "//test/config_rules/config:arm64": "--word_size=64", 8 | "//test/config_rules/config:x86": "--word_size=32", 9 | }), 10 | ) 11 | -------------------------------------------------------------------------------- /test/config_rules/config/BUILD: -------------------------------------------------------------------------------- 1 | config_setting( 2 | name = "x86_64", 3 | values = {"cpu": "x86_64"}, 4 | visibility = ["//test/config_rules/..."], 5 | ) 6 | 7 | config_setting( 8 | name = "x86", 9 | values = {"cpu": "x86"}, 10 | visibility = ["//test/config_rules/..."], 11 | ) 12 | 13 | config_setting( 14 | name = "arm64", 15 | values = {"cpu": "arm64"}, 16 | visibility = ["//test/config_rules/..."], 17 | ) 18 | -------------------------------------------------------------------------------- /test/config_rules/config_test.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import unittest 3 | 4 | 5 | class ConfigTest(unittest.TestCase): 6 | 7 | def test_flag_matches(self): 8 | """Test the flag matches as expected.""" 9 | self.assertEqual('--word_size=64', sys.argv[-1]) 10 | -------------------------------------------------------------------------------- /test/container_data.txt: -------------------------------------------------------------------------------- 1 | This file will only appear in the container if data is working properly. 2 | -------------------------------------------------------------------------------- /test/coverage_output_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # 3 | # Dummy test file for some of the e2e tests. 4 | 5 | import unittest 6 | 7 | 8 | class CoverageOutputTest(unittest.TestCase): 9 | 10 | def test_stuff(self): 11 | """Test that the flux capacitor is correctly calibrated.""" 12 | self.assertEqual(2, 2) 13 | -------------------------------------------------------------------------------- /test/cross_compile/README.md: -------------------------------------------------------------------------------- 1 | Example rules for testing cross-compiling. 2 | 3 | One can test a simple binary with `plz build -a linux_x86 //test/cross_compile:bin`. 4 | The configuration for that is stored in `.plzconfig_linux_x86` at the repo root. 5 | This typically requires some additional packages to be installed; e.g. `gcc-multilib` or similar. 6 | -------------------------------------------------------------------------------- /test/cross_compile/bin_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eu 3 | 4 | if [ "`test/cross_compile/bin`" != "42" ]; then 5 | echo "unexpected output" 6 | exit 1 7 | fi 8 | if [ ! `file test/cross_compile/bin | grep 32-bit` ]; then 9 | echo "unexpected architecture of binary" 10 | exit 1 11 | fi 12 | -------------------------------------------------------------------------------- /test/cross_compile/lib/lib.c: -------------------------------------------------------------------------------- 1 | #include "test/cross_compile/lib/embed.h" 2 | 3 | #include 4 | 5 | int GetAnswer() { 6 | return atoi(embed_start()); 7 | } 8 | -------------------------------------------------------------------------------- /test/cross_compile/lib/lib.h: -------------------------------------------------------------------------------- 1 | // Returns, as usual, the answer to Life, the Universe and Everything. 2 | int GetAnswer(); 3 | -------------------------------------------------------------------------------- /test/cross_compile/lib/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import "fmt" 4 | 5 | func main() { 6 | fmt.Println("42") 7 | } 8 | -------------------------------------------------------------------------------- /test/cross_compile/location_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "`cat $DATA`" != "test/cross_compile/arch_location.txt" ]; then 4 | echo "Unexpected contents of file: `cat $DATA`" 5 | exit 1 6 | fi 7 | -------------------------------------------------------------------------------- /test/cross_compile/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "test/cross_compile/lib/lib.h" 4 | 5 | 6 | int main(int argc, const char* argv[]) { 7 | printf("%d\n", GetAnswer()); 8 | } 9 | -------------------------------------------------------------------------------- /test/cross_compile/select_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "`cat $DATA`" != "wibble" ]; then 4 | echo "Unexpected contents of file: `cat $DATA`" 5 | exit 1 6 | fi 7 | -------------------------------------------------------------------------------- /test/cross_compile/test_arch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This will succeed if the correct arch has been recorded. 3 | exec grep "test_x86" "${PKG_DIR}/arch.txt" 4 | -------------------------------------------------------------------------------- /test/cycle/TEST_BUILD: -------------------------------------------------------------------------------- 1 | # A set of build targets that test issue #43. 2 | # Due to the nature of how we exercise the issue the test itself cannot be in this package. 3 | 4 | python_library( 5 | name = "cycle_1", 6 | deps = [":cycle_2"], 7 | ) 8 | 9 | python_library( 10 | name = "cycle_2", 11 | deps = [":cycle_1"], 12 | ) 13 | 14 | gentest( 15 | name = "cycle_test", 16 | labels = ["cycle"], 17 | no_test_output = True, 18 | test_cmd = "true", 19 | deps = [ 20 | ":cycle_1", 21 | ":cycle_2", 22 | ], 23 | ) 24 | -------------------------------------------------------------------------------- /test/data_files_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check this file exists in the expected location. 4 | if [ ! -f test/container_data.txt ]; then 5 | exit 1 6 | fi 7 | -------------------------------------------------------------------------------- /test/double_local_subinclude/BUILD: -------------------------------------------------------------------------------- 1 | subinclude("//test/build_defs") 2 | 3 | please_repo_e2e_test( 4 | name = "double_local_subinclude_test", 5 | # This isn't 100% deterministic but 20 clean runs should be reasonably sufficient 6 | plz_command = "for i in `seq 1 20`; do plz build -p -v 4 //...; done", 7 | repo = "test_repo", 8 | ) 9 | -------------------------------------------------------------------------------- /test/double_local_subinclude/test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [Parse] 2 | PreloadSubincludes = //a:defs_2 3 | -------------------------------------------------------------------------------- /test/double_local_subinclude/test_repo/a/1.build_defs: -------------------------------------------------------------------------------- 1 | THE_QUESTION = "what is the answer to life, the universe and everything?" 2 | -------------------------------------------------------------------------------- /test/double_local_subinclude/test_repo/a/2.build_defs: -------------------------------------------------------------------------------- 1 | subinclude("//a:defs_1") 2 | 3 | THE_ANSWER = 42 4 | -------------------------------------------------------------------------------- /test/double_local_subinclude/test_repo/a/BUILD_FILE: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "defs_2", 3 | srcs = ["2.build_defs"], 4 | visibility = ["PUBLIC"], 5 | ) 6 | 7 | # "Sleep" for some time by busy looping to make sure we subinclude from 2.build_defs before registering :defs_1. 8 | # This was a race condition fixed in #3354 9 | for n in range(10000000): 10 | pass 11 | 12 | filegroup( 13 | name = "defs_1", 14 | srcs = ["1.build_defs"], 15 | visibility = ["PUBLIC"], 16 | ) 17 | 18 | subinclude(":defs_2") 19 | 20 | assert THE_QUESTION.endswith("?"), "not a question" 21 | assert THE_ANSWER == 42, "wrong answer to life, the universe and everything" 22 | -------------------------------------------------------------------------------- /test/double_local_subinclude/test_repo/b/BUILD_FILE: -------------------------------------------------------------------------------- 1 | subinclude("//a:defs_2") 2 | 3 | assert THE_ANSWER == 42, "wrong answer to life, the universe and everything" 4 | -------------------------------------------------------------------------------- /test/double_local_subinclude/test_repo/c/BUILD_FILE: -------------------------------------------------------------------------------- 1 | subinclude("//a:defs_1") 2 | 3 | assert THE_QUESTION.endswith("?"), "not a question" 4 | -------------------------------------------------------------------------------- /test/entry_point/test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [Parse] 2 | BuildFileName = BUILD 3 | preloadsubincludes = ///shell//build_defs:shell 4 | preloadsubincludes = ///go//build_defs:go 5 | 6 | [Plugin "shell"] 7 | target = //plugins:shell 8 | 9 | 10 | [Plugin "go"] 11 | target = //plugins:go 12 | stdlib = //third_party/go:std -------------------------------------------------------------------------------- /test/entry_point/test_repo/foo/BUILD_FILE: -------------------------------------------------------------------------------- 1 | build_rule( 2 | name = "foo", 3 | cmd = "$TOOL > $OUT", 4 | outs = ["wibble.txt"], 5 | tools = ["//tools:my_tool|printer"] 6 | ) 7 | 8 | sh_cmd( 9 | name = "foo_cmd", 10 | cmd = "$(out_exe //tools:my_tool|printer) > wibble.txt", 11 | data = ["//tools:my_tool"], 12 | ) 13 | -------------------------------------------------------------------------------- /test/entry_point/test_repo/plugins/BUILD_FILE: -------------------------------------------------------------------------------- 1 | plugin_repo( 2 | name = "shell", 3 | plugin = "shell-rules", 4 | revision = "v0.1.1", 5 | ) 6 | 7 | plugin_repo( 8 | name = "go", 9 | plugin = "go-rules", 10 | revision = "v1.21.5", 11 | ) 12 | -------------------------------------------------------------------------------- /test/entry_point/test_repo/puku.json: -------------------------------------------------------------------------------- 1 | { 2 | "stop": true 3 | } 4 | -------------------------------------------------------------------------------- /test/entry_point/test_repo/third_party/go/BUILD_FILE: -------------------------------------------------------------------------------- 1 | go_stdlib( 2 | name = "std", 3 | ) 4 | -------------------------------------------------------------------------------- /test/entry_point/test_repo/tools/BUILD_FILE: -------------------------------------------------------------------------------- 1 | build_rule( 2 | name = "my_tool", 3 | srcs = [ 4 | ":file_printer", 5 | ], 6 | cmd = "mkdir $OUT && echo wibble > $OUT/file.txt && mv $(location :file_printer) $OUT", 7 | outs = ["my_tool"], 8 | visibility = ["PUBLIC"], 9 | binary = True, 10 | entry_points = { 11 | "printer": "my_tool/file_printer", 12 | } 13 | ) 14 | 15 | go_binary( 16 | name = "file_printer", 17 | srcs = ["file_printer.go"], 18 | ) 19 | 20 | -------------------------------------------------------------------------------- /test/entry_point/test_repo/tools/file_printer.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "path/filepath" 7 | ) 8 | 9 | // Prints file.txt in the current working directory 10 | func main() { 11 | path, err := os.Executable() 12 | if err != nil { 13 | panic(err) 14 | } 15 | 16 | b, err := os.ReadFile(filepath.Join(filepath.Dir(path), "file.txt")) 17 | if err != nil { 18 | panic(err) 19 | } 20 | 21 | fmt.Print(string(b)) 22 | } 23 | -------------------------------------------------------------------------------- /test/env_test/BUILD: -------------------------------------------------------------------------------- 1 | subinclude("//test/build_defs") 2 | 3 | please_repo_e2e_test( 4 | name = "env_test", 5 | expected_output = { 6 | "plz-out/gen/foo.txt": "foo bar", 7 | "plz-out/gen/bar.txt": "bar.txt foo.txt", 8 | }, 9 | plz_command = "plz build //:env_test", 10 | repo = "test_repo", 11 | ) 12 | -------------------------------------------------------------------------------- /test/env_test/test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [parse] 2 | BuildFileName = BUILD_FILE 3 | -------------------------------------------------------------------------------- /test/env_test/test_repo/BUILD_FILE: -------------------------------------------------------------------------------- 1 | genrule( 2 | name = "env_test", 3 | outs = ["foo.txt", "bar.txt"], 4 | cmd = "echo $FOO > foo.txt && echo $BAR > bar.txt", 5 | env = { 6 | "FOO": "foo bar", 7 | "BAR": "$OUTS", 8 | }, 9 | ) 10 | -------------------------------------------------------------------------------- /test/exec/test_repo/.plzconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/test/exec/test_repo/.plzconfig -------------------------------------------------------------------------------- /test/exec/test_repo/BUILD_FILE: -------------------------------------------------------------------------------- 1 | genrule( 2 | name = "dummy", 3 | cmd = "echo 'echo test > out.txt' > $OUT", 4 | outs = ["dummy"], 5 | binary = True, 6 | ) 7 | 8 | genrule( 9 | name = "success", 10 | cmd = "echo $@ > $OUT", 11 | outs = ["success.txt"], 12 | binary = True, 13 | ) 14 | 15 | genrule( 16 | name = "success2", 17 | cmd = "echo $@ > $OUT", 18 | outs = ["success2.txt"], 19 | binary = True, 20 | ) 21 | 22 | genrule( 23 | name = "failure", 24 | cmd = "false", 25 | outs = ["failure.txt"], 26 | binary = True, 27 | ) 28 | -------------------------------------------------------------------------------- /test/export/BUILD: -------------------------------------------------------------------------------- 1 | subinclude("//test/build_defs") 2 | 3 | plz_e2e_test( 4 | name = "export_src_please_test", 5 | cmd = "plz export --output plz-out/plzexport //src/core && plz --repo_root=$(plz query reporoot)/plz-out/plzexport build //src/core", 6 | ) 7 | -------------------------------------------------------------------------------- /test/extra_test_output_test.go: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | import ( 4 | "encoding/base64" 5 | "os" 6 | "testing" 7 | ) 8 | 9 | const msg = "UmljY2FyZG8gbGlrZXMgcGluZWFwcGxlIHBpenphCg==" 10 | 11 | func TestWriteExtraOutput(t *testing.T) { 12 | out, err := base64.StdEncoding.DecodeString(msg) 13 | if err != nil { 14 | t.Errorf("Expected no error, got %s", err) 15 | } 16 | err = os.WriteFile("truth.txt", out, 0644) 17 | if err != nil { 18 | t.Errorf("Expected no error, got %s", err) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/filegroup/hash_filegroup_test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | EXPECTED="test/filegroup/hash_filegroup_test-c340e9699046999e0dead1f677a889fc94d90488d3a524183afd30b4e17f80aa.txt" 4 | if [ "$DATA" != "$EXPECTED" ]; then 5 | echo "Unexpected hash filegroup name; was $DATA, should be $EXPECTED" 6 | exit 1 7 | fi 8 | -------------------------------------------------------------------------------- /test/filegroup/hash_filegroup_test.txt: -------------------------------------------------------------------------------- 1 | Beware of the Leopard! 2 | -------------------------------------------------------------------------------- /test/filegroup/many/BUILD: -------------------------------------------------------------------------------- 1 | for i in range(100): 2 | filegroup( 3 | name = "f%02d" % i, 4 | srcs = ["//test/filegroup:gen"], 5 | ) 6 | -------------------------------------------------------------------------------- /test/filegroup/named_test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | WIBBLE=$(cat $DATA_WIBBLE) 4 | WOBBLE=$(cat $DATA_WOBBLE) 5 | if [ "$WIBBLE" != "wibblewibblewibble" ]; then 6 | echo "Unexpected context in wibble: $WIBBLE" 7 | exit 1 8 | fi 9 | if [ "$WOBBLE" != "wobblewobblewobble" ]; then 10 | echo "Unexpected context in wobble: $WOBBLE" 11 | exit 1 12 | fi 13 | if [ "$DATA_ALL" != "test/filegroup/wibble test/filegroup/wobble" ]; then 14 | echo "Unexpected context in DATA_ALL: $DATA_ALL" 15 | exit 1 16 | fi 17 | -------------------------------------------------------------------------------- /test/filegroup/output_hash/test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [Parse] 2 | BuildFileName = BUILD_FILE -------------------------------------------------------------------------------- /test/filegroup/output_hash/test_repo/srcs/BUILD_FILE: -------------------------------------------------------------------------------- 1 | genrule( 2 | name = "file1", 3 | srcs = ["file1"], 4 | cmd = "cp $SRC $OUT", 5 | outs = ["file1.out"], 6 | ) 7 | 8 | filegroup( 9 | name = "filegroup", 10 | srcs = ["file2", ":file1"], 11 | hashes = ["sha256: 05421a2c674d447cc418ab3807bead1eabe2646faf4f6adcc01d751423349b7e"], 12 | ) -------------------------------------------------------------------------------- /test/filegroup/output_hash/test_repo/srcs/file1: -------------------------------------------------------------------------------- 1 | wibble wiblle wiblle -------------------------------------------------------------------------------- /test/filegroup/output_hash/test_repo/srcs/file2: -------------------------------------------------------------------------------- 1 | wobble wobble wobble -------------------------------------------------------------------------------- /test/flakiness_test.py: -------------------------------------------------------------------------------- 1 | import random 2 | import unittest 3 | 4 | 5 | class FlakinessTest(unittest.TestCase): 6 | 7 | def test_flakiness(self): 8 | """This test is deliberately flaky to test that functionality.""" 9 | self.assertLess(random.random(), 0.3) 10 | 11 | 12 | if __name__ == '__main__': 13 | unittest.main() 14 | -------------------------------------------------------------------------------- /test/flaky_test.py: -------------------------------------------------------------------------------- 1 | import random 2 | import unittest 3 | 4 | 5 | class FlakyTest(unittest.TestCase): 6 | 7 | def test_flaky(self): 8 | self.assertEqual(1, random.choice([1, 2, 3])) 9 | -------------------------------------------------------------------------------- /test/get_entry_points/BUILD: -------------------------------------------------------------------------------- 1 | none = genrule( 2 | name = "none", 3 | outs = ["x"], 4 | cmd = "echo x > $OUTS", 5 | ) 6 | 7 | one = genrule( 8 | name = "one", 9 | outs = { 10 | "y": ["y"], 11 | "z": ["z"], 12 | }, 13 | cmd = "for i in $OUTS; do echo x > $i; done", 14 | entry_points = { 15 | "ep": "y", 16 | }, 17 | ) 18 | 19 | def assert_dict(l1, l2): 20 | if l1 != l2: 21 | fail(f"{l1} != {l2}") 22 | 23 | assert_dict( 24 | {}, 25 | get_entry_points(none), 26 | ) 27 | 28 | assert_dict( 29 | {"ep": "y"}, 30 | get_entry_points(one), 31 | ) 32 | -------------------------------------------------------------------------------- /test/glob/BUILD: -------------------------------------------------------------------------------- 1 | sh_test( 2 | name = "glob_build_test", 3 | src = "glob_build_test.sh", 4 | data = glob( 5 | ["**"], 6 | include_symlinks = True, 7 | ), 8 | ) 9 | 10 | sh_test( 11 | name = "glob_build_symlink_test", 12 | src = "glob_build_test_symlink.sh", 13 | data = glob(["**"]), 14 | ) 15 | -------------------------------------------------------------------------------- /test/glob/glob_build_test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -f test/glob/BUILD ]; then 4 | echo "Should not be able to glob the BUILD file" 5 | exit 1 6 | fi 7 | 8 | if [ ! -f test/glob/test.txt.symlink ]; then 9 | echo "Should be able to glob the symlink file" 10 | exit 1 11 | fi 12 | 13 | if [ ! -f test/glob/test.txt ]; then 14 | echo "Should be able to glob the .txt file" 15 | exit 1 16 | fi -------------------------------------------------------------------------------- /test/glob/glob_build_test_symlink.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ -f test/glob/test.txt.symlink ]; then 4 | echo "Shouldn't be able to glob the symlink file" 5 | exit 1 6 | fi 7 | -------------------------------------------------------------------------------- /test/glob/test.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/test/glob/test.txt -------------------------------------------------------------------------------- /test/glob/test.txt.symlink: -------------------------------------------------------------------------------- 1 | test.txt -------------------------------------------------------------------------------- /test/go.mod: -------------------------------------------------------------------------------- 1 | module dummy -------------------------------------------------------------------------------- /test/include/test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [parse] 2 | BuildFileName = BUILD 3 | preloadsubincludes = ///shell//build_defs:shell 4 | 5 | [plugin "shell"] 6 | target = //plugins:shell 7 | -------------------------------------------------------------------------------- /test/include/test_repo/BUILD_FILE: -------------------------------------------------------------------------------- 1 | sh_cmd( 2 | name = "target1", 3 | cmd = "echo foo", 4 | labels = ["foo"], 5 | ) 6 | 7 | sh_cmd( 8 | name = "target2", 9 | cmd = "echo bar", 10 | labels = ["bar"], 11 | ) 12 | -------------------------------------------------------------------------------- /test/include/test_repo/plugins/BUILD_FILE: -------------------------------------------------------------------------------- 1 | plugin_repo( 2 | name = "shell", 3 | plugin = "shell-rules", 4 | revision = "v0.1.1", 5 | ) 6 | -------------------------------------------------------------------------------- /test/individual_test_run.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | 4 | class TestRunningIndividualTests(unittest.TestCase): 5 | 6 | def test_first_thing(self): 7 | pass 8 | 9 | def test_second_thing(self): 10 | pass 11 | 12 | def test_other_thing(self): 13 | pass 14 | -------------------------------------------------------------------------------- /test/internal_pkg_test/BUILD: -------------------------------------------------------------------------------- 1 | subinclude("//test/build_defs") 2 | 3 | please_repo_e2e_test( 4 | name = "internal_pkg_test", 5 | expected_output = { 6 | "out.txt": "arcat: //_please:arcat", 7 | }, 8 | labels = ["manual"], 9 | plz_command = "plz build //src:unzip && plz query print -f tools //src:unzip > out.txt", 10 | repo = "test_repo", 11 | ) 12 | -------------------------------------------------------------------------------- /test/internal_pkg_test/test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [parse] 2 | BuildFileName = BUILD_FILE 3 | 4 | [FeatureFlags] 5 | PleaseDownloadTools = true 6 | -------------------------------------------------------------------------------- /test/internal_pkg_test/test_repo/src/BUILD_FILE: -------------------------------------------------------------------------------- 1 | genrule( 2 | name = "unzip", 3 | srcs = ["input.zip"], 4 | cmd = "$TOOLS_ARCAT x -o $OUT $SRC", 5 | tools = { 6 | "arcat": [CONFIG.ARCAT_TOOL], 7 | } 8 | ) 9 | -------------------------------------------------------------------------------- /test/internal_pkg_test/test_repo/src/input.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/test/internal_pkg_test/test_repo/src/input.zip -------------------------------------------------------------------------------- /test/keep_going/test_repo/.plzconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/test/keep_going/test_repo/.plzconfig -------------------------------------------------------------------------------- /test/keep_going/test_repo/package2/BUILD_FILE: -------------------------------------------------------------------------------- 1 | build_rule( 2 | name = "transitive_parse_fail", 3 | deps = ["//parse_failure:test"], 4 | ) -------------------------------------------------------------------------------- /test/keep_going/test_repo/parse_failure/BUILD_FILE: -------------------------------------------------------------------------------- 1 | fail("test failure") -------------------------------------------------------------------------------- /test/local_subinclude_test/BUILD: -------------------------------------------------------------------------------- 1 | subinclude("//test/build_defs") 2 | 3 | please_repo_e2e_test( 4 | name = "test_subrepo", 5 | expected_output = { 6 | "out.txt": "//subrepo:gotest\n//subrepo/dir:gotest\n//subrepo/dir:pleasings2", 7 | }, 8 | plz_command = "plz --profile local query alltargets //subrepo/... > out.txt", 9 | repo = "test_repo", 10 | ) 11 | 12 | please_repo_e2e_test( 13 | name = "test_local", 14 | expected_output = { 15 | "plz-out/gen/local/out": "constant", 16 | "plz-out/gen/local/foo/out": "constant", 17 | }, 18 | plz_command = "plz build //local/...", 19 | repo = "test_repo", 20 | ) 21 | -------------------------------------------------------------------------------- /test/local_subinclude_test/test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [parse] 2 | BuildFileName = BUILD_FILE 3 | BuildFileName = BUILD -------------------------------------------------------------------------------- /test/local_subinclude_test/test_repo/local/BUILD_FILE: -------------------------------------------------------------------------------- 1 | export_file( 2 | name = "constant", 3 | src = "constant.build_defs", 4 | visibility = ["PUBLIC"], 5 | ) 6 | 7 | subinclude(":constant") 8 | 9 | genrule( 10 | name = "output", 11 | outs = ["out"], 12 | cmd = "echo $CONSTANT > $OUTS", 13 | env = { 14 | "CONSTANT": CONSTANT, 15 | }, 16 | ) 17 | -------------------------------------------------------------------------------- /test/local_subinclude_test/test_repo/local/constant.build_defs: -------------------------------------------------------------------------------- 1 | CONSTANT = "constant" -------------------------------------------------------------------------------- /test/local_subinclude_test/test_repo/local/foo/BUILD_FILE: -------------------------------------------------------------------------------- 1 | subinclude("//local:constant") 2 | 3 | genrule( 4 | name = "output", 5 | outs = ["out"], 6 | cmd = "echo $CONSTANT > $OUTS", 7 | env = { 8 | "CONSTANT": CONSTANT, 9 | }, 10 | ) -------------------------------------------------------------------------------- /test/local_subinclude_test/test_repo/subrepo/BUILD_FILE: -------------------------------------------------------------------------------- 1 | subinclude("///subrepo/dir/pleasings2//go") 2 | 3 | gotestsum_test( 4 | name = "gotest", 5 | race = True, 6 | ) 7 | -------------------------------------------------------------------------------- /test/local_subinclude_test/test_repo/subrepo/dir/BUILD_FILE: -------------------------------------------------------------------------------- 1 | github_repo( 2 | name = "pleasings2", 3 | repo = "sagikazarmark/mypleasings", 4 | revision = "502d7fc5487b0904a78c60b5f645dd4642298211", 5 | ) 6 | 7 | subinclude("///subrepo/dir/pleasings2//go") 8 | 9 | gotestsum_test( 10 | name = "gotest", 11 | race = True, 12 | ) -------------------------------------------------------------------------------- /test/manual_label/BUILD: -------------------------------------------------------------------------------- 1 | gentest( 2 | name = "failing_test", 3 | labels = ["manual"], 4 | test_cmd = "false", 5 | ) 6 | 7 | gentest( 8 | name = "passing_test", 9 | no_test_output = True, 10 | test_cmd = "true", 11 | deps = [":failing_test"], 12 | ) 13 | -------------------------------------------------------------------------------- /test/misc_rules/a.txt: -------------------------------------------------------------------------------- 1 | We aim to misbehave. 2 | -------------------------------------------------------------------------------- /test/misc_rules/filegroup_not_require_test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if [ ! -f test/misc_rules/a.txt ]; then 3 | exit 0 4 | fi 5 | exit 1 6 | -------------------------------------------------------------------------------- /test/misc_rules/filegroup_require_test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if [ -f test/misc_rules/a.txt ]; then 3 | exit 0 4 | fi 5 | exit 1 6 | -------------------------------------------------------------------------------- /test/name_conflict.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | func main() {} 4 | -------------------------------------------------------------------------------- /test/num_runs_test.go: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | import "testing" 4 | import "time" 5 | 6 | func TestNumRuns(t *testing.T) { 7 | // Just take up a little time here so it's obvious how a number of runs 8 | // multiplies up the duration (Go's so fast that this is essentially instant otherwise). 9 | time.Sleep(100 * time.Millisecond) 10 | } 11 | -------------------------------------------------------------------------------- /test/optional_outs_test/BUILD: -------------------------------------------------------------------------------- 1 | subinclude("//test/build_defs") 2 | 3 | please_repo_e2e_test( 4 | name = "optional_outs_test", 5 | expected_output = { 6 | "plz-out/gen/foo/foo.sym": "", 7 | "plz-out/gen/foo/foo.wildcard.sym": "", 8 | }, 9 | plz_command = "plz build //foo && rm plz-out/gen/foo/* && plz build //foo", 10 | repo = "test_repo", 11 | ) 12 | -------------------------------------------------------------------------------- /test/optional_outs_test/test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [Parse] 2 | BuildFileName = BUILD_FILE 3 | -------------------------------------------------------------------------------- /test/optional_outs_test/test_repo/foo/BUILD_FILE: -------------------------------------------------------------------------------- 1 | genrule( 2 | name = "foo", 3 | outs = ["foo.a"], 4 | cmd = "touch foo.a && touch foo.sym && touch foo.wildcard.sym", 5 | optional_outs = [ 6 | "foo.sym", 7 | "*.wildcard.sym", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /test/parse/inline_subinclude/BUILD.test: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "constant", 3 | srcs = ["constant.build_defs"], 4 | ) 5 | 6 | subinclude(":constant") 7 | 8 | assert ANSWER == 42 9 | -------------------------------------------------------------------------------- /test/parse/inline_subinclude/constant.build_defs: -------------------------------------------------------------------------------- 1 | ANSWER = 42 2 | -------------------------------------------------------------------------------- /test/parse/label_list_subinclude/BUILD.test: -------------------------------------------------------------------------------- 1 | constant12 = filegroup( 2 | name = "constant12", 3 | srcs = ["constant1.build_defs", "constant2.build_defs"], 4 | ) 5 | 6 | filegroup( 7 | name = "constant34", 8 | srcs = { 9 | "A": ["constant3.build_defs"], 10 | "B": ["constant4.build_defs"], 11 | }, 12 | ) 13 | 14 | CON4 = 0 15 | 16 | subinclude(constant12, [":constant34|A"]) 17 | 18 | assert CON1 == 1 19 | assert CON2 == 2 20 | assert CON3 == 3 21 | assert CON4 == 0 22 | -------------------------------------------------------------------------------- /test/parse/label_list_subinclude/constant1.build_defs: -------------------------------------------------------------------------------- 1 | CON1 = 1 2 | -------------------------------------------------------------------------------- /test/parse/label_list_subinclude/constant2.build_defs: -------------------------------------------------------------------------------- 1 | CON2 = 2 2 | -------------------------------------------------------------------------------- /test/parse/label_list_subinclude/constant3.build_defs: -------------------------------------------------------------------------------- 1 | CON3 = 3 2 | -------------------------------------------------------------------------------- /test/parse/label_list_subinclude/constant4.build_defs: -------------------------------------------------------------------------------- 1 | CON4 = 4 2 | -------------------------------------------------------------------------------- /test/parse/namedout_subinclude/BUILD.test: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "constant", 3 | srcs = { 4 | "NAMED": ["constant.build_defs"], 5 | }, 6 | ) 7 | 8 | subinclude(":constant|NAMED") 9 | 10 | assert ANSWER == 42 11 | -------------------------------------------------------------------------------- /test/parse/namedout_subinclude/constant.build_defs: -------------------------------------------------------------------------------- 1 | ANSWER = 42 2 | -------------------------------------------------------------------------------- /test/parse/pre_post_build_config/BUILD.test: -------------------------------------------------------------------------------- 1 | package(GO_TOOL = "foo") 2 | 3 | subinclude("//test/parse/pre_post_build_config/build_defs:build_foo") 4 | 5 | build_foo(name = "target") 6 | 7 | -------------------------------------------------------------------------------- /test/parse/pre_post_build_config/build_defs/BUILD.test: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "build_foo", 3 | srcs = ["build_foo.build_defs"], 4 | visibility = ["PUBLIC"], 5 | ) 6 | 7 | -------------------------------------------------------------------------------- /test/parse/pre_post_build_config/build_defs/build_foo.build_defs: -------------------------------------------------------------------------------- 1 | def _prebuild(x): 2 | assert CONFIG.GO_TOOL == "foo" 3 | 4 | def _postbuild(x, y): 5 | assert CONFIG.GO_TOOL == "foo" 6 | 7 | def build_foo(name): 8 | return build_rule( 9 | name = name, 10 | cmd = "true", 11 | pre_build = _prebuild, 12 | post_build = _postbuild, 13 | ) 14 | 15 | -------------------------------------------------------------------------------- /test/parse/subinclude_visibility/BUILD.test: -------------------------------------------------------------------------------- 1 | # This should fail because this target isn't visible to subinclude here. 2 | subinclude("//test/build_defs:not_visible") 3 | -------------------------------------------------------------------------------- /test/parse_test/additional_output_test.go: -------------------------------------------------------------------------------- 1 | // Test on adding extra output files to a target in a post-build function. 2 | package parse 3 | 4 | import ( 5 | "os" 6 | "testing" 7 | ) 8 | 9 | func TestContentsOfOutputFile(t *testing.T) { 10 | contents, err := os.ReadFile("test/parse_test/test_additional_output.txt") 11 | if err != nil { 12 | t.Errorf("Failed to read additional output file: %s", err) 13 | } 14 | if string(contents) != "kittens" { 15 | t.Errorf("Unexpected file contents: was '%s', expected 'kittens'", string(contents)) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /test/pass_env_test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | 4 | source "test/pass_env.sh" 5 | if [ -z "$USER" ]; then 6 | echo '$USER is not set' 7 | exit 1 8 | fi 9 | -------------------------------------------------------------------------------- /test/please_shim/test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [please] 2 | location = ./please 3 | version = 17.11.0 4 | -------------------------------------------------------------------------------- /test/please_shim/test_repo/.plzconfig.update_version: -------------------------------------------------------------------------------- 1 | [please] 2 | version = 17.10.0 3 | -------------------------------------------------------------------------------- /test/please_shim/test_repo/please/README.md: -------------------------------------------------------------------------------- 1 | This is the directory where Please is meant to be installed. 2 | -------------------------------------------------------------------------------- /test/plugins/config_field_value_plugin/.plzconfig: -------------------------------------------------------------------------------- 1 | [PluginDefinition] 2 | Name = config_field_value 3 | 4 | [PluginConfig "str_required"] 5 | Type = str 6 | Inherit = false 7 | DefaultValue = 8 | 9 | [PluginConfig "str_optional"] 10 | Type = str 11 | Optional = true 12 | Inherit = false 13 | 14 | [PluginConfig "int_required"] 15 | Type = int 16 | Inherit = false 17 | DefaultValue = 0 18 | 19 | [PluginConfig "int_optional"] 20 | Type = int 21 | Optional = true 22 | Inherit = false 23 | 24 | [PluginConfig "bool_required"] 25 | Type = bool 26 | Inherit = false 27 | DefaultValue = false 28 | 29 | [PluginConfig "bool_optional"] 30 | Type = bool 31 | Optional = true 32 | Inherit = false 33 | -------------------------------------------------------------------------------- /test/plugins/config_field_value_plugin/build_defs/BUILD_FILE: -------------------------------------------------------------------------------- 1 | export_file( 2 | name = "defs", 3 | src = "defs.build_defs", 4 | visibility = ["PUBLIC"], 5 | ) 6 | -------------------------------------------------------------------------------- /test/plugins/config_field_value_plugin/build_defs/defs.build_defs: -------------------------------------------------------------------------------- 1 | # This file only exists so that config_field_value_test_repo has a target to 2 | # build, which will cause this plugin to be loaded. 3 | -------------------------------------------------------------------------------- /test/plugins/config_field_value_test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [Plugin "config_field_value"] 2 | Target = //plugins:config_field_value 3 | -------------------------------------------------------------------------------- /test/plugins/config_field_value_test_repo/plugins/BUILD_FILE: -------------------------------------------------------------------------------- 1 | plugin_repo( 2 | name = "config_field_value", 3 | revision = "v0.0.1", 4 | ) 5 | -------------------------------------------------------------------------------- /test/plugins/config_field_value_test_repo/test/BUILD_FILE: -------------------------------------------------------------------------------- 1 | subinclude("///config_field_value//build_defs:defs") 2 | 3 | text_file( 4 | name = "config_field_value_test", 5 | out = "config_field_value_test", 6 | content = "\n".join([f"{k}='{v}'" for k, v in CONFIG.CONFIG_FIELD_VALUE.items()]), 7 | ) 8 | -------------------------------------------------------------------------------- /test/plugins/foo_plugin/.plzconfig: -------------------------------------------------------------------------------- 1 | [Parse] 2 | BuildFileName = BUILD.plugin 3 | 4 | [PluginDefinition] 5 | name = foo 6 | 7 | [Plugin "foo"] 8 | ModulePath = foolang 9 | CompileFlag = -sha1 10 | BarTool = bar_test_tool 11 | 12 | [PluginConfig "fooc_tool"] 13 | Inherit = true 14 | DefaultValue = fooc 15 | 16 | [PluginConfig "bar_tool"] 17 | Inherit = true 18 | DefaultValue = bar 19 | 20 | [PluginConfig "module_path"] 21 | Optional = false 22 | 23 | [PluginConfig "compile_flags"] 24 | ConfigKey = CompileFlag 25 | Repeatable = true 26 | 27 | [PluginConfig "bool_test"] 28 | Type = bool 29 | DefaultValue = True 30 | 31 | [PluginConfig "int_test"] 32 | Type = int 33 | DefaultValue = 100 -------------------------------------------------------------------------------- /test/plugins/foo_plugin/build_defs/BUILD_FILE: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "foolang", 3 | srcs = ["foolang.build_defs"], 4 | visibility=["PUBLIC"], 5 | ) -------------------------------------------------------------------------------- /test/plugins/foo_plugin/build_defs/foolang.build_defs: -------------------------------------------------------------------------------- 1 | def foolang_library(name:str, src:str): 2 | flags = " ".join(CONFIG.FOO.COMPILE_FLAGS) 3 | path = CONFIG.FOO.MODULE_PATH + "/" + src 4 | return build_rule( 5 | name = name, 6 | srcs = [src], 7 | cmd = f"$TOOL {flags} -path {path} -out=$OUT $SRCS", 8 | outs = [f"{name}.foo"], 9 | tools = [CONFIG.FOO.FOOC_TOOL], 10 | ) 11 | -------------------------------------------------------------------------------- /test/plugins/foo_plugin/test/BUILD_FILE: -------------------------------------------------------------------------------- 1 | subinclude("//build_defs:foolang") 2 | 3 | foolang_library( 4 | name = "foo_lib", 5 | src = "test.foo", 6 | ) 7 | 8 | bar = CONFIG.FOO.BAR_TOOL 9 | genrule( 10 | name = "bar_inherit_test", 11 | cmd = f"echo {bar} > $OUT", 12 | outs = ["bar_inherit_test"], 13 | ) -------------------------------------------------------------------------------- /test/plugins/foo_plugin/test/test.foo: -------------------------------------------------------------------------------- 1 | Wibble wobble -------------------------------------------------------------------------------- /test/plugins/foo_plugin/tools/BUILD_FILE: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "fooc", 3 | srcs = ["fooc"], 4 | visibility = ["PUBLIC"], 5 | ) -------------------------------------------------------------------------------- /test/plugins/init_plugin_test/.plzconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/test/plugins/init_plugin_test/.plzconfig -------------------------------------------------------------------------------- /test/plugins/nested_subrepo/.plzconfig: -------------------------------------------------------------------------------- 1 | [Parse] 2 | BuildFileName = BUILD.plugin 3 | 4 | [Plugin "foo"] 5 | ModulePath = nested 6 | FoocTool = invalid ; This config should be inherited from the host repo 7 | -------------------------------------------------------------------------------- /test/plugins/nested_subrepo/README: -------------------------------------------------------------------------------- 1 | This repo is meant to be like a library that is built with Please. We should use some of the config settings from 2 | the host repo, explicitly layering in stuff that's marked to be inherited. 3 | 4 | For example if this was a go repo, we'd want to use the GoTool from the host repo. If we didn't we might end up mixing 5 | toolchain versions and therefore we wouldn't be able to link to this library. 6 | 7 | In this case, this subrepo defines a FoocTool but we use the FoocTool as defined in the host repo. -------------------------------------------------------------------------------- /test/plugins/nested_subrepo/test/BUILD_FILE: -------------------------------------------------------------------------------- 1 | subinclude("///foo//build_defs:foolang") 2 | 3 | foolang_library( 4 | name = "nested_lib", 5 | src = "test.foo",) -------------------------------------------------------------------------------- /test/plugins/nested_subrepo/test/test.foo: -------------------------------------------------------------------------------- 1 | Wibble wobble -------------------------------------------------------------------------------- /test/plugins/self_referencing_plugin/.plzconfig: -------------------------------------------------------------------------------- 1 | [PluginDefinition] 2 | name = foo 3 | 4 | [Plugin "foo"] 5 | 6 | [Plugin "shell"] 7 | target = //plugins:shell 8 | 9 | [Parse] 10 | preloadsubincludes = ///shell//build_defs:shell 11 | buildFileName = BUILD 12 | -------------------------------------------------------------------------------- /test/plugins/self_referencing_plugin/BUILD_FILE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/test/plugins/self_referencing_plugin/BUILD_FILE -------------------------------------------------------------------------------- /test/plugins/self_referencing_plugin/build_defs/BUILD_FILE: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "foo", 3 | srcs = ["foo.build_defs"], 4 | visibility = ["PUBLIC"], 5 | ) -------------------------------------------------------------------------------- /test/plugins/self_referencing_plugin/build_defs/foo.build_defs: -------------------------------------------------------------------------------- 1 | def foo_library(name): 2 | return genrule( 3 | name = name, 4 | cmd = "$TOOL > $OUT", 5 | outs = [f"{name}.txt"], 6 | tools = ["///foo//tools:tool"], 7 | ) -------------------------------------------------------------------------------- /test/plugins/self_referencing_plugin/plugins/BUILD_FILE: -------------------------------------------------------------------------------- 1 | plugin_repo( 2 | name = "shell", 3 | plugin = "shell-rules", 4 | revision = "v0.1.1", 5 | ) 6 | -------------------------------------------------------------------------------- /test/plugins/self_referencing_plugin/test/BUILD_FILE: -------------------------------------------------------------------------------- 1 | subinclude("///foo//build_defs:foo") 2 | 3 | foo_library(name = "test") -------------------------------------------------------------------------------- /test/plugins/self_referencing_plugin/tools/BUILD_FILE: -------------------------------------------------------------------------------- 1 | sh_cmd( 2 | name = "tool", 3 | cmd = "echo foo", 4 | visibility = ["PUBLIC"], 5 | ) -------------------------------------------------------------------------------- /test/plugins/test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [Plugin "foo"] 2 | Target = //plugins:foo 3 | FoocTool = @foo//tools:fooc 4 | bartool = bar 5 | CompileFlag = -sha256 6 | BoolTest = False 7 | IntTest = 15 8 | -------------------------------------------------------------------------------- /test/plugins/test_repo/.plzconfig.dev: -------------------------------------------------------------------------------- 1 | [Plugin "foo"] 2 | CompileFlag= 3 | bartool=bar-dev -------------------------------------------------------------------------------- /test/plugins/test_repo/.plzconfig_foo_bar66: -------------------------------------------------------------------------------- 1 | [Plugin "foo"] 2 | fooctool = bar66 -------------------------------------------------------------------------------- /test/plugins/test_repo/BUILD_FILE: -------------------------------------------------------------------------------- 1 | subinclude("///foo//build_defs:foolang") 2 | 3 | subrepo( 4 | name = "nested", 5 | path = CONFIG.NESTED_SUBREPO, 6 | ) 7 | 8 | genrule( 9 | name = "output_fooc", 10 | cmd = f"echo {CONFIG.FOO.FOOC_TOOL} > $OUT", 11 | outs = ["fooc.txt"], 12 | ) -------------------------------------------------------------------------------- /test/plugins/test_repo/override/BUILD_FILE: -------------------------------------------------------------------------------- 1 | subinclude("@foo//build_defs:foolang") 2 | 3 | package(foo = {"fooc_tool": "overriden"}) 4 | 5 | text_file( 6 | name = "override_test", 7 | content = f"fooc: {CONFIG.FOO.FOOC_TOOL}, bar: {CONFIG.FOO.BAR_TOOL}, path: {CONFIG.FOO.MODULE_PATH}, flags: {CONFIG.FOO.COMPILE_FLAGS}", 8 | out = "fooc", 9 | ) -------------------------------------------------------------------------------- /test/plugins/test_repo/plugins/BUILD_FILE: -------------------------------------------------------------------------------- 1 | plugin_repo( 2 | name = "foo", 3 | revision = "v1.0.0", 4 | ) 5 | 6 | plugin_repo( 7 | name = "go", 8 | plugin = "go-rules", 9 | revision = "v1.21.5", 10 | ) 11 | -------------------------------------------------------------------------------- /test/plugins/test_repo/test/BUILD_FILE: -------------------------------------------------------------------------------- 1 | subinclude("@foo//build_defs:foolang") 2 | 3 | if not isinstance(CONFIG.FOO.BOOL_TEST, bool): 4 | fail("BoolTest should be a bool") 5 | 6 | if CONFIG.FOO.BOOL_TEST: 7 | fail("BoolTest should be falsy") 8 | 9 | if not isinstance(CONFIG.FOO.INT_TEST, int): 10 | fail("IntTest should be an int") 11 | 12 | foolang_library( 13 | name = "root_lib", 14 | src = "test.foo", 15 | ) -------------------------------------------------------------------------------- /test/plugins/test_repo/test/test.foo: -------------------------------------------------------------------------------- 1 | wibblewibblewibble -------------------------------------------------------------------------------- /test/plugins/tools/BUILD: -------------------------------------------------------------------------------- 1 | go_binary( 2 | name = "fooc", 3 | srcs = ["fooc.go"], 4 | visibility = ["PUBLIC"], 5 | ) 6 | -------------------------------------------------------------------------------- /test/plz_debug/BUILD: -------------------------------------------------------------------------------- 1 | subinclude("//test/build_defs") 2 | 3 | please_repo_e2e_test( 4 | name = "debug_target", 5 | expected_output = { 6 | "output": "hello world\nlorem ipsum...", 7 | }, 8 | # `--port` is used here to prevent this test from erroring out on Circle CI, 9 | # where it won't bring the process group where the debugging session is being 10 | # executed to the foreground. 11 | plz_command = "plz debug --port=31000 //:hello_world >output", 12 | repo = "test_repo", 13 | ) 14 | -------------------------------------------------------------------------------- /test/plz_debug/test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [Parse] 2 | BuildFileName = BUILD_FILE 3 | -------------------------------------------------------------------------------- /test/plz_debug/test_repo/BUILD_FILE: -------------------------------------------------------------------------------- 1 | # Dummy build rule used to show that the debug fields work as expected. 2 | build_rule( 3 | name = "hello_world", 4 | cmd = { 5 | 'dbg': "echo 'hello world' > $OUT", 6 | }, 7 | outs = ["out"], 8 | debug_cmd = "$DEBUG_TOOLS_CAT $OUT $DEBUG_DATA", 9 | debug_data = ["file1.txt"], 10 | debug_tools = { 11 | 'cat': 'cat' 12 | }, 13 | binary = True, 14 | ) 15 | -------------------------------------------------------------------------------- /test/plz_debug/test_repo/file1.txt: -------------------------------------------------------------------------------- 1 | lorem ipsum... 2 | -------------------------------------------------------------------------------- /test/plz_exec/test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [Parse] 2 | BuildFileName = BUILD 3 | 4 | [Plugin "shell"] 5 | target = //plugins:shell 6 | 7 | [Plugin "go"] 8 | target = //plugins:go 9 | -------------------------------------------------------------------------------- /test/plz_exec/test_repo/.plzconfig.sandbox: -------------------------------------------------------------------------------- 1 | [Sandbox] 2 | build = true 3 | test = true -------------------------------------------------------------------------------- /test/plz_exec/test_repo/BUILD_FILE: -------------------------------------------------------------------------------- 1 | subinclude("///go//build_defs:go", "///shell//build_defs:shell") 2 | 3 | sh_cmd( 4 | name = "hello_world", 5 | cmd = "echo \"hello world\"", 6 | ) 7 | 8 | go_binary( 9 | name = "network_test", 10 | srcs = ["network_test.go"] 11 | ) 12 | -------------------------------------------------------------------------------- /test/plz_exec/test_repo/network_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | "net" 6 | "time" 7 | ) 8 | 9 | func main() { 10 | if _, err := net.DialTimeout("tcp", "google.com:80", time.Second); err != nil { 11 | log.Fatalf("Dial error: %s", err) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /test/plz_exec/test_repo/plugins/BUILD_FILE: -------------------------------------------------------------------------------- 1 | plugin_repo( 2 | name = "shell", 3 | revision = "v0.1.1", 4 | ) 5 | 6 | plugin_repo( 7 | name = "go", 8 | plugin = "go-rules", 9 | revision = "v1.21.5", 10 | ) 11 | -------------------------------------------------------------------------------- /test/plz_exec/test_repo/puku.json: -------------------------------------------------------------------------------- 1 | { 2 | "stop": true 3 | } 4 | -------------------------------------------------------------------------------- /test/plz_format/test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [Parse] 2 | BuildFileName = BUILD_FILE 3 | -------------------------------------------------------------------------------- /test/plz_format/test_repo/src/BUILD_FILE: -------------------------------------------------------------------------------- 1 | python_binary( 2 | name = "foo", 3 | main = "main.py" 4 | ) 5 | -------------------------------------------------------------------------------- /test/plz_format/test_repo/src/FORMATTED_BUILD_FILE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/test/plz_format/test_repo/src/FORMATTED_BUILD_FILE -------------------------------------------------------------------------------- /test/plz_generate/test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [Parse] 2 | BuildFileName = BUILD_FILE 3 | 4 | [build] 5 | LinkGeneratedSources = true 6 | -------------------------------------------------------------------------------- /test/plz_generate/test_repo/.plzconfig.auto: -------------------------------------------------------------------------------- 1 | [build] 2 | LinkGeneratedSources = true 3 | UpdateGitignore = true -------------------------------------------------------------------------------- /test/plz_generate/test_repo/src/BUILD_FILE: -------------------------------------------------------------------------------- 1 | genrule( 2 | name = "foo", 3 | outs = ["foo.gen"], 4 | cmd = "echo wibble > $OUT", 5 | labels = ["codegen"], 6 | ) -------------------------------------------------------------------------------- /test/plz_generate/test_repo/src/bar/BUILD_FILE: -------------------------------------------------------------------------------- 1 | genrule( 2 | name = "bar", 3 | outs = ["bar.gen"], 4 | cmd = "echo wobble > $OUT", 5 | labels = ["codegen"], 6 | ) -------------------------------------------------------------------------------- /test/plz_generate/test_repo/src/bar/baz/BUILD_FILE: -------------------------------------------------------------------------------- 1 | genrule( 2 | name = "baz", 3 | outs = ["baz.gen"], 4 | cmd = "echo wabble > $OUT", 5 | labels = ["codegen", "link:" + package_name()], 6 | ) -------------------------------------------------------------------------------- /test/plz_run/temp.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/test/plz_run/temp.txt -------------------------------------------------------------------------------- /test/plz_run/test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [Parse] 2 | BuildFileName = BUILD 3 | preloadsubincludes = ///shell//build_defs:shell 4 | 5 | [plugin "shell"] 6 | target = //plugins:shell 7 | -------------------------------------------------------------------------------- /test/plz_run/test_repo/plugins/BUILD_FILE: -------------------------------------------------------------------------------- 1 | plugin_repo( 2 | name = "shell", 3 | plugin = "shell-rules", 4 | revision = "v0.1.1", 5 | ) 6 | -------------------------------------------------------------------------------- /test/plz_run/test_repo/src/arg_printer.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | echo $@ 4 | -------------------------------------------------------------------------------- /test/plz_run/test_repo/src/dummydata.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/test/plz_run/test_repo/src/dummydata.txt -------------------------------------------------------------------------------- /test/plz_run/test_repo/src/env_printer.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | printenv DATA -------------------------------------------------------------------------------- /test/plz_run/test_repo/src/wibble.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/test/plz_run/test_repo/src/wibble.txt -------------------------------------------------------------------------------- /test/preloaded_subinc/BUILD: -------------------------------------------------------------------------------- 1 | subinclude("//test/build_defs") 2 | 3 | please_repo_e2e_test( 4 | name = "preload_subinc_test", 5 | expected_output = { 6 | "out.txt": "//src:k8s", 7 | }, 8 | plz_command = "plz query alltargets //src:k8s > out.txt", 9 | repo = "test_repo", 10 | ) 11 | -------------------------------------------------------------------------------- /test/preloaded_subinc/test_repo/.plzconfig: -------------------------------------------------------------------------------- 1 | [parse] 2 | BuildFileName = BUILD 3 | preloadsubincludes = ///shell//build_defs:shell 4 | PreloadSubincludes = ///pleasings//k8s:k8s 5 | PreloadSubincludes = //build_defs:foo 6 | 7 | [Plugin "shell"] 8 | Target = //plugins:shell 9 | 10 | [Plugin "pleasings"] 11 | Target = //plugins:pleasings 12 | -------------------------------------------------------------------------------- /test/preloaded_subinc/test_repo/build_defs/BUILD_FILE: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "foo", 3 | srcs = ["foo.build_defs"], 4 | visibility = ["PUBLIC"], 5 | ) 6 | 7 | filegroup( 8 | name = "bar", 9 | srcs = ["bar.build_defs"], 10 | visibility = ["PUBLIC"], 11 | ) 12 | -------------------------------------------------------------------------------- /test/preloaded_subinc/test_repo/build_defs/bar.build_defs: -------------------------------------------------------------------------------- 1 | def bar(): 2 | pass -------------------------------------------------------------------------------- /test/preloaded_subinc/test_repo/build_defs/foo.build_defs: -------------------------------------------------------------------------------- 1 | subinclude("//build_defs:bar") 2 | 3 | bar() 4 | 5 | def foo(): 6 | pass 7 | -------------------------------------------------------------------------------- /test/preloaded_subinc/test_repo/plugins/BUILD_FILE: -------------------------------------------------------------------------------- 1 | plugin_repo( 2 | name = "shell", 3 | plugin = "shell-rules", 4 | revision = "v0.1.1", 5 | ) 6 | 7 | plugin_repo( 8 | name = "pleasings", 9 | plugin = "pleasings", 10 | owner = "thought-machine", 11 | revision = "9b03499b58111c555ee45ed92e2fccc32d842160", 12 | ) 13 | -------------------------------------------------------------------------------- /test/preloaded_subinc/test_repo/src/BUILD_FILE: -------------------------------------------------------------------------------- 1 | # This file contains a reference to sh_test which is preloaded. Make sure that works. 2 | subinclude("//src/build_defs:empty") 3 | 4 | k8s_config( 5 | name = "k8s", 6 | srcs = [ 7 | "service.yaml", 8 | ], 9 | ) 10 | 11 | foo() 12 | -------------------------------------------------------------------------------- /test/preloaded_subinc/test_repo/src/build_defs/BUILD_FILE: -------------------------------------------------------------------------------- 1 | # This should be available to us via preloads even though this file is involved in a subinclude 2 | blah = sh_test 3 | 4 | # Empty doesn't export anything. It just checks that foo() is preloaded there 5 | filegroup( 6 | name = "empty", 7 | srcs = ["empty.build_defs"], 8 | visibility = ["//src/..."], 9 | ) -------------------------------------------------------------------------------- /test/preloaded_subinc/test_repo/src/build_defs/empty.build_defs: -------------------------------------------------------------------------------- 1 | foo() -------------------------------------------------------------------------------- /test/preloaded_subinc/test_repo/src/service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: hello-svc 5 | spec: 6 | selector: 7 | app: hello 8 | ports: 9 | - protocol: TCP 10 | port: 8000 11 | targetPort: 8000 -------------------------------------------------------------------------------- /test/preloaded_subinc/test_repo/src/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | exit 0 -------------------------------------------------------------------------------- /test/proto_plugin/BUILD: -------------------------------------------------------------------------------- 1 | subinclude("//test/build_defs:build_defs") 2 | 3 | please_repo_e2e_test( 4 | name = "proto_rules_test", 5 | # the protoc releases page doesn't support these platforms 6 | labels = [ 7 | "no_cirrus", 8 | "no-musl", 9 | ], 10 | plz_command = "plz -o plugin.go.gotool:$TOOLS_GO test", 11 | repo = "test_repo", 12 | tools = { 13 | "go": [CONFIG.GO.GO_TOOL], 14 | }, 15 | ) 16 | -------------------------------------------------------------------------------- /test/proto_plugin/test_repo/BUILD_FILE: -------------------------------------------------------------------------------- 1 | # This can be deleted once #2403 has landed -------------------------------------------------------------------------------- /test/proto_plugin/test_repo/plugins/BUILD_FILE: -------------------------------------------------------------------------------- 1 | plugin_repo( 2 | name = "proto", 3 | revision = "064ff35796b681b33a0667e85a5b1a1d54b64f64", 4 | ) 5 | 6 | plugin_repo( 7 | name = "go", 8 | plugin = "go-rules", 9 | revision = "v1.21.5", 10 | ) 11 | 12 | plugin_repo( 13 | name = "go-proto", 14 | revision = "v0.3.0", 15 | ) 16 | -------------------------------------------------------------------------------- /test/proto_plugin/test_repo/puku.json: -------------------------------------------------------------------------------- 1 | { 2 | "stop": true 3 | } 4 | -------------------------------------------------------------------------------- /test/proto_plugin/test_repo/test/BUILD_FILE: -------------------------------------------------------------------------------- 1 | subinclude("///go//build_defs:go") 2 | 3 | go_test( 4 | name = "proto_test", 5 | srcs = ["proto_test.go"], 6 | deps = ["//test/proto"], 7 | ) -------------------------------------------------------------------------------- /test/proto_plugin/test_repo/test/proto/BUILD_FILE: -------------------------------------------------------------------------------- 1 | subinclude("///proto//build_defs:proto") 2 | 3 | proto_library( 4 | name = "proto_only", 5 | srcs = ["service.proto"], 6 | visibility = ["PUBLIC"], 7 | ) 8 | 9 | grpc_library( 10 | name = "proto", 11 | srcs = ["service.proto"], 12 | visibility = ["PUBLIC"], 13 | ) -------------------------------------------------------------------------------- /test/proto_plugin/test_repo/test/proto/service.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package test.proto; 4 | 5 | service HelloService { 6 | rpc Hello(HelloRequest) returns (HelloResponse); 7 | } 8 | 9 | message HelloRequest { 10 | string id = 1; 11 | 12 | string person = 2; 13 | } 14 | 15 | message HelloResponse { 16 | string id = 1; 17 | 18 | string greeting = 2; 19 | } -------------------------------------------------------------------------------- /test/proto_plugin/test_repo/test/proto_test.go: -------------------------------------------------------------------------------- 1 | package test 2 | 3 | import ( 4 | "testing" 5 | 6 | "github.com/thought-machine/please/test/proto_plugin/test/proto" 7 | ) 8 | 9 | func TestServiceImportable(t *testing.T) { 10 | _ = proto.HelloRequest{} 11 | } 12 | -------------------------------------------------------------------------------- /test/query_affectedtests_test.txt: -------------------------------------------------------------------------------- 1 | //test:affectedtests_test 2 | -------------------------------------------------------------------------------- /test/query_alltargets_1.txt: -------------------------------------------------------------------------------- 1 | //test/moar:provided 2 | //test/moar:provider 3 | //test/moar:require_provide_check 4 | //test/moar:require_test 5 | //test/moar:test_require_fg 6 | //test/moar:test_require_go 7 | //test/moar:test_require_py 8 | -------------------------------------------------------------------------------- /test/query_alltargets_2.txt: -------------------------------------------------------------------------------- 1 | //test/moar:require_test 2 | -------------------------------------------------------------------------------- /test/query_output_test.txt: -------------------------------------------------------------------------------- 1 | plz-out/gen/test/please 2 | -------------------------------------------------------------------------------- /test/query_print_test.txt: -------------------------------------------------------------------------------- 1 | hello 2 | greetings 3 | -------------------------------------------------------------------------------- /test/query_somepath_nopath_test.txt: -------------------------------------------------------------------------------- 1 | Couldn't find any dependency path between //src:please and //docs/tools/config_templater:config_templater 2 | -------------------------------------------------------------------------------- /test/query_somepath_test.txt: -------------------------------------------------------------------------------- 1 | Found path: 2 | //src:please 3 | //src/build:build 4 | //src/core:core 5 | //src/fs:fs 6 | -------------------------------------------------------------------------------- /test/require_provide_test.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/test/require_provide_test.txt -------------------------------------------------------------------------------- /test/require_provides/BUILD: -------------------------------------------------------------------------------- 1 | subinclude("//test/build_defs") 2 | 3 | please_repo_e2e_test( 4 | name = "require_provide_test", 5 | expected_output = { 6 | "plz-out/gen/foo.ls": "foo.txt", # Nothing provided for foo, so we get the filegroup rule 7 | "plz-out/gen/bar.ls": "bar.txt", # bar matches a provide so we get the bar file instead 8 | "plz-out/gen/baz.ls": "", # baz matches a provide on an empty list so we get nothing 9 | "plz-out/gen/nothing.ls": "foo.txt", # Similar to foo, this matches the main rule 10 | }, 11 | plz_command = "plz build :all", 12 | repo = "test_repo", 13 | ) 14 | -------------------------------------------------------------------------------- /test/require_provides/test_repo/.plzconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/test/require_provides/test_repo/.plzconfig -------------------------------------------------------------------------------- /test/revdeps/hidden_test/lvl1.txt: -------------------------------------------------------------------------------- 1 | //test/revdeps/hidden_test:lvl1 2 | -------------------------------------------------------------------------------- /test/revdeps/hidden_test/lvl2.txt: -------------------------------------------------------------------------------- 1 | //test/revdeps/hidden_test:lvl1 2 | //test/revdeps/hidden_test:lvl2 3 | -------------------------------------------------------------------------------- /test/revdeps/hidden_test/lvl3.txt: -------------------------------------------------------------------------------- 1 | //test/revdeps/hidden_test:lvl1 2 | //test/revdeps/hidden_test:lvl2 3 | //test/revdeps/hidden_test:lvl3 4 | -------------------------------------------------------------------------------- /test/revdeps/hidden_test/lvl4.txt: -------------------------------------------------------------------------------- 1 | //test/revdeps/hidden_test:lvl1 2 | //test/revdeps/hidden_test:lvl2 3 | //test/revdeps/hidden_test:lvl3 4 | //test/revdeps/hidden_test:lvl4 5 | -------------------------------------------------------------------------------- /test/revdeps/hidden_test/lvl4_hidden.txt: -------------------------------------------------------------------------------- 1 | //test/revdeps/hidden_test:_lvl1#one 2 | //test/revdeps/hidden_test:_lvl1#two 3 | //test/revdeps/hidden_test:_lvl2#one 4 | //test/revdeps/hidden_test:lvl1 5 | -------------------------------------------------------------------------------- /test/revdeps/query_revdeps_branch_test.txt: -------------------------------------------------------------------------------- 1 | //test/revdeps:target2 2 | -------------------------------------------------------------------------------- /test/revdeps/query_revdeps_multiple_paths_test.txt: -------------------------------------------------------------------------------- 1 | //test/revdeps:target1 2 | //test/revdeps:target2 3 | //test/revdeps:target3 4 | -------------------------------------------------------------------------------- /test/revdeps/query_revdeps_no_level_test.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/test/revdeps/query_revdeps_no_level_test.txt -------------------------------------------------------------------------------- /test/revdeps/query_revdeps_root_test.txt: -------------------------------------------------------------------------------- 1 | //test/revdeps:target3 2 | -------------------------------------------------------------------------------- /test/revdeps/query_revdeps_single_level_test.txt: -------------------------------------------------------------------------------- 1 | //test/revdeps:target2 2 | -------------------------------------------------------------------------------- /test/revdeps/require_provide/revdeps.txt: -------------------------------------------------------------------------------- 1 | //test/revdeps/require_provide:three 2 | //test/revdeps/require_provide:two 3 | -------------------------------------------------------------------------------- /test/revdeps/require_provide/somepath.txt: -------------------------------------------------------------------------------- 1 | Found path: 2 | //test/revdeps/require_provide:three 3 | //test/revdeps/require_provide:two 4 | -------------------------------------------------------------------------------- /test/run_completions.txt: -------------------------------------------------------------------------------- 1 | //test/completions:binary 2 | //test/completions:test 3 | -------------------------------------------------------------------------------- /test/secrets/BUILD: -------------------------------------------------------------------------------- 1 | # Test on using secrets. Obviously it can't test any real secrets 2 | # but it proves the system works. 3 | gentest( 4 | name = "test_root_file", 5 | outs = ["test_root_file.sh"], 6 | cmd = 'echo "#!$SECRETS\nexec true" > "$OUT"', 7 | no_test_output = True, 8 | secrets = ["/bin/sh"], 9 | test_cmd = "$TEST", 10 | ) 11 | -------------------------------------------------------------------------------- /test/select/BUILD: -------------------------------------------------------------------------------- 1 | config_setting( 2 | name = "linux_x86", 3 | values = { 4 | "os": "linux", 5 | "cpu": "x86", 6 | }, 7 | ) 8 | -------------------------------------------------------------------------------- /test/sh_rules/no_shebang.sh: -------------------------------------------------------------------------------- 1 | true 2 | 3 | # This checks that the top line of the script isn't reused for building the target as it's not a shebang. 4 | if [ "`grep -axc "true" $0`" != "1" ]; then 5 | echo "The top line of the original file is being reused and it's not a shebang" >&2 6 | exit 1 7 | fi 8 | 9 | -------------------------------------------------------------------------------- /test/sh_rules/sh_binary.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | 4 | # test /bin/bash can be used 5 | [ ! -z "$BASH_VERSION" ] || (echo "Expected a bash shell" >&2 && exit 11) 6 | 7 | source test/sh_rules/sh_lib.sh 8 | [ "$TEST_DEPS_VAR" = "123" ] || (echo "Could not source variable from dependency" && exit 12) 9 | -------------------------------------------------------------------------------- /test/sh_rules/sh_lib.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # used by the sh deps test 3 | export TEST_DEPS_VAR="123" 4 | -------------------------------------------------------------------------------- /test/sh_rules/shebang.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | if [ "`head -1 $0`" != "#!/usr/bin/env bash" ]; then 4 | echo "Shebang of the original file isn't the first line of the produced artefact" >&2 5 | exit 1 6 | fi 7 | 8 | -------------------------------------------------------------------------------- /test/stamp/BUILD: -------------------------------------------------------------------------------- 1 | go_binary( 2 | name = "stamp", 3 | srcs = ["main.go"], 4 | definitions = { 5 | "github.com/thought-machine/please/test/stamp/lib.GitRevision": "$SCM_REVISION", 6 | "github.com/thought-machine/please/test/stamp/lib.GitDescribe": "$SCM_DESCRIBE", 7 | }, 8 | stamp = True, 9 | deps = ["//test/stamp/lib"], 10 | ) 11 | 12 | sh_test( 13 | name = "stamp_test", 14 | src = "stamp_test.sh", 15 | data = [":stamp"], 16 | ) 17 | -------------------------------------------------------------------------------- /test/stamp/lib/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "lib", 3 | srcs = ["lib.go"], 4 | visibility = ["//test/stamp:all"], 5 | ) 6 | -------------------------------------------------------------------------------- /test/stamp/lib/lib.go: -------------------------------------------------------------------------------- 1 | package lib 2 | 3 | // vars that will be overridden at build time with actual git data. 4 | // N.B. Must be a variable not a constant - constants aren't linker symbols and 5 | // hence can't be replaced in the same way. 6 | var ( 7 | GitRevision = "12345-revision" 8 | GitDescribe = "12345-describe" 9 | ) 10 | -------------------------------------------------------------------------------- /test/stamp/main.go: -------------------------------------------------------------------------------- 1 | // Package main implements a simple binary that prints out the git revision 2 | // at the time it was compiled. 3 | package main 4 | 5 | import ( 6 | "fmt" 7 | 8 | "github.com/thought-machine/please/test/stamp/lib" 9 | ) 10 | 11 | func main() { 12 | fmt.Println(lib.GitRevision) 13 | fmt.Println(lib.GitDescribe) 14 | } 15 | -------------------------------------------------------------------------------- /test/stamp/stamp_test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | unexpected="12345-revision 4 | 12345-describe" 5 | 6 | if [ "`$DATA`" == "${unexpected}" ]; then 7 | echo "Stamped variable has not been replaced correctly." 8 | exit 1 9 | fi 10 | -------------------------------------------------------------------------------- /test/subrepo/BUILD: -------------------------------------------------------------------------------- 1 | subinclude("//test/build_defs") 2 | 3 | please_repo_e2e_test( 4 | name = "same_package_error", 5 | expect_output_contains = { 6 | "output": "is not defined in this package yet", 7 | }, 8 | expected_failure = True, 9 | plz_command = "plz build //:all 2>output", 10 | repo = "test_repo", 11 | ) 12 | -------------------------------------------------------------------------------- /test/subrepo/test_repo/.plzconfig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/test/subrepo/test_repo/.plzconfig -------------------------------------------------------------------------------- /test/subrepo/test_repo/BUILD_FILE: -------------------------------------------------------------------------------- 1 | subinclude("///subrepo//:foo") 2 | 3 | local_repository( 4 | name = "subrepo", 5 | path = "subrepo", 6 | ) 7 | -------------------------------------------------------------------------------- /test/subrepo/test_repo/subrepo/BUILD_FILE: -------------------------------------------------------------------------------- 1 | genrule( 2 | name = "foo", 3 | cmd = "touch foo.txt", 4 | ) 5 | -------------------------------------------------------------------------------- /test/symlink_test.txt: -------------------------------------------------------------------------------- 1 | test1234 2 | -------------------------------------------------------------------------------- /test/test_completions.txt: -------------------------------------------------------------------------------- 1 | //test/completions:test 2 | -------------------------------------------------------------------------------- /test/test_output_test_1.txt: -------------------------------------------------------------------------------- 1 | === RUN TestJSONExpectedFailure-6 2 | --- PASS: TestJSONExpectedFailure-6 (0.00s) 3 | === RUN TestJSONSkipped-6 4 | --- PASS: TestJSONSkipped-6 (0.00s) 5 | === RUN TestBuckXML-6 6 | --- PASS: TestBuckXML-6 (0.00s) 7 | === RUN TestJUnitXML-6 8 | --- PASS: TestJUnitXML-6 (0.00s) 9 | PASS 10 | -------------------------------------------------------------------------------- /test/test_output_test_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /test/test_tools/BUILD: -------------------------------------------------------------------------------- 1 | sh_binary( 2 | name = "tool", 3 | srcs = "tool.sh", 4 | ) 5 | 6 | build_rule( 7 | name = "unnamed_test", 8 | outs = ["UNNAMED"], 9 | cmd = "echo 'wibble wibble wibble' > $OUT", 10 | no_test_output = True, 11 | test = True, 12 | test_cmd = "$TOOL $TEST", 13 | test_tools = [":tool"], 14 | ) 15 | 16 | build_rule( 17 | name = "named_test", 18 | outs = ["NAMED"], 19 | cmd = "echo 'wibble wibble wibble' > $OUT", 20 | no_test_output = True, 21 | test = True, 22 | test_cmd = "$TOOLS_DUMMY $TEST", 23 | test_tools = { 24 | "DUMMY": [":tool"], 25 | }, 26 | ) 27 | -------------------------------------------------------------------------------- /test/test_tools/tool.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | if [ "$(cat $1)" != "wibble wibble wibble" ]; then 5 | echo "content wasn't wibble wibble wibble" 6 | echo $CONTENT 7 | exit 1 8 | fi -------------------------------------------------------------------------------- /test/whatinputs/multiple_sources.txt: -------------------------------------------------------------------------------- 1 | //test/whatinputs/test_package:target1 2 | //test/whatinputs/test_package:target1 3 | -------------------------------------------------------------------------------- /test/whatinputs/test_package/BUILD: -------------------------------------------------------------------------------- 1 | genrule( 2 | name = "target1", 3 | srcs = ["foo.txt"], 4 | outs = ["out.txt"], 5 | cmd = "cat $SRCS > $OUT", 6 | ) 7 | -------------------------------------------------------------------------------- /test/whatinputs/test_package/foo.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thought-machine/please/0e1002f7dc3a22f53e26a225aae2cb1e26f40111/test/whatinputs/test_package/foo.txt -------------------------------------------------------------------------------- /third_party/cc/BUILD: -------------------------------------------------------------------------------- 1 | github_repo( 2 | name = "gtest", 3 | build_file = "gtest.build", 4 | repo = "google/googletest", 5 | revision = "release-1.11.0", 6 | strip_build = True, 7 | ) 8 | -------------------------------------------------------------------------------- /third_party/cc/gtest.build: -------------------------------------------------------------------------------- 1 | cc_library( 2 | name = "gtest", 3 | srcs = glob(["googletest/src/*.cc"], exclude=["googletest/src/gtest-all.cc"]), 4 | hdrs = glob(["googletest/include/**.h"]), 5 | private_hdrs = glob(["googletest/src/*.h"]), 6 | includes = ["googletest/include", "googletest"], 7 | visibility = ["PUBLIC"], 8 | linker_flags=["-lpthread"], 9 | ) 10 | 11 | -------------------------------------------------------------------------------- /third_party/js/BUILD: -------------------------------------------------------------------------------- 1 | filegroup( 2 | name = "asciinema", 3 | srcs = [ 4 | "asciinema-player.css", 5 | "asciinema-player.js", 6 | ], 7 | visibility = ["//docs/..."], 8 | ) 9 | -------------------------------------------------------------------------------- /third_party/python/importlib_metadata.patch: -------------------------------------------------------------------------------- 1 | --- importlib_metadata/__init__.py 2020-03-03 22:11:25.660002895 +0000 2 | +++ importlib_metadata/__init__.py.new 2020-03-14 11:57:19.600001299 +0000 3 | @@ -588,4 +588,4 @@ 4 | return distribution(distribution_name).requires 5 | 6 | 7 | -__version__ = version(__name__) 8 | +__version__ = '1.5.0' 9 | -------------------------------------------------------------------------------- /tools/build_langserver/BUILD: -------------------------------------------------------------------------------- 1 | go_binary( 2 | name = "build_langserver", 3 | srcs = ["langserver_main.go"], 4 | visibility = ["PUBLIC"], 5 | deps = [ 6 | "///third_party/go/github.com_sourcegraph_jsonrpc2//:jsonrpc2", 7 | "///third_party/go/gopkg.in_op_go-logging.v1//:go-logging.v1", 8 | "//src/cli", 9 | "//tools/build_langserver/lsp", 10 | ], 11 | ) 12 | -------------------------------------------------------------------------------- /tools/build_langserver/lsp/astutils/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "astutils", 3 | srcs = ["ast_utils.go"], 4 | visibility = ["//tools/build_langserver/..."], 5 | ) 6 | -------------------------------------------------------------------------------- /tools/build_langserver/lsp/astutils/ast_utils.go: -------------------------------------------------------------------------------- 1 | package astutils 2 | 3 | import "strings" 4 | 5 | func TrimStrLit(lit string) string { 6 | return strings.Trim(strings.TrimLeft(lit, "fr"), "\"'") 7 | } 8 | -------------------------------------------------------------------------------- /tools/build_langserver/lsp/test_data/.plzconfig: -------------------------------------------------------------------------------- 1 | [parse] 2 | buildfilename = test.build 3 | buildfilename = BUILD 4 | builddefsdir = build_defs 5 | preloadsubincludes = ///go//build_defs:go 6 | 7 | [Plugin "go"] 8 | target = //plugins:go 9 | 10 | [remote] 11 | url = 12 | numexecutors = 0 13 | -------------------------------------------------------------------------------- /tools/build_langserver/lsp/test_data/build_defs/test.build: -------------------------------------------------------------------------------- 1 | for filename in glob(["*.build_defs"]): 2 | filegroup( 3 | name = filename[:-11], 4 | srcs = [filename], 5 | visibility = ["PUBLIC"], 6 | ) 7 | -------------------------------------------------------------------------------- /tools/build_langserver/lsp/test_data/plugins/test.build: -------------------------------------------------------------------------------- 1 | plugin_repo( 2 | name = "go", 3 | plugin = "go-rules", 4 | revision = "v1.21.5", 5 | ) 6 | -------------------------------------------------------------------------------- /tools/build_langserver/lsp/test_data/puku.json: -------------------------------------------------------------------------------- 1 | { 2 | "stop": true 3 | } 4 | -------------------------------------------------------------------------------- /tools/build_langserver/lsp/test_data/src/core/config_test.go: -------------------------------------------------------------------------------- 1 | package core 2 | -------------------------------------------------------------------------------- /tools/build_langserver/lsp/test_data/src/core/test.build: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "core", 3 | srcs = glob( 4 | ["*.go"], 5 | exclude = [ 6 | "*_test.go", 7 | "version.go", 8 | ], 9 | allow_empty = True, 10 | ) + [ 11 | ":version", 12 | ], 13 | visibility = ["PUBLIC"], 14 | deps = [ 15 | "//third_party/go:gcfg", 16 | "//third_party/go:logging", 17 | ], 18 | ) 19 | 20 | go_test( 21 | name = "config_test", 22 | srcs = ["config_test.go"], 23 | data = glob(["test_data/*.plzconfig*"], allow_empty = True), 24 | deps = [ 25 | ":core", 26 | ], 27 | ) 28 | -------------------------------------------------------------------------------- /tools/http_cache/BUILD: -------------------------------------------------------------------------------- 1 | go_binary( 2 | name = "http_cache", 3 | srcs = ["main.go"], 4 | visibility = ["PUBLIC"], 5 | deps = [ 6 | "//src/cli", 7 | "//src/cli/logging", 8 | "//tools/http_cache/cache", 9 | ], 10 | ) 11 | 12 | sh_cmd( 13 | name = "run_local", 14 | cmd = r"exec \\$DATA -p 1771 -d /tmp/please_http_cache", 15 | data = [":http_cache"], 16 | ) 17 | -------------------------------------------------------------------------------- /tools/http_cache/README.md: -------------------------------------------------------------------------------- 1 | # HTTP Cache 2 | 3 | HTTP cache implements a resource based http server that please can use as a cache. The cache supports storing files 4 | via PUT requests and retrieving them again through GET requests. Really any http server (e.g. nginx) can be used as a 5 | cache for please however this is a lightweight and easy to configure option. 6 | 7 | ## Usage 8 | 9 | http_cache [OPTIONS] 10 | 11 | HTTP Cache options: 12 | -v, --verbosity= Verbosity of output (higher number = more output) (default: warning) 13 | -d, --dir= The directory to store cached artifacts in. 14 | -p, --port= The port to run the server on 15 | -------------------------------------------------------------------------------- /tools/http_cache/cache/BUILD: -------------------------------------------------------------------------------- 1 | go_library( 2 | name = "cache", 3 | srcs = ["cache.go"], 4 | visibility = ["PUBLIC"], 5 | deps = [ 6 | "//src/cli/logging", 7 | "//src/fs", 8 | ], 9 | ) 10 | -------------------------------------------------------------------------------- /tools/images/alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.24-alpine 2 | LABEL org.opencontainers.image.authors="please thoughtmachine net" 3 | LABEL org.opencontainers.image.source=https://github.com/thought-machine/please 4 | 5 | RUN apk add --no-cache git patch gcc g++ libc-dev bash libgcc xz protoc protobuf-dev perl-utils 6 | 7 | # Ensure this is where we expect on the PATH 8 | RUN ln -s /usr/local/go/bin/go /usr/local/bin/go 9 | 10 | WORKDIR /tmp 11 | -------------------------------------------------------------------------------- /tools/images/alpine/README.md: -------------------------------------------------------------------------------- 1 | Please Alpine image 2 | ------------------- 3 | 4 | This image contains everything needed to build Please and its 5 | associated tools. It is fairly minimal and doesn't contain everything 6 | needed to run all of the language-specific tests (see the Ubuntu image 7 | if that is of interest). 8 | This is the canonical build environment for Please in Linux that we 9 | use to release binaries from. 10 | -------------------------------------------------------------------------------- /tools/images/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -euvo pipefail 4 | 5 | tag=$(date +%Y%m%d) 6 | 7 | reporoot=$(plz query reporoot) 8 | images=("alpine" "freebsd_builder" "ubuntu" "ubuntu_alt") 9 | 10 | for image in ${images[@]}; do 11 | cd "$reporoot/tools/images/$image" 12 | echo "Building $image" 13 | docker build . --tag "ghcr.io/thought-machine/please_$image:$tag" 14 | docker push "ghcr.io/thought-machine/please_$image:$tag" 15 | done 16 | -------------------------------------------------------------------------------- /tools/images/freebsd_builder/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:noble 2 | LABEL org.opencontainers.image.authors="please thoughtmachine net" 3 | LABEL org.opencontainers.image.source=https://github.com/thought-machine/please 4 | 5 | # A few miscellaneous dependencies. 6 | RUN apt-get update && apt-get install -y curl git gcc xz-utils && apt-get clean 7 | 8 | # Go 9 | RUN curl -fsSL https://dl.google.com/go/go1.24.1.linux-amd64.tar.gz | tar -xzC /usr/local 10 | RUN ln -s /usr/local/go/bin/go /usr/local/bin/go && ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt 11 | RUN GOOS=freebsd go install std 12 | 13 | WORKDIR /tmp 14 | -------------------------------------------------------------------------------- /tools/images/freebsd_builder/README.md: -------------------------------------------------------------------------------- 1 | Please FreeBSD builder image 2 | ---------------------------- 3 | 4 | This image contains necessary dependencies for building 5 | a version of Please for FreeBSD. It is obviously not 6 | actually FreeBSD itself; we use this because CircleCI 7 | doesn't support native FreeBSD builders. 8 | -------------------------------------------------------------------------------- /tools/images/ubuntu/README.md: -------------------------------------------------------------------------------- 1 | Please Ubuntu image 2 | ------------------- 3 | 4 | This image contains everything needed to build Please & associated tools 5 | and run all the tests. It's the canonical supported environment for 6 | normal usage. 7 | 8 | It is currently based on Bionic (18.04) but Focal (20.04) should work fine too. 9 | It should be possible to get older versions running in a similar way. 10 | -------------------------------------------------------------------------------- /tools/images/ubuntu/motd.txt: -------------------------------------------------------------------------------- 1 | This is a prebuilt image based on Ubuntu Noble which contains 2 | everything you should need to build Please. 3 | 4 | Run the following to get started: 5 | git clone https://github.com/thought-machine/please.git 6 | cd please 7 | ./bootstrap.sh 8 | -------------------------------------------------------------------------------- /tools/images/ubuntu_alt/README.md: -------------------------------------------------------------------------------- 1 | Alternative Ubuntu image 2 | ------------------------ 3 | 4 | This is a modified version of the normal Ubuntu image with different 5 | OS and package versions. It's not really recommended for normal use 6 | but exists so we can test that things at least work in this environment. 7 | 8 | Notable differences: 9 | - Uses Jammy instead of Noble 10 | - Go 1.23 (standard one has 1.24) 11 | -------------------------------------------------------------------------------- /tools/images/ubuntu_alt/motd.txt: -------------------------------------------------------------------------------- 1 | This is a prebuilt image based on Ubuntu Bionic which contains 2 | everything you should need to build Please. 3 | Note that it's an alternative to the standard image so some 4 | minor issues may exist. 5 | 6 | Run the following to get started: 7 | git clone https://github.com/thought-machine/please.git 8 | cd please 9 | ./bootstrap.sh 10 | -------------------------------------------------------------------------------- /tools/images/ubuntu_alt/plzconfig: -------------------------------------------------------------------------------- 1 | [build] 2 | ; For testing this flow on CI. 3 | xattrs = false 4 | -------------------------------------------------------------------------------- /tools/misc/apparmor_profile: -------------------------------------------------------------------------------- 1 | # Allow Please and its sandbox binary to create unprivileged user namespaces. 2 | # These are used for sandboxing build actions when the appropriate config is enabled. 3 | 4 | abi , 5 | include 6 | 7 | profile /home/*/.please/please /home/*/.please/please_sandbox flags=(unconfined) { 8 | userns, 9 | 10 | # Site-specific additions and overrides. See local/README for details. 11 | include if exists 12 | } 13 | -------------------------------------------------------------------------------- /tools/misc/bb_storage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | mkdir -p plz-out/storage-cas plz-out/storage-ac 4 | 5 | exec docker run \ 6 | -p 8980:8980 \ 7 | -v $(pwd)/tools/misc:/config \ 8 | -v $(pwd)/plz-out/storage-cas:/storage-cas \ 9 | -v $(pwd)/plz-out/storage-ac:/storage-ac \ 10 | buildbarn/bb-storage:20190617T155413Z-3c42fa4 \ 11 | /config/bb_storage.json 12 | -------------------------------------------------------------------------------- /tools/misc/data/linux_amd64/release_asset_13.2.7: -------------------------------------------------------------------------------- 1 | wibble wibble wibble -------------------------------------------------------------------------------- /tools/misc/lint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eu 3 | 4 | [ -f "plz-out/please/plz" ] && PLZ="plz-out/please/plz" || PLZ="./pleasew" 5 | 6 | 7 | $PLZ run //third_party/binary:golangci-lint -p -- run --sort-results src/... tools/... 8 | $PLZ fmt -q || { 9 | echo "BUILD files are not correctly formatted; run plz fmt -w to fix." 10 | exit 1 11 | } 12 | -------------------------------------------------------------------------------- /tools/misc/plz_ci.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # This script implements an example CI flow using plz, which will perform an exhaustive diff 4 | # of the build graph against master and run all targets that have changed 5 | # This is not affected by trivial changes (e.g. formatting changes to BUILD files). 6 | 7 | set -eu 8 | set -o pipefail 9 | 10 | # Set $ORIGIN to a branch or tag name if you want to build vs. something other than master. 11 | ORIGIN="${ORIGIN:-origin/master}" 12 | plz query changes --since "$ORIGIN" | plz test - 13 | -------------------------------------------------------------------------------- /tools/performance/BUILD: -------------------------------------------------------------------------------- 1 | python_binary( 2 | name = "gen_parse_tree", 3 | labels = ["hlink:plz-out/pkg"], 4 | main = "gen_parse_tree.py", 5 | deps = [ 6 | "//third_party/python:absl", 7 | "//third_party/python:progress", 8 | ], 9 | ) 10 | 11 | python_binary( 12 | name = "parse_perf_test", 13 | labels = ["hlink:plz-out/pkg"], 14 | main = "parse_perf_test.py", 15 | deps = [ 16 | "//third_party/python:absl", 17 | "//third_party/python:colorlog", 18 | ], 19 | ) 20 | -------------------------------------------------------------------------------- /tools/performance/benchmark/BUILD: -------------------------------------------------------------------------------- 1 | go_binary( 2 | name = "benchmark", 3 | srcs = ["main.go"], 4 | visibility = ["PUBLIC"], 5 | deps = ["///third_party/go/golang.org_x_tools//benchmark/parse"], 6 | ) 7 | -------------------------------------------------------------------------------- /tools/release_signer/BUILD: -------------------------------------------------------------------------------- 1 | go_binary( 2 | name = "release_signer", 3 | srcs = ["main.go"], 4 | visibility = [ 5 | "//package/...", 6 | "//tools/javac_worker:all", 7 | ], 8 | deps = [ 9 | "///third_party/go/github.com_sigstore_sigstore_pkg_signature_kms_gcp//:gcp", 10 | "//src/cli", 11 | "//tools/release_signer/signer", 12 | ], 13 | ) 14 | -------------------------------------------------------------------------------- /tools/release_signer/signer/test_data/bad.txt: -------------------------------------------------------------------------------- 1 | Bad test file for signing 2 | -------------------------------------------------------------------------------- /tools/release_signer/signer/test_data/test.txt: -------------------------------------------------------------------------------- 1 | Test file for signing 2 | 3 | --------------------------------------------------------------------------------