Skip to content

Commit 3c276ec

Browse files
stuartmorganfranciscojma86
authored andcommitted
Restructure the example app (#242)
* Re-organize the example app Instead of making the platform implementations peers of the example Flutter application, make them subdirectories of it. This matches the structure of a standard Flutter application's mobile implementations, and provides a better example of how to use the project to add desktop support to an existing Flutter app. Since interest so far has been for that use case rather than adding Flutter to an existing application (and the current Linux and Windows implementations don't really support the hybrid use case anyway), this should be more reflective of how it would actually be used. * Move Linux build output under example/build/
1 parent f26ec2e commit 3c276ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+43
-40
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ install:
2020
- ps: build\ci\install_flutter.ps1 $env:APPVEYOR_BUILD_FOLDER\..
2121

2222
build_script:
23-
- msbuild "example\windows\Example Embedder.sln"
23+
- msbuild "example\windows_fde\Example Embedder.sln"

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ matrix:
2525
before_script:
2626
- export PATH=$PATH:$TRAVIS_BUILD_DIR/../flutter/bin:$TRAVIS_BUILD_DIR/bin
2727
script:
28-
- make -C example/linux
28+
- make -C example/linux_fde
2929

3030
- os: linux
3131
dist: xenial
@@ -39,11 +39,11 @@ matrix:
3939
before_script:
4040
- export PATH=$PATH:$TRAVIS_BUILD_DIR/bin
4141
script:
42-
- make -C example/linux USE_GN=1
42+
- make -C example/linux_fde USE_GN=1
4343

4444
- os: osx
4545
language: objective-c
46-
xcode_project: example/macos/ExampleEmbedder.xcodeproj
46+
xcode_project: example/macos_fde/ExampleEmbedder.xcodeproj
4747
xcode_scheme: ExampleEmbedder
4848
install:
4949
- build/ci/install_flutter $TRAVIS_BUILD_DIR/..

Debugging.md

Lines changed: 2 additions & 2 deletions
File renamed without changes.
File renamed without changes.

example/README.md

Lines changed: 20 additions & 11 deletions

example/analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include: ../analysis_options.yaml

example/flutter_app/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

example/flutter_app/analysis_options.yaml

Lines changed: 0 additions & 1 deletion
This file was deleted.
File renamed without changes.

example/linux/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

example/linux/Makefile renamed to example/linux_fde/Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
# Dependency locations
1616
PROJECT_ROOT=$(CURDIR)/../..
1717
FLUTTER_EMBEDDER_LIB_DIR=$(PROJECT_ROOT)/library/linux
18-
FLUTTER_APP_DIR=$(PROJECT_ROOT)/example/flutter_app
18+
FLUTTER_APP_DIR=$(CURDIR)/..
19+
FLUTTER_APP_BUILD_DIR=$(FLUTTER_APP_DIR)/build
1920
PLUGINS_DIR=$(PROJECT_ROOT)/plugins
2021
TOOLS_DIR=$(PROJECT_ROOT)/tools
2122
FLUTTER_DIR=$(shell $(TOOLS_DIR)/flutter_location)
@@ -47,10 +48,10 @@ FLUTTER_BIN=$(FLUTTER_DIR)/bin/flutter
4748
ICU_DATA_NAME=icudtl.dat
4849
ICU_DATA_SOURCE=$(FLUTTER_DIR)/bin/cache/artifacts/engine/linux-x64/$(ICU_DATA_NAME)
4950
FLUTTER_ASSETS_NAME=flutter_assets
50-
FLUTTER_ASSETS_SOURCE=$(FLUTTER_APP_DIR)/build/$(FLUTTER_ASSETS_NAME)
51+
FLUTTER_ASSETS_SOURCE=$(FLUTTER_APP_BUILD_DIR)/$(FLUTTER_ASSETS_NAME)
5152

5253
# Output bundle structure and targets
53-
OUT_DIR=$(CURDIR)/out
54+
OUT_DIR=$(FLUTTER_APP_BUILD_DIR)/linux_fde
5455
OUT_DATA_DIR=$(OUT_DIR)/data
5556
OUT_LIB_DIR=$(OUT_DIR)/lib
5657

@@ -61,8 +62,6 @@ ALL_LIBS_OUT=$(foreach lib,$(ALL_LIBS),$(OUT_LIB_DIR)/$(notdir $(lib)))
6162
# Overrides for the optional GN build.
6263
ifdef USE_GN
6364
GN_OUT_DIR=$(PROJECT_ROOT)/out
64-
# Use GN's out dir even though this isn't a GN build, to group build output.
65-
OUT_DIR=$(GN_OUT_DIR)/example
6665

6766
# The GN build places all libraries at the top level of the output directory.
6867
FLUTTER_EMBEDDER_LIB=$(GN_OUT_DIR)/lib$(FLUTTER_EMBEDDER_LIB_NAME).so
File renamed without changes.
File renamed without changes.

example/macos/ExampleEmbedder.xcodeproj/project.pbxproj renamed to example/macos_fde/ExampleEmbedder.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
33CC10FE2044A7620003C045 /* FlutterEmbedderMac.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = FlutterEmbedderMac.xcodeproj; path = ../../library/macos/FlutterEmbedderMac.xcodeproj; sourceTree = "<group>"; };
132132
33CC11122044BFA00003C045 /* ExampleWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleWindow.swift; sourceTree = "<group>"; };
133133
33CC11162044C3600003C045 /* Example Embedder-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Example Embedder-Bridging-Header.h"; sourceTree = "<group>"; };
134-
33CC112C20461AD40003C045 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = ../../example/flutter_app/build/flutter_assets; sourceTree = "<group>"; };
134+
33CC112C20461AD40003C045 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = ../build/flutter_assets; sourceTree = "<group>"; };
135135
/* End PBXFileReference section */
136136

137137
/* Begin PBXFrameworksBuildPhase section */
@@ -355,7 +355,7 @@
355355
);
356356
runOnlyForDeploymentPostprocessing = 0;
357357
shellPath = /bin/sh;
358-
shellScript = "DEPOT_ROOT=\"$PROJECT_DIR\"/../..\n\"$DEPOT_ROOT\"/tools/build_flutter_assets \"$DEPOT_ROOT\"/example/flutter_app";
358+
shellScript = "FDE_ROOT=\"$PROJECT_DIR\"/../..\n\"$FDE_ROOT\"/tools/build_flutter_assets \"$PROJECT_DIR\"/..";
359359
};
360360
/* End PBXShellScriptBuildPhase section */
361361

File renamed without changes.

example/flutter_app/pubspec.yaml renamed to example/pubspec.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: example_flutter
2-
description: A new Flutter project.
2+
description: An example project for flutter-desktop-embedding.
33

44
dependencies:
55
flutter:
@@ -8,12 +8,15 @@ dependencies:
88
cupertino_icons: ^0.1.0
99

1010
# Desktop embedder plugins.
11+
# Note: In an actual project, these paths would include the
12+
# path from your application to the flutter_desktop_embedding
13+
# checkout.
1114
color_panel:
12-
path: ../../plugins/color_panel
15+
path: ../plugins/color_panel
1316
file_chooser:
14-
path: ../../plugins/file_chooser
17+
path: ../plugins/file_chooser
1518
menubar:
16-
path: ../../plugins/menubar
19+
path: ../plugins/menubar
1720

1821
dev_dependencies:
1922
flutter_test:
File renamed without changes.

example/windows/flutter_embedder_example.cpp renamed to example/windows_fde/flutter_embedder_example.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ int main(int argc, char **argv) {
2929
// Start the engine.
3030
// TODO: Make paths relative to the executable so it can be run from anywhere.
3131
auto window = flutter_desktop_embedding::CreateFlutterWindow(
32-
640, 480, "..\\..\\example\\flutter_app\\build\\flutter_assets",
32+
640, 480, "..\\build\\flutter_assets",
3333
"..\\..\\library\\windows\\dependencies\\engine\\icudtl.dat", arguments);
3434
if (window == nullptr) {
3535
flutter_desktop_embedding::FlutterTerminate();

example/windows/scripts/build_example_app.bat renamed to example/windows_fde/scripts/build_example_app.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
:: See the License for the specific language governing permissions and
1313
:: limitations under the License.
1414
@echo off
15-
%~dp0..\..\..\tools\build_flutter_assets %~dp0..\..\..\example\flutter_app
15+
%~dp0..\..\..\tools\build_flutter_assets %~dp0..\..

library/GN.md

Lines changed: 0 additions & 2 deletions

plugins/README.md

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)