Skip to content

build info caching leaves stale build info files on disk #172

@0xalpharush

Description

@0xalpharush

Now that build-info is being cached in foundry, all old build info's under out/build-info are left on disk even after recompiling. Could they be merged into one valid, current build info for the given compilation unit?

For instance, ls out/build-info will accumulate new entires each time I edit a file:

6d5ba56c654d768d5bf8d51bbc3c7e34.json c1f9db2b3d661b08e8fe8c097f2fdad8.json f2030736ea49b0ca4a5709ec90d5910d.json

These also appear in cache/solidity-files-cache.json:

    "builds": [
        "6d5ba56c654d768d5bf8d51bbc3c7e34",
        "c1f9db2b3d661b08e8fe8c097f2fdad8",
        "f2030736ea49b0ca4a5709ec90d5910d"
    ]

Instead, I would expect that there is one build info on disk (assuming one compilation unit) which consists of the aggregate artifacts of the most recent, solidity files still on disk. Otherwise, there is not really a great way to tell whether there are multiple compilation units or if the build info entry is a newer version of a previous entry

I think they could be merged here but lmk if another approach is more desirable

let cached_builds = cache.read_builds(&project.paths.build_infos).unwrap_or_default();

xref foundry-rs/foundry#8164
xref #140

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions