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

Track mib compilation artifacts #2709

Merged
merged 3 commits into from
May 22, 2022
Merged

Conversation

ferd
Copy link
Collaborator

@ferd ferd commented May 21, 2022

This has two parts:

  1. Fix extension matching in compiler DAG

Turns out this didn't work! Now it does. The check of edge acted as a
workaround that prevented clearing more files than necessary, but when
multiple output artifacts existed, it over-deleted them, apparently.

So now this is properly checked as a bit of logic and all tests keep
passing.

  1. Track and match MIB file build artifacts in DAG

This allows incremental builds with these files.

ferd added 2 commits May 21, 2022 00:17
Turns out this didn't work! Now it does. The check of edge acted as a
workaround that prevented clearing more files than necessary, but when
multiple output artifacts existed, it over-deleted them, apparently.

So now this is properly checked as a bit of logic and all tests keep
passing.
This allows incremental builds with these files.
false;
false ->
%% must be header file or artifact
digraph:in_edges(G, F) == [] andalso maybe_rm_vertex(G, F),
Copy link
Collaborator Author

@ferd ferd May 21, 2022

Choose a reason for hiding this comment

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

Specifically here, the artifact file was possibly deleted more than required when the previous implementation didn't match on the extension (we pass in [".beam"] for ArtifactExt, or for the MIB compiler, [".hrl", ".bin"]), but the .erl compiler used the on-disk build artifacts to re-fetch the compile opts as a fallback and likely hid the bug.

This might represent a perf gain?

Copy link
Collaborator Author

@ferd ferd May 21, 2022

Choose a reason for hiding this comment

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

@max-au this is code you had initially written, I don't know if you still care about that aspect of the workflow or if you've moved elsewhere tooling wise yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

We didn't have any *.mib files or anything similar, so I guess I could never notice it. Change itself looks fine here, although it appears to be fragile enough to at least attempt a test...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah the test is implicitly covered by the MIB test. Without that change, the compiler permanently kept deleting build artifacts' from the DAG and recompiling them, which failed the test case. I'll look at making a more explicit one though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That was a good call, turns out there were dangling artifact vertices in the DAG as well (the files were deleted and the edge removed when the source went away, but not the artifact vertex). The new regression test covers that as well.

@ferd ferd requested a review from tsloughter May 21, 2022 00:32
@ferd ferd force-pushed the track-mib-compilation-artifacts branch from 661d79c to c13ed8f Compare May 22, 2022 01:46
@ferd
Copy link
Collaborator Author

ferd commented May 22, 2022

ugh, will fix the sorting issue with the windows paths by doing crappy naming schemes.

This discovered a bug where dangling artifact files could be left in the
DAG and bloat it over time. This was unlikely to be a real problem, but
it's nice to be clean.
@ferd ferd force-pushed the track-mib-compilation-artifacts branch from c13ed8f to cb084db Compare May 22, 2022 02:08
@ferd ferd merged commit e217913 into erlang:main May 22, 2022
jiahuili430 pushed a commit to jiahuili430/rebar3 that referenced this pull request May 25, 2022
ferd added a commit that referenced this pull request Jun 18, 2022
New features:

- [Add --offline option and REBAR_OFFLINE environment variable](#2643)
- [Add support for project-local plugins](#2697)
- [Add eunit --test flag](#2684)

Experimental features for which we promise no backwards compatibility in
the near future:

- [Experimental vendoring provider](#2689)
  - [Support plugins in experimental vendor provider](#2702)

Other changes:

- [Support OTP 23..25 inclusively](#2706)
- [Bump Relx to 4.7.0](#2718)
  - [Use `erlexec` directly in relx helper functions](erlware/relx#902)
  - [Make rlx_util:parse_vsn parse integer versions](erlware/relx#913)
  - [fix awk script check_name() in extended_bin](erlware/relx#915)
  - [avoid crash when overlay is malformed](erlware/relx#916)
  - [keep attributes when stripping beams](erlware/relx#906)
  - [Fix {include_erts,true} in Windows releases](erlware/relx#914)
  - [ensure the erl file is writable before copying dyn_erl to it](erlware/relx#903)
  - Various tests added
- [Properly carry overlay_vars settings for files in relx](#2711)
- [Track mib compilation artifacts](#2709)
- [Attempt to find apps in git subdirs (sparse checkouts)](#2687)
- [Do not discard parameters --system_libs and --include-erts when duplicate values exist](#2695)
- [Use default `depth` parameter for SSL](#2690)
- [Fix global cache config overriding](#2683)
- [Error out on unknown templates in 'new' command](#2676)
- [Fix a typo](#2674)
- [Bump certifi to 2.9.0](#2673)
- [add a debug message in internal dependency fetching code](#2672)
- [Use SPDX id for license in template and test](#2668)
- [Use default branch for git and git_subdir resources with no revision](#2663)

Signed-off-by: Fred Hebert <mononcqc@ferd.ca>
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.

3 participants