From fe1595999ff3205ca5d6371f1d0d135e074b4910 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Tue, 19 May 2020 21:44:19 -0700 Subject: [PATCH] Load wayland proto definitions if available otherwise load stubs Fixes: 157095921 Test: yarn run dev & load wayland trace Change-Id: Id6a5faa592d4ec8c8919828983f32283db40fc53 --- tools/winscope/README.md | 3 +-- tools/winscope/webpack.config.js | 6 ++++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/winscope/README.md b/tools/winscope/README.md index dc4c2ea6f..8821601f0 100644 --- a/tools/winscope/README.md +++ b/tools/winscope/README.md @@ -19,5 +19,4 @@ contain the proto definitions for their internal states. ### Building with internal extensions Internal paths in vendor/ which are not available in AOSP must be replaced by -stub files. Actual path can be optionally picked up using env args. For -example, to pick up Wayland support, run `WAYLAND=yes yarn run dev` +stub files. See getWaylandSafePath for an example diff --git a/tools/winscope/webpack.config.js b/tools/winscope/webpack.config.js index 2dcb43809..ff31ff361 100644 --- a/tools/winscope/webpack.config.js +++ b/tools/winscope/webpack.config.js @@ -14,14 +14,16 @@ * limitations under the License. */ +const fs = require('fs'); var path = require('path') var webpack = require('webpack') var HtmlWebpackPlugin = require('html-webpack-plugin') var HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin') function getWaylandSafePath() { - if (process.env.WAYLAND) { - return path.resolve(__dirname, '../../../vendor/google_arc/libs/wayland_service'); + waylandPath = path.resolve(__dirname, '../../../vendor/google_arc/libs/wayland_service'); + if (fs.existsSync(waylandPath)) { + return waylandPath; } return path.resolve(__dirname, 'src/stubs'); }