SAP / ui5-tooling

An open and modular toolchain to develop state of the art applications based on the UI5 framework
https://sap.github.io/ui5-tooling
Apache License 2.0
466 stars 71 forks source link

Build of UI5 app fails with custom UI5 libs (via `includeDependencies`) using custom tasks => "Could not find custom task..." #859

Closed petermuessig closed 1 year ago

petermuessig commented 1 year ago

Expected Behavior

When building an UI5 application project consuming a custom UI5 library project providing own build tasks, the build should be able to run this build task for this UI5 library project.

Current Behavior

The build fails with the issue that the tooling extension providing the custom build task cannot be found:

> SAPDevelop/temp/ui5-tooling-dep-issue  % npm run build:app

> ui5-tooling-dep-issue@1.0.0 build:app
> npm run build -w com.myorg.myapp

> com.myorg.myapp@1.0.0 build
> ui5 build --clean-dest

info graph:helpers:ui5Framework Using OpenUI5 version: 1.117.0
info ProjectBuilder Preparing build for project com.myorg.myapp
info ProjectBuilder   Target directory: ./dist
info ProjectBuilder   Requested dependencies:
info ProjectBuilder     + com.myorg.mylib

⚠️  Process Failed With Error

Error Message:
Could not find custom task ui5-tooling-stringreplace-task, referenced by project com.myorg.mylib in project graph with root node com.myorg.myapp

For details, execute the same command again with an additional '--verbose' parameter
npm ERR! Lifecycle script `build` failed with error: 
npm ERR! Error: command failed 
npm ERR!   in workspace: com.myorg.myapp@1.0.0 
npm ERR!   at location: /Users/dXXXXXX/SAPDevelop/temp/ui5-tooling-dep-issue/packages/com.myorg.myapp 

Steps to Reproduce the Issue

  1. Download the attached zip file: ui5-tooling-dep-issue.zip
  2. Run npm install in the project root
  3. Run npm run build:app to see the issue

Context

> SAPDevelop/temp/ui5-tooling-dep-issue  % npm version
{
  'ui5-tooling-dep-issue': '1.0.0',
  npm: '9.8.1',
  node: '18.15.0',
  v8: '10.2.154.26-node.25',
  uv: '1.44.2',
  zlib: '1.2.13',
  brotli: '1.0.9',
  ares: '1.18.1',
  modules: '108',
  nghttp2: '1.51.0',
  napi: '8',
  llhttp: '6.0.10',
  uvwasi: '0.0.15',
  acorn: '8.8.2',
  simdutf: '3.1.0',
  undici: '5.20.0',
  openssl: '3.0.8+quic',
  cldr: '42.0',
  icu: '72.1',
  tz: '2022g',
  unicode: '15.0',
  ngtcp2: '0.8.1',
  nghttp3: '0.7.0'
}
RandomByte commented 1 year ago

Hey Peter, this works as designed.

For myapp to be able to use the ui5-tooling-stringreplace dependency, mylib needs to declare it within the package.json dependencies rather than devDependencies.

petermuessig commented 1 year ago

That's true, indeed... My mistake...