From 392c64b34ac828cf966826022a2255ed00d8b12e Mon Sep 17 00:00:00 2001 From: Hidenori Matsubayashi Date: Fri, 2 Sep 2022 20:35:29 +0900 Subject: [PATCH] Update for flutter 3.3.0 (#130) Signed-off-by: Hidenori Matsubayashi --- bin/internal/engine.version | 2 +- bin/internal/flutter.version | 2 +- bin/internal/shared.sh | 4 ++-- lib/commands/analyze.dart | 6 +++++- lib/commands/build.dart | 3 +-- lib/commands/create.dart | 12 ++++++++++-- lib/elinux_build_target.dart | 25 +++++++++++++------------ lib/elinux_device_discovery.dart | 8 +------- lib/elinux_doctor.dart | 4 ++-- lib/elinux_plugins.dart | 8 ++++++-- 10 files changed, 42 insertions(+), 32 deletions(-) diff --git a/bin/internal/engine.version b/bin/internal/engine.version index f232b40..2431e32 100644 --- a/bin/internal/engine.version +++ b/bin/internal/engine.version @@ -1 +1 @@ -e85ea0e79c6d894c120cda4ee8ee10fe6745e187 +5e9e0e0aa8be4ff69facadd706b713f0bb54d5b3 diff --git a/bin/internal/flutter.version b/bin/internal/flutter.version index 8c2db2f..14a210a 100644 --- a/bin/internal/flutter.version +++ b/bin/internal/flutter.version @@ -1 +1 @@ -f1875d570e39de09040c8f79aa13cc56baab8db1 +ffccd96b62ee8cec7740dab303538c5fc26ac543 diff --git a/bin/internal/shared.sh b/bin/internal/shared.sh index cd97b7e..454dc63 100644 --- a/bin/internal/shared.sh +++ b/bin/internal/shared.sh @@ -89,7 +89,7 @@ function update_flutter_elinux() { echo "Compiling flutter-elinux..." "$DART_EXE" --disable-dart-dev --no-enable-mirrors \ - --snapshot="$SNAPSHOT_PATH" --packages="$ROOT_DIR/.packages" \ + --snapshot="$SNAPSHOT_PATH" --packages="$ROOT_DIR/.dart_tool/package_config.json" \ "$ROOT_DIR/bin/flutter_elinux.dart" echo "$revision" > "$stamp_path" @@ -97,5 +97,5 @@ function update_flutter_elinux() { } function exec_snapshot() { - "$DART_EXE" --disable-dart-dev --packages="$ROOT_DIR/.packages" "$SNAPSHOT_PATH" "$@" + "$DART_EXE" --disable-dart-dev --packages="$ROOT_DIR/.dart_tool/package_config.json" "$SNAPSHOT_PATH" "$@" } diff --git a/lib/commands/analyze.dart b/lib/commands/analyze.dart index 645518a..19047e7 100644 --- a/lib/commands/analyze.dart +++ b/lib/commands/analyze.dart @@ -1,4 +1,4 @@ -// Copyright 2021 Sony Group Corporation. All rights reserved. +// Copyright 2022 Sony Group Corporation. All rights reserved. // Copyright 2020 Samsung Electronics Co., Ltd. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,6 +7,7 @@ import 'package:flutter_tools/src/commands/analyze.dart'; import 'package:flutter_tools/src/globals.dart' as globals; +import 'package:flutter_tools/src/project_validator.dart'; import '../elinux_plugins.dart'; @@ -20,5 +21,8 @@ class ELinuxAnalyzeCommand extends AnalyzeCommand with ELinuxExtension { logger: globals.logger, terminal: globals.terminal, artifacts: globals.artifacts, + allProjectValidators: [ + GeneralInfoProjectValidator() + ], ); } diff --git a/lib/commands/build.dart b/lib/commands/build.dart index 6869a77..55390ff 100644 --- a/lib/commands/build.dart +++ b/lib/commands/build.dart @@ -1,4 +1,4 @@ -// Copyright 2021 Sony Group Corporation. All rights reserved. +// Copyright 2022 Sony Group Corporation. All rights reserved. // Copyright 2020 Samsung Electronics Co., Ltd. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -33,7 +33,6 @@ class BuildPackageCommand extends BuildSubCommand BuildPackageCommand({bool verboseHelp = false}) : super(verboseHelp: verboseHelp) { addCommonDesktopBuildOptions(verboseHelp: verboseHelp); - usesBuildNameOption(); argParser.addOption( 'target-arch', defaultsTo: _getCurrentHostPlatformArchName(), diff --git a/lib/commands/create.dart b/lib/commands/create.dart index b2a45d1..3e538ed 100644 --- a/lib/commands/create.dart +++ b/lib/commands/create.dart @@ -1,4 +1,4 @@ -// Copyright 2021 Sony Group Corporation. All rights reserved. +// Copyright 2022 Sony Group Corporation. All rights reserved. // Copyright 2020 Samsung Electronics Co., Ltd. All rights reserved. // Copyright 2014 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -8,10 +8,10 @@ import 'dart:io'; -import 'package:file/file.dart'; import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/terminal.dart'; +import 'package:flutter_tools/src/base/utils.dart'; import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/commands/create.dart'; import 'package:flutter_tools/src/flutter_project_metadata.dart'; @@ -108,10 +108,18 @@ class ELinuxCreateCommand extends CreateCommand { 'Make sure your $relativePluginPath/pubspec.yaml contains the following lines.', color: TerminalColor.yellow, ); + + final String dartSdk = globals.cache.dartSdkBuild; + + // The dart project_name is in snake_case, this variable is the Title Case of the Project Name. + final String titleCaseProjectName = snakeCaseToTitleCase(projectName); + final Map templateContext = createTemplateContext( organization: '', projectName: projectName, flutterRoot: '', + titleCaseProjectName: titleCaseProjectName, + dartSdkVersionBounds: "'>=$dartSdk <3.0.0'", ); globals.printStatus( '\nflutter:\n' diff --git a/lib/elinux_build_target.dart b/lib/elinux_build_target.dart index 90ae3a2..062894f 100644 --- a/lib/elinux_build_target.dart +++ b/lib/elinux_build_target.dart @@ -1,4 +1,4 @@ -// Copyright 2021 Sony Group Corporation. All rights reserved. +// Copyright 2022 Sony Group Corporation. All rights reserved. // Copyright 2020 Samsung Electronics Co., Ltd. All rights reserved. // Copyright 2014 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -8,7 +8,6 @@ import 'dart:io'; -import 'package:file/file.dart'; import 'package:flutter_tools/src/artifacts.dart'; import 'package:flutter_tools/src/base/common.dart'; import 'package:flutter_tools/src/base/file_system.dart'; @@ -18,7 +17,6 @@ import 'package:flutter_tools/src/build_info.dart'; import 'package:flutter_tools/src/build_system/build_system.dart'; import 'package:flutter_tools/src/build_system/depfile.dart'; import 'package:flutter_tools/src/build_system/exceptions.dart'; -import 'package:flutter_tools/src/build_system/source.dart'; import 'package:flutter_tools/src/build_system/targets/android.dart'; import 'package:flutter_tools/src/build_system/targets/assets.dart'; import 'package:flutter_tools/src/build_system/targets/common.dart'; @@ -36,7 +34,9 @@ import 'elinux_plugins.dart'; /// /// Source: [AndroidAssetBundle] in `android.dart` abstract class ELinuxAssetBundle extends Target { - const ELinuxAssetBundle(); + const ELinuxAssetBundle(this.buildInfo); + + final ELinuxBuildInfo buildInfo; @override String get name => 'elinux_asset_bundle'; @@ -87,10 +87,14 @@ abstract class ELinuxAssetBundle extends Target { .file(isolateSnapshotData) .copySync(outputDirectory.childFile('isolate_snapshot_data').path); } + final TargetPlatform tp = buildInfo.targetArch == 'arm64' + ? TargetPlatform.linux_arm64 + : TargetPlatform.linux_x64; final Depfile assetDepfile = await copyAssets( environment, outputDirectory, - targetPlatform: null, // corresponds to flutter-tester + targetPlatform: tp, + buildMode: buildMode, ); final DepfileService depfileService = DepfileService( fileSystem: environment.fileSystem, @@ -105,9 +109,7 @@ abstract class ELinuxAssetBundle extends Target { /// Source: [DebugAndroidApplication] in `android.dart` class DebugELinuxApplication extends ELinuxAssetBundle { - DebugELinuxApplication(this.buildInfo); - - final ELinuxBuildInfo buildInfo; + DebugELinuxApplication(ELinuxBuildInfo buildInfo) : super(buildInfo); @override String get name => 'debug_elinux_application'; @@ -138,9 +140,7 @@ class DebugELinuxApplication extends ELinuxAssetBundle { /// See: [ReleaseAndroidApplication] in `android.dart` class ReleaseELinuxApplication extends ELinuxAssetBundle { - ReleaseELinuxApplication(this.buildInfo); - - final ELinuxBuildInfo buildInfo; + ReleaseELinuxApplication(ELinuxBuildInfo buildInfo) : super(buildInfo); @override String get name => 'release_elinux_application'; @@ -345,7 +345,8 @@ class NativeBundle { globals.fs.path.dirname(globals.fs.path.dirname(engineOutPath)); environment['LOCAL_ENGINE'] = globals.fs.path.basename(engineOutPath); } - writeGeneratedCmakeConfig(Cache.flutterRoot, eLinuxProject, environment); + writeGeneratedCmakeConfig( + Cache.flutterRoot, eLinuxProject, buildInfo.buildInfo, environment); await refreshELinuxPluginsList(eLinuxProject.parent); } diff --git a/lib/elinux_device_discovery.dart b/lib/elinux_device_discovery.dart index b081484..2c585a5 100644 --- a/lib/elinux_device_discovery.dart +++ b/lib/elinux_device_discovery.dart @@ -1,4 +1,4 @@ -// Copyright 2021 Sony Group Corporation. All rights reserved. +// Copyright 2022 Sony Group Corporation. All rights reserved. // Copyright 2020 Samsung Electronics Co., Ltd. All rights reserved. // Copyright 2014 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -22,7 +22,6 @@ import 'package:flutter_tools/src/flutter_device_manager.dart'; import 'package:flutter_tools/src/fuchsia/fuchsia_workflow.dart'; import 'package:flutter_tools/src/globals.dart' as globals; import 'package:flutter_tools/src/macos/macos_workflow.dart'; -import 'package:flutter_tools/src/windows/uwptool.dart'; import 'package:flutter_tools/src/windows/windows_workflow.dart'; import 'package:meta/meta.dart'; import 'package:process/process.dart'; @@ -61,11 +60,6 @@ class ELinuxDeviceManager extends FlutterDeviceManager { logger: globals.logger, platform: globals.platform, ), - uwptool: UwpTool( - artifacts: globals.artifacts, - logger: globals.logger, - processManager: globals.processManager, - ), ); final ELinuxDeviceDiscovery _eLinuxDeviceDiscovery = ELinuxDeviceDiscovery( diff --git a/lib/elinux_doctor.dart b/lib/elinux_doctor.dart index 0865fa4..1de4cfe 100644 --- a/lib/elinux_doctor.dart +++ b/lib/elinux_doctor.dart @@ -1,4 +1,4 @@ -// Copyright 2021 Sony Group Corporation. All rights reserved. +// Copyright 2022 Sony Group Corporation. All rights reserved. // Copyright 2020 Samsung Electronics Co., Ltd. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,7 +21,7 @@ ELinuxWorkflow get eLinuxWorkflow => context.get(); ELinuxValidator get eLinuxValidator => context.get(); /// See: [_DefaultDoctorValidatorsProvider] in `doctor.dart` -class ELinuxDoctorValidatorsProvider extends DoctorValidatorsProvider { +class ELinuxDoctorValidatorsProvider implements DoctorValidatorsProvider { @override List get validators { final List validators = diff --git a/lib/elinux_plugins.dart b/lib/elinux_plugins.dart index 17567c1..fe84fa8 100644 --- a/lib/elinux_plugins.dart +++ b/lib/elinux_plugins.dart @@ -1,4 +1,4 @@ -// Copyright 2021 Sony Group Corporation. All rights reserved. +// Copyright 2022 Sony Group Corporation. All rights reserved. // Copyright 2020 Samsung Electronics Co., Ltd. All rights reserved. // Copyright 2014 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be @@ -678,7 +678,11 @@ void _createPlatformPluginSymlinks( try { link.createSync(path); } on FileSystemException catch (e) { - handleSymlinkException(e, platform: globals.platform, os: globals.os); + handleSymlinkException(e, + platform: globals.platform, + os: globals.os, + destination: 'dest', + source: 'source'); rethrow; } }