takari / takari-lifecycle

Takari Maven Lifecycle
http://takari.io/book/40-lifecycle.html
Eclipse Public License 1.0
66 stars 35 forks source link

Incremental Files containing the full path of the inputs preventing Incremental Build #118

Open mehmetsalgar opened 1 year ago

mehmetsalgar commented 1 year ago

Hi,

I like to ask the reason to put full absolute file paths to the Incremental Build state file...

for ex, for me when I realise an incremental build contains the following path and hash information

xptd/builds/tikari/tikari-test/src/main/java/org/salgar/tikari/App.javaw/xq~sq~!�u��N%q~wsq~t

We are trying to use the Incremental Build feature of Takari in our Gitlab Build system (a la Gradle), when a Gitlab Job runs it puts the contents of the 'target/incremental' directory to the cache, so if the same job triggered because another condition in the pipeline (we are working with a monorepo, there are several Services, let say this is Service 3 and Service 1 can have a change and trigger the pipeline but Service 3 has no change, so we want to skip compile), it will skip the compile phase, use the compile binaries as jar from the cache.

The problem with it, every time job runs on a different gitlab runner, absolute path changes (the 'xptd' is the runner name in the next run it can be 'ABCD'), so takari thinks everytime file changed but there is absolutely no change / commit to the repository.

Would it not be enough to put file relative to maven project root (${project.base.dir}) in the incremental file at the end of the day, if the file is there relative to maven and hash code is same, it means file didn't change.

If it would be breaking change to implement such a thing, is it possible to make at least configurable, like for ex, 'absolute_path_for_incremental_state' true or false?

Or is there another reason to have this as absolute path that I am missing...