google / copybara

Copybara: A tool for transforming and moving code between repositories.
Apache License 2.0
2.15k stars 263 forks source link

How to get: Run or run_shell equivalent #295

Closed fzakaria closed 2 months ago

fzakaria commented 2 months ago

I'd like to do some transformations that don't seem captured in the current transformation set or what is possible via TransformationWork for dynamic_transformations.

Starlark in Bazel hast he actions run_shell and run that kind of let you do arbitrary transformations. Is there such support for this?

How do people do custom transformations? In my case, I actually need to run Bazel as part of the transformation to execute a command to update some files after the copybara.

copybara-github commented 2 months ago

Copybara is meant to be run in a trusted environment and limits the number of exit hatches available in config space. However it is a very simple module to write; you can easily subclass the ModuleSupplier and Main.java to create your own extended versions of Copybara.

fzakaria commented 2 months ago

I see -- fork and update https://github.com/google/copybara/blob/4db1f09fd48deed940d03e8b1e2a355a301f3c53/java/com/google/copybara/ModuleSupplier.java#L76 and write something similar to Buildifier/Buildozer actions?

I feel like they can all be generalized though but this is a good start; thank you.