0

The question is a little more complicated than the title suggests, so allow me to elaborate. I have a project that is split into two repositories. The both use Google Closure for dependency management and compilation. I need to deliver a compiled version of project A to project B. Project B does advanced optimizations, so project A must be whitespace only. The problem is that I can't find a way to satisfy all my requirements for compiled A, which are:

  • It must be ordered by dependency
  • There can be no goog base code, i.e., var goog=goog||{}...
  • Similarly, there can be no goog.provides or goog.requires
  • It must be whitespace-only compiled

So far I've tried:

  • Closurebuilder.py
    • pros: can be whitespace only
    • problem: Has base code; getting duplicate namespace issues
  • Compiler.jar
    • problem: whitespace-only mode keeps goog.provides and requires in
    • problem: any optimizations of project A break project B

Has anyone made a similar setup work?

Chad Killingsworth
  • 14,360
  • 2
  • 34
  • 57
ian
  • 168
  • 1
  • 1
  • 7
  • Is there a particular reason why the source from project A can't be included in the closurebuilder run of project B? That's the typical way such cases are handled and then should then you shouldn't have the goog.require/provide issues. – Chad Killingsworth Dec 07 '12 at 20:12
  • Project A comes to B via npm+github, and it is beneficial to shrink A to one file to save time. That's why B can't (well, shouldn't) receive A's source code. I solved it by getting the dependencies from closurebuilder.py and simply concatenating them together into one file. It gets shipped to a built repo, where B can pick it up via npm, and it gets run through a closure script (that adv. optimizes it and splits it into modules). Thanks for your suggestions. – ian Dec 13 '12 at 22:40

1 Answers1

0

I solved it by getting the dependencies from closurebuilder.py and simply concatenating them together, in order, into one file. It gets shipped to a built repo, where B can pick it up via npm, and it gets run through a closure script (that adv. optimizes it and splits it into modules).

ian
  • 168
  • 1
  • 1
  • 7