dart-lang / native

Dart packages related to FFI and native assets bundling.
BSD 3-Clause "New" or "Revised" License
115 stars 39 forks source link

[infra][native_assets_cli] `dart build exe` failing for example on 3.5.0-243.0.dev #1232

Closed dcharkes closed 1 month ago

dcharkes commented 2 months ago

The CI started failing last week with dev builds.

Run dart --enable-experiment=native-assets build bin/native_add_app.dart
  dart --enable-experiment=native-assets build bin/native_add_app.dart
  shell: /usr/bin/bash -e {0}
  env:
    DART_HOME: /opt/hostedtoolcache/dart/3.5.0-259.0.dev/x64
    PUB_CACHE: /home/runner/.pub-cache
Could not find dart. Have you built the full Dart SDK?

https://github.com/dart-lang/native/actions/runs/9531751030/job/26273028761

The run two weeks ago succeeded.

Run dart --enable-experiment=native-assets build bin/native_add_app.dart
  dart --enable-experiment=native-assets build bin/native_add_app.dart
  shell: /usr/bin/bash -e {0}
  env:
    DART_HOME: /opt/hostedtoolcache/dart/3.5.0-219.0.dev/x64
    PUB_CACHE: /home/runner/.pub-cache
Building native assets.
Writing native_assets.yaml.
Copying 1 build assets: (package:native_add_library/native_add_library.dart)
Generated: /home/runner/work/native/native/pkgs/native_assets_cli/example/build/native_add_app/bin/native_add_app/native_add_app.exe

https://github.com/dart-lang/native/actions/runs/9432414624/job/25982134422

So something must have changed in the meantime.

dcharkes commented 2 months ago

It fails on -243 as well.

So the error was introduced somewhere in https://github.com/dart-lang/sdk/compare/9dce57c343ecfa98a214259dc65a3370c39c76a1...5634a2598d34f01ebd76799b9bfe322e2572bc2f.

dcharkes commented 2 months ago

CLI/dartdev commits:

dcharkes commented 2 months ago

The error message is coming from:

https://github.com/dart-lang/sdk/blob/a8314dac745ceabc926f9d9bedb9e8692d690298/pkg/dartdev/lib/src/sdk.dart#L138-L148

  static bool checkArtifactExists(String path, {bool logError = true}) {
    if (!File(path).existsSync()) {
      if (logError) {
        log.stderr(
          'Could not find $path. Have you built the full Dart SDK?',
        );
      }
      return false;
    }
    return true;
  }

And the most likely call path is:

https://github.com/dart-lang/sdk/blob/a8314dac745ceabc926f9d9bedb9e8692d690298/pkg/dartdev/lib/src/commands/build.dart#L70

  Future<int> run() async {
    if (!Sdk.checkArtifactExists(genKernel) ||
        !Sdk.checkArtifactExists(genSnapshot) ||
        !Sdk.checkArtifactExists(sdk.dart)) {
      return 255;
    }

And sdk.dart was recently changed: from Platform.resolvedExecutable to Platform.executable.

https://dart-review.googlesource.com/c/sdk/+/370000/5/pkg/dartdev/lib/src/sdk.dart

dcharkes commented 2 months ago

A possible fix landed in https://github.com/dart-lang/sdk/commit/4abd615d3279573ad4711995a545ed156da8a315. The first dev release that should be in is 3.5.0-305.0.dev.

No release in the archive yet https://dart.dev/get-dart/archive.

dcharkes commented 2 months ago

A possible fix landed in dart-lang/sdk@4abd615. The first dev release that should be in is 3.5.0-305.0.dev.

No release in the archive yet https://dart.dev/get-dart/archive.

Unfortunately that fix didn't work: https://github.com/dart-lang/sdk/issues/56080#issuecomment-2216879041

dcharkes commented 1 month ago

Another possible fix https://github.com/dart-lang/sdk/commit/e9be5dc4aae7f0c717661521f2508ea5a726ff55, lets wait for the next dev release.

Should be available after 3.6.0-69.0.dev