-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
ref: rework build to be reusable outside of setup.py #71098
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
Merged
Merged
Changes from all commits
Commits
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 hidden or 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,40 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import argparse | ||
| import os | ||
| import subprocess | ||
|
|
||
|
|
||
| def _build_static_assets() -> None: | ||
| node_options = os.environ.get("NODE_OPTIONS", "") | ||
| env = { | ||
| **os.environ, | ||
| # By setting NODE_ENV=production, a few things happen | ||
| # * React optimizes out certain code paths | ||
| # * Webpack will add version strings to built/referenced assets | ||
| "NODE_ENV": "production", | ||
| # TODO: Our JS builds should not require 4GB heap space | ||
| "NODE_OPTIONS": f"{node_options} --max-old-space-size=4096".lstrip(), | ||
| } | ||
|
|
||
| def _cmd(*cmd: str) -> None: | ||
| ret = subprocess.call(cmd, env=env) | ||
| if ret: | ||
| raise SystemExit(ret) | ||
|
|
||
| _cmd("yarn", "install", "--production", "--frozen-lockfile", "--quiet") | ||
| _cmd("yarn", "tsc", "-p", "config/tsconfig.build.json") | ||
| _cmd("yarn", "build-production", "--bail") | ||
| _cmd("yarn", "build-chartcuterie-config", "--bail") | ||
|
|
||
|
|
||
| def main() -> int: | ||
| parser = argparse.ArgumentParser() | ||
| parser.parse_args() | ||
|
|
||
| _build_static_assets() | ||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| raise SystemExit(main()) | ||
This file contains hidden or 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,21 @@ | ||
| import argparse | ||
|
|
||
| from sentry.build import _integration_docs, _js_sdk_registry, _static_assets | ||
|
|
||
|
|
||
| def main() -> int: | ||
| parser = argparse.ArgumentParser() | ||
| parser.parse_args() | ||
|
|
||
| print("=> integration docs") | ||
| _integration_docs._sync_docs(_integration_docs._TARGET) | ||
| print("=> js sdk registry") | ||
| _js_sdk_registry._download(_js_sdk_registry._TARGET) | ||
| print("=> static assets") | ||
| _static_assets._build_static_assets() | ||
|
|
||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| raise SystemExit(main()) |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -113,7 +113,7 @@ const ENABLE_CODECOV_BA = env.CODECOV_ENABLE_BA === 'true' ?? false; | |
| // this is the path to the django "sentry" app, we output the webpack build here to `dist` | ||
| // so that `django collectstatic` and so that we can serve the post-webpack bundles | ||
| const sentryDjangoAppPath = path.join(__dirname, 'src/sentry/static/sentry'); | ||
| const distPath = env.SENTRY_STATIC_DIST_PATH || path.join(sentryDjangoAppPath, 'dist'); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was this environment variable never used?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it was only ever set to exactly the same value as this |
||
| const distPath = path.join(sentryDjangoAppPath, 'dist'); | ||
| const staticPrefix = path.join(__dirname, 'static'); | ||
|
|
||
| // Locale file extraction build step | ||
|
|
||
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.
Are we planning to make use of this in the future?
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.
it's mostly so
thing --helpdoesn't make it just do it -- even though there's no options