Skip to content

Commit 9a89e78

Browse files
stuartmorgan-gEgor
authored and
Egor
committed
Add linux directory to examples (flutter#3064)
When Linux support was added to these plugins, the app template wasn't yet stabilized, so was not checked in. Now that it is stable, this adds them so that the plugin_tools workaround that created them on each run can be removed. Other than CHANGELOG.md updates and updating the verison in pubspec.yaml, this is purely the result of running 'flutter create .' in the example/ folders and adding the resulting linux/ directories.
1 parent 145df4a commit 9a89e78

Some content is hidden

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

41 files changed

+944
-6
lines changed

packages/path_provider/path_provider/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.6.20
2+
3+
* Check in linux/ directory for example/
4+
15
## 1.6.19
26

37
* Android implementation does path queries in the background thread rather than UI thread.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flutter/ephemeral
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
project(runner LANGUAGES CXX)
3+
4+
set(BINARY_NAME "example")
5+
set(APPLICATION_ID "io.flutter.plugins.example")
6+
7+
cmake_policy(SET CMP0063 NEW)
8+
9+
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
10+
11+
# Configure build options.
12+
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
13+
set(CMAKE_BUILD_TYPE "Debug" CACHE
14+
STRING "Flutter build mode" FORCE)
15+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
16+
"Debug" "Profile" "Release")
17+
endif()
18+
19+
# Compilation settings that should be applied to most targets.
20+
function(APPLY_STANDARD_SETTINGS TARGET)
21+
target_compile_features(${TARGET} PUBLIC cxx_std_14)
22+
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
23+
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
24+
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
25+
endfunction()
26+
27+
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
28+
29+
# Flutter library and tool build rules.
30+
add_subdirectory(${FLUTTER_MANAGED_DIR})
31+
32+
# System-level dependencies.
33+
find_package(PkgConfig REQUIRED)
34+
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
35+
36+
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
37+
38+
# Application build
39+
add_executable(${BINARY_NAME}
40+
"main.cc"
41+
"my_application.cc"
42+
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
43+
)
44+
apply_standard_settings(${BINARY_NAME})
45+
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
46+
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
47+
add_dependencies(${BINARY_NAME} flutter_assemble)
48+
# Only the install-generated bundle's copy of the executable will launch
49+
# correctly, since the resources must in the right relative locations. To avoid
50+
# people trying to run the unbundled copy, put it in a subdirectory instead of
51+
# the default top-level location.
52+
set_target_properties(${BINARY_NAME}
53+
PROPERTIES
54+
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
55+
)
56+
57+
# Generated plugin build rules, which manage building the plugins and adding
58+
# them to the application.
59+
include(flutter/generated_plugins.cmake)
60+
61+
62+
# === Installation ===
63+
# By default, "installing" just makes a relocatable bundle in the build
64+
# directory.
65+
set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
66+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
67+
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
68+
endif()
69+
70+
# Start with a clean build bundle directory every time.
71+
install(CODE "
72+
file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
73+
" COMPONENT Runtime)
74+
75+
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
76+
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
77+
78+
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
79+
COMPONENT Runtime)
80+
81+
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
82+
COMPONENT Runtime)
83+
84+
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
85+
COMPONENT Runtime)
86+
87+
if(PLUGIN_BUNDLED_LIBRARIES)
88+
install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
89+
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
90+
COMPONENT Runtime)
91+
endif()
92+
93+
# Fully re-copy the assets directory on each build to avoid having stale files
94+
# from a previous install.
95+
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
96+
install(CODE "
97+
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
98+
" COMPONENT Runtime)
99+
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
100+
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
101+
102+
# Install the AOT library on non-Debug builds only.
103+
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
104+
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
105+
COMPONENT Runtime)
106+
endif()
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
cmake_minimum_required(VERSION 3.10)
2+
3+
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
4+
5+
# Configuration provided via flutter tool.
6+
include(${EPHEMERAL_DIR}/generated_config.cmake)
7+
8+
# TODO: Move the rest of this into files in ephemeral. See
9+
# https://github.com/flutter/flutter/issues/57146.
10+
11+
# Serves the same purpose as list(TRANSFORM ... PREPEND ...),
12+
# which isn't available in 3.10.
13+
function(list_prepend LIST_NAME PREFIX)
14+
set(NEW_LIST "")
15+
foreach(element ${${LIST_NAME}})
16+
list(APPEND NEW_LIST "${PREFIX}${element}")
17+
endforeach(element)
18+
set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
19+
endfunction()
20+
21+
# === Flutter Library ===
22+
# System-level dependencies.
23+
find_package(PkgConfig REQUIRED)
24+
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
25+
pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
26+
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
27+
pkg_check_modules(BLKID REQUIRED IMPORTED_TARGET blkid)
28+
29+
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
30+
31+
# Published to parent scope for install step.
32+
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
33+
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
34+
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
35+
set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
36+
37+
list(APPEND FLUTTER_LIBRARY_HEADERS
38+
"fl_basic_message_channel.h"
39+
"fl_binary_codec.h"
40+
"fl_binary_messenger.h"
41+
"fl_dart_project.h"
42+
"fl_engine.h"
43+
"fl_json_message_codec.h"
44+
"fl_json_method_codec.h"
45+
"fl_message_codec.h"
46+
"fl_method_call.h"
47+
"fl_method_channel.h"
48+
"fl_method_codec.h"
49+
"fl_method_response.h"
50+
"fl_plugin_registrar.h"
51+
"fl_plugin_registry.h"
52+
"fl_standard_message_codec.h"
53+
"fl_standard_method_codec.h"
54+
"fl_string_codec.h"
55+
"fl_value.h"
56+
"fl_view.h"
57+
"flutter_linux.h"
58+
)
59+
list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
60+
add_library(flutter INTERFACE)
61+
target_include_directories(flutter INTERFACE
62+
"${EPHEMERAL_DIR}"
63+
)
64+
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
65+
target_link_libraries(flutter INTERFACE
66+
PkgConfig::GTK
67+
PkgConfig::GLIB
68+
PkgConfig::GIO
69+
PkgConfig::BLKID
70+
)
71+
add_dependencies(flutter flutter_assemble)
72+
73+
# === Flutter tool backend ===
74+
# _phony_ is a non-existent file to force this command to run every time,
75+
# since currently there's no way to get a full input/output list from the
76+
# flutter tool.
77+
add_custom_command(
78+
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
79+
${CMAKE_CURRENT_BINARY_DIR}/_phony_
80+
COMMAND ${CMAKE_COMMAND} -E env
81+
${FLUTTER_TOOL_ENVIRONMENT}
82+
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
83+
linux-x64 ${CMAKE_BUILD_TYPE}
84+
)
85+
add_custom_target(flutter_assemble DEPENDS
86+
"${FLUTTER_LIBRARY}"
87+
${FLUTTER_LIBRARY_HEADERS}
88+
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
#include "generated_plugin_registrant.h"
6+
7+
void fl_register_plugins(FlPluginRegistry* registry) {}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
#ifndef GENERATED_PLUGIN_REGISTRANT_
6+
#define GENERATED_PLUGIN_REGISTRANT_
7+
8+
#include <flutter_linux/flutter_linux.h>
9+
10+
// Registers Flutter plugins.
11+
void fl_register_plugins(FlPluginRegistry* registry);
12+
13+
#endif // GENERATED_PLUGIN_REGISTRANT_
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#
2+
# Generated file, do not edit.
3+
#
4+
5+
list(APPEND FLUTTER_PLUGIN_LIST
6+
)
7+
8+
set(PLUGIN_BUNDLED_LIBRARIES)
9+
10+
foreach(plugin ${FLUTTER_PLUGIN_LIST})
11+
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
12+
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
13+
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
14+
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
15+
endforeach(plugin)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include "my_application.h"
2+
3+
int main(int argc, char** argv) {
4+
// Only X11 is currently supported.
5+
// Wayland support is being developed:
6+
// https://github.com/flutter/flutter/issues/57932.
7+
gdk_set_allowed_backends("x11");
8+
9+
g_autoptr(MyApplication) app = my_application_new();
10+
return g_application_run(G_APPLICATION(app), argc, argv);
11+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#include "my_application.h"
2+
3+
#include <flutter_linux/flutter_linux.h>
4+
5+
#include "flutter/generated_plugin_registrant.h"
6+
7+
struct _MyApplication {
8+
GtkApplication parent_instance;
9+
};
10+
11+
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
12+
13+
// Implements GApplication::activate.
14+
static void my_application_activate(GApplication* application) {
15+
GtkWindow* window =
16+
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
17+
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
18+
gtk_widget_show(GTK_WIDGET(header_bar));
19+
gtk_header_bar_set_title(header_bar, "example");
20+
gtk_header_bar_set_show_close_button(header_bar, TRUE);
21+
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
22+
gtk_window_set_default_size(window, 1280, 720);
23+
gtk_widget_show(GTK_WIDGET(window));
24+
25+
g_autoptr(FlDartProject) project = fl_dart_project_new();
26+
27+
FlView* view = fl_view_new(project);
28+
gtk_widget_show(GTK_WIDGET(view));
29+
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
30+
31+
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
32+
33+
gtk_widget_grab_focus(GTK_WIDGET(view));
34+
}
35+
36+
static void my_application_class_init(MyApplicationClass* klass) {
37+
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
38+
}
39+
40+
static void my_application_init(MyApplication* self) {}
41+
42+
MyApplication* my_application_new() {
43+
return MY_APPLICATION(g_object_new(
44+
my_application_get_type(), "application-id", APPLICATION_ID, nullptr));
45+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ifndef FLUTTER_MY_APPLICATION_H_
2+
#define FLUTTER_MY_APPLICATION_H_
3+
4+
#include <gtk/gtk.h>
5+
6+
G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
7+
GtkApplication)
8+
9+
/**
10+
* my_application_new:
11+
*
12+
* Creates a new Flutter-based application.
13+
*
14+
* Returns: a new #MyApplication.
15+
*/
16+
MyApplication* my_application_new();
17+
18+
#endif // FLUTTER_MY_APPLICATION_H_

packages/path_provider/path_provider/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: path_provider
22
description: Flutter plugin for getting commonly used locations on host platform file systems, such as the temp and app data directories.
33
homepage: https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider
4-
version: 1.6.19
4+
version: 1.6.20
55

66
flutter:
77
plugin:

packages/path_provider/path_provider_linux/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.1.1+1
2+
3+
* Check in linux/ directory for example/
4+
15
## 0.1.1 - NOT PUBLISHED
26
* Reverts changes on 0.1.0, which broke the tree.
37

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flutter/ephemeral

0 commit comments

Comments
 (0)