From 8f3e4c29d4eefa2eb80001be7bda860e812722cc Mon Sep 17 00:00:00 2001 From: Daco Harkes Date: Tue, 16 Jan 2024 11:36:58 +0100 Subject: [PATCH] [native_toolchain_c] Remove private dependency use (#894) --- .github/workflows/native.yaml | 2 ++ .../test/data/dart_app/pubspec_overrides.yaml | 5 ++++ .../test/data/manifest.yaml | 1 + .../data/some_dev_dep/pubspec_overrides.yaml | 3 +++ .../native_add_app/pubspec_overrides.yaml | 5 ++++ pkgs/native_toolchain_c/CHANGELOG.md | 4 +++ pkgs/native_toolchain_c/pubspec.yaml | 2 +- tools/check_pubspec_overrides.dart | 26 +++++++++++++++++++ 8 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 pkgs/native_assets_builder/test/data/dart_app/pubspec_overrides.yaml create mode 100644 pkgs/native_assets_builder/test/data/some_dev_dep/pubspec_overrides.yaml create mode 100644 pkgs/native_assets_cli/example/native_add_app/pubspec_overrides.yaml create mode 100644 tools/check_pubspec_overrides.dart diff --git a/.github/workflows/native.yaml b/.github/workflows/native.yaml index df5d001e8..50fb32158 100644 --- a/.github/workflows/native.yaml +++ b/.github/workflows/native.yaml @@ -63,6 +63,8 @@ jobs: ndk-version: r26b if: ${{ matrix.sdk == 'stable' }} + - run: dart run ../../tools/check_pubspec_overrides.dart + - run: dart run ../../tools/delete_pubspec_overrides.dart if: ${{ matrix.dependencies == 'published' }} diff --git a/pkgs/native_assets_builder/test/data/dart_app/pubspec_overrides.yaml b/pkgs/native_assets_builder/test/data/dart_app/pubspec_overrides.yaml new file mode 100644 index 000000000..8e850de76 --- /dev/null +++ b/pkgs/native_assets_builder/test/data/dart_app/pubspec_overrides.yaml @@ -0,0 +1,5 @@ +dependency_overrides: + native_assets_cli: + path: ../../../../native_assets_cli/ + native_toolchain_c: + path: ../../../../native_toolchain_c/ diff --git a/pkgs/native_assets_builder/test/data/manifest.yaml b/pkgs/native_assets_builder/test/data/manifest.yaml index 7ae8b9e14..0cf24a3bd 100644 --- a/pkgs/native_assets_builder/test/data/manifest.yaml +++ b/pkgs/native_assets_builder/test/data/manifest.yaml @@ -8,6 +8,7 @@ - cyclic_package_2/pubspec_overrides.yaml - dart_app/bin/dart_app.dart - dart_app/pubspec.yaml +- dart_app/pubspec_overrides.yaml - native_add/build.dart - native_add/ffigen.yaml - native_add/lib/native_add.dart diff --git a/pkgs/native_assets_builder/test/data/some_dev_dep/pubspec_overrides.yaml b/pkgs/native_assets_builder/test/data/some_dev_dep/pubspec_overrides.yaml new file mode 100644 index 000000000..c18eed080 --- /dev/null +++ b/pkgs/native_assets_builder/test/data/some_dev_dep/pubspec_overrides.yaml @@ -0,0 +1,3 @@ +dependency_overrides: + native_assets_cli: + path: ../../../../native_assets_cli/ diff --git a/pkgs/native_assets_cli/example/native_add_app/pubspec_overrides.yaml b/pkgs/native_assets_cli/example/native_add_app/pubspec_overrides.yaml new file mode 100644 index 000000000..272d61ecc --- /dev/null +++ b/pkgs/native_assets_cli/example/native_add_app/pubspec_overrides.yaml @@ -0,0 +1,5 @@ +dependency_overrides: + native_assets_cli: + path: ../../../native_assets_cli/ + native_toolchain_c: + path: ../../../native_toolchain_c/ diff --git a/pkgs/native_toolchain_c/CHANGELOG.md b/pkgs/native_toolchain_c/CHANGELOG.md index 9927f9c17..9ec73f16f 100644 --- a/pkgs/native_toolchain_c/CHANGELOG.md +++ b/pkgs/native_toolchain_c/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.4+1 + +- Stop depending on private `package:native_assets_cli` `CCompilerConfig` fields. + ## 0.3.4 - Bump `package:native_assets_cli` to 0.4.0. diff --git a/pkgs/native_toolchain_c/pubspec.yaml b/pkgs/native_toolchain_c/pubspec.yaml index ca2f7ba92..dffc1ca96 100644 --- a/pkgs/native_toolchain_c/pubspec.yaml +++ b/pkgs/native_toolchain_c/pubspec.yaml @@ -1,7 +1,7 @@ name: native_toolchain_c description: >- A library to invoke the native C compiler installed on the host machine. -version: 0.3.4 +version: 0.3.4+1 repository: https://github.com/dart-lang/native/tree/main/pkgs/native_toolchain_c topics: diff --git a/tools/check_pubspec_overrides.dart b/tools/check_pubspec_overrides.dart new file mode 100644 index 000000000..a519047bb --- /dev/null +++ b/tools/check_pubspec_overrides.dart @@ -0,0 +1,26 @@ +import 'dart:io'; + +void main(List arguments) async { + final allPubspecs = await Directory.current + .list(recursive: true) + .where((f) => f.path.endsWith('pubspec.yaml')) + .map((f) => f as File) + .toList(); + final nativePubspecs = + allPubspecs.where((f) => f.path.contains('pkgs/native_')).toList(); + final missingOverrides = nativePubspecs + .map((element) => + File.fromUri(element.uri.resolve('pubspec_overrides.yaml'))) + .where((f) => !f.existsSync()) + .where((f) => + !f.path.endsWith('pkgs/native_assets_cli/pubspec_overrides.yaml')) + .toList() + .join('\n'); + if (missingOverrides.isEmpty) { + print('No missing overrides.'); + } else { + print('Missing overrides:'); + print(missingOverrides); + exit(1); + } +}