-
Notifications
You must be signed in to change notification settings - Fork 203
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
refactor: build step cleanup #2926
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a918699
add metadata dir
holic 3d40857
generate system manifests
holic 9964cb1
system namespace and system ID
holic cf9c312
fixes
holic 1ca67c3
refactor
holic 78f48c0
configPath -> rootDir
holic 3f247e3
don't need these
holic 843a7a7
remove metadata dir from config for now
holic 851a4ac
switch other utils to use rootDir instead of configPath
holic 3a62f54
remove system manifest things
holic 4880cf1
revert namespace config changes
holic 0710805
Merge remote-tracking branch 'origin/main' into holic/build-cleanup
holic 26f482b
Merge remote-tracking branch 'origin/main' into holic/build-cleanup
holic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import path from "node:path"; | ||
import { glob } from "glob"; | ||
import { World } from "../config/v2/output"; | ||
|
||
export async function findSolidityFiles({ rootDir, config }: { rootDir: string; config: World }) { | ||
const files = await glob(path.join(config.sourceDirectory, "**", "*.sol"), { | ||
cwd: rootDir, | ||
}); | ||
|
||
return files.sort().map((filename) => ({ | ||
filename, | ||
basename: path.basename(filename, ".sol"), | ||
})); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import path from "node:path"; | ||
import { loadConfig, resolveConfigPath } from "@latticexyz/config/node"; | ||
import { getRemappings } from "@latticexyz/common/foundry"; | ||
import { tablegen } from "@latticexyz/store/codegen"; | ||
import { findSolidityFiles } from "../node/findSolidityFiles"; | ||
import { World } from "../config/v2"; | ||
import { worldgen } from "../node"; | ||
|
||
/** | ||
* To avoid circular dependencies, we run a very similar `build` step as `cli` package here. | ||
*/ | ||
|
||
// TODO: turn this into something we can run from CLI, then we can import/use it via CLI and here rather than duplicating. | ||
// TODO: do the same for store build too | ||
|
||
const configPath = await resolveConfigPath(); | ||
const rootDir = path.dirname(configPath); | ||
const config = (await loadConfig(configPath)) as World; | ||
const remappings = await getRemappings(); | ||
|
||
// TODO: move this into worldgen | ||
const existingContracts = (await findSolidityFiles({ rootDir, config })).map((file) => ({ | ||
path: file.filename, | ||
basename: file.basename, | ||
})); | ||
const codegenDirectory = path.join(config.sourceDirectory, config.codegen.outputDirectory); | ||
|
||
// TODO: clean | ||
|
||
await Promise.all([ | ||
tablegen({ rootDir, config, remappings }), | ||
worldgen( | ||
{ | ||
...config, | ||
// override the namespace to be the root namespace for generating the core system interface | ||
namespace: "", | ||
}, | ||
existingContracts, | ||
codegenDirectory, | ||
), | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
surprised this hasn't come up before but downstream usages may need to exclude
.t.sol
and.s.sol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah likely because we're all good about putting source in
src
but technically possible to have test files, etc. live in this dir as well (and I personally like colocating tests with the files they're testing)