Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(all): remove debug/trace functions from production builds #13838

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions android/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,7 @@ AndroidBuilder.prototype.validate = function validate(logger, config, cli) {
this.minifyJS = true;
this.encryptJS = true;
this.minifyCSS = true;
this.removeLogs = true;
this.allowDebugging = false;
this.allowProfiling = false;
this.proguard = false;
Expand Down Expand Up @@ -2637,6 +2638,7 @@ AndroidBuilder.prototype.processJSFiles = async function processJSFiles(jsFilesM
transpile: this.transpile,
sourceMap: this.sourceMaps,
resourcesDir: this.buildAssetsDir,
removeLogs: this.removeLogs,
logger: this.logger,
targets: {
chrome: this.chromeVersion
Expand Down
3 changes: 3 additions & 0 deletions cli/lib/tasks/process-js-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class ProcessJsTask extends IncrementalFileTask {
* @param {Object} options.defaultAnalyzeOptions Default configuration options for jsanalyze.
* @param {Boolean} options.defaultAnalyzeOptions.minify Whether to minify the JS files or not.
* @param {Boolean} options.defaultAnalyzeOptions.transpile Whether to transpile the JS files or not.
* @param {Boolean} options.defaultAnalyzeOptions.removeLogs Whether to remove the logs in the JS files or not.
* @param {Boolean} options.defaultAnalyzeOptions.sourceMaps Whether to generate source maps or not.
* @param {String} options.defaultAnalyzeOptions.resourcesDir Path to the directory where JS files will be copied to.
* @param {Object} options.defaultAnalyzeOptions.logger Appc logger instance.
Expand Down Expand Up @@ -292,10 +293,12 @@ class ProcessJsTask extends IncrementalFileTask {
const isFileFromCommonFolder = from.startsWith(this.sdkCommonFolder);
const transpile = isFileFromCommonFolder ? false : this.defaultAnalyzeOptions.transpile;
const minify = isFileFromCommonFolder ? false : this.defaultAnalyzeOptions.minify;
const removeLogs = isFileFromCommonFolder ? false : this.defaultAnalyzeOptions.removeLogs;
const analyzeOptions = Object.assign({}, this.defaultAnalyzeOptions, {
filename: from,
minify,
transpile,
removeLogs
});

let newContents;
Expand Down