Commit Graph

147 Commits

Author SHA1 Message Date
Matt Mackay 09c08e4ed7
fix: update recommend CI flags from Workflows (#378) 2023-02-22 15:46:20 -08:00
Greg Magolan 1fdfd6e831
fix: add missing **kwargs to write_aspect_bazelrc_presets (#379) 2023-02-22 12:17:00 -08:00
Greg Magolan 569fa374ef
feat: add write_aspect_bazelrc_presets macro (#370) 2023-02-17 14:34:06 -08:00
Alex Eagle 1df2becc7a chore: turn on more basic precommit checks
In particular this makes our bazelrc presets more compliant with client codebases, ensuring they can copy these files and not trip on their own pre-commit check
2023-02-17 11:00:00 -08:00
Greg Magolan fde705ba8c
feat: make bazel-lib the source-of-truth for Aspect recommended bazelrc settings (#369) 2023-02-16 16:59:21 -08:00
Greg Magolan 8f02b3364e
feat: add to_rlocation_path and to_repository_relative_path functions to paths.bzl (#362) 2023-02-11 12:36:49 -08:00
Alex Eagle 2cb6c7ac4f chore: also accept expected as a list of entries 2023-01-20 16:16:42 -08:00
Alex Eagle 19dcea9828 refactor: infer the archive type from the filename 2023-01-20 16:16:42 -08:00
Alex Eagle 9b7250d146 test: add happy-path test for assert_archive_contains 2023-01-20 16:16:42 -08:00
Greg Magolan 63f5aff803
feat: hardlink generated files in copy_to_directory and copy_directory instead of copying (#321) 2023-01-16 17:19:13 -08:00
Greg Magolan ce043b299d
fix: fix pathing issue in new copy_to_directory binary tool on Windows (#334) 2023-01-16 15:09:18 -08:00
Sahin Yort 4dc36a97f2
feat: add coreutils toolchain (#332) 2023-01-16 21:02:17 +03:00
Greg Magolan 7b6c814e27
Add copy_directory binary tool (#324) 2023-01-14 15:51:01 -08:00
Greg Magolan 4edb5018e8
chore: update pre-bazel 6 work-around in utils to only apply for bazel versions < 6 (#320) 2023-01-14 12:13:02 -08:00
Greg Magolan fb3ef6e45d
feat: improved copy_to_directory performance & globbing support using copy_to_directory_bin_action (#311) 2023-01-07 11:26:27 -08:00
Konstantin Zadorozhny b13fd20bee
Remove the use of realpath in tests (#315)
* do not use realpath

* make the file to follow symlinks on linux
2023-01-06 11:56:25 -08:00
Greg Magolan bf76da829c
fix: handle directory symlinks in copy_to_directory_bin_action tool binary (#314) 2023-01-06 10:29:45 -08:00
Greg Magolan ec13ec9a69
feat: improve performance of copy_to_directory by moving glob match & copying to a golang binary (#308) 2023-01-03 09:42:20 -08:00
Greg Magolan 4ad1dc2398
chore: run gazelle for golang (#305) 2023-01-01 15:37:00 -08:00
Derek Cormier 2689a48940
fix: fix a bug where transition tests required cpp toolchain on osx (#299) 2022-12-14 18:49:45 -08:00
Derek Cormier 72a26212f2
Add platform_transition_binary rule (#289)
* feat: add platform_transition_binary rule
2022-12-14 11:21:08 -08:00
Greg Magolan 35b7662e55
fix: write_source_files should use target platform for additional_update_targets (#297) 2022-12-03 15:02:33 -08:00
Greg Magolan 9059f8fa5e feat: add executable attribute to write_source_files 2022-12-03 10:46:08 -08:00
Greg Magolan 3d73637ee5
feat: add base64 encode & decode utility functions (#292) 2022-11-25 17:00:02 -08:00
Greg Magolan 9077a147c0
fix: fix copy_to_directory flattening with root_paths = ['**'] (#277) 2022-11-07 18:28:04 -08:00
Jason Bedard 350408b93d
perf: do not execute glob for non-glob copy_to_directory root_paths/replace_prefix params (#274)
* glob: add is_glob util method

* perf: do not execute glob for non-glob copy_to_directory root_paths/replace_prefix params

* perf: add common path matching shortcuts

* fix: disallow invalid empty glob expressions
2022-11-02 18:44:42 -07:00
Alex Eagle a9dc052c8b feat: add assert_outputs
It's a simple way to make an executable example demonstrate what outputs a rule produces.
See https://github.com/aspect-build/rules_ts/pull/214 for an example usage in the real world.
2022-10-31 15:25:12 -07:00
Greg Magolan 21873d57b7
fix: use bzlmod @@ in to_label if Bazel version is 6 or greater (#265) 2022-10-26 15:46:39 -07:00
Alex Eagle 1ec71cdcb5 fix: @@//label is not external
Workaround https://github.com/bazelbuild/bazel/issues/16528
2022-10-21 14:42:37 -07:00
Jason Bedard 475015bee0
refactor: give internal impl methods meaningful names (#252) 2022-09-20 15:23:56 -07:00
Greg Magolan bbfb74c8e6
fix: fix host platform detection on all copy actions which always run locally (#241) 2022-09-12 20:45:48 -07:00
Alex Eagle f688d17cfb feat: jq supports stamping
Fixes #223
2022-08-22 12:39:54 -07:00
Alex Eagle 896ee0c1f0 chore: set test timeouts to short
I recently enabled --test_verbose_timeout_warnings and that caused a bunch of warnings in our build.
This fixes it, and adds a utility for us or others to make test-wrapping macros that set to short by default.
2022-08-20 13:58:43 -07:00
Derek Cormier 889e736476 fix: fix a bug where the same file couldn't be copied to the same output
dir twice on Windows
2022-08-20 11:31:56 -07:00
Alex Eagle 15ec78eb73 ci: enable engflow RBE for github actions 2022-08-19 08:42:00 -07:00
Twan Koolen e446a3d8e7 Add failing test case demonstrating issue with root_paths in the presence of globs in dependencies. 2022-08-18 21:14:12 -07:00
Greg Magolan c867e37856
fix: fix make var expansion in expand_template (#213) 2022-08-11 19:30:45 -07:00
Alex Eagle 20d759f669 feat: add utility for asserting that a file contains a string
Useful for basic smoke tests of bazel outputs
2022-08-04 18:02:29 -07:00
Greg Magolan 06d54eef4c
fix: improve handling of duplicate files in copy_to_directory (#205) 2022-08-01 09:56:52 -07:00
Greg Magolan c4f6fcff42 fix: add missing convienence aliases to exclude_srcs_packages 2022-07-29 18:52:54 -07:00
Greg Magolan 01da4db80c fix: add missing convienence aliases to include_srcs_packages 2022-07-29 18:52:54 -07:00
Greg Magolan 71910e93f3
feat: add include_srcs_packages and exclude_srcs_packages and improve implementation and documentation of other filters and transformations (#203) 2022-07-29 16:16:33 -07:00
Greg Magolan a5e61b3961
fix: dedup additional files in copy_to_directory_action (#200) 2022-07-28 20:39:12 -07:00
Greg Magolan e4399557d7
chore: add '?' pattern to test cases of copy_to_directory (#199) 2022-07-28 12:59:30 -07:00
Greg Magolan 85e8b7e555
feat: add glob support to copy_to_directory include_srcs_patterns, exclude_srcs_patterns, replace_prefixes and root_paths. (#196)
This deprecates exclude_prefixes with docs suggesting to using exclude_srcs_patterns instead
2022-07-28 12:50:41 -07:00
Greg Magolan fd03cf0ecb
feat: add glob_match starlark utility function that support "*", "**" and "?" expressions as well as optionally allow for "*" and "?" to match of path separators (#194) 2022-07-27 18:48:02 -07:00
Greg Magolan 61c7cc209b
feat: add include_prefixes to copy_to_directory (#193) 2022-07-27 15:15:42 -07:00
Alex Eagle 8a11a106db chore: change default for run_binary#stamp
Greg convinced me that users will get really slow stamped builds because most run_binary tools don't actually read the status files, but will be cache-invalidated.
2022-07-15 09:29:28 -07:00
Alex Eagle de081fb72e feat: basic stamping support 2022-07-14 22:37:42 -07:00
Alex Eagle 6f52c77a51 assert that directories aren't included in file_exists 2022-07-14 07:53:05 -07:00
Alex Eagle 546758589d Add utility for checking file existence.
Avoids continued copy-paste of this like https://github.com/aspect-build/rules_ts/blob/main/ts/defs.bzl#L35-L44
2022-07-14 07:53:05 -07:00
Greg Magolan d4f6524fbd feat: add copy_to_directory_action 2022-06-28 09:08:45 -07:00
Alex Eagle 32882befdf feat: let jq act like copy_to_bin
This lets you have a file in the output tree with the same path as a source file, but modified.
2022-06-21 18:40:29 -07:00
Jesse Tatasciore 63ae772087
fix: Allow relative_file to take in paths starting with ../ (#166)
* fix: relative_file fix when to path is itself relative starting with ../

* feat: Allow users to use ../ in paths and add tests

* fix: Clarify documentation

Co-authored-by: Greg Magolan <gmagolan@gmail.com>
2022-06-20 14:21:49 -07:00
Derek Cormier ce015ca4f3 fix: support non-json input files in jq 2022-06-17 10:27:18 -07:00
Greg Magolan b3c2884bdf
feat: add mnemonic, progress_message && execution_requirements to run_binary (#161) 2022-06-16 16:58:41 -07:00
Greg Magolan 14f83ab4e8
feat: add out_dirs to run_binary rule and deprecate output_dir (#160) 2022-06-16 16:26:29 -07:00
Derek Cormier 80603fb7eb fix: fix a bug where two copy_to_bin actions couldn't copy the same file 2022-06-16 11:49:09 -07:00
Derek Cormier 3ff61c57e9 fix: fix a bug where write_source_files diff_test fails on windows when
a source is from an external repository
2022-06-16 09:10:30 -07:00
Greg Magolan 6ba7c64c8d
feat: add allow_overwrites attribute to copy_to_directory and disable overwrites as the default behavior on linux and macos (#153) 2022-06-14 10:52:40 -07:00
Alex Eagle 562c4b231d feat: add to_output_relative_path
This is useful in rules_js ecosystem where the working directory is bazel-out/arch/bin so many paths need to be relative to there.
2022-06-13 12:55:22 -07:00
Alex Eagle 695a8c4ad4
fix: copy_to_directory repairs read-only file permissions (#134)
When two srcs have the same nested folder, we need to correct the permissions like bazel's sandbox would.

Fixes #133
2022-06-08 15:41:54 -07:00
= 7017045707 fix: fix yq windows issues by bumping version 2022-05-31 11:07:14 -07:00
Derek Cormier faba95385d fix: fix a bug where copy_to_directory wouldn't copy hidden files inside
of folders
2022-05-19 20:50:43 -07:00
Derek Cormier 400ff189b3 fix: fix a bug where yq failed to build in the root package 2022-05-02 20:35:59 -07:00
Greg Magolan 9a9a1888e1
chore: normalize @generated by comments (#93) 2022-04-29 00:49:15 -07:00
Greg Magolan f1e10df09c
chore: replace is_windows select pattern with target_platform_has_constraint pattern (#95) 2022-04-29 00:36:51 -07:00
Greg Magolan 67e1072e25
chore: use aspect_bazel_lib diff_test (#94) 2022-04-29 00:36:41 -07:00
Derek Cormier 3e4024c785
feat: yq (#80) 2022-04-19 21:45:06 -07:00
Derek Cormier e0af9633ed chore: fix buildifier errors 2022-04-15 15:44:40 -07:00
Greg Magolan 35b430abcc
feat: add some additional make variable substitutions for common useful values in the context (#73) 2022-04-14 07:05:28 -07:00
Greg Magolan b2955dcb05
feat: add copy_to_bin rule (#69) 2022-04-12 16:31:04 -07:00
Jason Bedard 0f30bf96b7
fix(write_source_files): fix nested directories (#65) 2022-04-06 11:25:17 -07:00
Derek Cormier 35b8fd3425
refactor: remove directory functionality from copy_file (#64) 2022-04-05 13:38:54 -07:00
Derek Cormier a23d1b03f7
feat: add copy_directory (#63) 2022-04-03 17:52:03 -07:00
Greg Magolan e30e89fa3d
feat: add run_binary with output directory support & improved makevar expansion (#57) 2022-03-31 20:04:35 -07:00
Alex Eagle 096133e5d2
feat: platform_transition_filegroup (#55)
* feat: platform_transition_filegroup

Lifted from https://github.com/aspect-build/gcc-toolchain/pull/8/files
See also https://github.com/fmeum/rules_meta/blob/main/meta/internal/meta.bzl#L4

* test: add tests for transition filegroup
2022-03-30 21:04:14 -07:00
Greg Magolan 3599515632
fix: ensure out_file does not show up in source file query of write_source_file so that it can be used with ibazel (#52) 2022-03-28 14:53:58 -07:00
Greg Magolan bda5c632be
feat: replace default_info_files with output_files which adds output_group attribute (#50) 2022-03-15 17:36:22 -07:00
Greg Magolan 3b93ee0baa
Add DefaultOutputPathInfo provider and update write_source_files to accept it (#48)
Also update write_source_files to accept DirectoryPathInfo
2022-03-14 17:33:52 -07:00
Greg Magolan 0fd56dc59d
feat: add directory_path rule and DirectoryPathInfo for specifying files within tree artifacts (#42) 2022-03-03 16:40:32 -08:00
Derek Cormier f788d286d0
feat: write to source folders (#41) 2022-03-02 12:58:36 -08:00
Derek Cormier 71c1b893d6
feat: bulk updates for write_source_files (#40) 2022-02-28 15:42:20 -08:00
Derek Cormier 2195e1c69a feat: write_source_files windows implementation 2022-02-24 16:45:31 -08:00
Derek Cormier ca4a9f8c23
fix: fix buildifier 5.0.0 errors (#35) 2022-02-11 07:52:01 -08:00
Derek Cormier 8e6a15ceae feat: write_source_files 2022-02-07 10:00:35 -08:00
Matt Mackay 1b28271ebc
[utils] propagate CPU tags (#24) 2022-01-18 16:24:44 -05:00
Greg Magolan 8f27b63480 feat: add forked diff_test that handles comparing directories 2021-12-21 16:12:05 -08:00
Derek Cormier e371656bc3 feat: load jq filter from file 2021-12-20 13:21:26 -08:00
Greg Magolan 8dc3d2e52a feat: add include_external_repositories and exclude_prefixes attributes to copy_to_directory
Also change the default behavior such that files from external repositories are not included unless the external repository is listed in include_external_repositories
2021-12-16 17:37:54 -08:00
Derek Cormier b8347b5f0a feat: add jq toolchain and rule 2021-12-14 17:59:52 -08:00
Alex Eagle 48b0a774ea
fix: copy_to_directory exposes output in runfiles (#10) 2021-12-01 17:09:48 -08:00
Greg Magolan 0d2981f288 feat: copy_to_directory copies files and directories to an output directory 2021-11-16 21:30:32 -08:00
Alex Eagle 2dfacb4d88
feat: expand_template does execpath and vars substitutions (#6) 2021-11-11 05:54:42 -08:00
Alex Eagle da6fb88da7
feat: add runfiles helpers needed for rules_js (#3)
* feat: add runfiles helpers needed for rules_js

* chore: code review feedback
2021-11-10 06:30:07 -08:00
Alex Eagle cb8c2bad22
feat: add some paths and utils (#1)
* feat: add some paths and utils

* test: exercise relative to_label

* chore: cleanup naming and rctx helper
2021-11-09 15:13:30 -08:00
Alex Eagle 03eaca91f1 Add unittest 2021-11-08 07:22:47 -08:00