-
Notifications
You must be signed in to change notification settings - Fork 67
[native_assets_cli] BuildOutput extension: addDataAssetDirectories #2097
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
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
80af89c
add BuildOutput extensions addFoundCodeAssets and addDataAssetDirecto…
MichealReed 28e4dd2
update changelog
MichealReed ec9b98c
should use targetOS
MichealReed ba20b2d
tests should use targetOS
MichealReed 80f7576
mappings instead of names, libraries don't always match convention.
MichealReed 42d26a3
fix comments
MichealReed 6795c87
test nesting
MichealReed 703a5c5
optional outputDirectory URI
MichealReed 6c91856
normalize keys instead of edit generated file, needs new issue
MichealReed 7da0b8f
use dependency from dart
MichealReed 303e701
remove main from ffigen
MichealReed 4e99e19
clean-up unnecessary show
MichealReed d78a647
show AddDataAssetsDirectoryExtension and GetLinkMode
MichealReed 2836592
BuildOutputBuilder in changelog.
MichealReed 82a4b05
remove AddFoundCodeAssets extension
MichealReed 09cbb6b
remove AddFoundCodeAssets extension
MichealReed a9b87b9
remove GetLinkMode extension
MichealReed 379a76e
remove addfound tests
MichealReed b76ec8f
dont add directories
MichealReed 768827c
dont add directories
MichealReed 590811f
remove directory tests
MichealReed 8f29e61
remove addfoundlibrary from download_asset example
MichealReed 7b0d8fb
update changelog
MichealReed ca389e5
no need for code asset import in config
MichealReed 6423e27
remove config important from validation tests
MichealReed 56cbc0b
actually add the data asset
MichealReed 3cf0742
fix asset name
MichealReed 7719d15
fix config imports
MichealReed a60dff5
restore download_asset
MichealReed af8218c
move to data_assets
MichealReed c21eba0
restore download_asset example
MichealReed 8034a81
fix validation test, cleanup new extension
MichealReed 7424003
restore base config.dart imports
MichealReed 7d6c35d
addDependency directory
MichealReed 2c316ea
remove import
MichealReed bc33b02
restore build_runner_test
MichealReed 57d6d41
add directory uri
MichealReed File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
25 changes: 1 addition & 24 deletions
25
pkgs/native_assets_builder/test_data/simple_data_asset/hook/build.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,11 @@ | ||
// Copyright (c) 2024, 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. | ||
import 'dart:io'; | ||
|
||
import 'package:native_assets_cli/data_assets.dart'; | ||
|
||
void main(List<String> args) async { | ||
await build(args, (input, output) async { | ||
final assetDirectory = Directory.fromUri( | ||
input.packageRoot.resolve('assets/'), | ||
); | ||
// If assets are added, rerun hook. | ||
output.addDependency(assetDirectory.uri); | ||
|
||
await for (final dataAsset in assetDirectory.list()) { | ||
if (dataAsset is! File) { | ||
continue; | ||
} | ||
|
||
// The file path relative to the package root, with forward slashes. | ||
final name = dataAsset.uri | ||
.toFilePath(windows: false) | ||
.substring(input.packageRoot.toFilePath(windows: false).length); | ||
|
||
output.assets.data.add( | ||
DataAsset(package: input.packageName, name: name, file: dataAsset.uri), | ||
); | ||
// TODO(https://github.com/dart-lang/native/issues/1208): Report | ||
// dependency on asset. | ||
output.addDependency(dataAsset.uri); | ||
} | ||
await output.addDataAssetDirectories(['assets'], input: input); | ||
}); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.