-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[build-script] Transform IndexStoreDB and SorcekitLSP to use ProductBuilder #24854
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
[build-script] Transform IndexStoreDB and SorcekitLSP to use ProductBuilder #24854
Conversation
@swift-ci please test |
82c6995
to
db26d74
Compare
Rebased on top of master to adapt to the changes introduced in #24330. Ideally @swift-ci please test |
Build failed |
Build failed |
Build failed |
@swift-ci please test linux platform |
Looks like the non-smoke macOS tests are not building sourcekit-lsp (fix is #24916). |
@swift-ci please smoke test macOS |
Sorry about that. I was expecting the non-smoke tests to be all that smoke test do, and then some. Thanks for noticing that. |
Build failed |
@swift-ci please test Linux |
@@ -961,20 +961,16 @@ class BuildScriptInvocation(object): | |||
|
|||
# Non-build-script-impl products... | |||
# Note: currently only supports building for the host. | |||
for host_target in [self.args.host_target]: | |||
for host_target in [ |
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.
Why leave the list if its a single element?
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.
I think you are asking why have a for ... in
for a known one element list, right? I think the reason is future-proofing, because the comment says that the products only support building for the host, but they might some day support building for more targets, and that change will be easy having this in place. Ben might know the real reason, since he wrote the original code.
def __init__(self, product_class, args, toolchain, workspace, host): | ||
self.__source_dir = workspace.source_dir( | ||
product_class.product_source_name()) | ||
self.__build_dir = workspace.build_dir(host.name, |
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.
why double underscores?
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.
Python performs name mangling when you use two underscores as a prefix. It is useful for private variables that cannot be accessed from other classes (including subclasses of this one).
https://docs.python.org/2/tutorial/classes.html#private-variables-and-class-local-references
Build failed |
That Linux error is on me. I will have a look tomorrow. Benchmarks wasn’t there when I started these changes, and I notice the new toolchain needing product, but I didn’t realize benchmarks was there. |
db26d74
to
6277c99
Compare
@swift-ci please test |
Build failed |
Build failed |
…uilder. Create a new helper builder for IndexStoreDB and SourceKitLSP called BuildScriptHelperBuilder (because the invoked script is called build-script-helper.py). Move most of the code that existed in a function in indexstore.db into that helper class. Create small subtypes of the helper paramtrized for IndexStoreDB and SourceKitLSP. Modify the main build-script to invoke the new build instead of the Product class directly. This way, when all the products use builders to be build, all of them will use the same Python invocations, but some of them will use build-script-impl, and others will use build-script-helper.py.
6277c99
to
6d0c1e7
Compare
Fix the linter problem. @swift-ci please test |
Build failed |
Build failed |
Abandoning these efforts. It might still be useful for better Windows builds for most of the community, but I will not have time to keep improving this and it doesn't seem to be a lot of interest in improving the build system in this direction. |
Create a new helper builder for IndexStoreDB and SourceKitLSP called
BuildScriptHelperBuilder (because the invoked script is called
build-script-helper.py). Move most of the code that existed in a
function in indexstore.db into that helper class.
Create small subtypes of the helper paramtrized for IndexStoreDB and
SourceKitLSP.
Modify the main build-script to invoke the new build instead of the
Product class directly. This way, when all the products use builders
to be build, all of them will use the same Python invocations, but
some of them will use build-script-impl, and others will use
build-script-helper.py.