Skip to content

Commit

Permalink
Add a format checker to the CI pipeline (#90)
Browse files Browse the repository at this point in the history
* Format gn files

* Format C/C++ files

* Update azure-pipelines.yml

* Rename the format job
  • Loading branch information
swift-kim authored May 18, 2021
1 parent 18e31c8 commit 9f408ef
Show file tree
Hide file tree
Showing 31 changed files with 217 additions and 117 deletions.
10 changes: 10 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ pr:
- flutter-*-tizen

jobs:
- job: format
pool:
name: Default
demands: agent.os -equals Linux
steps:
- checkout: self
path: src/flutter
- bash: ci/format.sh
displayName: Verify formatting
- job: build
dependsOn: format
strategy:
matrix:
tizen-arm-release:
Expand Down
1 change: 0 additions & 1 deletion shell/platform/common/cpp/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ source_set("common_cpp") {
deps = [
":common_cpp_library_headers",
"//flutter/shell/platform/common/cpp/client_wrapper:client_wrapper",
# "//flutter/shell/platform/embedder:embedder_as_internal_library",
]

public_deps = [
Expand Down
3 changes: 2 additions & 1 deletion shell/platform/embedder/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ shared_library("flutter_engine_library") {
output_name = "flutter_engine"

# For Tizen 5.5 or older. See the script file for details.
ldflags = [ "-Wl,--version-script=" + rebase_path("flutter_engine_exports.lst") ]
ldflags =
[ "-Wl,--version-script=" + rebase_path("flutter_engine_exports.lst") ]

if (is_mac && !embedder_for_target) {
ldflags = [ "-Wl,-install_name,@rpath/FlutterEmbedder.framework/$_framework_binary_subpath" ]
Expand Down
10 changes: 5 additions & 5 deletions shell/platform/tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ template("embedder_for_profile") {
"channels/settings_channel.cc",
"channels/text_input_channel.cc",
"external_texture_gl.cc",
"flutter_tizen_engine.cc",
"flutter_tizen.cc",
"flutter_tizen_engine.cc",
"key_event_handler.cc",
"tizen_event_loop.cc",
"tizen_log.cc",
Expand Down Expand Up @@ -152,7 +152,7 @@ template("embedder_for_profile") {

configs += [
":tizen_rootstrap_include_dirs",
"//flutter/shell/platform/common/cpp:desktop_library_implementation"
"//flutter/shell/platform/common/cpp:desktop_library_implementation",
]

public_configs = [ "//flutter:config" ]
Expand Down Expand Up @@ -214,12 +214,12 @@ copy("copy_icu") {

group("tizen") {
deps = [
":copy_icu",
":flutter_tizen_common",
":flutter_tizen_mobile",
":flutter_tizen_wearable",
":flutter_tizen_tv",
":flutter_tizen_common",
":flutter_tizen_wearable",
":publish_cpp_client_wrapper",
":publish_headers_tizen",
":copy_icu",
]
}
3 changes: 2 additions & 1 deletion shell/platform/tizen/channels/key_event_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ static const std::map<int, int> kModifierMap = {
KeyEventChannel::KeyEventChannel(flutter::BinaryMessenger* messenger)
: channel_(
std::make_unique<flutter::BasicMessageChannel<rapidjson::Document>>(
messenger, kChannelName,
messenger,
kChannelName,
&flutter::JsonMessageCodec::GetInstance())) {}

KeyEventChannel::~KeyEventChannel() {}
Expand Down
4 changes: 3 additions & 1 deletion shell/platform/tizen/channels/navigation_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ static constexpr char kPopRouteMethod[] = "popRoute";

NavigationChannel::NavigationChannel(flutter::BinaryMessenger* messenger)
: channel_(std::make_unique<flutter::MethodChannel<rapidjson::Document>>(
messenger, kChannelName, &flutter::JsonMethodCodec::GetInstance())) {}
messenger,
kChannelName,
&flutter::JsonMethodCodec::GetInstance())) {}

NavigationChannel::~NavigationChannel() {}

Expand Down
7 changes: 4 additions & 3 deletions shell/platform/tizen/channels/platform_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ static constexpr char kChannelName[] = "flutter/platform";
PlatformChannel::PlatformChannel(flutter::BinaryMessenger* messenger,
TizenRenderer* renderer)
: channel_(std::make_unique<flutter::MethodChannel<rapidjson::Document>>(
messenger, kChannelName, &flutter::JsonMethodCodec::GetInstance())),
messenger,
kChannelName,
&flutter::JsonMethodCodec::GetInstance())),
renderer_(renderer) {
channel_->SetMethodCallHandler(
[this](
Expand Down Expand Up @@ -327,8 +329,7 @@ void GetData(
document.SetObject();
rapidjson::Document::AllocatorType& allocator = document.GetAllocator();
document.AddMember(rapidjson::Value(kTextKey, allocator),
rapidjson::Value(string_clipboard, allocator),
allocator);
rapidjson::Value(string_clipboard, allocator), allocator);
result->Success(document);
}

Expand Down
2 changes: 1 addition & 1 deletion shell/platform/tizen/channels/platform_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ void GetData(
void SetData(
const flutter::MethodCall<rapidjson::Document>& call,
std::unique_ptr<flutter::MethodResult<rapidjson::Document>> result);
};
}; // namespace Clipboard

#endif // EMBEDDER_PLATFORM_CHANNEL_H_
19 changes: 13 additions & 6 deletions shell/platform/tizen/channels/platform_view_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ int ExtractIntFromMap(const flutter::EncodableValue& arguments,
if (std::holds_alternative<flutter::EncodableMap>(arguments)) {
flutter::EncodableMap values = std::get<flutter::EncodableMap>(arguments);
flutter::EncodableValue value = values[flutter::EncodableValue(key)];
if (std::holds_alternative<int>(value)) return std::get<int>(value);
if (std::holds_alternative<int>(value))
return std::get<int>(value);
}
return -1;
}
Expand All @@ -40,13 +41,15 @@ double ExtractDoubleFromMap(const flutter::EncodableValue& arguments,
if (std::holds_alternative<flutter::EncodableMap>(arguments)) {
flutter::EncodableMap values = std::get<flutter::EncodableMap>(arguments);
flutter::EncodableValue value = values[flutter::EncodableValue(key)];
if (std::holds_alternative<double>(value)) return std::get<double>(value);
if (std::holds_alternative<double>(value))
return std::get<double>(value);
}
return -1;
}

flutter::EncodableMap ExtractMapFromMap(
const flutter::EncodableValue& arguments, const char* key) {
const flutter::EncodableValue& arguments,
const char* key) {
if (std::holds_alternative<flutter::EncodableMap>(arguments)) {
flutter::EncodableMap values = std::get<flutter::EncodableMap>(arguments);
flutter::EncodableValue value = values[flutter::EncodableValue(key)];
Expand All @@ -57,7 +60,8 @@ flutter::EncodableMap ExtractMapFromMap(
}

flutter::EncodableList ExtractListFromMap(
const flutter::EncodableValue& arguments, const char* key) {
const flutter::EncodableValue& arguments,
const char* key) {
if (std::holds_alternative<flutter::EncodableMap>(arguments)) {
flutter::EncodableMap values = std::get<flutter::EncodableMap>(arguments);
flutter::EncodableValue value = values[flutter::EncodableValue(key)];
Expand All @@ -72,15 +76,18 @@ PlatformViewChannel::PlatformViewChannel(flutter::BinaryMessenger* messenger,
: engine_(engine),
channel_(
std::make_unique<flutter::MethodChannel<flutter::EncodableValue>>(
messenger, kChannelName,
messenger,
kChannelName,
&flutter::StandardMethodCodec::GetInstance())) {
channel_->SetMethodCallHandler(
[this](const flutter::MethodCall<flutter::EncodableValue>& call,
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>>
result) { HandleMethodCall(call, std::move(result)); });
}

PlatformViewChannel::~PlatformViewChannel() { Dispose(); }
PlatformViewChannel::~PlatformViewChannel() {
Dispose();
}

void PlatformViewChannel::Dispose() {
// Clean-up view_instances_
Expand Down
3 changes: 2 additions & 1 deletion shell/platform/tizen/channels/settings_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ static constexpr char kPlatformBrightnessKey[] = "platformBrightness";
SettingsChannel::SettingsChannel(flutter::BinaryMessenger* messenger)
: channel_(
std::make_unique<flutter::BasicMessageChannel<rapidjson::Document>>(
messenger, kChannelName,
messenger,
kChannelName,
&flutter::JsonMessageCodec::GetInstance())) {
system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR,
OnSettingsChangedCallback, this);
Expand Down
23 changes: 16 additions & 7 deletions shell/platform/tizen/channels/text_input_channel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ static const char* GetImfMethod() {
Eina_List* modules;

modules = ecore_imf_context_available_ids_get();
if (!modules) return nullptr;
if (!modules)
return nullptr;

void* module;
EINA_LIST_FREE(modules, module) { return (const char*)module; }
Expand All @@ -56,7 +57,8 @@ static bool IsASCIIPrintableKey(char c) {
return false;
}

void TextInputChannel::CommitCallback(void* data, Ecore_IMF_Context* ctx,
void TextInputChannel::CommitCallback(void* data,
Ecore_IMF_Context* ctx,
void* event_info) {
TextInputChannel* self = (TextInputChannel*)data;
if (!self) {
Expand All @@ -72,7 +74,8 @@ void TextInputChannel::CommitCallback(void* data, Ecore_IMF_Context* ctx,
self->OnCommit(str);
}

void TextInputChannel::PreeditCallback(void* data, Ecore_IMF_Context* ctx,
void TextInputChannel::PreeditCallback(void* data,
Ecore_IMF_Context* ctx,
void* event_info) {
TextInputChannel* self = (TextInputChannel*)data;
if (!self) {
Expand Down Expand Up @@ -108,7 +111,9 @@ void TextInputChannel::DeleteSurroundingCallback(void* data,
}

void TextInputChannel::InputPanelStateChangedCallback(
void* data, Ecore_IMF_Context* context, int value) {
void* data,
Ecore_IMF_Context* context,
int value) {
FT_LOGD("Change input panel state[%d]", value);
if (!data) {
FT_LOGW("No Data");
Expand All @@ -130,7 +135,9 @@ void TextInputChannel::InputPanelStateChangedCallback(
}

void TextInputChannel::InputPanelGeometryChangedCallback(
void* data, Ecore_IMF_Context* context, int value) {
void* data,
Ecore_IMF_Context* context,
int value) {
if (!data) {
FT_LOGW("No Data");
return;
Expand Down Expand Up @@ -205,7 +212,9 @@ Ecore_IMF_Keyboard_Locks EcoreInputModifierToEcoreIMFLock(
TextInputChannel::TextInputChannel(flutter::BinaryMessenger* messenger,
FlutterTizenEngine* engine)
: channel_(std::make_unique<flutter::MethodChannel<rapidjson::Document>>(
messenger, kChannelName, &flutter::JsonMethodCodec::GetInstance())),
messenger,
kChannelName,
&flutter::JsonMethodCodec::GetInstance())),
engine_(engine) {
channel_->SetMethodCallHandler(
[this](
Expand Down Expand Up @@ -367,7 +376,7 @@ bool TextInputChannel::FilterEvent(Ecore_Event_Key* keyDownEvent) {
bool isIME = true;
#else
bool isIME = ecore_imf_context_keyboard_mode_get(imf_context_) ==
ECORE_IMF_INPUT_PANEL_SW_KEYBOARD_MODE;
ECORE_IMF_INPUT_PANEL_SW_KEYBOARD_MODE;
#endif

Ecore_IMF_Event_Key_Down ecoreKeyDownEvent;
Expand Down
15 changes: 10 additions & 5 deletions shell/platform/tizen/channels/text_input_channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,17 @@ class TextInputChannel {
std::unique_ptr<flutter::MethodChannel<rapidjson::Document>> channel_;
std::unique_ptr<flutter::TextInputModel> active_model_;

static void CommitCallback(void* data, Ecore_IMF_Context* ctx,
static void CommitCallback(void* data,
Ecore_IMF_Context* ctx,
void* event_info);
static void PreeditCallback(void* data, Ecore_IMF_Context* ctx,
static void PreeditCallback(void* data,
Ecore_IMF_Context* ctx,
void* event_info);
static void PrivateCommandCallback(void* data, Ecore_IMF_Context* ctx,
static void PrivateCommandCallback(void* data,
Ecore_IMF_Context* ctx,
void* event_info);
static void DeleteSurroundingCallback(void* data, Ecore_IMF_Context* ctx,
static void DeleteSurroundingCallback(void* data,
Ecore_IMF_Context* ctx,
void* event_info);
static void InputPanelStateChangedCallback(void* data,
Ecore_IMF_Context* context,
Expand All @@ -80,7 +84,8 @@ class TextInputChannel {
int value);
static Eina_Bool RetrieveSurroundingCallback(void* data,
Ecore_IMF_Context* ctx,
char** text, int* cursor_pos);
char** text,
int* cursor_pos);

int client_id_{0};
SoftwareKeyboardGeometry current_keyboard_geometry_;
Expand Down
4 changes: 3 additions & 1 deletion shell/platform/tizen/external_texture_gl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ bool ExternalTextureGL::OnFrameAvailable(tbm_surface_h tbm_surface) {
}

bool ExternalTextureGL::PopulateTextureWithIdentifier(
size_t width, size_t height, FlutterOpenGLTexture* opengl_texture) {
size_t width,
size_t height,
FlutterOpenGLTexture* opengl_texture) {
if (!available_tbm_surface_) {
FT_LOGD("[texture id:%ld] available_tbm_surface_ is null", texture_id_);
return false;
Expand Down
3 changes: 2 additions & 1 deletion shell/platform/tizen/external_texture_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class ExternalTextureGL {
* texture object.
* Returns true on success, false on failure.
*/
bool PopulateTextureWithIdentifier(size_t width, size_t height,
bool PopulateTextureWithIdentifier(size_t width,
size_t height,
FlutterOpenGLTexture* opengl_texture);
bool OnFrameAvailable(tbm_surface_h tbm_surface);

Expand Down
Loading

0 comments on commit 9f408ef

Please sign in to comment.