I think you forgot to include the log4j JAR - this change fails to compile:

compile:
[javac] Compiling 474 source files to /Users/maxcarlson/openlaszlo/trunk2/WEB-INF/lps/server/build [javac] /Users/maxcarlson/openlaszlo/trunk2/WEB-INF/lps/server/src/org/openlaszlo/cache/Cache.java:1043: cannot find symbol
    [javac] symbol  : method isTraceEnabled()
    [javac] location: class org.apache.log4j.Logger
    [javac]             if (mLockLogger.isTraceEnabled()) {
    [javac]                            ^
...

On 10/4/10 5:35 PM, Henry Minsky wrote:
Change hqm-20101004-JXi by [email protected] on 2010-10-04 19:14:13 EDT
     in /Users/hqm/openlaszlo/trunk-clean
     for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: fix for "lzc --runtime=swf10 does not print compiler warnings if Flex 
back-end has an error"

New Features:

Bugs Fixed: LPP-9400

Technical Reviewer: ptw
QA Reviewer: max
Doc Reviewer: (pending)

Documentation:

Release Notes:

Overview:


Details:

CompilationError.java:
Main.java:
It turns out that a CompilationError has a
vector of auxiliary errors that it owns, which are used to record
compilation warnings. And when Compiler.compile catches a fatal error,
it helpfully attaches any accumlated warnings to it and throws it
again.

I added a toPlainText() method CompilationError which returns a
string made from the main error message plus the warnings (analogous
to the existing CompilationError.toXML() method that is used to
display warnings in the dev-console)  lzc (Main.java) calls this
method when it catches a CompilationError from the compiler.


cm/CompilationManager.java:
cache/Cache.java:
sc/SWF9External.java:
compiler/LibraryCompiler.java:
compiler/ObjectWriter.java:
compiler/DHTMLWriter.java:
compiler/SWFWriter.java:
compiler/FileResolver.java:
compiler/Compiler.java:
compiler/Main.java:
compiler/SWF9Writer.java:
compiler/CompilationError.java:
compiler/Parser.java:
compiler/CompilerMediaCache.java:

I discovered that a newer version of log4j has a "TRACE" level, which
is intended for finer grain logging. we have way too much info that
gets printed in mLogger.DEBUG level, making it much less useful for a
lot of debugging. I updated to a newer log4j jar file, and changed a
lot of the logger.debug() calls to logger.trace().

I made the flex compiler status output messages into mLogger.debug()
level, so now if you compile "lzc --runtime=swf10", you don't get all
the extraneous flex compiler command line debugging info. You but can
still view it by calling lzc -ldebug --runtime=swf10

"lzc -ltrace" will show all the stuff that debug level used to log



Tests:

compile this with lzc in swf10

<canvas>
   <view>
     <attribute name="bar" type="number"/>
     <method name="broken" returns="String">
       // Then forget to return a string
     </method>
     <view name="bar" />
   </view>
</canvas>

you should see the fatal flex error printed PLUS the LZX compiler warnings

   lzc --runtime=swf10 test/lpp-9400.lzx
   Compiling: test/lpp-9400.lzx to lpp-9400.swf10.swf
   compiler output is Loading configuration file 
/Users/hqm/openlaszlo/trunk-clean/WEB-INF/frameworks/flex-config.xml
   Compilation errors occurred:
   org.openlaszlo.sc.CompilerError: test/lpp-9400.lzx: 4: Error: Function does not return a value, in line: static 
var displayName = "<anonymous extends='view'>";static var children = [{attrs: {name: 
"bar"}, "class": LzView}];static var attributes = new LzInheritedHash(LzView.attributes);var 
bar;function broken ():String {}
   test/lpp-9400.lzx:8:24: element view has the same name="bar" attribute as a 
sibling element at test/lpp-9400.lzx:4:42
   test/lpp-9400.lzx:8:24: an attribute or method named 'bar' already is 
defined on element view



Files:
M       WEB-INF/lps/server/src/org/openlaszlo/cm/CompilationManager.java
M       WEB-INF/lps/server/src/org/openlaszlo/cache/Cache.java
M       WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java
M       WEB-INF/lps/server/src/org/openlaszlo/compiler/LibraryCompiler.java
M       WEB-INF/lps/server/src/org/openlaszlo/compiler/ObjectWriter.java
M       WEB-INF/lps/server/src/org/openlaszlo/compiler/DHTMLWriter.java
M       WEB-INF/lps/server/src/org/openlaszlo/compiler/SWFWriter.java
M       WEB-INF/lps/server/src/org/openlaszlo/compiler/FileResolver.java
M       WEB-INF/lps/server/src/org/openlaszlo/compiler/Compiler.java
M       WEB-INF/lps/server/src/org/openlaszlo/compiler/Main.java
M       WEB-INF/lps/server/src/org/openlaszlo/compiler/SWF9Writer.java
M       WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationError.java
M       WEB-INF/lps/server/src/org/openlaszlo/compiler/Parser.java
M       WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilerMediaCache.java


Changeset: http://svn.openlaszlo.org/openlaszlo/patches/hqm-20101004-JXi.tar

Reply via email to