Files
android_development/tools/winscope/webpack.config.js
Vishnu Nair cbddf0ad6c Move wayland support from default build
Wayland trace files are not available in AOSP so building Winscope will
break. Instead, pick up stub files by default and provide an option via
env args to pick up Wayland support.

Also removes obsolete protolog stubs which are no longer needed.

Test: Remove wayland trace from path and check if winscope still builds
Test: Build winscope with WAYLAND=true and confirm it pick up waylandproto file

Fixes: 151239942
Change-Id: Ie5b237725cd656c478a2ea99d469963956399714
2020-03-16 23:35:12 +00:00

125 lines
3.0 KiB
JavaScript

/*
* Copyright 2017, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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');
}
return path.resolve(__dirname, 'src/stubs');
}
module.exports = {
entry: './src/main.js',
output: {
path: path.resolve(__dirname, './dist'),
filename: 'build.js'
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
}
// other vue-loader options go here
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.proto$/,
loader: 'proto-loader',
options: {
paths: [
path.resolve(__dirname, '../../..'),
path.resolve(__dirname, '../../../external/protobuf/src')
]
}
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
resolve: {
alias: {
WaylandSafePath: getWaylandSafePath(),
},
modules: [
'node_modules',
path.resolve(__dirname, '../../..')
],
},
resolveLoader: {
modules: [
'node_modules',
path.resolve(__dirname, 'loaders')
]
},
devServer: {
historyApiFallback: true,
noInfo: true
},
performance: {
hints: false
},
devtool: '#eval-source-map'
}
var prod = (process.env.NODE_ENV === 'production');
if (prod) {
module.exports.devtool = '#source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}
module.exports.plugins = (module.exports.plugins || []).concat([
new HtmlWebpackPlugin({
inlineSource: prod ? '.(js|css)' : false,
template: 'src/index_template.html'
}),
new HtmlWebpackInlineSourcePlugin(),
]);