Skip to content

Commit

Permalink
Use Dart casing targetOs -> targetOS
Browse files Browse the repository at this point in the history
  • Loading branch information
dcharkes committed Feb 21, 2024
1 parent 51e71e6 commit 7ac882f
Show file tree
Hide file tree
Showing 28 changed files with 132 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class NativeAssetsBuildRunner {
/// [runPackageName] are built.
Future<DryRunResult> dryRun({
required LinkModePreferenceImpl linkModePreference,
required OSImpl targetOs,
required OSImpl targetOS,
required Uri workingDirectory,
required bool includeParentEnvironment,
PackageLayout? packageLayout,
Expand Down Expand Up @@ -169,7 +169,7 @@ class NativeAssetsBuildRunner {
final config = await _cliConfigDryRun(
packageName: package.name,
packageRoot: packageLayout.packageRoot(package.name),
targetOs: targetOs,
targetOS: targetOS,
linkMode: linkModePreference,
buildParentDir: packageLayout.dartToolNativeAssetsBuilder,
);
Expand Down Expand Up @@ -353,7 +353,7 @@ build_output.yaml contained a format error.
final buildDirName = BuildConfigImpl.checksum(
packageName: packageName,
packageRoot: packageRoot,
targetOs: target.os,
targetOS: target.os,
targetArchitecture: target.architecture,
buildMode: buildMode,
linkModePreference: linkMode,
Expand All @@ -372,7 +372,7 @@ build_output.yaml contained a format error.
outDir: outDirUri,
packageName: packageName,
packageRoot: packageRoot,
targetOs: target.os,
targetOS: target.os,
targetArchitecture: target.architecture,
buildMode: buildMode,
linkModePreference: linkMode,
Expand All @@ -386,11 +386,11 @@ build_output.yaml contained a format error.
static Future<BuildConfigImpl> _cliConfigDryRun({
required String packageName,
required Uri packageRoot,
required OSImpl targetOs,
required OSImpl targetOS,
required LinkModePreferenceImpl linkMode,
required Uri buildParentDir,
}) async {
final buildDirName = 'dry_run_${targetOs}_$linkMode';
final buildDirName = 'dry_run_${targetOS}_$linkMode';
final outDirUri = buildParentDir.resolve('$buildDirName/out/');
final outDir = Directory.fromUri(outDirUri);
if (!await outDir.exists()) {
Expand All @@ -400,7 +400,7 @@ build_output.yaml contained a format error.
outDir: outDirUri,
packageName: packageName,
packageRoot: packageRoot,
targetOs: targetOs,
targetOS: targetOS,
linkModePreference: linkMode,
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ void main() async {
);

await buildRunner.dryRun(
targetOs: Target.current.os,
targetOS: Target.current.os,
linkModePreference: LinkModePreferenceImpl.dynamic,
workingDirectory: packageUri,
includeParentEnvironment: true,
);
await buildRunner.dryRun(
targetOs: Target.current.os,
targetOS: Target.current.os,
linkModePreference: LinkModePreferenceImpl.dynamic,
workingDirectory: packageUri,
includeParentEnvironment: true,
Expand Down
2 changes: 1 addition & 1 deletion pkgs/native_assets_builder/test/build_runner/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Future<DryRunResult> dryRun(
dartExecutable: dartExecutable,
).dryRun(
linkModePreference: linkModePreference,
targetOs: Target.current.os,
targetOS: Target.current.os,
workingDirectory: packageUri,
includeParentEnvironment: includeParentEnvironment,
packageLayout: packageLayout,
Expand Down
2 changes: 1 addition & 1 deletion pkgs/native_assets_cli/example/local_asset/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void main(List<String> args) async {
id: 'library:$packageName/asset.txt',
file: assetPath,
linkMode: LinkMode.dynamic,
os: config.targetOs,
os: config.targetOS,
architecture: config.targetArchitecture,
dynamicLoading: BundledDylib(),
),
Expand Down
2 changes: 1 addition & 1 deletion pkgs/native_assets_cli/lib/src/api/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import 'build_output.dart';
/// id: 'library:$packageName/asset.txt',
/// file: assetPath,
/// linkMode: LinkMode.dynamic,
/// os: config.targetOs,
/// os: config.targetOS,
/// architecture: config.targetArchitecture,
/// dynamicLoading: BundledDylib(),
/// ),
Expand Down
14 changes: 7 additions & 7 deletions pkgs/native_assets_cli/lib/src/api/build_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ abstract final class BuildConfig {
Architecture? get targetArchitecture;

/// The operating system being compiled for.
OS get targetOs;
OS get targetOS;

/// When compiling for iOS, whether to target device or simulator.
///
/// Required when [targetOs] equals [OS.iOS].
/// Required when [targetOS] equals [OS.iOS].
///
/// Not available during a [dryRun].
IOSSdk? get targetIOSSdk;

/// When compiling for Android, the minimum Android SDK API version to that
/// the compiled code will be compatible with.
///
/// Required when [targetOs] equals [OS.android].
/// Required when [targetOS] equals [OS.android].
///
/// Not available during a [dryRun].
///
Expand Down Expand Up @@ -149,7 +149,7 @@ abstract final class BuildConfig {
required Uri packageRoot,
required BuildMode buildMode,
required Architecture targetArchitecture,
required OS targetOs,
required OS targetOS,
IOSSdk? targetIOSSdk,
int? targetAndroidNdkApi,
CCompilerConfig? cCompiler,
Expand All @@ -163,7 +163,7 @@ abstract final class BuildConfig {
packageRoot: packageRoot,
buildMode: buildMode as BuildModeImpl,
targetArchitecture: targetArchitecture as ArchitectureImpl,
targetOs: targetOs as OSImpl,
targetOS: targetOS as OSImpl,
targetIOSSdk: targetIOSSdk as IOSSdkImpl?,
targetAndroidNdkApi: targetAndroidNdkApi,
cCompiler: cCompiler as CCompilerConfigImpl?,
Expand All @@ -181,15 +181,15 @@ abstract final class BuildConfig {
required Uri outDir,
required String packageName,
required Uri packageRoot,
required OS targetOs,
required OS targetOS,
required LinkModePreference linkModePreference,
Iterable<String>? supportedAssetTypes,
}) =>
BuildConfigImpl.dryRun(
outDir: outDir,
packageName: packageName,
packageRoot: packageRoot,
targetOs: targetOs as OSImpl,
targetOS: targetOS as OSImpl,
linkModePreference: linkModePreference as LinkModePreferenceImpl,
supportedAssetTypes: supportedAssetTypes,
);
Expand Down
4 changes: 2 additions & 2 deletions pkgs/native_assets_cli/lib/src/api/ios_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ abstract final class IOSSdk {
///
/// The SDK location can be found on the host machine with
/// `xcrun --sdk iphoneos --show-sdk-path`.
static const IOSSdk iPhoneOs = IOSSdkImpl.iPhoneOs;
static const IOSSdk iPhoneOS = IOSSdkImpl.iPhoneOS;

/// The iphonesimulator SDK in Xcode.
///
Expand All @@ -22,7 +22,7 @@ abstract final class IOSSdk {

/// All known values for [IOSSdk].
static const values = <IOSSdk>[
iPhoneOs,
iPhoneOS,
iPhoneSimulator,
];
}
4 changes: 2 additions & 2 deletions pkgs/native_assets_cli/lib/src/helpers/asset_downloader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AssetDownloader implements Builder {
Uri? targetUri;
if (!config.dryRun) {
final downloadUri2 = downloadUri(
config.targetOs,
config.targetOS,
config.targetArchitecture!,
);
final fileName =
Expand All @@ -61,7 +61,7 @@ class AssetDownloader implements Builder {
file: targetUri,
linkMode: LinkMode.dynamic,
dynamicLoading: BundledDylib(),
os: config.targetOs,
os: config.targetOS,
architecture: config.targetArchitecture,
),
);
Expand Down
30 changes: 15 additions & 15 deletions pkgs/native_assets_cli/lib/src/model/build_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ final class BuildConfigImpl implements BuildConfig {
late final ArchitectureImpl? _targetArchitecture;

@override
OSImpl get targetOs => _targetOs;
late final OSImpl _targetOs;
OSImpl get targetOS => _targetOS;
late final OSImpl _targetOS;

@override
IOSSdkImpl? get targetIOSSdk {
Expand Down Expand Up @@ -92,7 +92,7 @@ final class BuildConfigImpl implements BuildConfig {
required Uri packageRoot,
required BuildModeImpl buildMode,
required ArchitectureImpl targetArchitecture,
required OSImpl targetOs,
required OSImpl targetOS,
IOSSdkImpl? targetIOSSdk,
int? targetAndroidNdkApi,
CCompilerConfigImpl? cCompiler,
Expand All @@ -107,7 +107,7 @@ final class BuildConfigImpl implements BuildConfig {
.._packageRoot = packageRoot
.._buildMode = buildMode
.._targetArchitecture = targetArchitecture
.._targetOs = targetOs
.._targetOS = targetOS
.._targetIOSSdk = targetIOSSdk
.._targetAndroidNdkApi = targetAndroidNdkApi
.._cCompiler = cCompiler ?? CCompilerConfigImpl()
Expand All @@ -125,7 +125,7 @@ final class BuildConfigImpl implements BuildConfig {
required Uri outDir,
required String packageName,
required Uri packageRoot,
required OSImpl targetOs,
required OSImpl targetOS,
required LinkModePreferenceImpl linkModePreference,
Iterable<String>? supportedAssetTypes,
}) {
Expand All @@ -134,7 +134,7 @@ final class BuildConfigImpl implements BuildConfig {
.._outDir = outDir
.._packageName = packageName
.._packageRoot = packageRoot
.._targetOs = targetOs
.._targetOS = targetOS
.._targetArchitecture = null
.._linkModePreference = linkModePreference
.._cCompiler = CCompilerConfigImpl()
Expand All @@ -157,7 +157,7 @@ final class BuildConfigImpl implements BuildConfig {
required String packageName,
required Uri packageRoot,
required ArchitectureImpl targetArchitecture,
required OSImpl targetOs,
required OSImpl targetOS,
required BuildModeImpl buildMode,
IOSSdkImpl? targetIOSSdk,
int? targetAndroidNdkApi,
Expand All @@ -171,7 +171,7 @@ final class BuildConfigImpl implements BuildConfig {
version ?? latestVersion,
packageName,
targetArchitecture.toString(),
targetOs.toString(),
targetOS.toString(),
targetIOSSdk.toString(),
targetAndroidNdkApi.toString(),
buildMode.toString(),
Expand Down Expand Up @@ -299,7 +299,7 @@ final class BuildConfigImpl implements BuildConfig {
}
},
(config) {
_targetOs = OSImpl.fromString(
_targetOS = OSImpl.fromString(
config.string(
OSImpl.configKey,
validValues: OSImpl.values.map((e) => '$e'),
Expand All @@ -317,7 +317,7 @@ final class BuildConfigImpl implements BuildConfig {
...ArchitectureImpl.values
else
for (final target in Target.values)
if (target.os == _targetOs) target.architecture
if (target.os == _targetOS) target.architecture
];
_targetArchitecture = ArchitectureImpl.fromString(
config.string(
Expand All @@ -331,7 +331,7 @@ final class BuildConfigImpl implements BuildConfig {
if (dryRun) {
_throwIfNotNullInDryRun<String>(IOSSdkImpl.configKey);
} else {
_targetIOSSdk = (osSet && _targetOs == OSImpl.iOS)
_targetIOSSdk = (osSet && _targetOS == OSImpl.iOS)
? IOSSdkImpl.fromString(
config.string(
IOSSdkImpl.configKey,
Expand All @@ -345,7 +345,7 @@ final class BuildConfigImpl implements BuildConfig {
if (dryRun) {
_throwIfNotNullInDryRun<int>(targetAndroidNdkApiConfigKey);
} else {
_targetAndroidNdkApi = (osSet && _targetOs == OSImpl.android)
_targetAndroidNdkApi = (osSet && _targetOS == OSImpl.android)
? config.int(targetAndroidNdkApiConfigKey)
: null;
}
Expand Down Expand Up @@ -456,7 +456,7 @@ final class BuildConfigImpl implements BuildConfig {
outDirConfigKey: _outDir.toFilePath(),
packageNameConfigKey: _packageName,
packageRootConfigKey: _packageRoot.toFilePath(),
OSImpl.configKey: _targetOs.toString(),
OSImpl.configKey: _targetOS.toString(),
LinkModePreferenceImpl.configKey: _linkModePreference.toString(),
supportedAssetTypesKey: _supportedAssetTypes,
_versionKey: latestVersion.toString(),
Expand Down Expand Up @@ -490,7 +490,7 @@ final class BuildConfigImpl implements BuildConfig {
if (other.packageName != packageName) return false;
if (other.packageRoot != packageRoot) return false;
if (other.dryRun != dryRun) return false;
if (other.targetOs != targetOs) return false;
if (other.targetOS != targetOS) return false;
if (other.linkModePreference != linkModePreference) return false;
if (!const DeepCollectionEquality()
.equals(other._supportedAssetTypes, _supportedAssetTypes)) return false;
Expand All @@ -511,7 +511,7 @@ final class BuildConfigImpl implements BuildConfig {
outDir,
packageName,
packageRoot,
targetOs,
targetOS,
linkModePreference,
dryRun,
const DeepCollectionEquality().hash(_supportedAssetTypes),
Expand Down
2 changes: 1 addition & 1 deletion pkgs/native_assets_cli/lib/src/model/c_code_asset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ final class CCodeAssetImpl implements CCodeAsset, AssetImpl {
_idKey: id,
_linkModeKey: linkMode.name,
_pathKey: dynamicLoading.toYaml(version, file),
_targetKey: Target.fromArchitectureAndOs(architecture!, os).toString(),
_targetKey: Target.fromArchitectureAndOS(architecture!, os).toString(),
}..sortOnKey();
}
return {
Expand Down
4 changes: 2 additions & 2 deletions pkgs/native_assets_cli/lib/src/model/ios_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ final class IOSSdkImpl implements IOSSdk {

const IOSSdkImpl._(this.xcodebuildSdk);

static const iPhoneOs = IOSSdkImpl._('iphoneos');
static const iPhoneOS = IOSSdkImpl._('iphoneos');
static const iPhoneSimulator = IOSSdkImpl._('iphonesimulator');

static const values = [
iPhoneOs,
iPhoneOS,
iPhoneSimulator,
];

Expand Down
2 changes: 1 addition & 1 deletion pkgs/native_assets_cli/lib/src/model/target.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class Target implements Comparable<Target> {
return target;
}

factory Target.fromArchitectureAndOs(
factory Target.fromArchitectureAndOS(
ArchitectureImpl architecture,
OSImpl os,
) {
Expand Down
Loading

0 comments on commit 7ac882f

Please sign in to comment.