Skip to content

Commit

Permalink
Add test project adding assets in link
Browse files Browse the repository at this point in the history
  • Loading branch information
mosuem committed May 7, 2024
1 parent 9e55614 commit 50ecb95
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# https://dart.dev/guides/libraries/private-files
# Created by `dart pub`
.dart_tool/
bin/add_dylib_link/
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This sample adds a native library in the link step.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
My test text
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// 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';

void main(List<String> arguments) {
print(File('assets/test.txt').readAsStringSync());
}
19 changes: 19 additions & 0 deletions pkgs/native_assets_builder/test_data/add_dylib_link/hook/link.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// 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 'package:native_assets_cli/native_assets_cli.dart';

void main(List<String> arguments) async {
await link(arguments, (config, output) async {
output
..addAsset(
DataAsset(
package: 'add_dylib_link',
name: 'test_text_file',
file: config.packageRoot.resolve('assets/test.txt'),
),
)
..addDependency(config.packageRoot.resolve('hook/link.dart'));
});
}
19 changes: 19 additions & 0 deletions pkgs/native_assets_builder/test_data/add_dylib_link/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: add_dylib_link
description: Add a dylib in the link step.
version: 1.0.0

publish_to: none

environment:
sdk: ^3.0.0

dependencies:
logging: ^1.1.1
# native_assets_cli: ^0.5.0
meta: ^1.12.0
native_assets_cli:
path: ../../../native_assets_cli/

dev_dependencies:
lints: ^3.0.0
test: ^1.24.0

0 comments on commit 50ecb95

Please sign in to comment.