diff --git a/internal/documentation/docs/pages/Builder.md b/internal/documentation/docs/pages/Builder.md index d36be96ec98..598a1655370 100644 --- a/internal/documentation/docs/pages/Builder.md +++ b/internal/documentation/docs/pages/Builder.md @@ -23,31 +23,32 @@ A project can add custom tasks to the build by using the [Custom Tasks Extensibi ### Standard Tasks -All available standard tasks are documented [in the API reference](https://ui5.github.io/cli/v5/api/index.html). Search for `@ui5/builder/tasks/` to filter the API reference for all available tasks. The list below offers the actual order of their execution: +All available standard tasks are documented in the **@ui5/builder API reference**. Use the sidebar menu to access the respective pages. The list below offers the actual order of their execution: +[TODO: Cleanup formatting]: # | Task | Type `application` | Type `component` | Type `library` | Type `theme-library` | |--------------------------------|:-----------------------:|:-----------------------:|:-----------------------:|:-----------------------:| -| escapeNonAsciiCharacters | enabled | enabled | enabled | | -| replaceCopyright | enabled | enabled | enabled | enabled | -| replaceVersion | enabled | enabled | enabled | enabled | -| replaceBuildtime | | | enabled | | -| generateJsdoc | | | *disabled* 1 | | -| executeJsdocSdkTransformation | | | *disabled* 1 | | -| minify | enabled | enabled | enabled | | -| generateFlexChangesBundle | enabled | enabled | enabled | | -| generateLibraryManifest | | | enabled | | -| enhanceManifest | enabled | enabled | enabled | | -| generateComponentPreload | enabled | enabled | *disabled* 2 | | -| generateLibraryPreload | | | enabled | | -| generateStandaloneAppBundle | *disabled* 3 | | | | -| transformBootstrapHtml | *disabled* 3 | | | | -| generateBundle | *disabled* 4 | *disabled* 4 | *disabled* 4 | | -| buildThemes | | | enabled | enabled | -| generateThemeDesignerResources | | | *disabled* 5 | *disabled* 5 | -| generateVersionInfo | *disabled* 1 | | | | -| generateCachebusterInfo | *disabled* | *disabled* | | | -| generateApiIndex | *disabled* 1 | | | | -| generateResourcesJson | *disabled* | *disabled* | *disabled* | *disabled* | +| [escapeNonAsciiCharacters](../api/module-@ui5_builder_tasks_escapeNonAsciiCharacters) | enabled | enabled | enabled | | +| [replaceCopyright](../api/module-@ui5_builder_tasks_replaceCopyright) | enabled | enabled | enabled | enabled | +| [replaceVersion](../api/module-@ui5_builder_tasks_replaceVersion) | enabled | enabled | enabled | enabled | +| [replaceBuildtime](../api/module-@ui5_builder_tasks_replaceBuildtime) | | | enabled | | +| [generateJsdoc](../api/module-@ui5_builder_tasks_jsdoc_generateJsdoc) | | | *disabled* 1 | | +| [executeJsdocSdkTransformation](../api/module-@ui5_builder_tasks_jsdoc_executeJsdocSdkTransformation) | | | *disabled* 1 | | +| [minify](../api/module-@ui5_builder_tasks_minify) | enabled | enabled | enabled | | +| [generateFlexChangesBundle](../api/module-@ui5_builder_tasks_bundlers_generateFlexChangesBundle) | enabled | enabled | enabled | | +| [generateLibraryManifest](../api/module-@ui5_builder_tasks_generateLibraryManifest) | | | enabled | | +| [enhanceManifest](../api/module-@ui5_builder_tasks_enhanceManifest) | enabled | enabled | enabled | | +| [generateComponentPreload](../api/module-@ui5_builder_tasks_bundlers_generateComponentPreload) | enabled | enabled | *disabled* 2 | | +| [generateLibraryPreload](../api/module-@ui5_builder_tasks_bundlers_generateLibraryPreload) | | | enabled | | +| [generateStandaloneAppBundle](../api/module-@ui5_builder_tasks_bundlers_generateStandaloneAppBundle) | *disabled* 3 | | | | +| transformBootstrapHtml TODO: Link missing??? | *disabled* 3 | | | | +| [generateBundle](../api/module-@ui5_builder_tasks_bundlers_generateBundle) | *disabled* 4 | *disabled* 4 | *disabled* 4 | | +| [buildThemes](../api/module-@ui5_builder_tasks_buildThemes) | | | enabled | enabled | +| [generateThemeDesignerResources](../api/module-@ui5_builder_tasks_generateThemeDesignerResources) | | | *disabled* 5 | *disabled* 5 | +| [generateVersionInfo](../api/module-@ui5_builder_tasks_generateVersionInfo) | enabled | *disabled* | *disabled* | *disabled* | +| [generateCachebusterInfo](../api/module-@ui5_builder_tasks_generateCachebusterInfo) | *disabled* | *disabled* | | | +| [generateApiIndex](../api/module-@ui5_builder_tasks_jsdoc_generateApiIndex) | *disabled* 1 | | | | +| [generateResourcesJson](../api/module-@ui5_builder_tasks_generateResourcesJson) | *disabled* | *disabled* | *disabled* | *disabled* | *Disabled tasks can be activated by certain build modes, the project configuration, or by using the `--include-task` [CLI parameter](./CLI.md#ui5-build). See footnotes where given* diff --git a/internal/documentation/docs/updates/migrate-v5.md b/internal/documentation/docs/updates/migrate-v5.md index c9db7b58dac..5a2db732b53 100644 --- a/internal/documentation/docs/updates/migrate-v5.md +++ b/internal/documentation/docs/updates/migrate-v5.md @@ -320,6 +320,12 @@ Update your `ui5.yaml` configuration to reference an existing middleware instead | `serveThemes` | CSS files pre-built by `buildThemes` task and served via `serveResources` | `serveResources` | | `testRunner` | TestRunner resources served via `serveResources` from the UI5 framework | `serveResources` | +## `sap-ui-version.json` + +When running `ui5 build` for projects of type `application`, the standard task [`generateVersionInfo`](../api/module-@ui5_builder_tasks_generateVersionInfo) (producing a `sap-ui-version.json` file under `resources/`) is now **executed by default**. This applies to every build type (default, jsdoc, and self-contained). For projects of other types (e.g. `library`), the behavior remains the same and [`generateVersionInfo`](../api/module-@ui5_builder_tasks_generateVersionInfo) is not executed. + +To see which standard tasks are executed by default, check out the [Standard Tasks](../pages/Builder#standard-tasks) table in the UI5 Builder page. + ## Learn More - [Project: Type `component`](../pages/Project#component) diff --git a/packages/builder/test/expected/build/application.m/dest/resources/sap-ui-version.json b/packages/builder/test/expected/build/application.m/dest/resources/sap-ui-version.json new file mode 100644 index 00000000000..a109feea58d --- /dev/null +++ b/packages/builder/test/expected/build/application.m/dest/resources/sap-ui-version.json @@ -0,0 +1,7 @@ +{ + "name": "application.m", + "version": "1.0.0", + "buildTimestamp": "WILL_BE_IGNORED_BY_TESTS", + "scmRevision": "", + "libraries": [] +} diff --git a/packages/builder/test/expected/build/application.o/dest/resources/sap-ui-version.json b/packages/builder/test/expected/build/application.o/dest/resources/sap-ui-version.json new file mode 100644 index 00000000000..b6212fb25e3 --- /dev/null +++ b/packages/builder/test/expected/build/application.o/dest/resources/sap-ui-version.json @@ -0,0 +1,7 @@ +{ + "name": "application.o", + "version": "1.0.0", + "buildTimestamp": "WILL_BE_IGNORED_BY_TESTS", + "scmRevision": "", + "libraries": [] +} diff --git a/packages/builder/test/lib/builder/builder.js b/packages/builder/test/lib/builder/builder.js index cf0f0c0c46b..8772cbda0a6 100644 --- a/packages/builder/test/lib/builder/builder.js +++ b/packages/builder/test/lib/builder/builder.js @@ -71,14 +71,20 @@ async function checkFileContentsIgnoreLineFeeds(t, expectedFiles, expectedPath, currentContent = JSON.parse(currentContent.replace(/(:\s+)(\d+)/g, ": 0")); expectedContent = JSON.parse(expectedContent.replace(/(:\s+)(\d+)/g, ": 0")); t.deepEqual(currentContent, expectedContent); - } else { - if (expectedFile.endsWith(".json")) { - try { - t.deepEqual(JSON.parse(currentContent), JSON.parse(expectedContent), expectedFile); - } catch (e) { - t.falsy(e, expectedFile); + } else if (expectedFile.endsWith(".json")) { + try { + const currentJson = JSON.parse(currentContent); + const expectedJson = JSON.parse(expectedContent); + // Check if file is "sap-ui-version.json" and ignore the buildTimestamp property for comparison: + if (expectedFile.endsWith("sap-ui-version.json")) { + delete currentJson.buildTimestamp; + delete expectedJson.buildTimestamp; } + t.deepEqual(currentJson, expectedJson, expectedFile); + } catch (e) { + t.falsy(e, expectedFile); } + } else { t.is(currentContent.replace(newLineRegexp, "\n"), expectedContent.replace(newLineRegexp, "\n"), relativeFile); diff --git a/packages/project/lib/build/helpers/composeTaskList.js b/packages/project/lib/build/helpers/composeTaskList.js index 11a23d39dcb..dca89a180e3 100644 --- a/packages/project/lib/build/helpers/composeTaskList.js +++ b/packages/project/lib/build/helpers/composeTaskList.js @@ -25,7 +25,6 @@ export default function composeTaskList(allTasks, {selfContained, jsdoc, include selectedTasks.generateCachebusterInfo = false; selectedTasks.generateApiIndex = false; selectedTasks.generateThemeDesignerResources = false; - selectedTasks.generateVersionInfo = false; // Disable generateResourcesJson due to performance. // When executed it analyzes each module's AST and therefore @@ -45,7 +44,6 @@ export default function composeTaskList(allTasks, {selfContained, jsdoc, include selectedTasks.generateJsdoc = true; selectedTasks.executeJsdocSdkTransformation = true; selectedTasks.generateApiIndex = true; - selectedTasks.generateVersionInfo = true; // Include theme build as required for SDK selectedTasks.buildThemes = true; diff --git a/packages/project/test/lib/build/BuildServer.integration.js b/packages/project/test/lib/build/BuildServer.integration.js index 0abcf7765a9..5d9c1df055a 100644 --- a/packages/project/test/lib/build/BuildServer.integration.js +++ b/packages/project/test/lib/build/BuildServer.integration.js @@ -163,7 +163,11 @@ test.serial("Serve application.a, request application resource", async (t) => { resource: "/test.js", assertions: { projects: { - "application.a": {} + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, + "application.a": {}, } } }); @@ -193,6 +197,7 @@ test.serial("Serve application.a, request application resource", async (t) => { "replaceCopyright", "enhanceManifest", "generateFlexChangesBundle", + "generateVersionInfo", ] } } @@ -219,7 +224,11 @@ test.serial("Serve application.a, create and delete a source file", async (t) => resource: "/created.js", assertions: { projects: { - "application.a": {} + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, + "application.a": {}, } } }); @@ -251,6 +260,7 @@ test.serial("Serve application.a, create and delete a source file", async (t) => "replaceCopyright", "enhanceManifest", "generateFlexChangesBundle", + "generateVersionInfo", ] } } @@ -272,22 +282,13 @@ test.serial("Serve application.a, create and delete a source file", async (t) => } }); - // #5 the second file is no longer served, but requesting it triggers a build of the dependencies - // because the file is not known anymore and might come from a different project. - // Note: This is special for applications, which are served at root level. For libraries, the server - // can determine whether a resources is inside a project namespace and only trigger a build for the affected - // project. The logic could be improved, especially like in this case where the requested resource is outside - // of /resources or /test-resources. + // #5 the second file is no longer served, thus requesting it shouldn't trigger a rebuild + // (all projects are still cached from the previous builds) await fixtureTester.requestResource({ resource: "/another.js", notFound: true, assertions: { - projects: { - "library.d": {}, - "library.a": {}, - "library.b": {}, - "library.c": {}, - } + projects: {} } }); @@ -308,6 +309,7 @@ test.serial("Serve application.a, create and delete a source file", async (t) => "replaceCopyright", "enhanceManifest", "generateFlexChangesBundle", + "generateVersionInfo", ] } } @@ -486,8 +488,11 @@ test.serial("Serve application.a, request application resource AND library resou resources: ["/test.js", "/resources/library/a/.library"], assertions: { projects: { + "library.d": {}, "library.a": {}, - "application.a": {} + "library.b": {}, + "library.c": {}, + "application.a": {}, } } }); @@ -558,7 +563,11 @@ test.serial("Serve application.a with --cache=Default", async (t) => { resource: "/test.js", assertions: { projects: { - "application.a": {} + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, + "application.a": {}, } } }); @@ -587,6 +596,7 @@ test.serial("Serve application.a with --cache=Default", async (t) => { "replaceCopyright", "enhanceManifest", "generateFlexChangesBundle", + "generateVersionInfo", ] } } @@ -609,7 +619,11 @@ test.serial("Serve application.a with --cache=Off", async (t) => { resource: "/test.js", assertions: { projects: { - "application.a": {} + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, + "application.a": {}, } } }); @@ -631,7 +645,11 @@ test.serial("Serve application.a with --cache=Off", async (t) => { resource: "/test.js", assertions: { projects: { - "application.a": {} + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, + "application.a": {}, } } }); @@ -651,7 +669,11 @@ test.serial("Serve application.a with --cache=Off", async (t) => { resource: "/test.js", assertions: { projects: { - "application.a": {} + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, + "application.a": {}, } } }); @@ -673,7 +695,11 @@ test.serial("Serve application.a with --cache=Off", async (t) => { resource: "/test.js", assertions: { projects: { - "application.a": {} + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, + "application.a": {}, } } }); @@ -688,7 +714,11 @@ test.serial("Serve application.a with --cache=ReadOnly", async (t) => { resource: "/test.js", assertions: { projects: { - "application.a": {} + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, + "application.a": {}, } } }); @@ -721,6 +751,7 @@ test.serial("Serve application.a with --cache=ReadOnly", async (t) => { "replaceCopyright", "enhanceManifest", "generateFlexChangesBundle", + "generateVersionInfo", ] } } @@ -749,6 +780,7 @@ test.serial("Serve application.a with --cache=ReadOnly", async (t) => { "replaceCopyright", "enhanceManifest", "generateFlexChangesBundle", + "generateVersionInfo", ] } } @@ -765,7 +797,11 @@ test.serial("Serve application.a with --cache=Force (1)", async (t) => { resource: "/test.js", assertions: { projects: { - "application.a": {} + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, + "application.a": {}, } } }); diff --git a/packages/project/test/lib/build/ProjectBuilder.integration.js b/packages/project/test/lib/build/ProjectBuilder.integration.js index c754b7213f1..7537a4e7e41 100644 --- a/packages/project/test/lib/build/ProjectBuilder.integration.js +++ b/packages/project/test/lib/build/ProjectBuilder.integration.js @@ -44,6 +44,13 @@ test.serial("Build application.a project multiple times", async (t) => { config: {destPath, cleanDest: false}, assertions: { projects: { + // Default builds of project type "application" include the "generateVersionInfo" + // task which requires dependencies to be built, so all dependencies are expected to be built here. + // Subsequent builds can reuse the cached results of these dependencies. + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, "application.a": {} } } @@ -75,6 +82,7 @@ test.serial("Build application.a project multiple times", async (t) => { "replaceCopyright", "enhanceManifest", "generateFlexChangesBundle", + "generateVersionInfo", ] } } @@ -90,12 +98,10 @@ test.serial("Build application.a project multiple times", async (t) => { await fixtureTester.buildProject({ config: {destPath, cleanDest: true, dependencyIncludes: {includeAllDependencies: true}}, assertions: { - projects: { - "library.d": {}, - "library.a": {}, - "library.b": {}, - "library.c": {}, - } + // Dependencies are NOT rebuilt because + // they were already built in build #1 and can be reused from cache. + // Thus, empty assertion for built projects. + projects: {} } }); @@ -180,6 +186,7 @@ test.serial("Build application.a project multiple times", async (t) => { "enhanceManifest", "escapeNonAsciiCharacters", "generateFlexChangesBundle", + "generateVersionInfo", "replaceCopyright" ] } @@ -204,6 +211,7 @@ test.serial("Build application.a project multiple times", async (t) => { "escapeNonAsciiCharacters", "generateFlexChangesBundle", "replaceCopyright", + "generateVersionInfo", ] }} } @@ -264,6 +272,7 @@ test.serial("Build application.a (with various dependencies)", async (t) => { "escapeNonAsciiCharacters", "generateFlexChangesBundle", "replaceCopyright", + "generateVersionInfo", ] } } @@ -308,6 +317,7 @@ test.serial("Build application.a (with various dependencies)", async (t) => { "escapeNonAsciiCharacters", "generateFlexChangesBundle", "replaceCopyright", + "generateVersionInfo", ] } } @@ -330,6 +340,7 @@ test.serial("Build application.a (with various dependencies)", async (t) => { "escapeNonAsciiCharacters", "generateFlexChangesBundle", "replaceCopyright", + "generateVersionInfo", ] } } @@ -342,18 +353,25 @@ test.serial("Build application.a (including only some dependencies)", async (t) const destPath = fixtureTester.destPath; // In this test, we're testing the "dependencyIncludes" build option - // which allows to include only a subset of the dependencies of a project in the build. + // which allows to include only a subset of the dependencies of a project in the build result. // "application.a" has 4 dependencies defined: library.a, library.b, library.c and library.d. // #1 build // Only include library.a and library.b as dependencies, but not library.c and library.d: + + // Note: For the initial build, ALL dependencies are built, + // due to the execution of the "generateVersionInfo" task in application.a which requires dependencies to be built. + // In subsequent builds, the cached results of the dependencies can be reused, + // so "includeDependency" can come to effect. await fixtureTester.buildProject({ config: {destPath, cleanDest: false, dependencyIncludes: {includeDependency: ["library.a", "library.b"]}}, assertions: { projects: { + "library.d": {}, "library.a": {}, "library.b": {}, + "library.c": {}, "application.a": {} } } @@ -364,6 +382,10 @@ test.serial("Build application.a (including only some dependencies)", async (t) {encoding: "utf8"})); await t.notThrowsAsync(fs.readFile(`${destPath}/resources/library/b/library-preload.js`, {encoding: "utf8"})); + + // Check that the remaining dependencies are NOT in the destPath: + // (Note: although library.c and library.d were built, + // they are not included in the build result because of the flag) await t.throwsAsync(fs.readFile(`${destPath}/resources/library/c/library-preload.js`, {encoding: "utf8"})); await t.throwsAsync(fs.readFile(`${destPath}/resources/library/d/library-preload.js`, @@ -372,14 +394,12 @@ test.serial("Build application.a (including only some dependencies)", async (t) // #2 build // Exclude library.d as dependency, but include all other dependencies - // (builds of library.a and library.b can be reused from cache): + // (builds of library.a, library.b and library.c can be reused from cache): await fixtureTester.buildProject({ config: {destPath, cleanDest: true, dependencyIncludes: {includeAllDependencies: true, excludeDependency: ["library.d"]}}, assertions: { - projects: { - "library.c": {}, - } + projects: {} } }); @@ -390,20 +410,20 @@ test.serial("Build application.a (including only some dependencies)", async (t) {encoding: "utf8"})); await t.notThrowsAsync(fs.readFile(`${destPath}/resources/library/c/library-preload.js`, {encoding: "utf8"})); + + // Check that the excluded dependency is NOT in the destPath: await t.throwsAsync(fs.readFile(`${destPath}/resources/library/d/library-preload.js`, {encoding: "utf8"})); // #3 build - // Include all dependencies (only library.d is built) - // (builds of library.a, library.b, and library.c can be reused from cache): + // Include all dependencies + // (builds of ALL libraries can be reused from cache): await fixtureTester.buildProject({ config: {destPath, cleanDest: true, dependencyIncludes: {includeAllDependencies: true}}, assertions: { - projects: { - "library.d": {}, - } + projects: {} } }); @@ -448,6 +468,10 @@ test.serial("Build application.a (custom task and tag handling)", async (t) => { config: {destPath, cleanDest: true}, assertions: { projects: { + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, "application.a": {} } } @@ -471,6 +495,7 @@ test.serial("Build application.a (custom task and tag handling)", async (t) => { "replaceCopyright", "enhanceManifest", "generateFlexChangesBundle", + "generateVersionInfo", ] } } @@ -523,6 +548,10 @@ test.serial("Build application.a (multiple custom tasks)", async (t) => { config: {destPath, cleanDest: true}, assertions: { projects: { + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, "application.a": {} } } @@ -561,6 +590,7 @@ test.serial("Build application.a (multiple custom tasks)", async (t) => { "escapeNonAsciiCharacters", "generateFlexChangesBundle", "replaceCopyright", + "generateVersionInfo", ] } } @@ -582,6 +612,10 @@ test.serial("Build application.a (multiple custom tasks 2)", async (t) => { config: {destPath, cleanDest: true}, assertions: { projects: { + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, "application.a": {} } } @@ -606,6 +640,7 @@ test.serial("Build application.a (multiple custom tasks 2)", async (t) => { "replaceCopyright", "enhanceManifest", "generateFlexChangesBundle", + "generateVersionInfo", ] } } @@ -635,6 +670,7 @@ test.serial("Build application.a (multiple custom tasks 2)", async (t) => { "escapeNonAsciiCharacters", "generateFlexChangesBundle", "replaceCopyright", + "generateVersionInfo", ] } } @@ -834,6 +870,7 @@ builder: "generateFlexChangesBundle", "replaceCopyright", "replaceVersion", + "generateVersionInfo", ] }, } @@ -985,6 +1022,10 @@ test.serial("Build application.a (Custom Component preload configuration)", asyn config: {destPath, cleanDest: true}, assertions: { projects: { + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, "application.a": {} } } @@ -1064,6 +1105,7 @@ test.serial("Build application.a (self-contained build)", async (t) => { "generateFlexChangesBundle", "replaceCopyright", "transformBootstrapHtml", + "generateVersionInfo", ] } } @@ -1181,6 +1223,7 @@ test.serial("Build application.a (Custom bundling)", async (t) => { "escapeNonAsciiCharacters", "generateFlexChangesBundle", "replaceCopyright", + "generateVersionInfo", ] } } @@ -1217,6 +1260,7 @@ test.serial("Build application.a (Custom bundling)", async (t) => { "escapeNonAsciiCharacters", "generateFlexChangesBundle", "replaceCopyright", + "generateVersionInfo", ] } } @@ -2465,6 +2509,10 @@ test.serial("Build application.a with --cache=Default", async (t) => { config: {destPath, cleanDest: false, cache: Cache.Default}, assertions: { projects: { + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, "application.a": {} } } @@ -2493,6 +2541,7 @@ test.serial("Build application.a with --cache=Default", async (t) => { "replaceCopyright", "enhanceManifest", "generateFlexChangesBundle", + "generateVersionInfo", ] } } @@ -2514,7 +2563,11 @@ test.serial("Build application.a with --cache=Off", async (t) => { config: {destPath, cleanDest: false, cache: Cache.Off}, assertions: { projects: { - "application.a": {} + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, + "application.a": {}, } } }); @@ -2524,7 +2577,11 @@ test.serial("Build application.a with --cache=Off", async (t) => { config: {destPath, cleanDest: true, cache: Cache.Off}, assertions: { projects: { - "application.a": {} + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, + "application.a": {}, } } }); @@ -2534,7 +2591,11 @@ test.serial("Build application.a with --cache=Off", async (t) => { config: {destPath, cleanDest: true, cache: Cache.Default}, assertions: { projects: { - "application.a": {} + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, + "application.a": {}, } } }); @@ -2552,7 +2613,11 @@ test.serial("Build application.a with --cache=Off", async (t) => { config: {destPath, cleanDest: true, cache: Cache.Off}, assertions: { projects: { - "application.a": {} + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, + "application.a": {}, } } }); @@ -2567,6 +2632,10 @@ test.serial("Build application.a with --cache=ReadOnly", async (t) => { config: {destPath, cleanDest: false, cache: Cache.Default}, assertions: { projects: { + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, "application.a": {} } } @@ -2595,6 +2664,7 @@ test.serial("Build application.a with --cache=ReadOnly", async (t) => { "replaceCopyright", "enhanceManifest", "generateFlexChangesBundle", + "generateVersionInfo", ] } } @@ -2618,6 +2688,7 @@ test.serial("Build application.a with --cache=ReadOnly", async (t) => { "replaceCopyright", "enhanceManifest", "generateFlexChangesBundle", + "generateVersionInfo", ] } } @@ -2634,6 +2705,10 @@ test.serial("Build application.a with --cache=Force (1)", async (t) => { config: {destPath, cleanDest: false, cache: Cache.Default}, assertions: { projects: { + "library.d": {}, + "library.a": {}, + "library.b": {}, + "library.c": {}, "application.a": {} } } diff --git a/packages/project/test/lib/build/TaskRunner.js b/packages/project/test/lib/build/TaskRunner.js index c4451c556c3..2dd78996b34 100644 --- a/packages/project/test/lib/build/TaskRunner.js +++ b/packages/project/test/lib/build/TaskRunner.js @@ -1295,6 +1295,7 @@ test("Custom task attached to a disabled task", async (t) => { "generateFlexChangesBundle", "generateComponentPreload", "myTask", + "generateVersionInfo", ], "Correct tasks execution"); }); @@ -1423,11 +1424,17 @@ test("getRequiredDependencies: Custom Task", async (t) => { }); test("getRequiredDependencies: Default application", async (t) => { + // This test includes a mock project of type "application". + // By default, builds of this project type always contain the "generateVersionInfo" task, + // which requires dependencies to be built. + const project = getMockProject("application"); project.getBundles = () => []; const taskRunner = createTaskRunner(t, project); - t.deepEqual(await taskRunner.getRequiredDependencies(), new Set([]), - "Default application project does not require dependencies"); + t.deepEqual(await taskRunner.getRequiredDependencies(), new Set([ + "dep.a", + "dep.b", + ]), "Default application project DOES require dependencies"); }); test("getRequiredDependencies: Default component", async (t) => { diff --git a/packages/project/test/lib/build/helpers/composeTaskList.js b/packages/project/test/lib/build/helpers/composeTaskList.js index 910994aabec..f1fb5f905c4 100644 --- a/packages/project/test/lib/build/helpers/composeTaskList.js +++ b/packages/project/test/lib/build/helpers/composeTaskList.js @@ -55,6 +55,7 @@ const allTasks = [ "minify", "buildThemes", "generateLibraryManifest", + "generateVersionInfo", "generateFlexChangesBundle", "generateComponentPreload", "generateBundle", @@ -76,6 +77,7 @@ const allTasks = [ "minify", "buildThemes", "generateLibraryManifest", + "generateVersionInfo", "generateFlexChangesBundle", "generateComponentPreload", "generateBundle", @@ -98,9 +100,10 @@ const allTasks = [ "buildThemes", "transformBootstrapHtml", "generateLibraryManifest", + "generateVersionInfo", "generateFlexChangesBundle", "generateStandaloneAppBundle", - "generateBundle" + "generateBundle", ] ], [ @@ -134,6 +137,7 @@ const allTasks = [ "minify", "buildThemes", "generateLibraryManifest", + "generateVersionInfo", "generateFlexChangesBundle", "generateComponentPreload", "generateResourcesJson", @@ -195,6 +199,7 @@ const allTasks = [ "minify", "buildThemes", "generateLibraryManifest", + "generateVersionInfo", "generateFlexChangesBundle", "generateComponentPreload", "generateBundle", @@ -219,6 +224,7 @@ const allTasks = [ "minify", "buildThemes", "generateLibraryManifest", + "generateVersionInfo", "generateFlexChangesBundle", "generateComponentPreload", "generateBundle", diff --git a/packages/server/test/lib/server/main.js b/packages/server/test/lib/server/main.js index 8e2e0849f0c..b535178673a 100644 --- a/packages/server/test/lib/server/main.js +++ b/packages/server/test/lib/server/main.js @@ -731,13 +731,13 @@ test("Get index of resources", async (t) => { t.is(res.statusCode, 200, "Correct HTTP status code"); t.is(res.headers["content-type"], "text/html; charset=utf-8", "Correct content type"); t.is(/