Skip to content

[hooks_runner] Don't report immutable Dart sources as dependencies #2296

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
May 14, 2025

Conversation

dcharkes
Copy link
Collaborator

Closes: #2290

Shaves 50ms off a fully cached flutter build for flutter create --template package_ffi's example project. (See #2290.)

Copy link

PR Health

API leaks ✔️

The 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.

Package Leaked API symbols
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/jni/lib/src/third_party/generated_bindings.dart
pkgs/objective_c/lib/src/ns_input_stream.dart

2 similar comments
Copy link

PR Health

API leaks ✔️

The 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.

Package Leaked API symbols
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/jni/lib/src/third_party/generated_bindings.dart
pkgs/objective_c/lib/src/ns_input_stream.dart

Copy link

PR Health

API leaks ✔️

The 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.

Package Leaked API symbols
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/jni/lib/src/third_party/generated_bindings.dart
pkgs/objective_c/lib/src/ns_input_stream.dart

Copy link

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

Base automatically changed from remove-package-config-workaround to main May 14, 2025 08:09
@dcharkes dcharkes force-pushed the skip-pub-cached-files-in-deps branch from 7bc2b16 to 2204c18 Compare May 14, 2025 08:30
@coveralls
Copy link

Coverage Status

coverage: 83.686% (+0.004%) from 83.682%
when pulling 2204c18 on skip-pub-cached-files-in-deps
into fe3094e on main.

@auto-submit auto-submit bot merged commit 6d51ecf into main May 14, 2025
37 checks passed
@auto-submit auto-submit bot deleted the skip-pub-cached-files-in-deps branch May 14, 2025 08:44
// TODO(https://github.com/dart-lang/pub/issues/4577): Use immutability bit
// when available.
static bool _isImmutable(Uri e) =>
e.toFilePath(windows: false).contains('/hosted/pub.dev/');
Copy link

Choose a reason for hiding this comment

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

I think we store the pub cache in package_config.json.

You could check if that is a prefix of the package path.

But remember that a cached package potentially can depend on a path-dependency, and thus be mutable. Perhaps you need to calculate the transitive dependency closure via package_graph.json...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We get all Dart sources in a list, and I'm just filtering out the ones in the pub cache.

Copy link

@sigurdm sigurdm May 16, 2025

Choose a reason for hiding this comment

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

Right - what I'm saying is that your filter is imprecise (having false positives). You don't want lib/src/hosted/pub.dev/my_file.dart to be assumed immutable.

Rather you could look up package_config.json['pubCache'] And see if the file is p.within that url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[hooks_runner] Omit pub-cache dart files from dependencies
4 participants