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

Further consolidate [CodeAsset] specific classes by moving them to lib/src/code_assets #1704

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkgs/native_assets_cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 0.9.1-wip

- Update pubspec.yaml of examples to use 0.9.0 of package:native_assets_cli
- Consolidate [CodeAsset] specific things into `lib/src/code_assets/*`

## 0.9.0

Expand Down
10 changes: 5 additions & 5 deletions pkgs/native_assets_cli/lib/code_assets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export 'native_assets_cli.dart'
EncodedAsset,
EncodedAssetBuildOutputBuilder,
EncodedAssetLinkOutputBuilder;
export 'src/architecture.dart' show Architecture;
export 'src/build_mode.dart' show BuildMode;
export 'src/c_compiler_config.dart' show CCompilerConfig;
export 'src/code_assets/architecture.dart' show Architecture;
export 'src/code_assets/c_compiler_config.dart' show CCompilerConfig;
export 'src/code_assets/code_asset.dart' show CodeAsset, OSLibraryNaming;
export 'src/code_assets/config.dart'
show
Expand All @@ -23,13 +23,13 @@ export 'src/code_assets/config.dart'
CodeAssetLinkOutputBuilder,
CodeAssetLinkOutputBuilderAdd,
CodeConfig;
export 'src/ios_sdk.dart' show IOSSdk;
export 'src/link_mode.dart'
export 'src/code_assets/ios_sdk.dart' show IOSSdk;
export 'src/code_assets/link_mode.dart'
show
DynamicLoadingBundled,
DynamicLoadingSystem,
LinkMode,
LookupInExecutable,
LookupInProcess,
StaticLinking;
export 'src/link_mode_preference.dart' show LinkModePreference;
export 'src/code_assets/link_mode_preference.dart' show LinkModePreference;
2 changes: 1 addition & 1 deletion pkgs/native_assets_cli/lib/native_assets_cli_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export 'src/config.dart'
LinkOutput;
export 'src/model/dependencies.dart';
export 'src/model/resource_identifiers.dart';
export 'src/model/target.dart' show Target;
export 'src/target.dart' show Target;
export 'src/validation.dart'
show
ValidationErrors,
Expand Down
4 changes: 0 additions & 4 deletions pkgs/native_assets_cli/lib/native_assets_cli_internal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,4 @@
library;

export 'native_assets_cli_builder.dart';

export 'src/model/dependencies.dart';
export 'src/model/hook.dart';
export 'src/model/resource_identifiers.dart';
export 'src/model/target.dart' show Target;
10 changes: 5 additions & 5 deletions pkgs/native_assets_cli/lib/src/api/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import '../validation.dart';
/// ],
/// );
/// await cbuilder.run(
/// buildConfig: config,
/// buildOutput: output,
/// config: config,
/// output: output,
/// logger: Logger('')
/// ..level = Level.ALL
/// ..onRecord.listen((record) => print(record.message)),
Expand All @@ -47,14 +47,14 @@ import '../validation.dart';
/// ```dart
/// import 'dart:io';
///
/// import 'package:native_assets_cli/native_assets_cli.dart';
/// import 'package:native_assets_cli/code_assets.dart';
///
/// const assetName = 'asset.txt';
/// final packageAssetPath = Uri.file('data/$assetName');
///
/// void main(List<String> args) async {
/// await build(args, (config, output) async {
/// if (config.linkModePreference == LinkModePreference.static) {
/// if (config.codeConfig.linkModePreference == LinkModePreference.static) {
/// // Simulate that this hook only supports dynamic libraries.
/// throw UnsupportedError(
/// 'LinkModePreference.static is not supported.',
Expand All @@ -81,7 +81,7 @@ import '../validation.dart';
/// file: assetPath,
/// linkMode: DynamicLoadingBundled(),
/// os: config.targetOS,
/// architecture: config.targetArchitecture,
/// architecture: config.codeConfig.targetArchitecture,
/// ),
/// );
/// });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import 'package:collection/collection.dart';

import 'json_utils.dart';
import 'utils/map.dart';
import '../json_utils.dart';
import '../utils/map.dart';

/// The configuration for a C toolchain.
final class CCompilerConfig {
Expand Down
5 changes: 3 additions & 2 deletions pkgs/native_assets_cli/lib/src/code_assets/code_asset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
// 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 '../architecture.dart';
import '../config.dart';
import '../encoded_asset.dart';
import '../json_utils.dart';
import '../link_mode.dart';
import '../os.dart';
import '../utils/json.dart';
import '../utils/map.dart';

import 'architecture.dart';
import 'link_mode.dart';

/// A code asset which respects the native application binary interface (ABI).
///
/// Typical languages which produce code assets that respect the native ABI
Expand Down
8 changes: 4 additions & 4 deletions pkgs/native_assets_cli/lib/src/code_assets/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// 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 '../architecture.dart';
import '../c_compiler_config.dart';
import '../config.dart';
import '../ios_sdk.dart';
import '../json_utils.dart';
import '../link_mode_preference.dart';

import 'architecture.dart';
import 'c_compiler_config.dart';
import 'code_asset.dart';
import 'ios_sdk.dart';
import 'link_mode_preference.dart';

/// Extension to the [BuildConfig] providing access to configuration specific to
/// code assets (only available if code assets are supported).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// 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 'code_assets/code_asset.dart';
import 'config.dart';
import '../config.dart';

import 'code_asset.dart';

/// The link mode for a [CodeAsset].
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// 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 'code_assets/code_asset.dart';
import 'code_asset.dart';

/// The preferred linkMode method for [CodeAsset]s.
final class LinkModePreference {
Expand Down
3 changes: 2 additions & 1 deletion pkgs/native_assets_cli/lib/src/code_assets/validation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import 'dart:io';

import '../../code_assets_builder.dart';
import '../link_mode.dart';

import 'link_mode.dart';

Future<ValidationErrors> validateCodeAssetBuildConfig(
BuildConfig config) async =>
Expand Down
2 changes: 1 addition & 1 deletion pkgs/native_assets_cli/lib/src/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import 'package:crypto/crypto.dart' show sha256;
import 'package:pub_semver/pub_semver.dart';

import 'api/deprecation_messages.dart';
import 'architecture.dart';
import 'build_mode.dart';
import 'code_assets/architecture.dart';
import 'encoded_asset.dart';
import 'json_utils.dart';
import 'metadata.dart';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import 'dart:ffi' show Abi;
import 'dart:io';

import '../architecture.dart';
import '../os.dart';
import 'code_assets/architecture.dart';
import 'os.dart';

final class Target implements Comparable<Target> {
final Abi abi;
Expand Down