Skip to content

Commit

Permalink
Fix recent changes for Linux and add pipeline for testing Linux builds (
Browse files Browse the repository at this point in the history
#157)

* Add workflow for testing Linux

* Fix Linux build errors

/webview_cef/example/linux/flutter/ephemeral/.plugin_symlinks/webview_cef/common/webview_js_handler.cc:180:21: error: enumeration value 'UNKNOWN' not handled in switch [-Werror,-Wswitch]
/webview_cef/example/linux/flutter/ephemeral/.plugin_symlinks/webview_cef/common/webview_plugin.cc:434:24: error: 4 enumeration values not handled in switch: 'VTYPE_INVALID', 'VTYPE_NULL', 'VTYPE_BINARY'... [-Werror,-Wswitch]
/webview_cef/example/linux/flutter/ephemeral/.plugin_symlinks/webview_cef/common/webview_plugin.cc:430:41: error: variable 'retValue' is uninitialized when used here [-Werror,-Wuninitialized]
  • Loading branch information
cadivus authored Oct 25, 2024
1 parent 28f0de5 commit 89cb151
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/test_linux_x86.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Test if the example app still builds on Linux x86
on:
push:
branches: ["main"]
paths:
- "common/**"
- "example/**"
- "lib/**"
- "linux/**"
- "third/**"
- "pubspec.yaml"
- ".github/workflows/test_linux_x86.yaml"
pull_request:
paths:
- "common/**"
- "example/**"
- "lib/**"
- "linux/**"
- "third/**"
- "pubspec.yaml"
- ".github/workflows/test_linux_x86.yaml"

jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
- run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev clang cmake pkg-config build-essential
- run: flutter --version
- run: lsb_release -a
- run: clang --version
- run: cmake --version
- run: g++ --version
- run: (cd example && flutter build linux)
4 changes: 4 additions & 0 deletions common/webview_js_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ bool CefJSBridge::EvaluateCallback(const CefString& callbackId, const JSValue& r
args->SetList(1, arrayList);
break;
}
default:
// For avoiding values like
// error: enumeration value 'UNKNOWN' not handled in switch [-Werror,-Wswitch]
break;
}

// 메시지 전송
Expand Down
8 changes: 6 additions & 2 deletions common/webview_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ namespace webview_cef {

if (values == nullptr) {
result(1, nullptr);
webview_value_unref(retValue);
return;
}

Expand All @@ -444,7 +443,7 @@ namespace webview_cef {
case VTYPE_STRING:
retValue = webview_value_new_string(values->GetString().ToString().c_str());
break;
case VTYPE_LIST:
case VTYPE_LIST: {
retValue = webview_value_new_list();
CefRefPtr<CefListValue> list = values->GetList();

Expand All @@ -467,6 +466,11 @@ namespace webview_cef {
}
}
break;
}
default:
// Return null as fallback
result(1, nullptr);
return;
}

result(1, retValue);
Expand Down

0 comments on commit 89cb151

Please sign in to comment.