[Laszlo-checkins] r8574 - in openlaszlo/trunk/WEB-INF/lps/server: bin src/org/openlaszlo/utils
hqm@openlaszlo.org
hqm at openlaszlo.org
Sun Apr 6 20:37:38 PDT 2008
Author: hqm
Date: 2008-04-06 20:37:35 -0700 (Sun, 06 Apr 2008)
New Revision: 8574
Added:
openlaszlo/trunk/WEB-INF/lps/server/bin/lzdeploy
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeployMain.java
Modified:
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeploySOLODHTML.java
Log:
Change 20080406-hqm-r by hqm at badtzmaru.local on 2008-04-06 23:35:20 EDT
in /Users/hqm/openlaszlo/trunk3
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: fix for SOLO Deployer class
New Features:
Bugs Fixed:
Technical Reviewer: (pending)
QA Reviewer: (pending)
Doc Reviewer: (pending)
Documentation:
Release Notes:
Details:
Tests:
lzdeploy test/deploy/hello.lzx
<canvas width="100%" height="80%" >
<simplelayout spacing="6"/>
<text>Hello World!</text>
<checkbox id="cb">Phone Home</checkbox>
<button onclick="cb.setAttribute('value', true)">Click Me!</button>
</canvas>
Added: openlaszlo/trunk/WEB-INF/lps/server/bin/lzdeploy
Property changes on: openlaszlo/trunk/WEB-INF/lps/server/bin/lzdeploy
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeployMain.java
Property changes on: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeployMain.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeploySOLODHTML.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeploySOLODHTML.java 2008-04-06 18:17:56 UTC (rev 8573)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/utils/DeploySOLODHTML.java 2008-04-07 03:37:35 UTC (rev 8574)
@@ -46,21 +46,7 @@
public class DeploySOLODHTML {
- public static void main(String args[])
- throws IOException
- {
- File tmpdir = File.createTempFile("foo", "bar").getParentFile();
- deploy(true,
- null,
- null,
- null,
- "/Users/hqm/openlaszlo/trunk/test/deploy/hello.lzx",
- new FileOutputStream("/tmp/solo.zip"),
- tmpdir,
- null);
- }
-
/**
* Create SOLO deploy archive or wrapper page for app
*
@@ -73,16 +59,32 @@
* @param tmpdir temporary file to hold compiler output, can be null
* @param title optional, if non-null, use as app title in wrapper html file
*/
- public static void deploy(boolean wrapperonly,
+
+ public static int deploy(boolean wrapperonly,
Canvas canvas,
String lpspath,
String url,
String sourcepath,
FileOutputStream outstream,
File tmpdir,
- String title)
+ String title)
throws IOException
{
+ return deploy(wrapperonly, canvas, lpspath, url, sourcepath, outstream, tmpdir, title, null, null);
+ }
+
+ public static int deploy(boolean wrapperonly,
+ Canvas canvas,
+ String lpspath,
+ String url,
+ String sourcepath,
+ FileOutputStream outstream,
+ File tmpdir,
+ String title,
+ Properties props,
+ HashMap skipfiles)
+ throws IOException
+ {
// Set this to make a limit on the size of zip file that is created
int maxZipFileSize = 64000000; // 64MB max
int warnZipFileSize = 10000000; // warn at 10MB of content (before compression)
@@ -100,11 +102,19 @@
}
File tempFile = File.createTempFile(sourcefile.getName(), null, tmpdir);
- Properties compilationProperties = new Properties();
+ Properties compilationProperties = (props == null) ? new Properties() : props;
// Compile a SOLO app with DHTML runtime.
compilationProperties.setProperty(CompilationEnvironment.RUNTIME_PROPERTY, "dhtml");
compilationProperties.setProperty(CompilationEnvironment.PROXIED_PROPERTY, "false");
org.openlaszlo.compiler.Compiler compiler = new org.openlaszlo.compiler.Compiler();
+
+ String mediaCacheDir = LPS.getWorkDirectory() + File.separator + "cache" + File.separator + "cmcache";
+ String scriptCacheDir = LPS.getWorkDirectory() + File.separator + "scache";
+
+ CompilerMediaCache cache = new CompilerMediaCache(new File(mediaCacheDir), new Properties());
+ compiler.setMediaCache(cache);
+ LPS.initialize();
+
canvas = compiler.compile(sourcefile, tempFile, compilationProperties);
}
@@ -146,7 +156,7 @@
outstream.close();
}
}
- return;
+ return 0;
}
/* Create a DOM for the Canvas XML descriptor */
@@ -285,19 +295,25 @@
for (int i=0; i<appfiles.size(); i++) {
String srcname = (String) appfiles.get(i);
String dstname = srcname.substring(appdir.getPath().length()+1);
- // Add ZIP entry to output stream.
- copyFileToZipFile(zout, srcname, dstname, zippedfiles);
-
- if (contentSize > maxZipFileSize) {
- throw new IOException("file length exceeds max of "+ (maxZipFileSize/1000000) +"MB");
+ if (skipfiles != null && !skipfiles.containsKey(srcname)) {
+ // Add ZIP entry to output stream.
+ copyFileToZipFile(zout, srcname, dstname, zippedfiles);
+ if (contentSize > maxZipFileSize) {
+ throw new IOException("file length exceeds max of "+ (maxZipFileSize/1000000) +"MB");
+ }
}
}
// Complete the ZIP file
zout.close();
} catch (IOException e) {
+ // Unix error return code
+ return 1;
}
+ // OK
+ return 0;
+
}
static void listFiles(ArrayList fnames, File dir) {
More information about the Laszlo-checkins
mailing list