qooxdoo-compiler icon indicating copy to clipboard operation
qooxdoo-compiler copied to clipboard

qx.core.Environment.get("qx.libraryInfoMap") not working in "build" target

Open sgaillard opened this issue 4 years ago • 4 comments

Hi, Here is my issue as suggested by Henner Kollmann @hkollmann on gitter.

I use to rely on qx.core.Environment.get("qx.libraryInfoMap") to get information about version and packages used in my apps and display them to the end user or as a log hint when debugging deployed apps. But today (qx --version: 1.0.0-beta-20201203-1458), as with version 1.0.0-beta-20201003-1033 when I first ask on gitter, this call returns un undefined value in target "build" and with qx deploy. With qx compile --target source (default compile target) everything goes as expected.

Step to reproduce:

  • qx create new_app
  • insert console.log(qx.core.Environment.get("qx.libraryInfoMap")); in the body of the app
  • qx compile --target source
  • qx compile --target build (or qx deploy --clean -o compiled/new_app)

Result:

  • Navigate to new_app/compiled/source result in the display in js console of the qx.libraryInfoMap with all libraries info available.
  • Navigate to new_app/compiled/build result in the display in js console of an undefined content.

Expected: Same result in both source and build targets

Environment:

  • platform: Debian/Linux
  • web server: nginx
  • code editor: vscode
  • web browser: chromium based

Minimum demo Application.js file:

/**
 * @asset(new_app/*)
 */
qx.Class.define("new_app.Application",
{
  extend : qx.application.Standalone,
  members :
  {
    main : function()
    {
      this.base(arguments);
      if (qx.core.Environment.get("qx.debug"))
      {
        qx.log.appender.Native;
        qx.log.appender.Console;
      }
      // Should output library info map whatever target is build
      console.log(qx.core.Environment.get("qx.libraryInfoMap"));
    }
  }
});

sgaillard avatar Dec 15 '20 10:12 sgaillard

@sgaillard Thanks for reporting. @johnspackman , can you have a look?

cboulanger avatar Dec 15 '20 10:12 cboulanger

Hi everybody, Does anyone had a look. The problem is still here with qx --version: 1.0.2. Or maybe, is there an other way to get version number of the project and its dependencies and display them in the deployed app? Best

sgaillard avatar Sep 07 '21 15:09 sgaillard

This should work if you use the --write-library-info command line option; although I can see that the qx deploy command turns it off regardless. Ideally this should be in the compile.json anyway, so that it can be relied on by the application. @sgaillard please can you have a quick re-test for with qx compile --target build --write-library-info?

johnspackman avatar Sep 20 '21 08:09 johnspackman

Just tryed qx compile --target build --write-library-info --clean and it seems to work as expected. Great! And as you mentioned it, qx deploy do not recognize command line option--write-library-info. Is it yet possible to put this parameter in the compile.json file?

sgaillard avatar Sep 20 '21 09:09 sgaillard