Skip to content
This repository was archived by the owner on Jan 28, 2024. It is now read-only.

Conversation

@TzviPM
Copy link
Contributor

@TzviPM TzviPM commented Nov 29, 2022

@TzviPM TzviPM added the type-enhancement A request for a change that isn't a bug label Nov 29, 2022
@TzviPM TzviPM requested a review from liamappelbe November 29, 2022 21:04
@TzviPM TzviPM self-assigned this Nov 29, 2022
test('objective_c', () {
final pubspecFile = File('example/objective_c/pubspec.yaml');
final pubspecYaml = loadYaml(pubspecFile.readAsStringSync()) as YamlMap;
final config = Config.fromYaml(pubspecYaml['ffigen'] as YamlMap);
Copy link
Contributor

Choose a reason for hiding this comment

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

This means we have the config in two places now, how are we going to keep that sync? These tests are here to ensure our examples keep working.

What is the reason for moving the config here instead of reading it from the file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I brought this up with Liam as a potential point of contention offline and we discussed a solution. My proposed solution is to make an additional test helper for reading a config from a file given its path from the project root and to use separate config files instead of a key in pubspec.yaml, so that the config file helper can simply read the file into a string and then use the existing helper, rather than parsing the pubspec.yaml to get the ffigen key

Copy link
Contributor

Choose a reason for hiding this comment

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

sgtm

${strings.entryPoints}:
- '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AVFAudio.framework/Headers/AVAudioPlayer.h'
${strings.preamble}: |
// ignore_for_file: camel_case_types, non_constant_identifier_names, unused_element, unused_field, return_of_invalid_type, void_checks, annotate_overrides, no_leading_underscores_for_local_identifiers, library_private_types_in_public_api
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: prefer ignore_for_file on separate lines and alphabetically ordered.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this was copied verbatim from the existing pubspec.yaml. see my previous comment, though, about how I plan to make this easier to synchronize by using a standalone config.yaml

Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix the place where this is copied from while your at it. 🙏

Great! Thanks @TzviPM !

Copy link
Contributor

@liamappelbe liamappelbe left a comment

Choose a reason for hiding this comment

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

Thanks for cleaning up!

// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// ignore_for_file: camel_case_types, non_constant_identifier_names No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: missing newline

entry-points:
- 'headers/example.h'
preamble: |
// ignore_for_file: deprecated_member_use No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: missing newline

output: 'generated_bindings.dart'
headers:
entry-points:
- 'headers/example.h' No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: missing newline

// ignore_for_file: unused_element, unused_field, return_of_invalid_type
// ignore_for_file: void_checks, annotate_overrides
// ignore_for_file: no_leading_underscores_for_local_identifiers
// ignore_for_file: library_private_types_in_public_api No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: missing newline

@liamappelbe
Copy link
Contributor

Oh, looks like a few tests are failing

@dcharkes
Copy link
Contributor

dcharkes commented Feb 9, 2023

@TzviPM is this still needed for your work?

@TzviPM TzviPM requested review from dcharkes and liamappelbe April 6, 2023 17:12
Copy link
Contributor

@dcharkes dcharkes left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -1,4 +1,4 @@
// Generated by Apple Swift version 5.5.2 (swiftlang-1300.0.40.106 clang-1300.0.29.21)
// Generated by Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
Copy link
Contributor

Choose a reason for hiding this comment

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

We haven't pinned clang on the CI?

// ignore_for_file: unused_element, unused_field, return_of_invalid_type
// ignore_for_file: void_checks, annotate_overrides
// ignore_for_file: no_leading_underscores_for_local_identifiers
// ignore_for_file: library_private_types_in_public_api No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: newline at end of file

output: 'generated_bindings.dart'
headers:
entry-points:
- 'headers/example.h' No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: newline at end of file

@TzviPM TzviPM merged commit 07137c6 into dart-archive:master Apr 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

type-enhancement A request for a change that isn't a bug

Development

Successfully merging this pull request may close these issues.

Add a common code path for config files used in tests

3 participants