OK. I know I'm doing something incredibly stupid, but... I still cannot get
pub serve, the simple web server built into Dart's Pub package manager, to serve up Polymer Element resources.I do not believe that I am doing any crazy though. I have a very simple, web-only application. The
pubspec.yaml contains only the latest versions of Polymer and Polymer Elements:name: flex dependencies: polymer: any polymer_elements: any dev_dependencies: unittest: anyI see no errors upon starting
pub serve (though it does take a good 10 seconds to spin up). If I curl for similar resources, then everything works OK:➜ dart git:(master) ✗ curl http://localhost:8080/packages/polymer_expressions/expression.dart // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. ...But if I
curl for Polymer Elements resources, I get nothing back:➜ dart git:(master) ✗ curl http://localhost:8080/packages/polymer_elements/polymer_elements.dartNothing. The connection just hangs.
Pub's server can be run in verbose mode with
pub serve -v (there are verbosity levels, but I just ask for everything here). With that, I find that the regular, working requests look like:FINE: BarbackServer GET /packages/polymer_expressions/expression.dart
| Loading polymer_expressions|lib/expression.dart
MSG : GET /packages/polymer_expressions/expression.dart → polymer_expressions|lib/expression.dart
FINE: BarbackServer GET /packages/polymer_expressions/expression.dart
| Served polymer_expressions|lib/expression.dart
Whereas the failing request look like:FINE: BarbackServer GET /packages/polymer_elements/polymer_elements.dart
| Loading polymer_elements|lib/polymer_elements.dartSo the request is coming into the Pub server. It seems to parse it properly—the requests is for the lib/polymer_elements.dart file in the polymer_elements package. But then... nothing.So I try using the GitHub repository for Polymer Elements instead. Perhaps it hold some insights into my woes:
name: flex
dependencies:
polymer: any
polymer_elements:
git: https://github.com/ErikGrimes/polymer_elements
dev_dependencies:
unittest: anyBut trying a pub upgrade with that yields:➜ dart git:(master) ✗ pub upgrade Resolving dependencies......................... Incompatible dependencies on 'polymer_elements': - 'flex' depends on it from source git - 'polymer_ui_elements' depends on it from source hostedWhy on earth is Polymer Elements trying to pull in Polymer UI elements anyway.
I do the usual GitHub upstream dance and use my repository instead:
name: flex
dependencies:
polymer: any
polymer_elements:
git: https://github.com/eee-c/polymer_elements
dev_dependencies:
unittest: anyAnd before I realize my mistake, I pub upgrade and pub serve and find that I can now curl for Polymer Element resources:➜ dart git:(master) ✗ curl http://localhost:8080/packages/polymer_elements/polymer_elements.dart // needed as entry point for dartdoc generation /** * Polymer Elements */ library polymer_elements; // ...My mistake is pointing my
pubspec.yaml dependencies at my fork of Polymer Elements as it exists on GitHub, not as it exists locally. But at least I know a change in the code since then has affected things. A git diff --stat <SHA1> where <SHA1> points to a0717db12 (my last commit) reveals that there have been a lot of code changes in the meantime. I tend to doubt code changes are my problem here. Instead, I think the problem is in the changes to the project's pubspec.yaml:➜ polymer_elements git:(master) gd a0717db12 pubspec.yaml diff --git a/pubspec.yaml b/pubspec.yaml index 398337d..7df61fd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: polymer_elements -version: 0.0.13 +version: 0.1.2 authors: - Erik GrimesAnd indeed, if I remove the Polymer UI Elements dependencies from my local fork of Polymer Elements, then I can- Günter Zöchbauer @@ -11,8 +11,11 @@ documentation: http://erikgrimes.github.io/polymer_elements/docs/index.html environment: sdk: ">=1.0.0 <2.0.0" dependencies: - polymer: ">=0.9.0 <0.10.0" -# polymer_ui_elements: 0.0.13 + polymer: ">=0.9.2+3 <0.10.0" + polymer_ui_elements: ">=0.1.1 <0.2.0" +#dependency_overrides: +# polymer_ui_elements: +# path: ../polymer_ui_elements dev_dependencies: unittest: ">=0.9.0 <0.10.0" transformers:
pub upgrade without error and, more importantly, successfully curl after starting pub serve. In fact, I can now serve my flex-layout web page:<!DOCTYPE html>
<html lang="en">
<head>
<title>Flex Test</title>
<!-- Load component(s) -->
<link rel="import" href="/packages/polymer_elements/polymer_flex_layout/polymer_flex_layout.html">
<script type="application/dart">export 'package:polymer/init.dart';</script>
<script src="packages/browser/dart.js"></script>
</head>
<body>
<polymer-flex-layout isContainer>
<div>Left</div>
<div align=center flex>Main</div>
<div>Right</div>
</polymer-flex-layout>
</body>
</html>
And see the results in Dartium:
I suspect that my problems have to do with circular dependencies in Polymer Elements and Polymer UI Elements. I am still not certain that either needs to depend on the other. Regardless, pub serve probably ought to deal with this situation better. PRs and bug reports to come…




