Skip to content

[ Tool ] Allow creation of projects inside the engine's examples directory#182268

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
jason-simmons:tool_create_engine_examples
Feb 12, 2026
Merged

[ Tool ] Allow creation of projects inside the engine's examples directory#182268
auto-submit[bot] merged 3 commits into
flutter:masterfrom
jason-simmons:tool_create_engine_examples

Conversation

@jason-simmons

Copy link
Copy Markdown
Member

engine/src/flutter/examples contains sample code for the engine embedder library. The examples include scripts that create and build Flutter projects that are run through the embedder.

…ctory

engine/src/flutter/examples contains sample code for the engine embedder library.  The examples include scripts that create and build Flutter projects that are run through the embedder.
@jason-simmons jason-simmons requested a review from bkonyi February 12, 2026 01:05
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Feb 12, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request extends the flutter create command to allow project creation within the engine/src/flutter/examples directory. This is a useful change for engine example development. The implementation is correct and includes a corresponding test case. I've suggested a small refactoring to improve the maintainability of the directory validation logic.

Comment on lines 211 to +216
final String examplesDirectory = globals.fs.path.join(flutterRoot, 'examples');
final String devDirectory = globals.fs.path.join(flutterRoot, 'dev');
final String engineExamplesDirectory = globals.fs.path.join(flutterRoot, 'engine', 'src', 'flutter', 'examples');
if (!globals.fs.path.isWithin(examplesDirectory, projectDirPath) &&
!globals.fs.path.isWithin(devDirectory, projectDirPath)) {
!globals.fs.path.isWithin(devDirectory, projectDirPath) &&
!globals.fs.path.isWithin(engineExamplesDirectory, projectDirPath)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This refactoring makes the logic for checking allowed directories more scalable and easier to read. By using a list of allowed directories, it's clearer what directories are permitted and simplifies adding new ones in the future.

Suggested change
final String examplesDirectory = globals.fs.path.join(flutterRoot, 'examples');
final String devDirectory = globals.fs.path.join(flutterRoot, 'dev');
final String engineExamplesDirectory = globals.fs.path.join(flutterRoot, 'engine', 'src', 'flutter', 'examples');
if (!globals.fs.path.isWithin(examplesDirectory, projectDirPath) &&
!globals.fs.path.isWithin(devDirectory, projectDirPath)) {
!globals.fs.path.isWithin(devDirectory, projectDirPath) &&
!globals.fs.path.isWithin(engineExamplesDirectory, projectDirPath)) {
final List<String> allowedDirectories = <String>[
globals.fs.path.join(flutterRoot, 'examples'),
globals.fs.path.join(flutterRoot, 'dev'),
globals.fs.path.join(flutterRoot, 'engine', 'src', 'flutter', 'examples'),
];
if (!allowedDirectories.any((String directory) => globals.fs.path.isWithin(directory, projectDirPath))) {

@bkonyi bkonyi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall.

@jason-simmons jason-simmons added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 12, 2026
@auto-submit auto-submit Bot added this pull request to the merge queue Feb 12, 2026
Merged via the queue into flutter:master with commit e1a890d Feb 12, 2026
142 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Feb 12, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 13, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 13, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 13, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 14, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 14, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 14, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 14, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 15, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 15, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 15, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 16, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 17, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 17, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 17, 2026
rickhohler pushed a commit to rickhohler/flutter that referenced this pull request Feb 19, 2026
…ctory (flutter#182268)

engine/src/flutter/examples contains sample code for the engine embedder
library. The examples include scripts that create and build Flutter
projects that are run through the embedder.
mboetger pushed a commit to mboetger/flutter that referenced this pull request Mar 26, 2026
…ctory (flutter#182268)

engine/src/flutter/examples contains sample code for the engine embedder
library. The examples include scripts that create and build Flutter
projects that are run through the embedder.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants