mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

Adds initial support for `flutter create` of apps and plugins. This is derived from the current FDE example app and sample plugin, with a few changes: - Added template values where it makes sense. - Moved some likely-to-change values into separate files for now, to simplify the delete/recreate cycle that will be necessary until it's stable. - Added some minor Makefile flag handling improvements Since the APIs/tooling/template aren't stable yet, the app template includes a version marker, which will be updated each time there's a breaking change. The build now checks that the template version matches the version known by that version of the tool, and gives a specific error message when there's a mismatch, which improves over the current breaking change experience of hitting whatever build failure the breaking change causes and having to figure out that the problem is that the runner is out of date. It also adds a warning to the `create` output about the fact that it won't be stable.
33 lines
1.0 KiB
Dart
33 lines
1.0 KiB
Dart
// Copyright 2014 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import '../base/file_system.dart';
|
|
import '../project.dart';
|
|
|
|
// The setting that controls the executable name in the linux makefile.
|
|
const String _kBinaryNameVariable = 'BINARY_NAME=';
|
|
|
|
/// Extracts the `BINARY_NAME` from a linux project Makefile.
|
|
///
|
|
/// Returns `null` if it cannot be found.
|
|
String makefileExecutableName(LinuxProject project) {
|
|
// Support the binary name being set either in the Makefile, or in the
|
|
// separate configution include file used by the template.
|
|
final List<File> makeFiles = <File>[
|
|
project.makeFile.parent.childFile('app_configuration.mk'),
|
|
project.makeFile,
|
|
];
|
|
for (final File file in makeFiles) {
|
|
if (!file.existsSync()) {
|
|
continue;
|
|
}
|
|
for (final String line in file.readAsLinesSync()) {
|
|
if (line.startsWith(_kBinaryNameVariable)) {
|
|
return line.split(_kBinaryNameVariable).last.trim();
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|