| Summary: | We should pass ES5 flag to Closure compiler | ||
|---|---|---|---|
| Product: | [ECD] Orion | Reporter: | Mark Macdonald <mamacdon> |
| Component: | Releng | Assignee: | Mark Macdonald <mamacdon> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | ken_walker, mamacdon |
| Version: | 2.0 | ||
| Target Milestone: | 3.0 M1 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Mark Macdonald
Made the change: http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?id=8dbe7d608a1c8667acf54c8d we'll see how the nightly build fares. It didn't work. The minification broke. > updateHTML: > [copy] Copying 2 files to /shared/eclipse/e4/orion/I201303262230/plugins/org.eclipse.orion.client.ui/web/edit > [java] > [java] Tracing dependencies for: compare/compare > [java] js: "/shared/eclipse/e4/orion/requirejs/dist/r.js", line 10871: exception from uncaught JavaScript throw: Error: Error evaluating module "undefined" at location "undefined": > [java] InternalError: Cannot convert ECMASCRIPT5 to com.google.javascript.jscomp.CompilerOptions$LanguageMode > [java] fileName:undefined > [java] lineNumber: undefined > [java] http://requirejs.org/docs/errors.html#defineerror > [java] > [java] Minifying file: /opt/public/eclipse/e4/orion/I201303262230/optimization/./compare/built-compare.js > [java] Java Result: 3 The above trace and this thread [1] suggest that there's no way to set the closure compiler's language mode from a RequireJS build file. Reverted: http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?id=c16aabaa6c2e7c96f2bf5e88 [1] https://groups.google.com/forum/#!msg/requirejs/9f4sgewYnAw/G-oSqCz2DSEJ WONTFIXing this bug. I clearly didn't read the last post in the discussion thread. There is a way to obtain the value of the enum constant needed by the closure compiler. Trying another fix: http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?id=c09aea6b298f89d5f4eada47 Didn't work either. > updateHTML: > [length] /shared/eclipse/e4/orion/I201303272230/optimization/built-index.js does not exist > [copy] Copying 1 file to /shared/eclipse/e4/orion/I201303272230/plugins/org.eclipse.orion.client.ui/web > [java] js: "/shared/eclipse/e4/orion/requirejs/dist/r.js", line 10871: exception from uncaught JavaScript throw: Error: Error evaluating module "undefined" at location "undefined": > [java] Error: Build file /opt/public/eclipse/e4/orion/I201303272230/optimization/./orion.build.js is malformed: InternalError: Can't find method java.lang.Enum.valueOf(string). (/shared/eclipse/e4/orion/requirejs/dist/r.js#11938(eval)#1) > [java] fileName:undefined > [java] lineNumber: undefined > [java] http://requirejs.org/docs/errors.html#defineerror > [java] > [java] Java Result: 3 Let's try this again: http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?id=3b008b7edeb61886c4fdde72 I give up. Let's use Uglify. Closure compiler is a waste of time.
> updateHTML:
> [length] /shared/eclipse/e4/orion/I201303282230/optimization/edit/built-edit.js does not exist
> [copy] Copying 1 file to /shared/eclipse/e4/orion/I201303282230/plugins/org.eclipse.orion.client.ui/web/edit
> [java] js: "/shared/eclipse/e4/orion/requirejs/dist/r.js", line 10871: exception from uncaught JavaScript throw: Error: Error evaluating module "undefined" at location "undefined":
> [java] Error: Build file /opt/public/eclipse/e4/orion/I201303282230/optimization/./orion.build.js is malformed: InternalError: Java class "com.google.javascript.jscomp.CompilerOptions$LanguageMode" has no public instance field or method named "fromString". (/shared/eclipse/e4/orion/requirejs/dist/r.js#11938(eval)#1)
> [java] fileName:undefined
> [java] lineNumber: undefined
> [java] http://requirejs.org/docs/errors.html#defineerror
> [java]
> [java] Java Result: 3
Trying again. Not sure why, but I can't seem to invoke the single-parameter enum #valueOf(String) method on the CompilerOptions enum, so trying the #valueOf(Class, String) version instead. http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?id=c3731a32fd396e3bef5e553da96a42dd4e5748f5 OK, I think that last change finally worked: minification succeeded in the most recent build. Opened bug 404670 about removing the temporary changes made to the JS validator to work around the old behavior. Closure is apparently now set to "ES5" mode, but despite that, it's still choking on the use of ES3 "future reserved" words like `char` which should not be reserved in ES5.
> [java] Tracing dependencies for: orion/editor/edit
> [java] Minifying file: /shared/eclipse/e4/orion/I201304012230/built-js/built-editor-amd.min.js
> [java] Apr 1, 2013 10:34:55 PM com.google.javascript.jscomp.LoggerErrorManager println
> [java] SEVERE: /shared/eclipse/e4/orion/I201304012230/built-js/built-editor-amd.min.js:14024: ERROR - Parse error. missing variable name
> [java] var char = buffer.charAt(offset--);
> [java] ^
I want to believe that [1] describes the problem and that we are simply using an outdated version of Closure. But that is probably too optimistic.
(In reply to comment #9) [1] http://code.google.com/p/closure-compiler/issues/detail?id=357 I misread the Orion build logs. The Orion IDE *was* sucessfully compiled by Closure using the fix from Comment 7, even after I reintroduced `char` as a variable name in an input file. However, the Closure compiler gets invoked by several different build tasks. The failures that remain are from the tasks that compile the standalone minified Orion Editor. Those tasks use different RequireJS build files, to which I neglected to add the "langageIn" flag. I just have to make the corresponding changes on those build files, and we should be done here. http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?id=6a4e330bf1c7cc9a5006f684 All build files changed. Closing this bug (hopefully forever). |