mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-01 06:37:41 +00:00
Added cplutil to rake.
Reviewed by me.
This commit is contained in:
@@ -4,7 +4,7 @@ require 'rake'
|
||||
require '../../common'
|
||||
|
||||
|
||||
subprojects = %w{objj objjc}
|
||||
subprojects = %w{cplutil objj objjc}
|
||||
|
||||
%w(build clean).each do |task_name|
|
||||
task task_name do
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version = "1.0"?>
|
||||
<project name = "cplutil" default = "build" basedir = "." >
|
||||
|
||||
<import file = "../../common.xml" />
|
||||
|
||||
<property name = "Build.Products" location = "${Build}/cplutil.build/${Configuration}" />
|
||||
<property name = "Build.cplutil" location = "${Build}/${Configuration}/cplutil" />
|
||||
<property name = "Build.cplutil.bin" location = "${Build}/${Configuration}/cplutil/bin" />
|
||||
<property name = "Build.cplutil.lib" location = "${Build}/${Configuration}/cplutil/lib" />
|
||||
|
||||
<target name = "clean">
|
||||
<delete dir = "${Build.cplutil}" verbose = "true" />
|
||||
<delete dir = "${Build.Products}" verbose = "true" />
|
||||
</target>
|
||||
|
||||
<target name = "build">
|
||||
|
||||
<mkdir dir = "${Build.Products}" />
|
||||
|
||||
<concat destfile = "${Build.Products}/cplutil.js">
|
||||
<filelist>
|
||||
<file name="${basedir}/../Utilities/bridge.js" />
|
||||
<file name="${basedir}/../Utilities/regex-bridge.js" />
|
||||
<file name="${Build}/Objective-J.build/\${Configuration}/Rhino/Objective-J.js" />
|
||||
<file name="${basedir}/cplutil.js" />
|
||||
</filelist>
|
||||
</concat>
|
||||
|
||||
<mkdir dir = "${Build.cplutil}" />
|
||||
|
||||
<jsc>
|
||||
<arguments>
|
||||
<arg line = "-o cplutil.class" />
|
||||
<arg value = "-nosource" />
|
||||
<arg value = "${Build.Products}/cplutil.js" />
|
||||
</arguments>
|
||||
</jsc>
|
||||
|
||||
<move file = "${Build.Products}/cplutil.class" tofile = "${Build.cplutil}/cplutil.class" />
|
||||
|
||||
<copy file = "cplutil" tofile = "${Build.cplutil.bin}/cplutil" />
|
||||
<copy file = "${Build.cplutil}/cplutil.class" tofile = "${Build.cplutil.lib}/cplutil.class" />
|
||||
|
||||
</target>
|
||||
|
||||
</project>
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# if OBJJ_HOME isn't set, try to determine it
|
||||
if [ -z $OBJJ_HOME ]; then
|
||||
# get path of the executable
|
||||
SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
|
||||
|
||||
# resolve symlinks
|
||||
if [ -h $SELF_PATH ]; then
|
||||
SELF_PATH=`readlink $SELF_PATH`
|
||||
fi
|
||||
|
||||
# get second ancestor directory
|
||||
SELF_DIR=`dirname $SELF_PATH`
|
||||
export OBJJ_HOME=`dirname $SELF_DIR`
|
||||
|
||||
# check to ensure it exists, print message
|
||||
if [ -d $OBJJ_HOME ]; then
|
||||
echo "OBJJ_HOME not set, defaulting to $OBJJ_HOME" 1>&2
|
||||
else
|
||||
echo "OBJJ_HOME not set, default at $OBJJ_HOME doesn't exist, exiting" 1>&2
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
OBJJ_LIB="$OBJJ_HOME/lib"
|
||||
CLASSPATH="$OBJJ_LIB:$OBJJ_LIB/js.jar"
|
||||
|
||||
# convert paths for Cygwin
|
||||
if [[ `uname` == CYGWIN* ]]; then
|
||||
CLASSPATH=`cygpath -wp "$CLASSPATH"`
|
||||
fi
|
||||
|
||||
java -classpath $CLASSPATH cplutil $@
|
||||
@@ -1,103 +0,0 @@
|
||||
|
||||
importPackage(java.lang);
|
||||
|
||||
importClass(java.io.File);
|
||||
importClass(java.io.BufferedReader);
|
||||
importClass(java.io.FileReader);
|
||||
importClass(java.io.BufferedWriter);
|
||||
importClass(java.io.FileWriter);
|
||||
|
||||
|
||||
function printUsage()
|
||||
{
|
||||
print("this is where you say the usage");
|
||||
}
|
||||
|
||||
function main()
|
||||
{
|
||||
if (arguments.length < 1)
|
||||
return printUsage();
|
||||
|
||||
var allFiles = NO,
|
||||
format = nil,
|
||||
filePaths = [],
|
||||
outPath = nil,
|
||||
outExtension = nil;
|
||||
|
||||
index = 0,
|
||||
count = arguments.length;
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
var argument = arguments[index];
|
||||
|
||||
if (argument.charAt(0) === '-' && !allFiles)
|
||||
{
|
||||
if (filePaths.length > 0)
|
||||
return printUsage();
|
||||
|
||||
else if (argument === "-convert")
|
||||
format = arguments[++index];
|
||||
|
||||
else if (argument === "-o")
|
||||
outPath = arguments[++index];
|
||||
|
||||
else if (argument === "-e")
|
||||
outExtension = arguments[++index];
|
||||
|
||||
else if (argument === "--")
|
||||
allFiles = YES;
|
||||
|
||||
else if (argument === "-help")
|
||||
return printUsage();
|
||||
}
|
||||
else
|
||||
filePaths.push(arguments[index]);
|
||||
}
|
||||
|
||||
index = 0;
|
||||
count = filePaths.length;
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
// Read the plist file
|
||||
var file = new File(filePaths[index]),
|
||||
reader = new BufferedReader(new FileReader(file)),
|
||||
fileContents = "";
|
||||
|
||||
// Get contents of the file
|
||||
while (reader.ready())
|
||||
fileContents += reader.readLine() + '\n';
|
||||
|
||||
reader.close();
|
||||
|
||||
var data = new objj_data();
|
||||
|
||||
data.string = fileContents;
|
||||
|
||||
var plistObject = new CPPropertyListCreateFromData(data);
|
||||
|
||||
if (format === "280north1")
|
||||
data = CPPropertyListCreate280NorthData(plistObject);
|
||||
|
||||
else if (format === "xml1")
|
||||
data = CPPropertyListCreateXMLData(plistObject);
|
||||
|
||||
var outFile = file;
|
||||
|
||||
if (outPath)
|
||||
outFile = new File(outPath);
|
||||
|
||||
// else if (outExtension)
|
||||
|
||||
|
||||
// Write out file
|
||||
var writer = new BufferedWriter(new FileWriter(outFile));
|
||||
|
||||
writer.write(data.string);
|
||||
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
|
||||
main.apply(main, arguments);
|
||||
Reference in New Issue
Block a user