This package is a patched version of opensource Copybara. The patches add support for Chromium specific functionality so that we can compile Copybara with this baked in.
To make this as straightforward and easy to fix as possible, there is a few different components.
patches/This directory contains .patch files which make changes to files which exist in the upstream GitHub repo. There is one patch file for each upstream file we modify. These are kept as simple as possible, mostly limited to patching BUILD files so bazel includes the new chromium modules and tests when building.
Patched files:
modified: java/com/google/copybara/BUILD modified: java/com/google/copybara/ModuleSupplier.java modified: javatests/com/google/copybara/BUILD
Run the local-test.sh script first, to generate the directories that the recipe expects to exist.
When extracting patches, you should make sure you're in the copybara source checkout directory created when running local-test.sh. Otherwise, the patch paths may be incorrect.
Try to extract one patch per changed file to limit the density of patch files. Everything more complex should be added directly to chromium-module or chromium-tests which are copied directly into Copybara by the install.sh to make upgrades as painless as possible.
git diff javatests/com/google/copybara/BUILD > ../patches/javatests-com-google-copybara-BUILD.patch
chromium-moduleThis is where the new functionality we've added exists. During the install.sh run, the contents of this directory is copied into java/com/google/copybara/chromium.
chromium-testsThe test files for the new chromium-module. The contents of this directory are copied into javatests/com/google/copybara/chromium by install.sh. The tests are also run during install to verify that everything is loaded correctly after patching. While verify.sh does exist as a 3PP step, it would run on the compiled version after build, which isn't useful here.
bazel installed for both building and testing.local-test.sh. This will download the open source version of Copybara at the revision specified in the 3pp.pb file and patch it with Chromium changes.local-build/copybara/copybara_deploy.jar. Any failures should cause the install script to immediately exit with an error.google-java-format -r chromium-module/* chromium-tests/*Once the patched version of Copybara is built, you can use the new helpers:
core.workflow( name = "My Cool Dependency", origin = git.origin( url = "https://example.com/some/upstream_project.git", ref = "main", ), destination = git.destination( url = "https://example.com/your/chromium_repo.git", fetch = "main", ), transformations = [ # This is where we use the custom Chromium transformations. # It will update 'Version' and 'Revision' with the provided values. # Since 'Update Mechanism' is not explicitly provided in metadata, # it will update with the default value of 'Autoroll'. chromium.update_readme( metadata = { "Version": "1.2.3", "Revision": "abcdef1234567890abcdef1234567890abcdef12", }, ), # Other transformations core.move("", "third_party/{0}/src".format(DEPENDENCY_NAME)), ], )