Deterministic file discovery and compilation unit ordering #2
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
WurstCompilerJassImpl.java(loadWurstFilesInDir,addDependenciesFromFolder,addLibDir) andModelManagerImpl.java(getFiles) useFile.listFiles()without sorting. On Linux/NixOS,listFiles()delegates toreaddir, which returns files in filesystem directory-entry order (dependent on inode allocation, ext4 dirhash, etc.).As a result:
CompilationUnitobjects are added toWurstModelin arbitrary order.AttrImportedPackage.getPackagespopulatesattrPackages()in non-deterministic order.Implementation Tasks
listFiles()) lexicographically by filename acrossWurstCompilerJassImpl,ModelManagerImpl, andImportFile.dependenciesandcompilationUnitsby canonical project-relative path.attrPackages(), sort packages topologically byattrInitDependencies(), using package name alphabetical ordering as the strict tie-breaker for independent sibling nodes.