Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Problem with webpack and workers on android build #176

Closed
danielgek opened this issue Jun 5, 2017 · 8 comments
Closed

Problem with webpack and workers on android build #176

danielgek opened this issue Jun 5, 2017 · 8 comments

Comments

@danielgek
Copy link

danielgek commented Jun 5, 2017

Hi, i'm having a problem building an app that has 3 workers
i think the problem is that all workers import globals

take a look at the end of the compilation log

> @ start-android-bundle /Users/danielgek/spms/Ces
> npm run ns-bundle --android --run-app


> @ ns-bundle /Users/danielgek/spms/Ces
> ns-bundle

Copying template files...
Installing  tns-android
/Users/danielgek/spms/Ces
└── [email protected] 

  ◜ Installing tns-android
Project successfully created.
Running webpack for android...
 10% building modules 0/2 modules 2 active ...sers/danielgek/spms/Ces/app/vendor.ts(node:59751) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see https://github.com/webpack/loader-utils/issues/56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
Hash: 2b02e57ab59dae113a0b                                                               
Version: webpack 2.5.1
Time: 76571ms
                         Asset       Size  Chunks                    Chunk Names
              fonts/CODE39.ttf    33.7 kB          [emitted]         
4d1cbb78cfe6a2d553fc.worker.js    3.43 MB          [emitted]  [big]  
2f5a5c63f4cdb16149e0.worker.js    3.22 MB          [emitted]  [big]  
                     bundle.js    4.61 MB       0  [emitted]  [big]  bundle
            app.android.css.js  292 bytes       1  [emitted]         app.android.css
                     vendor.js    2.96 MB       2  [emitted]  [big]  vendor
               app.android.css    14.3 kB       1  [emitted]         app.android.css
          css/font-awesome.css    33.1 kB          [emitted]         
 fonts/fontawesome-webfont.ttf     166 kB          [emitted]         
4110cc9e1a4660dd6b0e.worker.js    3.43 MB          [emitted]  [big]  
       fonts/Roboto Medium.ttf     163 kB          [emitted]         
      fonts/Roboto Regular.ttf     163 kB          [emitted]         
        assets/key-pad.old.png    19.2 kB          [emitted]         
            assets/key-pad.png    11.1 kB          [emitted]         
                assets/sns.png    19.3 kB          [emitted]         
                  package.json  154 bytes          [emitted]         
                    starter.js   41 bytes          [emitted]         
           tns-java-classes.js    0 bytes          [emitted]         
   [1] ../~/@angular/core/@angular/core.es5.js 468 kB {2} [built]
  [12] ../~/nativescript-angular/router.js 3.18 kB {2} [built]
  [15] ../~/@angular/router/@angular/router.es5.js 211 kB {2} [built]
  [18] ../~/@angular/common/@angular/common.es5.js 130 kB {2} [built]
  [40] ../~/@angular/forms/@angular/forms.es5.js 203 kB {2} [built]
  [76] ../~/@angular/http/@angular/http.es5.js 74.7 kB {2} [built]
  [88] ../~/@angular/platform-browser/@angular/platform-browser.es5.js 142 kB {2} [built]
 [146] ../~/nativescript-angular/platform-static.js 849 bytes {2} [built]
 [216] ../~/nativescript-angular/forms.js 1.52 kB {2} [built]
 [393] ./app.module.ngfactory.ts 42 kB {0} [built]
 [394] ./vendor-platform.android.ts 189 bytes {2} [built]
 [455] ./app.android.css 41 bytes {1} [built]
 [504] ./main.aot.ts 451 bytes {0} [built]
 [568] ./vendor.ts 457 bytes {2} [built]
 [917] ../~/nativescript-css-loader/lib/css-base.js 1.51 kB [built]
    + 903 hidden modules
Child app/app.component.html:
       [0] ./app.component.html 64 bytes {0} [built]
Child app/components/card/card.component.html:
        + 1 hidden modules
Child app/components/card-scroll/card-scroll.component.html:
        + 1 hidden modules
Child app/components/card-info/card-info.component.html:
        + 1 hidden modules
Child app/components/num-pad/num-pad.component.html:
        + 1 hidden modules
Child app/pages/card-adse/card-adse.component.html:
       [0] ./pages/card-adse/card-adse.component.html 999 bytes {0} [built]
Child app/components/side-drawer-page/side-drawer-page.component.html:
        + 1 hidden modules
Child app/pages/card-rnu/card-rnu.component.html:
       [0] ./pages/card-rnu/card-rnu.component.html 4.35 kB {0} [built]
Child app/pages/card-rentev/card-rentev.component.html:
       [0] ./pages/card-rentev/card-rentev.component.html 1.84 kB {0} [built]
Child app/pages/home/home.component.html:
       [0] ./pages/home/home.component.html 1.12 kB {0} [built]
Child app/pages/home/settings/settings.component.html:
       [0] ./pages/home/settings/settings.component.html 502 bytes {0} [built]
Child app/pages/home/about/about.component.html:
       [0] ./pages/home/about/about.component.html 1.34 kB {0} [built]
Child app/pages/pin/pin.component.html:
       [0] ./pages/pin/pin.component.html 1.75 kB {0} [built]
Child app/pages/mudar-pin/mudar-pin.component.html:
       [0] ./pages/mudar-pin/mudar-pin.component.html 1.16 kB {0} [built]
Child app/pages/login/login.component.html:
       [0] ./pages/login/login.component.html 1.2 kB {0} [built]
Child app/pages/login/login-chave-movel/login-chave-movel.component.html:
       [0] ./pages/login/login-chave-movel/login-chave-movel.component.html 312 bytes {0} [built]
Child app/pages/login/login-rnu/login-rnu.component.html:
       [0] ./pages/login/login-rnu/login-rnu.component.html 1.27 kB {0} [built]
Child app/pages/login/login-otp/login-otp.component.html:
       [0] ./pages/login/login-otp/login-otp.component.html 935 bytes {0} [built]
Child app/pages/login/login-rnu-info/login-rnu-info.component.html:
       [0] ./pages/login/login-rnu-info/login-rnu-info.component.html 2.46 kB {0} [built]
Child app/pages/card-vacinas/card-vacinas.component.html:
       [0] ./pages/card-vacinas/card-vacinas.component.html 7.39 kB {0} [built]
Child app/pages/introduction/introduction.component.html:
       [0] ./pages/introduction/introduction.component.html 4.66 kB {0} [built]
Child app/pages/error/error.component.html:
       [0] ./pages/error/error.component.html 530 bytes {0} [built]
Child app/pages/pem/pem-detail/pem-detail.component.html:
       [0] ./pages/pem/pem-detail/pem-detail.component.html 19.4 kB {0} [built]
Child app/pages/pem/pem-list/pem-list.component.html:
       [0] ./pages/pem/pem-list/pem-list.component.html 2.23 kB {0} [built]
Child app/pages/pem/show-qr/show-qr.component.html:
       [0] ./pages/pem/show-qr/show-qr.component.html 607 bytes {0} [built]
Child app/pages/cards/cards-available/cards-available.component.html:
       [0] ./pages/cards/cards-available/cards-available.component.html 856 bytes {0} [built]
Child app/pages/cards/card-list/card-list.component.html:
       [0] ./pages/cards/card-list/card-list.component.html 969 bytes {0} [built]
Child app/pages/cards/card-detail/card-detail.component.html:
       [0] ./pages/cards/card-detail/card-detail.component.html 286 bytes {0} [built]
Child app/components/card/card.component.css:
        + 1 hidden modules
Child app/components/card-info/card-info.component.css:
        + 1 hidden modules
Child app/components/num-pad/num-pad.component.css:
        + 1 hidden modules
Child app/pages/card-adse/card-adse.component.css:
       [0] ./pages/card-adse/card-adse.component.css 254 bytes {0} [built]
Child app/components/side-drawer-page/side-drawer-page.component.css:
        + 1 hidden modules
Child app/pages/card-rnu/card-rnu.component.css:
       [0] ./pages/card-rnu/card-rnu.component.css 256 bytes {0} [built]
Child app/pages/card-rentev/card-rentev.component.css:
       [0] ./pages/card-rentev/card-rentev.component.css 254 bytes {0} [built]
Child app/pages/home/home.component.css:
       [0] ./pages/home/home.component.css 127 bytes {0} [built]
Child app/pages/home/settings/settings.component.css:
       [0] ./pages/home/settings/settings.component.css 19 bytes {0} [built]
Child app/pages/home/about/about.component.css:
       [0] ./pages/home/about/about.component.css 19 bytes {0} [built]
Child app/pages/pin/pin.component.css:
       [0] ./pages/pin/pin.component.css 225 bytes {0} [built]
Child app/pages/mudar-pin/mudar-pin.component.css:
       [0] ./pages/mudar-pin/mudar-pin.component.css 296 bytes {0} [built]
Child app/pages/login/login.component.css:
       [0] ./pages/login/login.component.css 369 bytes {0} [built]
Child app/pages/login/login-chave-movel/login-chave-movel.component.css:
       [0] ./pages/login/login-chave-movel/login-chave-movel.component.css 19 bytes {0} [built]
Child app/pages/login/login-rnu/login-rnu.component.css:
       [0] ./pages/login/login-rnu/login-rnu.component.css 171 bytes {0} [built]
Child app/pages/login/login-otp/login-otp.component.css:
       [0] ./pages/login/login-otp/login-otp.component.css 165 bytes {0} [built]
Child app/pages/login/login-rnu-info/login-rnu-info.component.css:
       [0] ./pages/login/login-rnu-info/login-rnu-info.component.css 218 bytes {0} [built]
Child app/pages/card-vacinas/card-vacinas.component.css:
       [0] ./pages/card-vacinas/card-vacinas.component.css 197 bytes {0} [built]
Child app/pages/introduction/introduction.component.css:
       [0] ./pages/introduction/introduction.component.css 389 bytes {0} [built]
Child app/pages/error/error.component.css:
       [0] ./pages/error/error.component.css 114 bytes {0} [built]
Child app/pages/pem/pem-detail/pem-detail.component.css:
       [0] ./pages/pem/pem-detail/pem-detail.component.css 299 bytes {0} [built]
Child app/pages/pem/pem-list/pem-list.component.css:
       [0] ./pages/pem/pem-list/pem-list.component.css 271 bytes {0} [built]
Child app/pages/pem/show-qr/show-qr.component.css:
       [0] ./pages/pem/show-qr/show-qr.component.css 58 bytes {0} [built]
Child app/pages/cards/cards-available/cards-available.component.css:
       [0] ./pages/cards/cards-available/cards-available.component.css 79 bytes {0} [built]
Child app/pages/cards/card-list/card-list.component.css:
       [0] ./pages/cards/card-list/card-list.component.css 79 bytes {0} [built]
Child app/pages/cards/card-detail/card-detail.component.css:
       [0] ./pages/cards/card-detail/card-detail.component.css 127 bytes {0} [built]
Child worker:
                             Asset     Size  Chunks                    Chunk Names
    4d1cbb78cfe6a2d553fc.worker.js  3.43 MB       0  [emitted]  [big]  main
      [26] ../~/@ces-sec/jose/dist/index.js 549 bytes {0} [built]
      [38] ../~/@ces-sec/jose/dist/jwk.js 3.87 kB {0} [built]
      [67] ../~/tns-core-modules/xhr/xhr.js 11.4 kB {0} [built]
      [68] ../~/tns-core-modules/globals/globals.js 4.81 kB {0} [built]
      [69] ../~/@ces-sec/jose/dist/aes-key-wrap.js 5.83 kB {0} [built]
      [70] ../~/@ces-sec/jose/dist/jwe.js 14.1 kB {0} [built]
      [71] ../~/@ces-sec/jose/dist/jws.js 4.82 kB {0} [built]
     [136] ../~/@ces-sec/client/dist/index.js 357 bytes {0} [built]
     [137] ./providers/auth.worker.js 2.63 kB {0} [built]
     [138] ../~/@ces-sec/client/dist/client-auth.js 2.04 kB {0} [built]
     [139] ../~/@ces-sec/client/dist/client-comm.js 2.07 kB {0} [built]
     [140] ../~/@ces-sec/client/dist/client-other.js 827 bytes {0} [built]
     [141] ../~/@ces-sec/client/dist/client-telemetry.js 1.09 kB {0} [built]
     [233] ../~/tns-core-modules/console/console.js 13.4 kB {0} [built]
     [240] ../~/tns-core-modules/globals/decorators.js 1.28 kB {0} [built]
        + 259 hidden modules
Child worker:
                             Asset     Size  Chunks                    Chunk Names
    4110cc9e1a4660dd6b0e.worker.js  3.43 MB       0  [emitted]  [big]  main
      [26] ../~/@ces-sec/jose/dist/index.js 549 bytes {0} [built]
      [38] ../~/@ces-sec/jose/dist/jwk.js 3.87 kB {0} [built]
      [67] ../~/tns-core-modules/xhr/xhr.js 11.4 kB {0} [built]
      [68] ../~/tns-core-modules/globals/globals.js 4.81 kB {0} [built]
      [69] ../~/@ces-sec/jose/dist/aes-key-wrap.js 5.83 kB {0} [built]
      [70] ../~/@ces-sec/jose/dist/jwe.js 14.1 kB {0} [built]
      [71] ../~/@ces-sec/jose/dist/jws.js 4.82 kB {0} [built]
     [136] ../~/@ces-sec/client/dist/index.js 357 bytes {0} [built]
     [137] ./providers/common.worker.js 2.81 kB {0} [built]
     [138] ../~/@ces-sec/client/dist/client-auth.js 2.04 kB {0} [built]
     [139] ../~/@ces-sec/client/dist/client-comm.js 2.07 kB {0} [built]
     [140] ../~/@ces-sec/client/dist/client-other.js 827 bytes {0} [built]
     [141] ../~/@ces-sec/client/dist/client-telemetry.js 1.09 kB {0} [built]
     [233] ../~/tns-core-modules/console/console.js 13.4 kB {0} [built]
     [240] ../~/tns-core-modules/globals/decorators.js 1.28 kB {0} [built]
        + 259 hidden modules
Child worker:
                             Asset     Size  Chunks                    Chunk Names
    2f5a5c63f4cdb16149e0.worker.js  3.22 MB       0  [emitted]  [big]  main
       [6] ../~/tns-core-modules/file-system/file-system.js 19.5 kB {0} [built]
      [12] ../~/tns-core-modules/platform/platform.android.js 5.75 kB {0} [built]
      [31] ../~/@ces-sec/jose/dist/jwk.js 3.87 kB {0} [built]
      [55] ../~/tns-core-modules/xhr/xhr.js 11.4 kB {0} [built]
      [56] ../~/tns-core-modules/globals/globals.js 4.81 kB {0} [built]
      [59] ../~/@ces-sec/jose/dist/jws.js 4.82 kB {0} [built]
      [60] ../~/@ces-sec/jose/dist/util.js 1.24 kB {0} [built]
      [94] ../~/tns-core-modules/fetch/fetch.js 10.2 kB {0} [built]
      [96] ../~/tns-core-modules/timer/timer.android.js 1.86 kB {0} [built]
     [104] ../~/tns-core-modules/ui/dialogs/dialogs.android.js 12.1 kB {0} [built]
     [119] ../~/@ces-sec/jose/dist/index.js 549 bytes {0} [built]
     [120] ./providers/storage.worker.js 8.47 kB {0} [built]
     [192] ../~/tns-core-modules/console/console.js 13.4 kB {0} [built]
     [198] ../~/tns-core-modules/file-system/file-system-access.android.js 13 kB {0} [built]
     [199] ../~/tns-core-modules/globals/decorators.js 1.28 kB {0} [built]
        + 217 hidden modules
Child extract-text-webpack-plugin:
       [0] ../~/nativescript-css-loader/lib/css-base.js 1.51 kB {0} [built]
       [1] ../~/resolve-url-loader?{"silent":true,"absolute":false,"sourceMap":false,"fail":false,"keepQuery":false,"debug":false,"root":null}!../~/nativescript-css-loader?{"minimize":false}!../~/nativescript-dev-webpack/platform-css-loader.js!./app.android.css 14.5 kB {0} [built]
Running tns run...
Executing before-prepare hook from /Users/danielgek/spms/Ces/hooks/before-prepare/nativescript-dev-android-snapshot.js
Executing before-prepare hook from /Users/danielgek/spms/Ces/hooks/before-prepare/nativescript-dev-sass.js
Executing before-prepare hook from /Users/danielgek/spms/Ces/hooks/before-prepare/nativescript-dev-typescript.js
Preparing project...

:config phase:  createDefaultIncludeFiles

:config phase:  addAarDependencies
        +adding dependency: /Users/danielgek/spms/Ces/platforms/android/libs/aar/Common-2017.1.605-dev-release.aar
        +adding dependency: /Users/danielgek/spms/Ces/platforms/android/libs/aar/Data-2017.1.605-dev-release.aar
        +adding dependency: /Users/danielgek/spms/Ces/platforms/android/libs/aar/List-2017.1.605-dev-release.aar
        +adding dependency: /Users/danielgek/spms/Ces/platforms/android/libs/aar/nativescript-datetimepicker-release.aar
        +adding dependency: /Users/danielgek/spms/Ces/platforms/android/libs/aar/Primitives-2017.1.605-dev-release.aar
        +adding dependency: /Users/danielgek/spms/Ces/platforms/android/libs/aar/widgets-release.aar
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
Incremental java compilation is an incubating feature.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_3qtn1ri0vvfsv1hu9hid3ix1o.run(/Users/danielgek/spms/Ces/platforms/android/build-tools/android-static-binding-generator/build.gradle:126)
:asbg:clean UP-TO-DATE
:deleteMetadata
:deleteFlavors
:deleteConfigurations UP-TO-DATE
:deleteGeneratedBindings UP-TO-DATE
:clean

BUILD SUCCESSFUL

Total time: 4.73 secs
Successfully prepared plugin nativescript-angular for android.
Successfully prepared plugin nativescript-intl for android.
Successfully prepared plugin nativescript-angular-snapshot for android.
Successfully prepared plugin nativescript-appavailability for android.
Successfully prepared plugin nativescript-calendar for android.
Successfully prepared plugin nativescript-cardview for android.
Successfully prepared plugin nativescript-carousel for android.
Successfully prepared plugin nativescript-feedback for android.
Successfully prepared plugin nativescript-fonticon for android.
Successfully prepared plugin nativescript-iqkeyboardmanager for android.
Successfully prepared plugin nativescript-pager for android.
Successfully prepared plugin nativescript-secure-storage for android.
Successfully prepared plugin nativescript-telerik-ui for android.
Successfully prepared plugin nativescript-theme-core for android.
Successfully prepared plugin nativescript-timedatepicker for android.
Successfully prepared plugin nativescript-trace-raven for android.
Successfully prepared plugin nativescript-appversion for android.
Successfully prepared plugin nativescript-orientation for android.
Successfully prepared plugin nativescript-dom for android.
Successfully prepared plugin nativescript-globalevents for android.
Successfully prepared plugin nativescript-unit-test-runner for android.
Successfully prepared plugin tns-core-modules for android.
Successfully prepared plugin tns-core-modules-widgets for android.
Project successfully prepared (android)
Executing after-prepare hook from /Users/danielgek/spms/Ces/hooks/after-prepare/nativescript-dev-android-snapshot.js
Executing after-prepare hook from /Users/danielgek/spms/Ces/hooks/after-prepare/nativescript-dev-sass.js
All SASS source files removed from app package
Executing after-prepare hook from /Users/danielgek/spms/Ces/hooks/after-prepare/nativescript-unit-test-runner.js
Searching for devices...
Building project...

:config phase:  createDefaultIncludeFiles
        +found plugins: nativescript-angular-snapshot
Renaming plugin directory to flavor name: /Users/danielgek/spms/Ces/platforms/android/src/nativescript-angular-snapshot -> /Users/danielgek/spms/Ces/platforms/android/src/F0
        +found plugins: nativescript-calendar
         + creating include.gradle file for /Users/danielgek/spms/Ces/platforms/android/configurations/nativescript-calendar
Renaming plugin directory to flavor name: /Users/danielgek/spms/Ces/platforms/android/src/nativescript-calendar -> /Users/danielgek/spms/Ces/platforms/android/src/F1
        +found plugins: nativescript-cardview
Renaming plugin directory to flavor name: /Users/danielgek/spms/Ces/platforms/android/src/nativescript-cardview -> /Users/danielgek/spms/Ces/platforms/android/src/F2
        +found plugins: nativescript-carousel
Renaming plugin directory to flavor name: /Users/danielgek/spms/Ces/platforms/android/src/nativescript-carousel -> /Users/danielgek/spms/Ces/platforms/android/src/F3
        +found plugins: nativescript-feedback
Renaming plugin directory to flavor name: /Users/danielgek/spms/Ces/platforms/android/src/nativescript-feedback -> /Users/danielgek/spms/Ces/platforms/android/src/F4
        +found plugins: nativescript-pager
Renaming plugin directory to flavor name: /Users/danielgek/spms/Ces/platforms/android/src/nativescript-pager -> /Users/danielgek/spms/Ces/platforms/android/src/F5
        +found plugins: nativescript-secure-storage
Renaming plugin directory to flavor name: /Users/danielgek/spms/Ces/platforms/android/src/nativescript-secure-storage -> /Users/danielgek/spms/Ces/platforms/android/src/F6
        +found plugins: nativescript-telerik-ui
Renaming plugin directory to flavor name: /Users/danielgek/spms/Ces/platforms/android/src/nativescript-telerik-ui -> /Users/danielgek/spms/Ces/platforms/android/src/F7
        +found plugins: nativescript-timedatepicker
         + creating include.gradle file for /Users/danielgek/spms/Ces/platforms/android/configurations/nativescript-timedatepicker
Renaming plugin directory to flavor name: /Users/danielgek/spms/Ces/platforms/android/src/nativescript-timedatepicker -> /Users/danielgek/spms/Ces/platforms/android/src/F8
        +found plugins: tns-core-modules-widgets
         + creating include.gradle file for /Users/danielgek/spms/Ces/platforms/android/configurations/tns-core-modules-widgets
Renaming plugin directory to flavor name: /Users/danielgek/spms/Ces/platforms/android/src/tns-core-modules-widgets -> /Users/danielgek/spms/Ces/platforms/android/src/F9

:config phase:  createPluginsConfigFile
         Creating product flavors include.gradle file in /Users/danielgek/spms/Ces/platforms/android/configurations folder...

:config phase:  pluginExtend
        +applying configuration from: /Users/danielgek/spms/Ces/platforms/android/configurations/include.gradle
        +applying configuration from: /Users/danielgek/spms/Ces/platforms/android/configurations/nativescript-angular-snapshot/include.gradle
        +applying configuration from: /Users/danielgek/spms/Ces/platforms/android/configurations/nativescript-calendar/include.gradle
        +applying configuration from: /Users/danielgek/spms/Ces/platforms/android/configurations/nativescript-cardview/include.gradle
        +applying configuration from: /Users/danielgek/spms/Ces/platforms/android/configurations/nativescript-carousel/include.gradle
        +applying configuration from: /Users/danielgek/spms/Ces/platforms/android/configurations/nativescript-feedback/include.gradle
        +applying configuration from: /Users/danielgek/spms/Ces/platforms/android/configurations/nativescript-pager/include.gradle
        +applying configuration from: /Users/danielgek/spms/Ces/platforms/android/configurations/nativescript-secure-storage/include.gradle
        +applying configuration from: /Users/danielgek/spms/Ces/platforms/android/configurations/nativescript-telerik-ui/include.gradle
        +applying configuration from: /Users/danielgek/spms/Ces/platforms/android/configurations/nativescript-timedatepicker/include.gradle
        +applying configuration from: /Users/danielgek/spms/Ces/platforms/android/configurations/tns-core-modules-widgets/include.gradle

:config phase:  addAarDependencies
        +adding dependency: /Users/danielgek/spms/Ces/platforms/android/libs/aar/Common-2017.1.605-dev-release.aar
        +adding dependency: /Users/danielgek/spms/Ces/platforms/android/libs/aar/Data-2017.1.605-dev-release.aar
        +adding dependency: /Users/danielgek/spms/Ces/platforms/android/libs/aar/List-2017.1.605-dev-release.aar
        +adding dependency: /Users/danielgek/spms/Ces/platforms/android/libs/aar/nativescript-datetimepicker-release.aar
        +adding dependency: /Users/danielgek/spms/Ces/platforms/android/libs/aar/Primitives-2017.1.605-dev-release.aar
        +adding dependency: /Users/danielgek/spms/Ces/platforms/android/libs/aar/widgets-release.aar
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
Incremental java compilation is an incubating feature.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_3qtn1ri0vvfsv1hu9hid3ix1o.run(/Users/danielgek/spms/Ces/platforms/android/build-tools/android-static-binding-generator/build.gradle:126)
:preBuild UP-TO-DATE
:preF0F1F2F3F4F5F6F7F8F9DebugBuild UP-TO-DATE
:checkF0F1F2F3F4F5F6F7F8F9DebugManifest
:preF0F1F2F3F4F5F6F7F8F9ReleaseBuild UP-TO-DATE
:prepareCesRuntimeUnspecifiedLibrary
:prepareComAndroidSupportAnimatedVectorDrawable2530Library
:prepareComAndroidSupportAppcompatV72530Library
:prepareComAndroidSupportCardviewV72530Library
:prepareComAndroidSupportDesign2530Library
:prepareComAndroidSupportRecyclerviewV72530Library
:prepareComAndroidSupportSupportCompat2530Library
:prepareComAndroidSupportSupportCoreUi2530Library
:prepareComAndroidSupportSupportCoreUtils2530Library
:prepareComAndroidSupportSupportFragment2530Library
:prepareComAndroidSupportSupportMediaCompat2530Library
:prepareComAndroidSupportSupportV42530Library
:prepareComAndroidSupportSupportVectorDrawable2530Library
:prepareComAndroidSupportTransition2530Library
:prepareComEftimoffAndroidViewpagerTransformers101Library
:prepareComFacebookConcealConceal113Library
:prepareComOrhanobutHawk201Library
:prepareComRomandanylykPageindicatorview012Library
:prepareComTapadooAndroidAlerter106Library
:prepareCommon20171605DevReleaseLibrary
:prepareData20171605DevReleaseLibrary
:prepareList20171605DevReleaseLibrary
:prepareNativescriptDatetimepickerReleaseLibrary
:preparePrimitives20171605DevReleaseLibrary
:prepareWidgetsReleaseLibrary
:prepareF0F1F2F3F4F5F6F7F8F9DebugDependencies
:compileF0F1F2F3F4F5F6F7F8F9DebugAidl
:compileF0F1F2F3F4F5F6F7F8F9DebugRenderscript
:generateF0F1F2F3F4F5F6F7F8F9DebugBuildConfig
:cleanLocalAarFiles
:ensureMetadataOutDir
:collectAllJars
:setProperties
:generateTypescriptDefinitions SKIPPED
:copyTypings SKIPPED
:asbg:generateInterfaceNamesList
:asbg:traverseJsFiles
:asbg:runAstParser
Running full build
finished with reading lines with js files
Warning: there already is an extend called com.tns.FragmentClass.
Warning: The static binding generator will generate extend from:4d1cbb78cfe6a2d553fc.worker.js implementation
Warning: there already is an extend called com.tns.FragmentClass.
Warning: The static binding generator will generate extend from:2f5a5c63f4cdb16149e0.worker.js implementation
Warning: there already is an extend called com.tns.FragmentClass.
Warning: The static binding generator will generate extend from:vendor.js implementation
:asbg:generateBindings
Exception in thread "main" java.io.IOException: File already exists. This may lead to undesired behavior.
Please change the name of one of the extended classes.
/Users/danielgek/spms/Ces/platforms/android/src/main/java/com/tns/FragmentClass.java
        at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:59)
        at org.nativescript.staticbindinggenerator.Main.main(Main.java:15)
:asbg:generateBindings FAILED

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/danielgek/spms/Ces/platforms/android/build-tools/android-static-binding-generator/build.gradle' line: 251

* What went wrong:
Execution failed for task ':asbg:generateBindings'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 1 mins 0.932 secs
Multiple errors were thrown:
Command ./gradlew failed with exit code 1

if test needed, i can test with this app, thanks

@danielgek danielgek changed the title problem with webpack and workers on android build Problem with webpack and workers on android build Jun 5, 2017
@danielgek
Copy link
Author

danielgek commented Jun 6, 2017

@sis0k0 if you need, there is a test project here

is this the right place or should i move the issue to the android runtime?

@sis0k0
Copy link
Contributor

sis0k0 commented Jun 6, 2017

@danielgek, thanks. I'll take a look as soon as possible :).

@sis0k0
Copy link
Contributor

sis0k0 commented Jun 8, 2017

Ok, I've got bad news and good news.
The bad news - this is definitely an issue when the same code (tns-core-modules) exists twice. You can track the progress here: NativeScript/android#778

The good news - you don't really need to import globals in your worker. The only thing you are using from tns-core-modules is the console. You can either provide some custom implementation for the console, or you could just use the postMessage method and log on the main thread. Here's an example:

// worker.ts

declare function postMessage(message: any, targetOrigin?: string, transfer?: any[]): void;

onmessage = msg => {
    switch (msg.data.action) {
        case 'init':
            break;
        case 'encode':
            postMessage({ resultType: 'encode' });
            break;
        case 'decode':
            postMessage({ resultType: 'decode' });
            break;
        default:
            postMessage({ error: `Action not implemented common worker: ${}`});
            break;
    }
};

onerror = error => {
    postMessage({ error: 'on common worker error ' + error});
};
// app.component.ts
...
export class AppComponent {
    constructor(){
        let worker;

        if (global.TNS_WEBPACK) {
            const workerTemp = require('worker-loader!./worker.js');
            if (typeof workerTemp === 'function') {
                worker = workerTemp();
            }
            else {
                worker = workerTemp;
            }
        } else {
            worker = new Worker('./worker');
        }

        worker.onmessage = msg => console.dir(msg);
        worker.postMessage({ action: 'encode' });
    }
 }
...

@sis0k0 sis0k0 closed this as completed Jun 8, 2017
@danielgek
Copy link
Author

@sis0k0 thanks for your time, i will keep track on the other issue, and yes i don't need use console in the worker so i will just get rid of it ;)

@danielgek
Copy link
Author

@sis0k0 actually i will not be able to use this fix, because i'm using 'file-system' in the worker, so need to wait more for the fix on the android-runtime

@edoardocavazza
Copy link

Hi @danielgek, I have the same problem :( Have you found any workaround?

@danielgek
Copy link
Author

@edoardocavazza not yet, i haven't touched this again.
i'm waiting for the next nativescript version that i think it has a fix for this, can you confirm @sis0k0

@lukegeaves-ordapad
Copy link

I had the same error as the OP, thanks to your comments I worked out my issue.
Not sure how or why, but found duplicate calls to tns-core-modules in my webpack.config.js file:

modules: [
resolve(__dirname, "node_modules/tns-core-modules"),
resolve(__dirname, "node_modules"),
"node_modules/tns-core-modules",
"node_modules",
],

Removing the first resolve fixed my build issues 😄

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants