runNativePrebuiltCli function

Future<void> runNativePrebuiltCli(
  1. List<String> args, {
  2. NativeProject? project,
})

Runs the native_prebuilt CLI.

If project is provided, it is used for the build-related commands (plan, build, cache-key, explain-cache, verify). Otherwise the CLI auto-discovers the nearest native_prebuilt.yaml and uses the built-in default project if none is found.

Runs the native project CLI for package-local builds. This provides build commands for packages that define a NativeProject.

Implementation

Future<void> runNativePrebuiltCli(
  List<String> args, {
  NativeProject? project,
}) async {
  final buildProject = project ?? detect(Directory.current) ?? _defaultProject;
  final runner =
      CommandRunner<void>(
          'native_prebuilt',
          'Utilities for prebuilt native artifacts in Dart packages.',
        )
        ..addCommand(InitCommand())
        ..addCommand(ManifestCommand())
        ..addCommand(FetchCommand())
        ..addCommand(SchemaCommand())
        ..addCommand(DoctorCommand())
        ..addCommand(WorkflowCommand())
        ..addCommand(PlanCommand(project: buildProject))
        ..addCommand(
          BuildCommand(
            project: buildProject,
            autoDiscoverProject: project == null,
          ),
        )
        ..addCommand(CacheKeyCommand(project: buildProject))
        ..addCommand(ExplainCacheCommand(project: buildProject))
        ..addCommand(VerifyCommand(project: buildProject));

  await runner.run(args);
}