google / google/error-prone

better patching documentation

Open
#3,350 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
7.2k
Forks
820
Avg merge
5h 9m
Merged PRs (30d)
50

Description

When many projects are processed and patched (like in a multi-module build with hundreds of modules), applying the patches is not straight-forward.

The one option is to setup the plugin with
`-Xplugin:ErrorProne -XepAllErrorsAsWarnings -XepPatchChecks:DefaultCharset -XepPatchLocation:${project.build.directory}`

create a script
```shell
#/tmp/patchit
cd "$(dirname $1)/.."
patch -p1 -u -i target/error-prone.patch
```
and run
```
mvn verify -Perrorprone --threads=8
find . -iname error-prone.patch | xargs -I % -P 1 /tmp/patchit %
```
_i couldn't get `patch -d` option working, and note how I have to `xargs -P 1`_

The other option is to create the patch file first as an append only file, and then build, apply, remove:
```shell
touch error-prone.patch
sudo chattr +a error-prone.patch
mvn verify -Perrorprone --threads=1
patch -p0 -u -i error-prone.patch
sudo chattr -a error-prone.patch
rm error-prone.patch
```

I suggestion one or both of the following:

- add an "append to patch file" option to avoid the chattr stuff
- add an option to apply the patch directly on the source files as with git this simply shows up as changes to the working tree and can be applied/rejected

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.