dart-archive / bazel

Bazel support for Dart projects [EXPERIMENTAL]
https://pub.dartlang.org/packages/dazel
33 stars 13 forks source link

Weird build error with a simple Angular2 application #69

Open jmesserly opened 7 years ago

jmesserly commented 7 years ago

From @zoechi on October 31, 2016 20:55

 (master) $ bazel build :dashboard_layout_demo
WARNING: Sandboxed execution is not supported on your system and thus hermeticity of actions cannot be guaranteed. See http://bazel.io/docs/bazel-user-manual.html#sandboxing for more information. You can turn off this warning via --ignore_unsupported_sandboxing.
INFO: Found 1 target...
ERROR: /home/zoechi/dart/bwu_ng_mdl/BUILD:31:1: Compiling with dart2js //:dashboard_layout_demo failed: process-wrapper failed: error executing command /home/zoechi/.cache/bazel/_bazel_zoechi/3e443aaa6a6cf1824cc4980f306f0a94/execroot/bwu_ng_mdl/_bin/process-wrapper -1 5 - - external/io_bazel_rules_dart/dart/build_rules/tools/dart2js_helper.sh ... (remaining 8 argument(s) skipped).
bazel-out/local-fastbuild/bin/dashboard_layout_demo.build/lib/demo/dashboard_layout/dashboard_layout_demo_app_component.dart:2:1:
Error: Library not found 'package:angular2_components/angular2_components.dart'.
import 'package:angular2_components/angular2_components.dart'
    show materialInputDirectives;

bazel-out/local-fastbuild/bin/dashboard_layout_demo.build/lib/demo/dashboard_layout/dashboard_layout_demo_app_component.dart:3:10:
Hint: Library 'package:angular2_components/angular2_components.dart' doesn't export a 'materialInputDirectives' declaration.
Try removing 'materialInputDirectives' from the 'show' clause.
    show materialInputDirectives;
         ^^^^^^^^^^^^^^^^^^^^^^^
bazel-out/local-fastbuild/bin/dashboard_layout_demo.build/lib/src/layout/drawer_button/drawer_button_component.dart:5:10:
Hint: Library 'package:angular2_components/angular2_components.dart' doesn't export a 'GlyphComponent' declaration.
Try removing 'GlyphComponent' from the 'show' clause.
    show GlyphComponent;
         ^^^^^^^^^^^^^^
bazel-out/local-fastbuild/bin/dashboard_layout_demo.build/lib/src/layout/navigation_link/navigation_link_component.dart:5:10:
Hint: Library 'package:angular2_components/angular2_components.dart' doesn't export a 'GlyphComponent' declaration.
Try removing 'GlyphComponent' from the 'show' clause.
    show GlyphComponent;
         ^^^^^^^^^^^^^^
bazel-out/local-fastbuild/bin/dashboard_layout_demo.build/web/dashboard_layout_demo.dart:
Warning: 
****************************************************************
* WARNING: dart:mirrors support in dart2js is experimental,
*          and not recommended.
*          This implementation of mirrors is incomplete,
*          and often greatly increases the size of the generated
*          JavaScript code.
*
* Your app imports dart:mirrors via:
*   dashboard_layout_demo.dart => package:angular2 => dart:mirrors
*
* You can disable this message by using the --enable-experimental-mirrors
* command-line flag.
*
* To learn what to do next, please visit:
*    http://dartlang.org/dart2js-reflection
****************************************************************

bazel-out/local-fastbuild/bin/dashboard_layout_demo.build/lib/demo/dashboard_layout/dashboard_layout_demo_app_component.dart:28:7:
Error: Not a compile-time constant.
      materialInputDirectives
      ^^^^^^^^^^^^^^^^^^^^^^^
bazel-out/local-fastbuild/bin/dashboard_layout_demo.build/lib/demo/dashboard_layout/dashboard_layout_demo_app_component.dart:28:7:
Error: Not a compile-time constant.
      materialInputDirectives
      ^^^^^^^^^^^^^^^^^^^^^^^
bazel-out/local-fastbuild/bin/dashboard_layout_demo.build/lib/src/layout/drawer_button/drawer_button_component.dart:10:39:
Error: Not a compile-time constant.
    directives: const <dynamic>[NgIf, GlyphComponent],
                                      ^^^^^^^^^^^^^^
bazel-out/local-fastbuild/bin/dashboard_layout_demo.build/lib/src/layout/drawer_button/drawer_button_component.dart:10:39:
Error: Not a compile-time constant.
    directives: const <dynamic>[NgIf, GlyphComponent],
                                      ^^^^^^^^^^^^^^
bazel-out/local-fastbuild/bin/dashboard_layout_demo.build/lib/src/layout/navigation_link/navigation_link_component.dart:13:7:
Error: Not a compile-time constant.
      GlyphComponent,
      ^^^^^^^^^^^^^^
bazel-out/local-fastbuild/bin/dashboard_layout_demo.build/lib/src/layout/navigation_link/navigation_link_component.dart:13:7:
Error: Not a compile-time constant.
      GlyphComponent,
      ^^^^^^^^^^^^^^
bazel-out/local-fastbuild/bin/dashboard_layout_demo.build/lib/demo/dashboard_layout/dashboard_layout_demo_app_component.dart:28:7:
Error: Not a compile-time constant.
      materialInputDirectives
      ^^^^^^^^^^^^^^^^^^^^^^^
bazel-out/local-fastbuild/bin/dashboard_layout_demo.build/lib/demo/dashboard_layout/dashboard_layout_demo_app_component.dart:28:7:
Error: Not a compile-time constant.
      materialInputDirectives
      ^^^^^^^^^^^^^^^^^^^^^^^
bazel-out/local-fastbuild/bin/dashboard_layout_demo.build/lib/src/layout/drawer_button/drawer_button_component.dart:10:39:
Error: Not a compile-time constant.
    directives: const <dynamic>[NgIf, GlyphComponent],
                                      ^^^^^^^^^^^^^^
bazel-out/local-fastbuild/bin/dashboard_layout_demo.build/lib/src/layout/drawer_button/drawer_button_component.dart:10:39:
Error: Not a compile-time constant.
    directives: const <dynamic>[NgIf, GlyphComponent],
                                      ^^^^^^^^^^^^^^
bazel-out/local-fastbuild/bin/dashboard_layout_demo.build/lib/src/layout/navigation_link/navigation_link_component.dart:13:7:
Error: Not a compile-time constant.
      GlyphComponent,
      ^^^^^^^^^^^^^^
bazel-out/local-fastbuild/bin/dashboard_layout_demo.build/lib/src/layout/navigation_link/navigation_link_component.dart:13:7:
Error: Not a compile-time constant.
      GlyphComponent,
      ^^^^^^^^^^^^^^
Hint: 3 warning(s) suppressed in package:bwu_ng_mdl.
Hint: 4 hint(s) suppressed in package:angular2.
Error: Compilation failed.
Target //:dashboard_layout_demo failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 9.392s, Critical Path: 8.76s

pub build output

 (master) $ pub build
Loading source assets... 
Loading angular2/transform/codegen, sass, test/pub_serve and dart_to_js_script_rewriter transformers... 
Loading angular2 and angular2/transform/reflection_remover transformers... (4.8s)
Building bwu_ng_mdl... (14.0s)
[Info from Dart2JS]:
Compiling bwu_ng_mdl|web/dashboard_layout_demo.dart...
[Warning from Dart2JS]:
web/dashboard_layout_demo.dart:1:139:
Library 'package:angular2/platform/browser_static.dart' doesn't export a 'initReflector' declaration.
Try removing 'initReflector' from the 'show' clause.
import 'dashboard_layout_demo.template.dart' as ngStaticInit;import 'package:angular2/platform/browser_static.dart' show bootstrapStatic, initReflector;import 'dashboard_layout_demo.template.dart' as ngStaticInit;
                                                                                                                                          ^^^^^^^^^^^^^
[Warning from Dart2JS on bwu_ng_mdl|web/dashboard_layout_demo.dart]:
packages/angular2_components/src/utils/color/color.dart:102:3:
The class 'Color' overrides 'operator==', but not 'get hashCode'.
  bool operator ==(other) => other is Color && other.rgbString == rgbString;
  ^^^^^^^^^^^^^^^^^^^^^^^
[Dart2JS on bwu_ng_mdl|web/dashboard_layout_demo.dart]:
View the dumped .info.json file at https://dart-lang.github.io/dump-info-visualizer
[Info from Dart2JS]:
Took 0:00:16.182980 to compile bwu_ng_mdl|web/dashboard_layout_demo.dart.
Built 1419 files to "build".

The The class 'Color' overrides 'operator==', but not 'get hashCode'. error is already fixed in angular2_components in master AFAIK.

Dart VM version: 1.21.0-edge.d62e41fcea8fee5aa69f0875eb4f151abfdcc74e (Mon Oct 31 09:15:30 2016) on "linux_x64"

Copied from original issue: dart-lang/sdk#27707

jmesserly commented 7 years ago

Hi, I'm not sure if this is DDC related? The message says "Warning from Dart2JS" and the bazel build also seems to be using dart2js "WARNING: dart:mirrors support in dart2js is experimental"? Where is DDC being invoked?

jmesserly commented 7 years ago

I think this is probably a build/bazelify issue so moving to that repo

natebosch commented 7 years ago

Angular2 (or anything with transformers/codegen) aren't supported yet in bazelify.