[Laszlo-dev] [Laszlo-checkins] r15552 - in openlaszlo/trunk: WEB-INF/lps/server/src/org/openlaszlo/compiler test/snippets
P T Withington
ptw at pobox.com
Fri Jan 29 05:52:42 PST 2010
I'm trying to integrate this.
For some reason in branches/4.7 there is no
test/snippets/class-and-view-library.lzx
to update. There is class-and-view-library-proxied and class-and-view-library-noproxied. Any ideas what is going on here? How this file could be missing?
On 2010-01-28, at 11:40, hqm at openlaszlo.org wrote:
> Author: hqm
> Date: 2010-01-28 08:39:33 -0800 (Thu, 28 Jan 2010)
> New Revision: 15552
>
> Added:
> openlaszlo/trunk/test/snippets/class-and-view-library-noproxied.lzx
> openlaszlo/trunk/test/snippets/lpp-8727-library.lzx
> openlaszlo/trunk/test/snippets/lpp-8727.lzx
> Modified:
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassCompiler.java
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassModel.java
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ImportCompiler.java
> openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
> openlaszlo/trunk/test/snippets/class-and-view-library-proxied.lzx
> openlaszlo/trunk/test/snippets/class-and-view-library.lzx
> openlaszlo/trunk/test/snippets/class-resource-library.lzx
> openlaszlo/trunk/test/snippets/import-class-and-view-direct.lzx
> openlaszlo/trunk/test/snippets/import-class-resource.lzx
> Log:
> Change 20100122-hqm-F by hqm at badtzmaru.home on 2010-01-22 13:41:34 EST
> in /Users/hqm/openlaszlo/trunk
> for http://svn.openlaszlo.org/openlaszlo/trunk
>
> Summary: fix for bug in swf10 (and other runtimes) snippets
>
> New Features:
>
> Bugs Fixed: LPP-8727 bug in dynamic libraries
>
> Technical Reviewer: ptw
> QA Reviewer: max
> Doc Reviewer: (pending)
>
> Documentation:
>
> Release Notes:
>
> Overview:
>
> When the compiler compiles an <import> library, it makes a new
> compilation environment for emitting the code. However the ClassModels
> that it looks up may have the compilation environment of the main app, as they
> may have been created during the updateSchema phase.
>
>
> Details:
>
> ImportCompiler: Put the name of the runtime into the pathname of each
> snippet object file, so that user doesn't accidentally load a swf8
> library into a swf10 runtime or vice-versa
>
> ClassCompiler: The change is to set the classmodel's CompilationEnvironment to the
> current Compiler's value, so that any anon classes that get made will
> inherit that value.
>
> NodeModel: ensure that class is always emitted (this wasn't the bug in this case,
> but seemed like an oversight)
>
> ClassModel: make env var public, so it can be set by the ClassCompiler
>
> Tests:
>
> run in swf8,10,dhtml
>
> test/snippets/import-class-and-view.lzx
> test/snippets/lpp-8727.lzx
> test/snippets/import-view.lzx
> test/snippets/import-class-and-view.lzx
> test/snippets/import-class-and-view-direct.lzx
> test/snippets/import-class-resource.lzx
> test/snippets/import-dataload.lzx?lzr=swf10
>
>
> ant runlzunit
>
>
>
>
>
> Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassCompiler.java
> ===================================================================
> --- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassCompiler.java 2010-01-28 08:59:57 UTC (rev 15551)
> +++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassCompiler.java 2010-01-28 16:39:33 UTC (rev 15552)
> @@ -3,7 +3,7 @@
> * ****************************************************************************/
>
> /* J_LZ_COPYRIGHT_BEGIN *******************************************************
> -* Copyright 2001-2009 Laszlo Systems, Inc. All Rights Reserved. *
> +* Copyright 2001-2010 Laszlo Systems, Inc. All Rights Reserved. *
> * Use is subject to license terms. *
> * J_LZ_COPYRIGHT_END *********************************************************/
>
> @@ -108,6 +108,10 @@
> public void compile(Element elt) {
> String tagName = elt.getAttributeValue("name");
> ClassModel classModel = mEnv.getSchema().getClassModel(tagName);
> +
> + // Ensure that the class and any children is compiled into the current CompilationEnvironment
> + classModel.env = mEnv;
> +
> // May have already been compiled by a forward reference
> // May have already been compiled by a forward reference
> if (tagName.equals("anonymous")) {
> @@ -123,7 +127,7 @@
> // conditionally compiled as a forward reference (which will
> // only be emitted if the class is not in an import and we are
> // linking)
> - classModel.compile(mEnv, true);
> + classModel.compile(mEnv, true);
> }
> }
> }
>
> Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassModel.java
> ===================================================================
> --- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassModel.java 2010-01-28 08:59:57 UTC (rev 15551)
> +++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ClassModel.java 2010-01-28 16:39:33 UTC (rev 15552)
> @@ -25,7 +25,7 @@
> /** The name for debugging */
> public String debugExtends;
> public String debugWith;
> - final CompilationEnvironment env;
> + public CompilationEnvironment env;
> protected boolean builtin = false;
> // This is null for the root class
> protected ClassModel superModel;
> @@ -914,6 +914,6 @@
> }
>
> /**
> - * @copyright Copyright 2001-2009 Laszlo Systems, Inc. All Rights
> + * @copyright Copyright 2001-2010 Laszlo Systems, Inc. All Rights
> * Reserved. Use is subject to license terms.
> */
>
> Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ImportCompiler.java
> ===================================================================
> --- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ImportCompiler.java 2010-01-28 08:59:57 UTC (rev 15551)
> +++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ImportCompiler.java 2010-01-28 16:39:33 UTC (rev 15552)
> @@ -3,7 +3,7 @@
> * ****************************************************************************/
>
> /* J_LZ_COPYRIGHT_BEGIN *******************************************************
> -* Copyright 2001-2009 Laszlo Systems, Inc. All Rights Reserved. *
> +* Copyright 2001-2010 Laszlo Systems, Inc. All Rights Reserved. *
> * Use is subject to license terms. *
> * J_LZ_COPYRIGHT_END *********************************************************/
>
> @@ -93,14 +93,19 @@
> // I'm scared of the CompilationManager, just generate the output file
> // directly for now.
> String libfile = libsrcfile.getName();
> +
> String libprefix = mEnv.getLibPrefix();
> String runtime = mEnv.getProperty(mEnv.RUNTIME_PROPERTY);
> - String extension = ".swf";
> - if (mEnv.isAS3()) {
> - extension = ".swf";
> + // filename will be of the form "foo.<RUNTIME>.swf", e.g., foo.swf10.swf
> + String extension = "." + runtime;
> + if (mEnv.isSWF() || mEnv.isAS3()) {
> + extension += ".swf";
> } else if (Compiler.SCRIPT_RUNTIMES.contains(runtime)) {
> - extension = ".js";
> + extension += ".js";
> + } else {
> + throw new CompilationError("Compiling an import library for the "+runtime+" runtime is not supported.", element);
> }
> +
> String objfilename = libprefix + "/" + libfile + extension;
> String objpath = mEnv.getLibPrefixRelative() + "/" + libfile + extension;
>
> @@ -124,9 +129,9 @@
> if (mEnv.isAS3()) {
> // In Flash 9/10 we compile the main app first, then compile the libraries
> // against that generated source tree.
> - if (mLogger.isDebugEnabled()) {
> + if (mLogger.isDebugEnabled()) {
> mLogger.debug("... queueing import lib compilation" +libsrcfile+", " +objfilename +", "+ objpath+", "+module);
> - }
> + }
> queueLibraryCompilation(libsrcfile, objfilename, objpath, module);
> } else {
> compileLibrary(libsrcfile, objfilename, objpath, module);
>
> Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
> ===================================================================
> --- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java 2010-01-28 08:59:57 UTC (rev 15551)
> +++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java 2010-01-28 16:39:33 UTC (rev 15552)
> @@ -4,7 +4,7 @@
> * ***************************************************************************/
>
> /* J_LZ_COPYRIGHT_BEGIN *******************************************************
> -* Copyright 2001-2009 Laszlo Systems, Inc. All Rights Reserved. *
> +* Copyright 2001-2010 Laszlo Systems, Inc. All Rights Reserved. *
> * Use is subject to license terms. *
> * J_LZ_COPYRIGHT_END *********************************************************/
>
> @@ -2316,7 +2316,8 @@
> }
> // Allow forward references
> if (! classModel.isCompiled()) {
> - classModel.compile(env);
> + // Ensure the class model is compiled!
> + classModel.compile(env, true);
> }
> if (classModel.anonymous || classModel.builtin || env.tagDefined(tagName) || "anonymous".equals(tagName)) {
> // The class to instantiate
>
> Added: openlaszlo/trunk/test/snippets/class-and-view-library-noproxied.lzx
>
>
> Property changes on: openlaszlo/trunk/test/snippets/class-and-view-library-noproxied.lzx
> ___________________________________________________________________
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
> Modified: openlaszlo/trunk/test/snippets/class-and-view-library-proxied.lzx
> ===================================================================
> --- openlaszlo/trunk/test/snippets/class-and-view-library-proxied.lzx 2010-01-28 08:59:57 UTC (rev 15551)
> +++ openlaszlo/trunk/test/snippets/class-and-view-library-proxied.lzx 2010-01-28 16:39:33 UTC (rev 15552)
> @@ -16,6 +16,6 @@
>
> </library>
> <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
> -* Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
> +* Copyright 2001-2004, 2010 Laszlo Systems, Inc. All Rights Reserved. *
> * Use is subject to license terms. *
> * X_LZ_COPYRIGHT_END ****************************************************** -->
>
> Modified: openlaszlo/trunk/test/snippets/class-and-view-library.lzx
> ===================================================================
> --- openlaszlo/trunk/test/snippets/class-and-view-library.lzx 2010-01-28 08:59:57 UTC (rev 15551)
> +++ openlaszlo/trunk/test/snippets/class-and-view-library.lzx 2010-01-28 16:39:33 UTC (rev 15552)
> @@ -1,4 +1,4 @@
> -<library>
> +<library proxied="true">
>
> <class name="myclass" bgcolor="#ffccff"
> width="${this.textview.width}"
>
> Modified: openlaszlo/trunk/test/snippets/class-resource-library.lzx
> ===================================================================
> --- openlaszlo/trunk/test/snippets/class-resource-library.lzx 2010-01-28 08:59:57 UTC (rev 15551)
> +++ openlaszlo/trunk/test/snippets/class-resource-library.lzx 2010-01-28 16:39:33 UTC (rev 15552)
> @@ -2,13 +2,11 @@
>
> <resource name="aswf" src="../resources/swf/logo.swf"/>
> <class resource="aswf"
> - name="myclass" bgcolor="#ffccff"
> - width="${this.textview.width}"
> - height="${this.textview.height}" fontsize="20">
> + name="myclass" bgcolor="#ffccff" >
> </class>
> </library>
>
> <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
> -* Copyright 2001-2004, 2008 Laszlo Systems, Inc. All Rights Reserved. *
> +* Copyright 2001-2004, 2008, 2010 Laszlo Systems, Inc. All Rights Reserved. *
> * Use is subject to license terms. *
> * X_LZ_COPYRIGHT_END ****************************************************** -->
>
> Modified: openlaszlo/trunk/test/snippets/import-class-and-view-direct.lzx
> ===================================================================
> --- openlaszlo/trunk/test/snippets/import-class-and-view-direct.lzx 2010-01-28 08:59:57 UTC (rev 15551)
> +++ openlaszlo/trunk/test/snippets/import-class-and-view-direct.lzx 2010-01-28 16:39:33 UTC (rev 15552)
> @@ -1,19 +1,19 @@
> <canvas width="1024">
> <import proxied="false"
> - name="lib" href="class-and-view-library-proxied.lzx"
> + name="lib" href="class-and-view-library-noproxied.lzx"
> stage="late"
> onload="canvas.doLoaded()"/>
> <method name="doLoaded">
> - new myclass(canvas, {fontsize: 8, text: 'fontsize 8 [1] loaded myclass'});
> - new myclass(canvas, {fontsize: 10, text: 'fontsize 10 [2] loaded myclass'});
> - new myclass(canvas, {text: 'default fontsize [3] loaded myclass'});
> - new myclass(canvas, {fontsize: 30, text: 'fontsize 30 [4] loaded myclass'});
> + new lz.myclass(canvas, {fontsize: 8, text: 'fontsize 8 [1] loaded myclass'});
> + new lz.myclass(canvas, {fontsize: 10, text: 'fontsize 10 [2] loaded myclass'});
> + new lz.myclass(canvas, {text: 'default fontsize [3] loaded myclass'});
> + new lz.myclass(canvas, {fontsize: 30, text: 'fontsize 30 [4] loaded myclass'});
>
>
> </method>
> <simplelayout spacing="2" />
> </canvas>
> <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
> -* Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
> +* Copyright 2001-2004, 2010 Laszlo Systems, Inc. All Rights Reserved. *
> * Use is subject to license terms. *
> * X_LZ_COPYRIGHT_END ****************************************************** -->
>
> Modified: openlaszlo/trunk/test/snippets/import-class-resource.lzx
> ===================================================================
> --- openlaszlo/trunk/test/snippets/import-class-resource.lzx 2010-01-28 08:59:57 UTC (rev 15551)
> +++ openlaszlo/trunk/test/snippets/import-class-resource.lzx 2010-01-28 16:39:33 UTC (rev 15552)
> @@ -3,11 +3,11 @@
> stage="late"
> onload="canvas.doLoaded()"/>
> <method name="doLoaded">
> - new myclass(canvas);
> + new lz.myclass(canvas);
> </method>
> </canvas>
>
> <!-- * X_LZ_COPYRIGHT_BEGIN ***************************************************
> -* Copyright 2001-2004 Laszlo Systems, Inc. All Rights Reserved. *
> +* Copyright 2001-2004, 2010 Laszlo Systems, Inc. All Rights Reserved. *
> * Use is subject to license terms. *
> * X_LZ_COPYRIGHT_END ****************************************************** -->
>
> Added: openlaszlo/trunk/test/snippets/lpp-8727-library.lzx
>
>
> Property changes on: openlaszlo/trunk/test/snippets/lpp-8727-library.lzx
> ___________________________________________________________________
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
> Added: openlaszlo/trunk/test/snippets/lpp-8727.lzx
>
>
> Property changes on: openlaszlo/trunk/test/snippets/lpp-8727.lzx
> ___________________________________________________________________
> Name: svn:mime-type
> + text/plain
> Name: svn:eol-style
> + native
>
>
> _______________________________________________
> Laszlo-checkins mailing list
> Laszlo-checkins at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins
More information about the Laszlo-dev
mailing list