[Laszlo-checkins] r12403 - in openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo: compiler sc
hqm@openlaszlo.org
hqm at openlaszlo.org
Sat Jan 10 13:54:00 PST 2009
Author: hqm
Date: 2009-01-10 13:53:57 -0800 (Sat, 10 Jan 2009)
New Revision: 12403
Modified:
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ImportCompiler.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java
Log:
Change 20090110-hqm-g by hqm at badtzmaru.home on 2009-01-10 01:42:02 EST
in /Users/hqm/openlaszlo/trunk5
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: fix for nested import libraries in swf9
New Features:
Bugs Fixed: LPP-7589
Technical Reviewer: ptw
QA Reviewer: dda
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
+ adds an option to the script compiler reuse the same temporary as3
working directory for the main app and all libraries.
This puts all the class definitions and other global def in a place
where the flex compiler can see them while compiling any library
files. So compilation of a subclass can see the parent class source
files in parent libraries.
Tests:
+ test case from bug report works in swf9
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java 2009-01-10 16:07:47 UTC (rev 12402)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java 2009-01-10 21:53:57 UTC (rev 12403)
@@ -3,7 +3,7 @@
* ****************************************************************************/
/* J_LZ_COPYRIGHT_BEGIN *******************************************************
-* Copyright 2001-2008 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2009 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* J_LZ_COPYRIGHT_END *********************************************************/
@@ -196,7 +196,7 @@
this.mImportedLibraryFiles = new HashSet(srcEnv.getImportedLibraryFiles());
this.mLoadableImportedLibraryFiles = srcEnv.getLoadableImportedLibraryFiles();
this.mResourceNames = srcEnv.getResourceNames();
- this.mMainCompilationEnv = srcEnv;
+ this.mMainCompilationEnv = srcEnv.getMainCompilationEnv();
}
/** Use this constructor for unit testing. The Compiler uses the
@@ -756,7 +756,7 @@
}
public CompilationEnvironment getMainCompilationEnv() {
- return mMainCompilationEnv;
+ return mMainCompilationEnv != null ? mMainCompilationEnv : this;
}
public void setCompileTimeConstants(Map map) {
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 2009-01-10 16:07:47 UTC (rev 12402)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/ImportCompiler.java 2009-01-10 21:53:57 UTC (rev 12403)
@@ -3,7 +3,7 @@
* ****************************************************************************/
/* J_LZ_COPYRIGHT_BEGIN *******************************************************
-* Copyright 2001-2008 Laszlo Systems, Inc. All Rights Reserved. *
+* Copyright 2001-2009 Laszlo Systems, Inc. All Rights Reserved. *
* Use is subject to license terms. *
* J_LZ_COPYRIGHT_END *********************************************************/
@@ -50,6 +50,8 @@
String libname = XMLUtils.requireAttributeValue(element, NAME_ANAME);
String stage = XMLUtils.requireAttributeValue(element, "stage");
+ mLogger.debug("ImportCompiler.compile libname="+libname+", href="+href+", stage="+stage);
+
Element module = LibraryCompiler.resolveLibraryElement(
element, mEnv, mEnv.getImportedLibraryFiles());
if (module != null) {
@@ -118,6 +120,7 @@
if (mEnv.isAS3()) {
// In Flash 9/10 we compile the main app first, then compile the libraries
// against that generated source tree.
+ mLogger.debug("... queueing import lib compilation" +libsrcfile+", " +objfilename +", "+ objpath+", "+module);
queueLibraryCompilation(libsrcfile, objfilename, objpath, module);
} else {
compileLibrary(libsrcfile, objfilename, objpath, module);
@@ -151,7 +154,7 @@
*/
void queueLibraryCompilation(File infile, String outfile, String liburl, Element element) {
LibraryCompilation lc = new LibraryCompilation(this, infile, outfile, liburl, element);
- mEnv.queueLibraryCompilation(lc);
+ mEnv.getMainCompilationEnv().queueLibraryCompilation(lc);
}
/**
@@ -174,6 +177,9 @@
String runtime = env.getProperty(env.RUNTIME_PROPERTY);
if (env.isAS3()) {
props.setProperty(org.openlaszlo.sc.Compiler.SWF9_LOADABLE_LIB, "true");
+ // Compile the main app and all libraries using the same temp as3 dir, so all
+ // definitions are easy to share when the flex compiler does link-checking.
+ props.setProperty(org.openlaszlo.sc.Compiler.REUSE_WORK_DIRECTORY, "true");
writer = new SWF9Writer(props, ostream, mEnv.getMediaCache(), false, env);
} else if (Compiler.SCRIPT_RUNTIMES.contains(runtime)) {
writer = new DHTMLWriter(props, ostream,
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java 2009-01-10 16:07:47 UTC (rev 12402)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/Compiler.java 2009-01-10 21:53:57 UTC (rev 12403)
@@ -495,6 +495,7 @@
public static String PRINT_CONSTRAINTS = "printConstraints";
public static String PRINT_INSTRUCTIONS = "printInstructions";
public static String RESOLVER = "resolver";
+ public static String REUSE_WORK_DIRECTORY = "reuseWorkDirectory";
public static String SCRIPT_ELEMENT = "scriptElement";
public static String SWF9_APPLICATION_PREAMBLE = "SWF9applicationPreamble";
public static String SWF9_APP_CLASSNAME = "SWF9MainClassName";
@@ -1075,6 +1076,6 @@
}
/**
- * @copyright Copyright 2001-2008 Laszlo Systems, Inc. All Rights
+ * @copyright Copyright 2001-2009 Laszlo Systems, Inc. All Rights
* Reserved. Use is subject to license terms.
*/
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java 2009-01-10 16:07:47 UTC (rev 12402)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/sc/SWF9External.java 2009-01-10 21:53:57 UTC (rev 12403)
@@ -75,7 +75,16 @@
if (mInfo == null) {
mInfo = new ScriptCompilerInfo();
}
- workdir = createCompilationWorkDir();
+ if (options.getBoolean(Compiler.REUSE_WORK_DIRECTORY)) {
+ // Re-use the previous working directory from the ScriptCompilerInfo
+ workdir = mInfo.workDir;
+ } else {
+ workdir = createCompilationWorkDir();
+ // Copy pointer to working directory to the ScriptCompilerInfo,
+ // so any subsequent <import> library compilations can use it.
+ mInfo.workDir = workdir;
+ }
+ //System.err.println("REUSE_WORK_DIRECTORY = "+options.getBoolean(Compiler.REUSE_WORK_DIRECTORY) + " workdir = "+workdir);
}
/**
@@ -932,8 +941,8 @@
// If it's a loadable lib, check links against the main app,
// but don't link those classes in. We do this by declaring the main app
// source working directory as a external-library-path
- cmd.add("-compiler.source-path+="+mInfo.mainAppWorkDir);
- cmd.add("-external-library-path+="+mInfo.mainAppWorkDir);
+ cmd.add("-compiler.source-path+="+workdir);
+ cmd.add("-external-library-path+="+workdir);
}
@@ -1092,7 +1101,7 @@
}
/**
- * @copyright Copyright 2006-2008 Laszlo Systems, Inc. All Rights
+ * @copyright Copyright 2006-2009 Laszlo Systems, Inc. All Rights
* Reserved. Use is subject to license terms.
*/
More information about the Laszlo-checkins
mailing list