Skip to content

Update BSP connection build server config lookup path #1728

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 1 commit into from
Oct 15, 2024

Conversation

Rajveer100
Copy link
Contributor

Resolves #1695

Adopt <workspace_root>/.bsp search locations in addition to <workspace_root>/.

@Rajveer100 Rajveer100 requested a review from ahoppen as a code owner September 30, 2024 08:39
Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://build-server-protocol.github.io/docs/overview/server-discovery#default-locations-for-bsp-connection-files specifies a number of other search locations that we should also adopt.

Also, I don’t see any mention of the buildServer.json file so we shouldn’t hardcode that. For the lack of a better idea, I think we should pick the lexicographically first file in one of the search directories that is a valid BSP configuration file.

@Rajveer100 Rajveer100 force-pushed the bsp-connection-config branch from d9cd7ea to ccae1c6 Compare October 1, 2024 10:19
@Rajveer100 Rajveer100 requested a review from ahoppen October 1, 2024 10:20
@Rajveer100
Copy link
Contributor Author

Let me know about the updated logic.

Regarding picking the file, did you mean to say that if we had multiple .json files in different valid directories, we should pick the lexicographically first one?

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding picking the file, did you mean to say that if we had multiple .json files in different valid directories, we should pick the lexicographically first one?

Kind of. I’m saying that if in a single search location there are multiple .json files, we should pick the lexicographically first one. But we should still always prefer a build server config in the workspace .bsp folder over one in a system location.


Also, you need to update the logic that actually loads the build server config in createConnectionToBspServer. Could you also add test cases to make sure that we find BSP server config files in the <workspace folder>/.bsp location to BuildServerBuildSystemTests?

@Rajveer100 Rajveer100 force-pushed the bsp-connection-config branch from ccae1c6 to 8e8b9a9 Compare October 3, 2024 13:01
@Rajveer100 Rajveer100 requested a review from ahoppen October 3, 2024 13:02
@Rajveer100
Copy link
Contributor Author

I am not quite sure about the testing part, which path should be considered as the project workspace root for testing? Also, what do you recommend to invoke getConfigPath, do we add @testable import BuildSystemIntegration for accessing the private methods?

@ahoppen
Copy link
Member

ahoppen commented Oct 3, 2024

I am not quite sure about the testing part, which path should be considered as the project workspace root for testing? Also, what do you recommend to invoke getConfigPath, do we add @testable import BuildSystemIntegration for accessing the private methods?

I would create a MultiFileTestProject similar to how it’s done in

var files = files
files["buildServer.json"] = """
{
"name": "client name",
"version": "10",
"bspVersion": "2.0",
"languages": ["a", "b"],
"argv": ["server.py"]
}
"""
files["server.py"] = """
import sys
from typing import Dict, List, Optional
sys.path.append("\(skTestSupportInputsDirectory.path)")
from AbstractBuildServer import AbstractBuildServer, LegacyBuildServer
\(buildServer)
BuildServer().run()
""".replacing("$SDK_ARGS", with: sdkArgs)
try await super.init(
files: files,
testName: testName
)
, just put the build server configuration in a .bsp folder inside the workspace root.

@Rajveer100 Rajveer100 force-pushed the bsp-connection-config branch from 8e8b9a9 to 98d37cf Compare October 4, 2024 12:18
@Rajveer100 Rajveer100 requested a review from ahoppen October 4, 2024 12:20
@Rajveer100 Rajveer100 force-pushed the bsp-connection-config branch 2 times, most recently from 5286343 to b9cfe07 Compare October 7, 2024 18:37
@Rajveer100
Copy link
Contributor Author

Rajveer100 commented Oct 7, 2024

@ahoppen
I have made the changes.

@Rajveer100 Rajveer100 force-pushed the bsp-connection-config branch from b9cfe07 to f228a41 Compare October 10, 2024 08:03
@Rajveer100 Rajveer100 requested a review from ahoppen October 10, 2024 08:05
Resolves swiftlang#1695

Adopt `<workspace_root>/.bsp` search locations in addition to
`<workspace_root>/`.
@ahoppen ahoppen force-pushed the bsp-connection-config branch from f228a41 to 7b1f59e Compare October 14, 2024 20:22
@ahoppen
Copy link
Member

ahoppen commented Oct 14, 2024

I have updated your test case to make it pass, made a few more adjustments and pushed the changes to your branch.

@ahoppen
Copy link
Member

ahoppen commented Oct 14, 2024

@swift-ci Please test

@ahoppen
Copy link
Member

ahoppen commented Oct 14, 2024

@swift-ci Please test Windows

@Rajveer100
Copy link
Contributor Author

Thanks @ahoppen!

@ahoppen ahoppen merged commit 0360733 into swiftlang:main Oct 15, 2024
3 checks passed
@Rajveer100 Rajveer100 deleted the bsp-connection-config branch October 15, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Read BSP connection details from .bsp directory in addition to buildServer.json
2 participants