bolinfest / plovr

plovr: a Closure build tool
78 stars 49 forks source link

possible to compile plovr w/ latest closure-compiler? #79

Closed jmcmichael closed 9 years ago

jmcmichael commented 9 years ago

The current version of plovr uses an older version of the closure compiler which does not support the 'angular-pass' option. This makes my production workflow more complex than it needs to be, so I'd really like to have the latest closure compiler included with plovr - is this possible to do as part of a build step for plovr, or is upgrading the compiler version a more complex job than that?

nicks commented 9 years ago

AFAIK, the latest version of Plovr uses a version of closure-compiler that's only a few weeks old.

AngularPass looks like it's there to me: https://github.com/bolinfest/plovr/blob/master/closure/closure-compiler/src/com/google/javascript/jscomp/AngularPass.java

what am i missing?

jmcmichael commented 9 years ago

plovr is throwing these errors:

Error: WARNING: UNUSED OPTION "angular-pass" in /Users/jmcmichael/vc/civic-workflow-2/plovr/config-build.json. See http://plovr.com/options.html for the complete list of options.
WARNING: UNUSED OPTION "manage-closure-dependencies" in /Users/jmcmichael/vc/civic-workflow-2/plovr/config-build.json. See http://plovr.com/options.html for the complete list of options.
WARNING: UNUSED OPTION "generate-exports" in /Users/jmcmichael/vc/civic-workflow-2/plovr/config-build.json. See http://plovr.com/options.html for the complete list of options.

when using this config file:

{
  "id": "module-example",
  "mode": "ADVANCED",
  "angular-pass": true,
  "language-in": "ECMASCRIPT5_STRICT",
  "inputs": [
    "../closure/library/base.js",
    "../app/js/app.js",
    "../app/states/first/first-controller.js",
    "../app/states/first/first-module.js",
    "../app/states/second/second-controller.js",
    "../app/states/second/second-module.js",
    "../app/states/third/one/one-controller.js",
    "../app/states/third/one/one-module.js",
    "../app/states/third/third-controller.js",
    "../app/states/third/third-module.js",
    "../app/states/third/two/two-controller.js",
    "../app/states/third/two/two-module.js",
    "../app/components/directives/version-directive.js",
    "../app/components/filters/check-filter.js",
    "../app/components/services/version-service.js"
  ],
  "externs": [
    "../closure/externs/angular-1.3.js",
    "../closure/externs/angular-ui-router.js"
  ],
  "manage-closure-dependencies": true,
  "generate-exports": true,
  "debug": true,
  "level": "DEFAULT",
  "pretty-print": true,
  "output-file": "../app/js/app.min.js",
  "output-charset": "UTF-8",
  "fingerprint": true,
  "experimental-compiler-options": {
    "languageIn": "ECMASCRIPT5"
  },
  "global-scope-name": "__plovr__"
}

I had originally assumed these errors were thrown by the compiler, but now that I look more closely it appears they are being thrown by plovr. Perhaps plovr isn't recognizing these, and discarding them before passing to the compiler?

nicks commented 9 years ago

ya, plovr and compiler options are different.

experimental-compiler-options is a "magic shim" where you can throw compiler options in there, and plovr will make a best-effort guess what compiler option you're trying to invoke. Maybe add angularPass there?

software-engineering commented 9 years ago

{ "id": "module-example", "path": "???", "mode": "SIMPLE", "level": "DEFAULT", "experimental-compiler-options": { "languageIn": "ECMASCRIPT5_STRICT", "angularPass": true, "generateExports": true, "removeUnusedPrototypePropertiesInExterns": false, "externExports": true, "removeUnusedPrototypeProperties": false }, "inputs": [ "../app/js/app.js" ], "externs": [ "../closure/externs/angular-1.3.js", "../closure/externs/angular-ui-router.js" ], "debug": false, "pretty-print": true, "output-file": "../app/js/app.min.js", "output-charset": "UTF-8" }

"path": "???" -> not used remove

No base.js this was included.

Have you used the closure dependency managment? https://developers.google.com/closure/library/docs/introduction

You only need the init file "../app/js/app.js"

Example app.js goog.provide('app'); goog.require('app.states.first.first-controller') ...

jmcmichael commented 9 years ago

Yes! Moving 'angular-pass' to 'angularPass' in experimental-compiler-options worked.

@software-engineering - I am working with zemirco/nghellostyle as a starting point and developing a new workflow to use with an existing codebase. Right now I'm working on refactoring it to use plovr instead of assembling a bunch of command line args for the complier, and switching from a Grunt-based workflow to Gulp.

I tried just providing the app.js file in 'inputs', but I get the error:

Error: Exception in thread "main" java.lang.RuntimeException: org.plovr.MissingProvideException: Missing provide for my.first.module in ../app/js/app.js

Perhaps the author of this repo hasn't specified module dependencies correctly? I am just getting started with closure and haven't gotten into the details of provide/require yet.