Skip to content
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 AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ Taha Firoz (mtahafiroz@gmail.com)
Weiwei Duan (duanweiwei1982@gmail.com)
Anton Sakhon (kofhein@gmail.com)
Burak Karahan (burak.karahan@mail.ru)
Jason Huang (zxcv1884@gmail.com)
2 changes: 1 addition & 1 deletion bin/internal/engine.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18b71d647a292a980abb405ac7d16fe1f0b20434
cf56914b326edb0ccb123ffdc60f00060bd513fa
4 changes: 2 additions & 2 deletions bin/internal/flutter.version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
c23637390482d4cf9598c3ce3f2be31aa7332daf
3.29.2
ea121f8859e4b13e47a8f845e4586164519588bc
3.29.3
18 changes: 6 additions & 12 deletions lib/commands/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ class ELinuxBuildCommand extends BuildCommand {
}
}

class BuildPackageCommand extends BuildSubCommand
with ELinuxExtension, ELinuxRequiredArtifacts {
class BuildPackageCommand extends BuildSubCommand with ELinuxExtension, ELinuxRequiredArtifacts {
/// See: [BuildApkCommand] in `build_apk.dart`
BuildPackageCommand({bool verboseHelp = false})
: super(
Expand Down Expand Up @@ -73,8 +72,7 @@ class BuildPackageCommand extends BuildSubCommand
);
argParser.addOption(
'system-include-directories',
help:
'The additional system include paths to cross-compile for target platform. '
help: 'The additional system include paths to cross-compile for target platform. '
'This option is valid only '
'if the current host and target architectures are different.',
);
Expand All @@ -88,13 +86,11 @@ class BuildPackageCommand extends BuildSubCommand
final String name = 'elinux';

@override
Future<Set<DevelopmentArtifact>> get requiredArtifacts async =>
<DevelopmentArtifact>{
Future<Set<DevelopmentArtifact>> get requiredArtifacts async => <DevelopmentArtifact>{
// Use gen_snapshot of the arm64 linux-desktop when self-building
// on arm64 hosts. This is because elinux's artifacts for arm64
// doesn't support self-build as of now.
if (_getCurrentHostPlatformArchName() == 'arm64')
DevelopmentArtifact.linux,
if (_getCurrentHostPlatformArchName() == 'arm64') DevelopmentArtifact.linux,
ELinuxDevelopmentArtifact.elinux,
};

Expand All @@ -103,8 +99,7 @@ class BuildPackageCommand extends BuildSubCommand

/// See: [android.validateBuild] in `build_validation.dart`
void validateBuild(ELinuxBuildInfo eLinuxBuildInfo) {
if (eLinuxBuildInfo.buildInfo.mode.isPrecompiled &&
eLinuxBuildInfo.targetArch == 'x86') {
if (eLinuxBuildInfo.buildInfo.mode.isPrecompiled && eLinuxBuildInfo.targetArch == 'x86') {
throwToolExit('x86 ABI does not support AOT compilation.');
}
}
Expand All @@ -116,8 +111,7 @@ class BuildPackageCommand extends BuildSubCommand
final String? targetArch = stringArg('target-arch');
final String hostArch = _getCurrentHostPlatformArchName();
if (hostArch != targetArch && hostArch == 'arm64') {
globals.logger
.printError('Not supported cross-building for x64 on arm64.');
globals.logger.printError('Not supported cross-building for x64 on arm64.');
return FlutterCommandResult.fail();
}

Expand Down
17 changes: 6 additions & 11 deletions lib/commands/create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,8 @@ class ELinuxCreateCommand extends CreateCommand {
// The template directory that the flutter tools search for available
// templates cannot be overriden because the implementation is private.
// So we have to copy eLinux templates into the directory manually.
final Directory eLinuxTemplates = globals.fs
.directory(Cache.flutterRoot)
.parent
.childDirectory('templates');
final Directory eLinuxTemplates =
globals.fs.directory(Cache.flutterRoot).parent.childDirectory('templates');
if (!eLinuxTemplates.existsSync()) {
throwToolExit('Could not locate eLinux templates.');
}
Expand All @@ -167,19 +165,16 @@ class ELinuxCreateCommand extends CreateCommand {
_runGitClean(templates);

try {
for (final Directory projectType
in eLinuxTemplates.listSync().whereType<Directory>()) {
final Directory dest = templates
.childDirectory(projectType.basename)
.childDirectory('elinux.tmpl');
for (final Directory projectType in eLinuxTemplates.listSync().whereType<Directory>()) {
final Directory dest =
templates.childDirectory(projectType.basename).childDirectory('elinux.tmpl');
if (dest.existsSync()) {
dest.deleteSync(recursive: true);
}

copyDirectory(projectType, dest);
if (projectType.basename == 'app') {
final Directory sourceRunnerCommon =
projectType.childDirectory('runner');
final Directory sourceRunnerCommon = projectType.childDirectory('runner');
if (!sourceRunnerCommon.existsSync()) {
continue;
}
Expand Down
3 changes: 1 addition & 2 deletions lib/commands/drive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import 'package:flutter_tools/src/globals.dart' as globals;
import '../elinux_cache.dart';
import '../elinux_plugins.dart';

class ELinuxDriveCommand extends DriveCommand
with ELinuxExtension, ELinuxRequiredArtifacts {
class ELinuxDriveCommand extends DriveCommand with ELinuxExtension, ELinuxRequiredArtifacts {
ELinuxDriveCommand({super.verboseHelp})
: super(
fileSystem: globals.fs,
Expand Down
48 changes: 17 additions & 31 deletions lib/commands/packages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,28 @@ class ELinuxPackagesCommand extends FlutterCommand {
ELinuxPackagesCommand() {
addSubcommand(ELinuxPackagesGetCommand(
'get', "Get the current package's dependencies.", PubContext.pubGet));
addSubcommand(ELinuxPackagesGetCommand('upgrade',
"Upgrade the current package's dependencies to latest versions.", PubContext.pubUpgrade));
addSubcommand(
ELinuxPackagesGetCommand('add', 'Add a dependency to pubspec.yaml.', PubContext.pubAdd));
addSubcommand(ELinuxPackagesGetCommand(
'upgrade',
"Upgrade the current package's dependencies to latest versions.",
PubContext.pubUpgrade));
addSubcommand(ELinuxPackagesGetCommand(
'add', 'Add a dependency to pubspec.yaml.', PubContext.pubAdd));
addSubcommand(ELinuxPackagesGetCommand(
'remove',
'Removes a dependency from the current package.',
PubContext.pubRemove));
'remove', 'Removes a dependency from the current package.', PubContext.pubRemove));
addSubcommand(PackagesTestCommand());
addSubcommand(PackagesForwardCommand(
'publish', 'Publish the current package to pub.dartlang.org',
requiresPubspec: true));
addSubcommand(PackagesForwardCommand(
'downgrade', 'Downgrade packages in a Flutter project',
requiresPubspec: true));
addSubcommand(PackagesForwardCommand('deps', 'Print package dependencies',
requiresPubspec: true));
addSubcommand(PackagesForwardCommand(
'run', 'Run an executable from a package',
addSubcommand(PackagesForwardCommand('downgrade', 'Downgrade packages in a Flutter project',
requiresPubspec: true));
addSubcommand(
PackagesForwardCommand('cache', 'Work with the Pub system cache'));
PackagesForwardCommand('deps', 'Print package dependencies', requiresPubspec: true));
addSubcommand(
PackagesForwardCommand('run', 'Run an executable from a package', requiresPubspec: true));
addSubcommand(PackagesForwardCommand('cache', 'Work with the Pub system cache'));
addSubcommand(PackagesForwardCommand('version', 'Print Pub version'));
addSubcommand(PackagesForwardCommand(
'uploader', 'Manage uploaders for a package on pub.dev'));
addSubcommand(PackagesForwardCommand('uploader', 'Manage uploaders for a package on pub.dev'));
addSubcommand(PackagesForwardCommand('login', 'Log into pub.dev.'));
addSubcommand(PackagesForwardCommand('logout', 'Log out of pub.dev.'));
addSubcommand(
PackagesForwardCommand('global', 'Work with Pub global packages'));
addSubcommand(PackagesForwardCommand('global', 'Work with Pub global packages'));
addSubcommand(PackagesForwardCommand(
'outdated', 'Analyze dependencies to find which ones can be upgraded',
requiresPubspec: true));
Expand All @@ -69,12 +60,10 @@ class ELinuxPackagesCommand extends FlutterCommand {
final String description = 'Commands for managing Flutter packages.';

@override
Future<FlutterCommandResult> runCommand() async =>
FlutterCommandResult.fail();
Future<FlutterCommandResult> runCommand() async => FlutterCommandResult.fail();
}

class ELinuxPackagesGetCommand extends PackagesGetCommand
with _PostRunPluginInjection {
class ELinuxPackagesGetCommand extends PackagesGetCommand with _PostRunPluginInjection {
ELinuxPackagesGetCommand(super.commandName, super.description, super.context);
}

Expand All @@ -85,17 +74,14 @@ mixin _PostRunPluginInjection on FlutterCommand {
final FlutterCommandResult result = await super.runCommand();

if (result == FlutterCommandResult.success()) {
final String? workingDirectory =
argResults!.rest.isNotEmpty ? argResults!.rest[0] : null;
final String? workingDirectory = argResults!.rest.isNotEmpty ? argResults!.rest[0] : null;
final String? target = findProjectRoot(globals.fs, workingDirectory);
if (target == null) {
return result;
}
final FlutterProject rootProject =
FlutterProject.fromDirectory(globals.fs.directory(target));
final FlutterProject rootProject = FlutterProject.fromDirectory(globals.fs.directory(target));
await ensureReadyForELinuxTooling(rootProject);
if (rootProject.hasExampleApp &&
rootProject.example.pubspecFile.existsSync()) {
if (rootProject.hasExampleApp && rootProject.example.pubspecFile.existsSync()) {
await ensureReadyForELinuxTooling(rootProject.example);
}
}
Expand Down
9 changes: 3 additions & 6 deletions lib/commands/run.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,15 @@ import 'package:flutter_tools/src/commands/run.dart';
import '../elinux_cache.dart';
import '../elinux_plugins.dart';

class ELinuxRunCommand extends RunCommand
with ELinuxExtension, ELinuxRequiredArtifacts {
class ELinuxRunCommand extends RunCommand with ELinuxExtension, ELinuxRequiredArtifacts {
ELinuxRunCommand({super.verboseHelp});

@override
Future<Set<DevelopmentArtifact>> get requiredArtifacts async =>
<DevelopmentArtifact>{
Future<Set<DevelopmentArtifact>> get requiredArtifacts async => <DevelopmentArtifact>{
// Use gen_snapshot of the arm64 linux-desktop when self-building
// on arm64 hosts. This is because elinux's artifacts for arm64
// doesn't support self-build as of now.
if (_getCurrentHostPlatformArchName() == 'arm64')
DevelopmentArtifact.linux,
if (_getCurrentHostPlatformArchName() == 'arm64') DevelopmentArtifact.linux,
ELinuxDevelopmentArtifact.elinux,
};

Expand Down
46 changes: 16 additions & 30 deletions lib/commands/upgrade.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ class ELinuxUpgradeCommand extends UpgradeCommand {

@override
Future<FlutterCommandResult> runCommand() {
final ELinuxUpgradeCommandRunner commandRunner =
ELinuxUpgradeCommandRunner();
commandRunner.workingDirectory = stringArg('working-directory') ??
globals.fs.directory(Cache.flutterRoot).parent.path;
final ELinuxUpgradeCommandRunner commandRunner = ELinuxUpgradeCommandRunner();
commandRunner.workingDirectory =
stringArg('working-directory') ?? globals.fs.directory(Cache.flutterRoot).parent.path;
return commandRunner.runCommand(
force: boolArg('force'),
continueFlow: boolArg('continue'),
Expand Down Expand Up @@ -110,10 +109,8 @@ class ELinuxUpgradeCommandRunner {
globals.printStatus(
'Your current version: ${currentVersion.gitTag} (revision ${currentVersion.hashShort})\n');
} else {
globals.printStatus('The latest revision: ${upstreamVersion.hashShort}',
emphasis: true);
globals
.printStatus('Your current revision: ${currentVersion.hashShort}\n');
globals.printStatus('The latest revision: ${upstreamVersion.hashShort}', emphasis: true);
globals.printStatus('Your current revision: ${currentVersion.hashShort}\n');
}
globals.printStatus('To upgrade now, run "flutter-elinux upgrade".');

Expand Down Expand Up @@ -150,8 +147,7 @@ class ELinuxUpgradeCommandRunner {
throwOnError: true,
workingDirectory: workingDirectory,
);
final List<String> tags =
const LineSplitter().convert(result.stdout.trim());
final List<String> tags = const LineSplitter().convert(result.stdout.trim());
if (tags.isEmpty) {
throwToolExit(
'Unable to upgrade flutter-elinux: Your flutter-elinux checkout does not have any tags.\n'
Expand All @@ -167,13 +163,11 @@ class ELinuxUpgradeCommandRunner {
);
latestRevision = result.stdout.trim();
} on Exception catch (_) {
throwToolExit(
'Unable to upgrade flutter-elinux: The current flutter-elinux branch is '
throwToolExit('Unable to upgrade flutter-elinux: The current flutter-elinux branch is '
'not tracking any remote repository.\n'
'Re-install re-install flutter-elinux.');
}
return ELinuxGitTagVersion(
latestRevision, latestRevision.substring(0, 10), latestTag);
return ELinuxGitTagVersion(latestRevision, latestRevision.substring(0, 10), latestTag);
}

Future<ELinuxGitTagVersion> fetchCurrentBranchLatestVersion() async {
Expand All @@ -187,22 +181,19 @@ class ELinuxUpgradeCommandRunner {

// Gets the hash of the latest version.
// e.g. commit 13d148c1980913b68f55032dc37ae6026b71a2a1 (HEAD -> main, origin/main, origin/HEAD)
final List<String> lines =
const LineSplitter().convert(result.stdout.trim());
final List<String> lines = const LineSplitter().convert(result.stdout.trim());
if (lines.isEmpty) {
throwToolExit(
'Unable to upgrade flutter-elinux: Your flutter-elinux checkout does not have any logs.\n'
'Re-install re-install flutter-elinux.');
}
latestRevision = lines[0].split(' ')[1];
} on Exception catch (_) {
throwToolExit(
'Unable to upgrade flutter-elinux: The current flutter-elinux branch is '
throwToolExit('Unable to upgrade flutter-elinux: The current flutter-elinux branch is '
'not tracking any remote repository.\n'
'Re-install re-install flutter-elinux.');
}
return ELinuxGitTagVersion(
latestRevision, latestRevision.substring(0, 10), null);
return ELinuxGitTagVersion(latestRevision, latestRevision.substring(0, 10), null);
}

Future<ELinuxGitTagVersion> fetchCurrentVersion() async {
Expand All @@ -226,24 +217,20 @@ class ELinuxUpgradeCommandRunner {
final String errorString = e.toString();
if (errorString.contains('fatal: no tag exactly matches')) {
tag = null;
} else if (errorString
.contains('fatal: HEAD does not point to a branch')) {
} else if (errorString.contains('fatal: HEAD does not point to a branch')) {
throwToolExit(
'Unable to upgrade flutter-elinux: Your flutter-elinux checkout is currently not '
'on a release branch.\n'
'Re-install re-install flutter-elinux.');
} else if (errorString
.contains('fatal: no upstream configured for branch')) {
throwToolExit(
'Unable to upgrade flutter-elinux: The current flutter-elinux branch is '
} else if (errorString.contains('fatal: no upstream configured for branch')) {
throwToolExit('Unable to upgrade flutter-elinux: The current flutter-elinux branch is '
'not tracking any remote repository.\n'
'Re-install re-install flutter-elinux.');
} else {
throwToolExit(errorString);
}
}
return ELinuxGitTagVersion(
latestRevision, latestRevision!.substring(0, 10), tag);
return ELinuxGitTagVersion(latestRevision, latestRevision!.substring(0, 10), tag);
}

/// Source: [attemptReset] in `upgrade.dart` (exact copy)
Expand Down Expand Up @@ -316,8 +303,7 @@ class ELinuxUpgradeCommandRunner {
globals.printStatus('');
await pub.get(
context: PubContext.pubUpgrade,
project:
FlutterProject.fromDirectory(globals.fs.directory(projectRoot)),
project: FlutterProject.fromDirectory(globals.fs.directory(projectRoot)),
upgrade: true,
);
}
Expand Down
7 changes: 2 additions & 5 deletions lib/elinux_artifacts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ class ELinuxArtifacts extends CachedArtifacts {

/// See: [CachedArtifacts._getEngineArtifactsPath]
Directory _getEngineArtifactsDirectory(String arch, BuildMode mode) {
return _cache
.getArtifactDirectory('engine')
.childDirectory('elinux-$arch-${mode.name}');
return _cache.getArtifactDirectory('engine').childDirectory('elinux-$arch-${mode.name}');
}

/// See: [CachedArtifacts._getAndroidArtifactPath] in `artifacts.dart`
Expand All @@ -43,8 +41,7 @@ class ELinuxArtifacts extends CachedArtifacts {
platform != null &&
getNameForTargetPlatform(platform).startsWith('linux')) {
assert(mode != null, 'Need to specify a build mode.');
assert(mode != BuildMode.debug,
'Artifact $artifact only available in non-debug mode.');
assert(mode != BuildMode.debug, 'Artifact $artifact only available in non-debug mode.');

final String arch = _getArchForTargetPlatform(platform);
return _getEngineArtifactsDirectory(arch, mode!)
Expand Down
Loading