-
Notifications
You must be signed in to change notification settings - Fork 60
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
[native_toolchain_c] Add libraries
and libraryDirectories
options to CTool
#1423
Conversation
PR HealthBreaking changes ✔️Details
Changelog Entry ✔️Details
Changes to files need to be accounted for in their respective changelogs. API leaks ✔️DetailsThe following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
License Headers ✔️Details
All source files should start with a license header. Unrelated files missing license headers
Package publish validation ✔️Details
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
8408424
to
1a11e7d
Compare
CBuilder.dynamicallyLinkTo
optionlibraries
and libraryPaths
options to CBuilder
1a11e7d
to
951fb4d
Compare
libraries
and libraryPaths
options to CBuilder
libraries
and libraryDirectories
options to CBuilder
libraries
and libraryDirectories
options to CBuilder
libraries
and libraryDirectories
options to CTool
951fb4d
to
94882a5
Compare
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.
Awesome! LGTM w comments addressed! 🚀
@@ -14,7 +15,7 @@ abstract class CTool { | |||
/// What kind of artifact to build. | |||
final OutputType type; | |||
|
|||
/// Name of the library or executable to linkg. |
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.
build or link
(I believe linkers also inherit from ctool)
@@ -6,9 +6,6 @@ | |||
'mac-os': Timeout.factor(2), | |||
'windows': Timeout.factor(10), | |||
}) | |||
// TODO(https://github.com/dart-lang/native/issues/1415): Enable support | |||
// for Windows once linker flags are supported by CBuilder. | |||
@TestOn('!windows') |
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.
Also if (Platform.isWindows) {
on line 20.
#include "math.h" | ||
|
||
int main() { | ||
return math_add(1, 2); |
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 a bit weird to expect a return code of 3 as the result of doing 1+2 because non-zero exit code usually indicate a problem. It's better to check whether the result is equal to 3 in c, and return exitcode 0 if the calculation was correct and 1 or 255 if the calculation is not correct. Or, for example printf the result and check the stdout in the test.
This check will fail until https://dart-review.googlesource.com/c/sdk/+/381580 is in the latest dev release. P.S.: Some projects only require approval to run checks for first time contributors. Is there a specific reason why this is not possible for this repo? 🙂 |
Add a skip with a TODO. Otherwise the CI is going to be red all the time.
Yeah I would love to, but the Google policies don't allow it unfortunately. (There's some security concerns about being able to add arbitrary code and arbitrary GitHub actions in PRs.) It's churn for us to press the 'approve' button as well. 🙈 I'll try to be responsive on PRs. 💨 |
And, I appreciate that! It was not meant as criticism. 😊 I'm pretty sure that I can trigger checks in the Flutter repo without approval, though, and that's Google too, but I guess different teams have different policies. 🤔😂 |
53cdbaf
to
7e93fc5
Compare
These two new options align with the compiler/linker flags for linking.
libraries
->-l$library
forgcc/clang
and$library.lib
for MSVClibraryDirectories
->-L$directory
forgcc/clang
and/LIBPATH:$directory
for MSVCPer default, the
BuildConfig.outputDirectory
is added tolibraryDirectories
, since placing libraries directly into theoutputDirectory
is likely a common use case and is whatCTool
s do.Fixes #1419
Contribution guidelines:
dart format
.Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.