From 0e468c4d72d3b92858d3bb17360107e2f9ba7107 Mon Sep 17 00:00:00 2001 From: Matthias Osswald Date: Tue, 25 Feb 2020 10:10:49 +0100 Subject: [PATCH] Add verbose logging --- lib/tasks/buildThemes.js | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/lib/tasks/buildThemes.js b/lib/tasks/buildThemes.js index 1ae82755d..d738f24fa 100644 --- a/lib/tasks/buildThemes.js +++ b/lib/tasks/buildThemes.js @@ -2,6 +2,7 @@ const path = require("path"); const themeBuilder = require("../processors/themeBuilder"); const ReaderCollectionPrioritized = require("@ui5/fs").ReaderCollectionPrioritized; const fsInterface = require("@ui5/fs").fsInterface; +const log = require("@ui5/logger").getLogger("builder:tasks:buildThemes"); /** * Task to build a library theme. @@ -61,18 +62,11 @@ module.exports = async function({workspace, dependencies, options}) { let allResources = await pAllResources; const isAvailable = function(resource) { - let themeAvailable = false; let libraryAvailable = false; - + let themeAvailable = false; const resourcePath = resource.getPath(); const themeName = path.basename(path.dirname(resourcePath)); - if (!availableThemes || availableThemes.length === 0) { - themeAvailable = true; // If no themes are found, build all themes - } else { - themeAvailable = availableThemes.includes(themeName); - } - if (!availableLibraries || availableLibraries.length === 0) { libraryAvailable = true; // If no libraries are found, build themes for all libraries } else { @@ -83,11 +77,35 @@ module.exports = async function({workspace, dependencies, options}) { } } - // Only build if theme and library are available - return themeAvailable && libraryAvailable; + if (!availableThemes || availableThemes.length === 0) { + themeAvailable = true; // If no themes are found, build all themes + } else { + themeAvailable = availableThemes.includes(themeName); + } + + if (log.isLevelEnabled("verbose")) { + if (!libraryAvailable) { + log.verbose(`Skipping ${resourcePath}: Library is not available`); + } + if (!themeAvailable) { + log.verbose(`Skipping ${resourcePath}: sap.ui.core theme '${themeName}' is not available`); + } + } + + // Only build if library and theme are available + return libraryAvailable && themeAvailable; }; if (availableLibraries || availableThemes) { + if (log.isLevelEnabled("verbose")) { + log.verbose("Filtering themes to be built:"); + if (availableLibraries) { + log.verbose(`Available libraries: ${availableLibraries.join(", ")}`); + } + if (availableThemes) { + log.verbose(`Available sap.ui.core themes: ${availableThemes.join(", ")}`); + } + } allResources = allResources.filter(isAvailable); }