flow icon indicating copy to clipboard operation
flow copied to clipboard

Gradle Task vaadinBuildFrontend fails if buildDir is mapped (to a ram-disk)

Open mictaege opened this issue 3 years ago • 0 comments

Description of the bug / feature

Since updating to Vaadin 20 and vaadin-gradle-plugin 20.0.4 I get the following error on executing gradle clean vaadinClean vaadinBuildFrontend.

Execution failed for task ':ologis-ui:ologis-ui-base:vaadinBuildFrontend'.
> Webpack process exited with non-zero exit code.
  Stderr: 'Hash: c8f3d9e3e4e4ffb1c256
  Version: webpack 4.46.0
  Time: 3066ms
  Built at: 26.07.2021 12:57:33
   4 assets
  Entrypoint bundle = VAADIN/build/vaadin-bundle-4a23ca2fcbed5e4d7208.cache.js
   [3] ../node_modules/.pnpm/[email protected]/node_modules/lit-element/lit-element.js + 5 modules 74.6 KiB {0} [built]
       |    6 modules
   [5] ../node_modules/.pnpm/[email protected]/node_modules/lit-html/lit-html.js + 1 modules 4.62 KiB {0} [built]
       |    2 modules
  [11] ./generated/vaadin.ts + 6 modules 131 KiB {0} [built]
       | ./generated/vaadin.ts 58 bytes [built]
       | ../media/ramdisk/ologis/ologis-ui-base/index.ts 1.49 KiB [built]
       | ../media/ramdisk/ologis/ologis-ui-base/flow-frontend/Flow.js 15.6 KiB [built]
       | ../media/ramdisk/ologis/ologis-ui-base/flow-frontend/ConnectionState.js 4.36 KiB [built]
       | ../media/ramdisk/ologis/ologis-ui-base/flow-frontend/ConnectionIndicator.js 14.4 KiB [built]
       |     + 2 hidden modules
  [12] ../media/ramdisk/ologis/ologis-ui-base/flow-frontend/FlowBootstrap.js 7.87 KiB {1} [built]
  [13] ../media/ramdisk/ologis/ologis-ui-base/flow-frontend/FlowClient.js 139 KiB {2} [built]
  [14] /media/ramdisk/ologis/ologis-ui-base/frontend/generated-flow-imports.js + 1 modules 7.2 KiB {3} [built]
       | /media/ramdisk/ologis/ologis-ui-base/frontend/generated-flow-imports.js 4.85 KiB [built]
       | ./styles/shared-styles.css 2.34 KiB [built]
      + 9 hidden modules

  ERROR in /media/ramdisk/ologis/ologis-ui-base/frontend/generated-flow-imports.js
  Module not found: Error: Can't resolve '@polymer/iron-icon/iron-icon.js' in '/media/ramdisk/ologis/ologis-ui-base/frontend'
   @ /media/ramdisk/ologis/ologis-ui-base/frontend/generated-flow-imports.js 12:0-41
   @ ../media/ramdisk/ologis/ologis-ui-base/index.ts
   @ ./generated/vaadin.ts

... much more 'Module not found' errors

This error happens only if the gradle buildDir is mapped to another directory as the standard gradle build directory myproject/build.

In my case the gradle buildDir is mapped to a ram-disk with the following configuration in the init.gradle file:

gradle.projectsLoaded {  
    rootProject.allprojects {  
        buildDir = "/media/ramdisk/${rootProject.name}/${project.name}"  
    }  
}

In addition to the error, I get the following directory structure generated in my projects root directory (and not in the buildDir directory):

myproject
└── media
    └── ramdisk
        └── ologis
            └── ologis-ui-base
                ├── flow-frontend
                │   ├── Authentication.d.ts
                │   ├── ...
                ├── index.html
                ├── index.ts
                └── plugins
                    ├── application-theme-plugin
                    │   ├── application-theme-plugin.js
                    │   ├── package.json
                    │   ├── theme-copy.js
                    │   ├── theme-generator.js
                    │   └── theme-handle.js
                    ├── stats-plugin
                    │   ├── package.json
                    │   └── stats-plugin.js
                    ├── theme-live-reload-plugin
                    │   ├── package.json
                    │   └── theme-live-reload-plugin.js
                    └── theme-loader
                        ├── package.json
                        └── theme-loader.js

Minimal reproducible example

  • if I remove the buildDir configuration from the init.gradle file gradle clean vaadinClean vaadinBuildFrontend succeeds in my project. If the buildDir configuration is added the build fails

  • with base-starter-gradle v14 gradle clean vaadinClean vaadinBuildFrontend works both with and without the buildDir configuration in init.gradle

Expected behavior

vaadinBuildFrontend should not fail if the gradle buildDir is mapped to another directory. Especially because mapping the buildDir to a ram-disk is a quite common approach to speed up development.

Actual behavior

vaadinBuildFrontend task fails if the gradle buildDir is mapped to another directory. Probably because buildDir is interpreted as a relative and not as an absolute path at some point

Versions:

- Vaadin / Flow version: 20
- vaadin-gradle-plugin: 20.0.4
- Java version: 11
- Gradle 7.1.1
- OS version: Ubuntu 20.04 (on WSL2)

mictaege avatar Jul 26 '21 11:07 mictaege