RC-Paves3-build / plovr

Automatically exported from code.google.com/p/plovr
0 stars 0 forks source link

Using a custom version of closure library can cause path naming conflicts with own files #55

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
We use the "closure-library" config attribute to point to a checked out version 
of the closure library. We also have a few files that mirror some closure files 
where we've overridden them or provided custom versions, for example:

/our-project/
    closure-library/
        ...
    our-stuff/
        dom/
            dom.js
            forms.js
        ui/
            dialog.js
            control.js

With the latest builds we get errors like this for any files we have in our own 
dirs that mirror the files in closure:

    JSC_DUPLICATE_INPUT. Duplicate input: /dom/dom.js at (unknown source) line (unknown line) : (unknown column)

If we switch to using the version of closure packaged with plovr, the problem 
goes away.

This works fine in the builds up to and including the sept release, the 
november release is the one that caused the issues for us. I just built the 
latest version from the repo and got a stacktrace instead of the above error:

Exception in thread "main" java.lang.IllegalArgumentException: duplicate key: 
/ui/control.js
    at com.google.common.base.Preconditions.checkArgument(Preconditions.java:115)
    at com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:72)
    at com.google.common.collect.ImmutableMap$Builder.fromEntryList(ImmutableMap.java:221)
    at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:207)
    at org.plovr.Manifest.getAllDependencies(Manifest.java:327)
    at org.plovr.Manifest.getInputsInCompilationOrder(Manifest.java:182)
    at org.plovr.ModuleConfig.partitionInputsIntoModules(ModuleConfig.java:221)
    at org.plovr.ModuleConfig.buildModulesUsingOption1(ModuleConfig.java:191)
    at org.plovr.ModuleConfig.getModules(ModuleConfig.java:186)
    at org.plovr.Manifest.getCompilerArguments(Manifest.java:171)
    at org.plovr.CompileRequestHandler.compile(CompileRequestHandler.java:94)
    at org.plovr.cli.BuildCommand.runCommandWithOptions(BuildCommand.java:52)
    at org.plovr.cli.BuildCommand.runCommandWithOptions(BuildCommand.java:25)
    at org.plovr.cli.AbstractCommandRunner.runCommand(AbstractCommandRunner.java:41)
    at org.plovr.cli.Command.execute(Command.java:45)
    at org.plovr.cli.Main.main(Main.java:43)

Original issue reported on code.google.com by adun...@wimm.com on 8 Dec 2011 at 9:31

GoogleCodeExporter commented 8 years ago
Hmm, I was afraid this might happen. I think I should fix things so that 
whether you use the closure-library option or not, the library should be served 
under /closure/goog/. This will likely simplify things in plovr, anyway.

Original comment by bolinf...@gmail.com on 9 Dec 2011 at 7:00

GoogleCodeExporter commented 8 years ago

Original comment by bolinf...@gmail.com on 9 Dec 2011 at 7:01

GoogleCodeExporter commented 8 years ago
I believe that I have fixed this with a combination of the following changes:

http://code.google.com/p/plovr/source/detail?r=8079d6d7fc2a419846f6f41462d999d5b
b059c4b
http://code.google.com/p/plovr/source/detail?r=c962fdacd79b369ebc73fe2fb5de782d3
1dbfc52

It would be a big help if you could build plovr from head and verify that this 
fixes this issue.

Original comment by bolinf...@gmail.com on 2 May 2012 at 3:27

GoogleCodeExporter commented 8 years ago
Works great, thanks for the fix, I did have some issues with our module 
declarations, on initial run I got this error:

Exception in thread "main" java.lang.NullPointerException
    at org.plovr.Manifest.buildDependenciesInternal(Manifest.java:295)
    at org.plovr.Manifest.buildDependencies(Manifest.java:280)
    at org.plovr.ModuleConfig.partitionInputsIntoModules(ModuleConfig.java:250)
    at org.plovr.ModuleConfig.buildModulesUsingOption1(ModuleConfig.java:192)
    at org.plovr.ModuleConfig.getModules(ModuleConfig.java:187)
    at org.plovr.Manifest.getCompilerArguments(Manifest.java:182)
    at org.plovr.CompileRequestHandler.compile(CompileRequestHandler.java:94)
    at org.plovr.cli.BuildCommand.runCommandWithOptions(BuildCommand.java:58)
    at org.plovr.cli.BuildCommand.runCommandWithOptions(BuildCommand.java:31)
    at org.plovr.cli.AbstractCommandRunner.runCommand(AbstractCommandRunner.java:41)
    at org.plovr.cli.Command.execute(Command.java:45)
    at org.plovr.cli.Main.mainWithExitCode(Main.java:56)
    at org.plovr.cli.Main.main(Main.java:30)

After some digging, it appeared that our inclusion of 
"closure-library/closure/goog/deps.js" as an 'input' was causing the error. We 
were including that for the third-party stuff (deferreds, specifically), 
getting rid of that seems to work fine.

Before removing the deps.js inclusion, I tried without modules and hit an issue 
with our use of the 'soy' namespace, but I converted the remaining usage to 
'goog.soy' instead, which from what I gather is what we should have been using 
to begin with?

After fixing the soy namespace and removing deps.js it appears to compile fine 
with and without modules.

Thanks for the bug fix, and thanks for the tool, it's indispensable for us.

-Andy

Original comment by adun...@wimm.com on 2 May 2012 at 4:51

GoogleCodeExporter commented 8 years ago
Well, that makes sense, I see that deps.js has been deprecated in 
closure-library head. And the file is empty.

-Andy

Original comment by adun...@wimm.com on 2 May 2012 at 4:52

GoogleCodeExporter commented 8 years ago
I'm using the latest closure-library-20120710-r2029 and the latest plovr 
released of 02/2012.  Use the closure-library options to use the latest 
closure-library version, but when I tried to run my web app I'm getting this 
error.
/templates/account.soy: ERROR - Missing provide for soy in 
/templates/account.soy

I don't have any modules defined and I'm fairly new in using plovr. Below is my 
plovr config file:L
{
    "id": "accountmgmt",
    "paths": ["src/main/webapp", "target/common"],
    "inputs": "src/main/webapp/js/main.js",
    "mode": "RAW",
    "level": "VERBOSE",
    "closure-library": "target/dependencies/closure-library-20120710-r2029/",
    "debug": true
}

Am I missing something, any help is very much appreciated.

Thank
Jun Victorio

Original comment by junvicto...@gmail.com on 10 Aug 2012 at 5:32

GoogleCodeExporter commented 8 years ago
Try adding 'closure-library/third_party/closure/goog/' to your 'paths' 
attribute. It's possible that plovr is looking for the soy template files even 
if you're not explicitly using them.

If that doesn't work also 'closure-templates/javascript/soyutils_usegoog.js' to 
your 'inputs', but try the above first as that might actually include code in 
your compiled output.

Original comment by andy.dun...@cloudcar.com on 10 Aug 2012 at 5:37