Skip to content
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

[native_assets_cli] Add example for downloading assets #1860

Merged
merged 2 commits into from
Jan 9, 2025

Conversation

dcharkes
Copy link
Collaborator

@dcharkes dcharkes commented Jan 3, 2025

Add an example for how to download assets in a hook which are built on GitHub CI.

Design approach:

  • tool/build.dart uses package:native_toolchain_c.
  • GitHub action that publishes artifacts on a tag (not the package release tag).
  • hook/build.dart downloads the artifacts.
  • tool/generate_asset_hashes.dart generates hashes that are used in hook/build.dart to check download integrity.

GitHub actions mostly cargo culted from:

Closes: #157

@github-actions github-actions bot added type-infra A repository infrastructure change or enhancement package:native_assets_cli labels Jan 3, 2025
Copy link

github-actions bot commented Jan 3, 2025

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
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

@dcharkes dcharkes force-pushed the download-example branch 14 times, most recently from 2e55936 to ab77834 Compare January 3, 2025 13:56
@coveralls
Copy link

coveralls commented Jan 6, 2025

Coverage Status

coverage: 88.026% (+0.3%) from 87.717%
when pulling 16d4e33 on download-example
into a646680 on main.

@dcharkes dcharkes requested a review from mosuem January 6, 2025 09:43
@dcharkes dcharkes marked this pull request as ready for review January 9, 2025 09:25
@@ -0,0 +1,117 @@
name: download_asset
Copy link
Member

Choose a reason for hiding this comment

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

The name is a bit misleading, maybe building_assets?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hm, yeah, it's the name of the example package, because we're in a mono repo here. I agree with you that if it's not a mono repo it should probably be named building_assets. Should we name it package_download_asset.yaml and name: package_download_asset?

Copy link
Member

Choose a reason for hiding this comment

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

Sure, but it's just a nit. So do as you want :)

iOSSdk?.type,
)];
if (fileHash != expectedHash) {
throw Exception('File $file was not downloaded correctly.');
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I would print the hashes

@auto-submit auto-submit bot merged commit 43ad99c into main Jan 9, 2025
44 checks passed
@auto-submit auto-submit bot deleted the download-example branch January 9, 2025 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[doc] Document how to do build.dart that downloads a binary
3 participants