<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Helvetica, Arial, sans-serif">For anyone
following this thread, I thought I'd report on my solution here.<br>
<br>
To include the build data in my app, I used 'Rake', the build tool of
the ever-so-shiny Ruby language.&nbsp; Every time I run rake, an XML file is
generated (compilationData.xml) that contains the time at which the
build was produced.<br>
<br>
Since I was already introducing a fairly heavyweight build tool like
Rake, I thought I'd automate the building of several different
'flavors' of my app as well - something I had previously done
manually.&nbsp; (These 'flavors' are the various binary combinations of
'Debug' and 'Pro'.)&nbsp; Compilation is provided via the ropenlaszlo ruby
gem, and distribution-ready packages are prepared with a variety of
shell commands (cp, zip, etc.)<br>
<br>
If you're intrigued by what this 'Featurific' thing might be, feel free
to check out <a href="http://featurific.com">http://featurific.com</a>
.<br>
<br>
Hope this helps someone else! :)<br>
<br>
-Rich<br>
<br>
<br>
&lt;begin Rakefile&gt;<br>
<small><font face="Courier New, Courier, monospace"># Written by Rich
following the instructions at
<a class="moz-txt-link-freetext" href="http://weblog.openlaszlo.org/archives/2006/01/deploying-openlaszlo-applications-with-rake/">http://weblog.openlaszlo.org/archives/2006/01/deploying-openlaszlo-applications-with-rake/</a><br>
# Also used <a class="moz-txt-link-freetext" href="http://sishen.lifegoo.com/?p=41">http://sishen.lifegoo.com/?p=41</a> as a guide<br>
<br>
# Before running 'rake' you'll need to ensure you've run the following
commands to properly set your env vars<br>
# export OPENLASZLO_HOME=/Applications/OpenLaszlo\ Server\
4.0.2/Server/lps-4.0.2&nbsp;&nbsp; # location of the OpenLaszlo SDK on the file
system<br>
# export
OPENLASZLO_URL=<a class="moz-txt-link-freetext" href="http://localhost:8080/lps-4.0.2">http://localhost:8080/lps-4.0.2</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
# URL of the OpenLaszlo server<br>
<br>
<br>
require 'rubygems'<br>
require 'ropenlaszlo'<br>
require 'rake/clean'<br>
<br>
@@time = Time.new<br>
<br>
BUILD_DIR = "build"<br>
ARCHIVE_DIR = File.join(BUILD_DIR, 'archives')<br>
F_FREE_DIR = File.join(ARCHIVE_DIR, 'Featurific')<br>
F_PRO_DIR = File.join(ARCHIVE_DIR, 'FeaturificPro')<br>
<br>
directory(BUILD_DIR)<br>
directory(ARCHIVE_DIR)<br>
directory(F_FREE_DIR)<br>
directory(F_PRO_DIR)<br>
<br>
CLEAN.include(File.join(BUILD_DIR, '*.swf'))&nbsp; # Remove all SWFs (leave
archives dir intact)<br>
CLOBBER.include(BUILD_DIR)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Remove all build files<br>
<br>
##### Compile main.lzx to .swf<br>
# NOTE: Since we :clean before every compilation, we don't need to
include all lzx files as dependencies.&nbsp; This means the app will be<br>
# re-built from scratch on *every* 'rake' (otherwise, the app would
only be rebuilt if main.lzx had been changed)<br>
file File.join(BUILD_DIR, 'main.swf') =&gt; ['main.lzx', :clean,
BUILD_DIR, F_FREE_DIR, F_PRO_DIR] do<br>
&nbsp; #&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
debug&nbsp;&nbsp; pro<br>
&nbsp; compile('main.lzx', 'featurific.swf',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'swf8',
false,&nbsp; false)<br>
&nbsp; compile('main.lzx', 'featurificDebug.swf',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'swf8',
true,&nbsp;&nbsp; false)<br>
&nbsp; compile('main.lzx', 'featurificPro.swf',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'swf8',
false,&nbsp; true)<br>
&nbsp; compile('main.lzx', 'featurificProDebug.swf',&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'swf8',
true,&nbsp;&nbsp; true)<br>
end<br>
<br>
def compile(infile, outfile, runtime, debug, pro_version)<br>
&nbsp; puts "\nCompiling #{infile} to #{outfile}
(runtime:#{runtime},\tdebug:#{debug},\tpro_version:#{pro_version})" if
verbose<br>
&nbsp; prepare_compilation_data(pro_version)<br>
&nbsp; puts "Compiling..."<br>
&nbsp; OpenLaszlo::compile infile, {:output =&gt; File.join(BUILD_DIR,
outfile), :runtime =&gt; runtime, :debug =&gt; debug}<br>
&nbsp; <br>
&nbsp; if pro_version<br>
&nbsp;&nbsp;&nbsp; cp File.join(BUILD_DIR, outfile), File.join(F_PRO_DIR, outfile)<br>
&nbsp; else<br>
&nbsp;&nbsp;&nbsp; cp File.join(BUILD_DIR, outfile), File.join(F_FREE_DIR, outfile)<br>
&nbsp; end<br>
end<br>
<br>
def prepare_compilation_data(pro_version)<br>
&nbsp; puts "Preparing compilation data" if verbose<br>
&nbsp; open("compilationData.xml",'w') do |outfile|<br>
&nbsp;&nbsp;&nbsp; outfile.puts "&lt;data&gt;"<br>
&nbsp;&nbsp;&nbsp; outfile.puts "\t&lt;buildTime value='#{@@time}'/&gt;"<br>
&nbsp;&nbsp;&nbsp; outfile.puts "\t&lt;proVersion value='#{pro_version}'/&gt;"<br>
&nbsp;&nbsp;&nbsp; outfile.puts "&lt;/data&gt;"<br>
&nbsp; end<br>
end<br>
<br>
<br>
##### Create archives<br>
desc "Build the app and create distro archives"<br>
task :create_archives =&gt; [:clobber, ARCHIVE_DIR,
File.join(BUILD_DIR, 'main.swf')] do<br>
&nbsp; puts "\nCreating archives" if verbose<br>
<br>
&nbsp; # Common files<br>
&nbsp; cp_r File.join('buildResources', 'common', '.'), F_FREE_DIR<br>
&nbsp; cp_r File.join('buildResources', 'common', '.'), F_PRO_DIR<br>
<br>
&nbsp; # FREE<br>
&nbsp; cp_r File.join('buildResources', 'FREE', '.'), F_FREE_DIR<br>
&nbsp; <br>
&nbsp; # Pro<br>
&nbsp; cp_r File.join('buildResources', 'Pro', '.'), F_PRO_DIR<br>
&nbsp; <br>
&nbsp; sh "cd #{F_FREE_DIR} &amp;&amp; zip -qr -9 ../featurific.zip *"<br>
&nbsp; sh "cd #{F_PRO_DIR} &amp;&amp; zip -qr -9 ../featurificPro.zip *"<br>
end<br>
<br>
<br>
##### Default - Compile<br>
task :default =&gt; File.join(BUILD_DIR, 'main.swf')</font></small><br>
&lt;end Rakefile&gt;<br>
<br>
<br>
<br>
<br>
<br>
&lt;begin output&gt;<br>
<font face="Courier New, Courier, monospace"><small>Fuji:/Applications/OpenLaszlo
Server 4.0.2/Server/lps-4.0.2/gallery3 rich$ rake create_archives<br>
(in /Applications/OpenLaszlo Server 4.0.2/Server/lps-4.0.2/gallery3)<br>
rm -r build/featurific.swf<br>
rm -r build/featurificDebug.swf<br>
rm -r build/featurificPro.swf<br>
rm -r build/featurificProDebug.swf<br>
rm -r build<br>
mkdir -p build/archives<br>
mkdir -p build/archives/Featurific<br>
mkdir -p build/archives/FeaturificPro<br>
<br>
Compiling main.lzx to featurific.swf (runtime:swf8,&nbsp;&nbsp;&nbsp;&nbsp; debug:false,&nbsp;&nbsp;&nbsp;
pro_version:false)<br>
Preparing compilation data<br>
Compiling...<br>
cp build/featurific.swf build/archives/Featurific/featurific.swf<br>
<br>
Compiling main.lzx to featurificDebug.swf (runtime:swf8,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
debug:true,&nbsp;&nbsp;&nbsp; pro_version:false)<br>
Preparing compilation data<br>
Compiling...<br>
cp build/featurificDebug.swf
build/archives/Featurific/featurificDebug.swf<br>
<br>
Compiling main.lzx to featurificPro.swf (runtime:swf8,&nbsp; debug:false,&nbsp;&nbsp;&nbsp;
pro_version:true)<br>
Preparing compilation data<br>
Compiling...<br>
cp build/featurificPro.swf
build/archives/FeaturificPro/featurificPro.swf<br>
<br>
Compiling main.lzx to featurificProDebug.swf (runtime:swf8,&nbsp;&nbsp;&nbsp;&nbsp;
debug:true,&nbsp;&nbsp;&nbsp; pro_version:true)<br>
Preparing compilation data<br>
Compiling...<br>
cp build/featurificProDebug.swf
build/archives/FeaturificPro/featurificProDebug.swf<br>
<br>
Creating archives<br>
cp -r buildResources/common/. build/archives/Featurific<br>
cp -r buildResources/common/. build/archives/FeaturificPro<br>
cp -r buildResources/FREE/. build/archives/Featurific<br>
cp -r buildResources/Pro/. build/archives/FeaturificPro<br>
cd build/archives/Featurific &amp;&amp; zip -qr -9 ../featurific.zip *<br>
cd build/archives/FeaturificPro &amp;&amp; zip -qr -9
../featurificPro.zip *</small></font><br>
&lt;end output&gt;<br>
</font></font><br>
P T Withington wrote:
<blockquote cite="mid:7457305F-3E10-42C8-9281-3E792DB25513@pobox.com"
 type="cite">The debug version is formatted to the debug console (and
only available in debug).&nbsp; The canvas version is available in all apps
and returns a string that can be displayed by your application.
  <br>
  <br>
Maybe file an improvement request to add the app compile timestamp to
that info...
  <br>
  <br>
On 2007-10-30, at 13:22 EDT, Henry Minsky wrote:
  <br>
  <br>
  <blockquote type="cite">The actual call to get the info as a string
is
    <br>
    <br>
LzCanvas.versionInfoString()
    <br>
    <br>
    <br>
    <br>
On 10/30/07, Henry Minsky <a class="moz-txt-link-rfc2396E" href="mailto:henry.minsky@gmail.com">&lt;henry.minsky@gmail.com&gt;</a> wrote:
    <br>
    <blockquote type="cite"><br>
Hmm, that's a good idea, I don't think the compiler bakes the&nbsp; date
that
      <br>
the app was compiled into the app anyplace. It does bake in the
information
      <br>
on the version of LPS that is running though:
      <br>
      <br>
Debug.versionInfo ()
      <br>
      <br>
will return a string like this
      <br>
Debug.versionInfo
      <br>
      <br>
lzx&gt; Debug.versionInfo
      <br>
()
      <br>
URL:
      <br>
      <br>
<a class="moz-txt-link-freetext" href="http://127.0.0.1:8080/trunk/test/forum2/main.lzx?lzt=object&lzt=object&lzr=dhtml&debug=true&lzbacktrace=true">http://127.0.0.1:8080/trunk/test/forum2/main.lzx?lzt=object&amp;lzt=object&amp;lzr=dhtml&amp;debug=true&amp;lzbacktrace=true</a>
      <br>
      <br>
Version: 4.1.x.0
      <br>
Release: Latest
      <br>
Build: 7031 C:\users\hqm\openlaszlo\trunk
      <br>
Date: 2007-10-28T20:54:17-0400
      <br>
Target: dhtml
      <br>
Runtime: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: 1.8.1.8)
      <br>
Gecko/20071008 Firefox/2.0.0.8
      <br>
lzx&gt;
      <br>
      <br>
On 10/30/07, Rich Christiansen <a class="moz-txt-link-rfc2396E" href="mailto:warproof@warproof.com">&lt;warproof@warproof.com&gt;</a> wrote:
      <br>
      <blockquote type="cite"><br>
I'm currently dealing with the unpleasant headache of tracking various
        <br>
installations of different versions of my SOLO app.&nbsp; I've added
        <br>
functionality to display the version number of the app, but I'd also
        <br>
like to include a build number.&nbsp; In fact, I'd prefer to just use the
        <br>
time at which the app was built if that's possible.
        <br>
        <br>
How could I go about doing this?&nbsp; Some sort of preprocessing directive?
        <br>
        <br>
Thanks in advance! :)
        <br>
-Rich
        <br>
        <br>
      </blockquote>
      <br>
      <br>
      <br>
--
      <br>
Henry Minsky
      <br>
Software Architect
      <br>
<a class="moz-txt-link-abbreviated" href="mailto:hminsky@laszlosystems.com">hminsky@laszlosystems.com</a>
      <br>
      <br>
      <br>
    </blockquote>
    <br>
    <br>
--&nbsp;<br>
Henry Minsky
    <br>
Software Architect
    <br>
<a class="moz-txt-link-abbreviated" href="mailto:hminsky@laszlosystems.com">hminsky@laszlosystems.com</a>
    <br>
  </blockquote>
  <br>
  <br>
</blockquote>
</body>
</html>