-
Couldn't load subscription status.
- Fork 10.6k
Add brotli support to FoundationNetworking #83441
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
Conversation
|
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
|
Seems windows ci passed. Linux failed due to test compilation error. I've added one more commit to enable test on Linux for swiftlang/swift-corelibs-foundation#5251 |
|
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
1 similar comment
|
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
|
Linux test failure should be fixed now on swiftlang/swift-corelibs-foundation#5251 |
|
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
|
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test Linux platform |
cf08366 to
39f056b
Compare
cf08366 to
a01f1d5
Compare
|
rebased. swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
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 would be nice to get a bit more background on what is being done and why.
| Build-CMakeProject ` | ||
| -Src $SourceCache\brotli ` | ||
| -Bin "$BinaryCache\$($Platform.Triple)\brotli" ` | ||
| -InstallTo "$BinaryCache\$($Platform.Triple)\usr" ` |
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.
Do we need to install it? Can we not use it from the build tree?
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'm following the example of zlib here, and it feels cleaner to rely on build artifacts being in a consistent place for all dependency outputs. It seems all other dependencies already do this, so I think we should be consistent. (Maybe let's do these kind of changes in a separate PR for all dependencies if you feel strongly about it)
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.
zlib is the only one doing this because it cannot be used from the build tree (I would love to migrate to that model for zlib as well). We no longer install any library which is not being distributed as a DLL - but that requires switching to the master branch rather than a release.
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.
Just to be clear, by "use it from the build tree", we'll be referencing .lib object files in brotli build tree like brotli\out\Release\brotlicommon.lib, and header files in its source tree at paths like brotli\c\include\brotli\decode.h?
I could try but I doubt it'll play well with the goal in the other comment which is using Brotli_DIR.
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.
Yes, except, the idea with Brotli_DIR is that you tell CMake the directory to look into for BrotliConfig.cmake and it will wire up the headers and libraries appropriately. You don't need to pass flags or paths to the libraries or headers.
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.
Thanks. I will experiment and report back.
utils/build.ps1
Outdated
| @@ -2334,6 +2349,8 @@ function Build-CURL([Hashtable] $Platform) { | |||
| USE_WIN32_LDAP = "NO"; | |||
| ZLIB_ROOT = "$BinaryCache\$($Platform.Triple)\usr"; | |||
| ZLIB_LIBRARY = "$BinaryCache\$($Platform.Triple)\usr\lib\zlibstatic.lib"; | |||
| BROTLIDEC_LIBRARY = "$BinaryCache\$($Platform.Triple)\usr\lib\brotlidec.lib" | |||
| BROTLICOMMON_LIBRARY = "$BinaryCache\$($Platform.Triple)\usr\lib\brotlicommon.lib" | |||
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.
Do we need to pass in the library paths or do they generate a config file that we can use with Brotli_DIR?
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.
The build output of brotli does include 3 .pc files, but unsure how well curl supports BROTLI_DIR. The input variables for curl's brotli cmake are BROTLI_INCLUDE_DIR, BROTLICOMMON_LIBRARY, BROTLIDEC_LIBRARY according to https://github.com/curl/curl/blob/master/CMake/FindBrotli.cmake
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.
The .pc files are for pkg-config, which we do not use or support as that is not something that is available on Windows by default. https://github.com/curl/curl/blob/master/CMake/FindBrotli.cmake#L62-L68 is the bit that matters - it should hopefully allow us to specify just the _DIR suffixed variable to find everything.
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.
fixed in ab40c18 . I'm not sure why this works as I don't find a BrotliConfig.cmake in brotli's output. According to https://cmake.org/cmake/help/latest/command/find_package.html#full-signature , for this <package>_DIR pattern to work, BrotliConfig.cmake needs to be found in that directory.
Updated the overview for this PR. Let me know if any details are missing. |
|
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
27da7cf to
ab40c18
Compare
|
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
utils/build.ps1
Outdated
| @@ -2334,6 +2350,7 @@ function Build-CURL([Hashtable] $Platform) { | |||
| USE_WIN32_LDAP = "NO"; | |||
| ZLIB_ROOT = "$BinaryCache\$($Platform.Triple)\usr"; | |||
| ZLIB_LIBRARY = "$BinaryCache\$($Platform.Triple)\usr\lib\zlibstatic.lib"; | |||
| BROTLI_DIR = "$BinaryCache\$($Platform.Triple)"; | |||
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.
This seems wrong. If this is meant to be an installed image, that should have the \usr suffix (like zlib). Otherwise, this should include the product name in the path.
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.
Yes. It should have the \usr suffix. Fixed in 11fa0bc
ab40c18 to
11fa0bc
Compare
|
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
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 that this set of changes look correct. I think that we will need some help from @shahmishal to get the repository handling worked out.
11fa0bc to
f384b05
Compare
|
rebased resolving conflicts. swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
|
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
|
Please turn this on in |
f384b05 to
f27db2b
Compare
added in f27db2b8ae9f45c00f1cb58740f43403731253cc |
|
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
f27db2b to
c9e909b
Compare
|
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
|
@swift-ci Please clean test |
|
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
|
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
2 similar comments
|
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
|
swiftlang/swift-corelibs-foundation#5251 @swift-ci Please clean test |
|
Merged along with swiftlang/swift-corelibs-foundation#5251 |
<!-- If this pull request is targeting a release branch, please fill out the following form: https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1 Otherwise, replace this comment with a description of your changes and rationale. Provide links to external references/discussions if appropriate. If this pull request resolves any GitHub issues, link them like so: Resolves <link to issue>, resolves <link to another issue>. For more information about linking a pull request to an issue, see: https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue --> <!-- Before merging this pull request, you must run the Swift continuous integration tests. For information about triggering CI builds via @swift-ci, see: https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci Thank you for your contribution to Swift! --> Add brotli as a dependency to enable brotli decoding for curl. brotli is a general purpose compression algorithm used extensively on web. (https://datatracker.ietf.org/doc/html/rfc7932) brotli support for curl is enabled by integrating the brotli compression library (https://github.com/google/brotli). I've also added some tests for FoundationNetworking in swiftlang/swift-corelibs-foundation#5251 which exercises this feature by - looking at the accept-encoding http header - decoding a brotli encoded payload
Add brotli as a dependency to enable brotli decoding for curl.
brotli is a general purpose compression algorithm used extensively on web. (https://datatracker.ietf.org/doc/html/rfc7932)
brotli support for curl is enabled by integrating the brotli compression library (https://github.com/google/brotli). I've also added some tests for FoundationNetworking in swiftlang/swift-corelibs-foundation#5251 which exercises this feature by