Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incremental API and disk format for task caching #210

Merged
merged 13 commits into from
Aug 15, 2023

Conversation

niloc132
Copy link
Member

@niloc132 niloc132 commented Dec 21, 2022

The Task.execute() call now can examine old results and changes to inputs to make decisions about incrementally building new outputs more efficiently.

Fixes #176

@niloc132 niloc132 marked this pull request as ready for review July 19, 2023 19:15
@treblereel treblereel self-requested a review August 3, 2023 16:55
Copy link
Collaborator

@treblereel treblereel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's good to go. I use this branch last two month and looks like it's work well

Files.createDirectories(localTaskDir);
Files.write(localTaskDir.resolve(timestamp), Collections.singleton(taskDir.toString()));

Files.list(localTaskDir).sorted(Comparator.<Path>naturalOrder().reversed()).skip(5).forEach(old -> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this const configurable, as a separate PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -16,6 +16,9 @@ public abstract class AbstractCacheMojo extends AbstractMojo {
@Parameter(defaultValue = "${project.build.directory}/gwt3BuildCache", required = true, property = "gwt3.cache.dir")
private File gwt3BuildCacheDir;

@Parameter(defaultValue = "${project.build.directory}/j2cl-maven-plugin-local-cache", required = true)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so now we have j2cl-maven-plugin-local-cache and gwt3BuildCache, isn't this redundant?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a good question, but they serve different purposes. The gwt3buildCache (should be renamed someday) is explicitly able to be shared between projects, and holds build output that could be reusable across modules, projects. On the other hand, the local cache only is meant to be specific to a single module, and reflects the last N (N=5 above, but you suggest we change this) rebuilds. Those last rebuilds are references to the gwt3BuildCache, so we know what recent rebuilds were appropriate for this module, and in what order they happened.

If the local cache was global, you could work on project A for a day, then project B for a day, then try to update A and it would try to incrementally rebuild from B's last builds. This won't magically protect you from changing git branches, but in theory tasks that are able to be incremental will notice if too much has changed to be incremental and will do a fresh build.

@niloc132 niloc132 merged commit c18f3ea into Vertispan:main Aug 15, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Track task input details that contribute to the cache entry's hash
2 participants