dart-lang / dart-lang/native

[ffigen] Output dependencies & only rerun if dependencies change

Open
#1,101 0 comments 0 reactions 0 assignees View on GitHub
P4 package:ffigen
Dominant language
Dart
Stars
275
Forks
144
Avg merge
2d 10h
Merged PRs (30d)
47

Description

Pulling some learnings from https://github.com/dart-lang/native/pull/977.

> My preference would be to let a higher level of build system handle checking the file times, like Bazel or [package:build](https://pub.dev/packages/build) or [native assets](https://pub.dev/packages/native_assets_cli).

👍 Great thinking about how this integrates in the larger eco system.

I think the FFIgen (and JNIgen) should be able to report the list of dependencies (https://github.com/dart-lang/native/issues/1008). We don't want every user of FFIgen (and JNIgen) to manually come up with a list of dependencies.

The logic of checking the files timestamps could maybe live in a shared package that then FFIgen, JNIgen, and native_assets_builder can reuse.

One question to ask is what abstraction to use for listing dependencies:

1. File paths
2. Directory paths (which would mean all files transitively in that directory, and it also means that if someone adds a file in such directory it's added).
3. Glob patterns? (which would mean that any files added to the file system matching such pattern would trigger a rebuild). -> But not every build system wrapping FFIgen/JNIgen might be able consume glob patterns (native assets, package:build, ...)

_Originally posted by @dcharkes in https://github.com/dart-lang/native/issues/977#issuecomment-1996980549_

Some more edge cases to consider -

1. Transitive dependencies could be changed
2. ffigen version might be updated in pubspec.yaml
3. Any updates to compiler-opts specified via the environment itself.

_Originally posted by @mannprerak2 in https://github.com/dart-lang/native/issues/977#issuecomment-1984118360_

I think the first step is to output a list of dependencies.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.