PDA

View Full Version : shorthand element in .jsb targets



Clay
23 May 2007, 8:17 PM
I'm working on a PHP-based build tool for JSBuilder-managed projects that's a bit more than what has been done with PHP previously. (To my knowledge, anyway.)

In parsing .jsb files, I'm baffled a bit by how the shorthand list changes per-adapter. The SVN trunk has three .jsb files, each of which have multiple build targets that all have the same YUI shorthand list.

Reading through the actual build process here:

http://js-builder.googlecode.com/svn/trunk/JSBuild/ProjectBuilder.cs

... I'm not seeing how those shorthand items are actually being used anywhere. I've seen the *result* of shorthand substitutions in Ext releases, but am thinking that some other .jsb projects are being used to do the actual release builds. This belief is based on the settings in the trunk .jsb files ... such as minify=False, and the seemingly-outdated shorthand list, among other things.

Can someone familiar with JSBuilder and the actual build/release process for Ext comment on this? I'm aiming for very close (if not identical) output from my PHP build script relative to actual Ext release builds.

Thanks,
Clay

jack.slocum
24 May 2007, 10:30 AM
The shorthand list isn't being used. I don't think it does anything anymore and the code it used to run may have been eliminated.

Clay
25 May 2007, 6:34 AM
The shorthand list isn't being used. I don't think it does anything anymore and the code it used to run may have been eliminated.

Hey Jack, I mention it because of lines 150-179 in /JSBuild/ProjectBuilder.cs


if (!target.Shorthand)
{
foreach (string f in target.Includes)
{
sw.Write(files[f].Minified + "\n");
}
}
else
{
string[] sh = target.ParseList();
StringBuilder fcn = new StringBuilder();
fcn.Append("(function(){");
int index = 0;
foreach (string s in sh)
{
fcn.AppendFormat("var _{0} = {1};", ++index, s);
}
sw.Write(fcn.Append("\n"));
foreach (string f in target.Includes)
{
string min = files[f].Minified;
index = 0;
foreach (string s in sh)
{
min = min.Replace(s, "_" + index);
}
sw.Write(min + "\n");
}
sw.Write("})();");
}

... which seems close to where the slight obfuscation-for-brevity that minified Ext builds have is coming from.

Is the conversion to "var _2=..." and so on that minimized Ext builds have sprinkled all over now coming from a procedure external to JSBuilder?

Thanks,
Clay

jack.slocum
26 May 2007, 3:36 PM
Yes, I use ShrinkSafe for that. That's why the shorthand was axed.