mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
major changes, very much WIP, experimenting with async
This commit is contained in:
+13
-11
@@ -1,19 +1,21 @@
|
||||
|
||||
require("../common.jake");
|
||||
|
||||
var framework = require("objective-j/jake").framework,
|
||||
BundleTask = require("objective-j/jake").BundleTask;
|
||||
var framework = require("../Foundation/objective-j/jake").framework,
|
||||
BundleTask = require("../Foundation/objective-j/jake").BundleTask;
|
||||
|
||||
$BUILD_PATH = FILE.join($BUILD_DIR, $CONFIGURATION, 'AppKit');
|
||||
const path = require("path");
|
||||
|
||||
$BUILD_PATH = path.join($BUILD_DIR, $CONFIGURATION, 'AppKit');
|
||||
|
||||
AppKitFiles = new FileList("**/*.j").exclude('CoreGraphics/CGContextCanvas.j', 'CoreGraphics/CGContextVML.j', 'Themes/**/*', 'Tools/**/*', "Platform/DOM/CPPlatform.j", "Platform/DOM/CPPlatformString.j");
|
||||
|
||||
FIXME_fileDependency (FILE.join("Platform", "CPPlatform.j"), FILE.join("Platform", "DOM", "CPPlatform.j"));
|
||||
FIXME_fileDependency (FILE.join("Platform", "CPPlatformString.j"), FILE.join("Platform", "DOM", "CPPlatformString.j"));
|
||||
FIXME_fileDependency (path.join("Platform", "CPPlatform.j"), path.join("Platform", "DOM", "CPPlatform.j"));
|
||||
FIXME_fileDependency (path.join("Platform", "CPPlatformString.j"), path.join("Platform", "DOM", "CPPlatformString.j"));
|
||||
|
||||
appKitTask = framework ("AppKit", function(appKitTask)
|
||||
{
|
||||
appKitTask.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "AppKit.build", $CONFIGURATION))
|
||||
appKitTask.setBuildIntermediatesPath(path.join($BUILD_DIR, "AppKit.build", $CONFIGURATION))
|
||||
appKitTask.setBuildPath($BUILD_CONFIGURATION_DIR);
|
||||
|
||||
appKitTask.setAuthor("280 North, Inc.");
|
||||
@@ -40,7 +42,7 @@ appKitTask = framework ("AppKit", function(appKitTask)
|
||||
appKitTask.setCompilerFlags("-DDEBUG -g -S --inline-msg-send -Wno-unused-but-set-variable " + INCLUDES);
|
||||
});
|
||||
|
||||
$BUILD_CJS_CAPPUCCINO_APPKIT = FILE.join($BUILD_CJS_CAPPUCCINO_FRAMEWORKS, "AppKit");
|
||||
$BUILD_CJS_CAPPUCCINO_APPKIT = path.join($BUILD_CJS_CAPPUCCINO_FRAMEWORKS, "AppKit");
|
||||
|
||||
filedir ($BUILD_CJS_CAPPUCCINO_APPKIT, ["AppKit"], function()
|
||||
{
|
||||
@@ -53,11 +55,11 @@ task ("Theme", [$BUILD_CJS_CAPPUCCINO_APPKIT], function()
|
||||
{
|
||||
subjake(["Themes"], "build");
|
||||
|
||||
cp_r(FILE.join($BUILD_DIR, $CONFIGURATION, 'Aristo.blend'), FILE.join($BUILD_PATH, 'Resources', 'Aristo.blend'));
|
||||
cp_r(FILE.join($BUILD_DIR, $CONFIGURATION, 'Aristo.blend'), FILE.join($BUILD_CJS_CAPPUCCINO_APPKIT, "Resources", "Aristo.blend"));
|
||||
cp_r(path.join($BUILD_DIR, $CONFIGURATION, 'Aristo.blend'), path.join($BUILD_PATH, 'Resources', 'Aristo.blend'));
|
||||
cp_r(path.join($BUILD_DIR, $CONFIGURATION, 'Aristo.blend'), path.join($BUILD_CJS_CAPPUCCINO_APPKIT, "Resources", "Aristo.blend"));
|
||||
|
||||
cp_r(FILE.join($BUILD_DIR, $CONFIGURATION, 'Aristo2.blend'), FILE.join($BUILD_PATH, 'Resources', 'Aristo2.blend'));
|
||||
cp_r(FILE.join($BUILD_DIR, $CONFIGURATION, 'Aristo2.blend'), FILE.join($BUILD_CJS_CAPPUCCINO_APPKIT, "Resources", "Aristo2.blend"));
|
||||
cp_r(path.join($BUILD_DIR, $CONFIGURATION, 'Aristo2.blend'), path.join($BUILD_PATH, 'Resources', 'Aristo2.blend'));
|
||||
cp_r(path.join($BUILD_DIR, $CONFIGURATION, 'Aristo2.blend'), path.join($BUILD_CJS_CAPPUCCINO_APPKIT, "Resources", "Aristo2.blend"));
|
||||
});
|
||||
|
||||
task ("build", ["AppKit", $BUILD_CJS_CAPPUCCINO_APPKIT, "Theme"]);
|
||||
|
||||
@@ -2,10 +2,6 @@ console.log("at the top of CommonJS/Jakefile");
|
||||
|
||||
require("../common.jake");
|
||||
|
||||
const { FileList } = require("../common.jake");
|
||||
const { task } = require("../common.jake");
|
||||
const { filedir } = require("../common.jake");
|
||||
|
||||
// var FILE = require("file");
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
|
||||
@@ -25,8 +25,11 @@ require("../common.jake");
|
||||
var framework = require("./objective-j/jake").framework;
|
||||
var BundleTask = require("./objective-j/jake").BundleTask;
|
||||
|
||||
const path = require("path");
|
||||
|
||||
foundationTask = framework ("Foundation", function(foundationTask)
|
||||
{
|
||||
console.log("in foundationTask");
|
||||
foundationTask.setBuildIntermediatesPath(path.join($BUILD_DIR, "Foundation.build", $CONFIGURATION))
|
||||
foundationTask.setBuildPath($BUILD_CONFIGURATION_DIR);
|
||||
|
||||
@@ -62,9 +65,14 @@ $BUILD_CJS_FOUNDATION = path.join($BUILD_CJS_CAPPUCCINO_FRAMEWORKS, "Foundation"
|
||||
|
||||
filedir ($BUILD_CJS_FOUNDATION, ["Foundation"], function()
|
||||
{
|
||||
console.log("in task $BUILD_CJS_FOUNDATION");
|
||||
cp_r(foundationTask.buildProductPath(), $BUILD_CJS_FOUNDATION);
|
||||
});
|
||||
|
||||
|
||||
task ("build", ["Foundation", $BUILD_CJS_FOUNDATION]);
|
||||
|
||||
CLOBBER.include($BUILD_CJS_FOUNDATION);
|
||||
|
||||
console.log("at the end of Foundation/jakefile");
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
var /* FILE = require("file"), */
|
||||
OS = require("os"),
|
||||
Jake = require("jake"),
|
||||
Jake = require("../../../../jake/lib/jake"),
|
||||
BundleTask = (require("./bundletask")).BundleTask;
|
||||
|
||||
var fs = require("fs-extra");
|
||||
@@ -81,7 +81,7 @@ ApplicationTask.prototype.shouldGenerateCacheManifest = function()
|
||||
};
|
||||
ApplicationTask.prototype.defineFrameworksTask = function()
|
||||
{
|
||||
if (!this._frameworksPath && (this.environments()).indexOf((require("objective-j/jake/environment")).Browser) === -1)
|
||||
if (!this._frameworksPath && (this.environments()).indexOf((require("./environment.js")).Browser) === -1)
|
||||
return;
|
||||
var buildPath = this.buildProductPath(),
|
||||
newFrameworks = path.join(buildPath, "Frameworks"),
|
||||
|
||||
@@ -26,8 +26,8 @@ var /* FILE = require("file"),
|
||||
TERM = require("narwhal/term"),
|
||||
base64 = require("base64"),
|
||||
Jake = require("jake"),*/
|
||||
CLEAN = require("../../../common.jake").CLEAN,
|
||||
CLOBBER = require("../../../common.jake").CLOBBER,
|
||||
//CLEAN = require("../../../common.jake").CLEAN,
|
||||
//CLOBBER = require("../../../common.jake").CLOBBER,
|
||||
ObjectiveJ = require("objj-runtime"),
|
||||
environment = require("./environment");
|
||||
|
||||
@@ -35,13 +35,14 @@ var /* FILE = require("file"),
|
||||
var Task = Jake.Task,
|
||||
filedir = Jake.filedir; */
|
||||
|
||||
var jake = require("jake");
|
||||
// for testing
|
||||
var Jake = require("../../../../jake/lib/jake.js");
|
||||
var fs = require("fs-extra");
|
||||
var glob = require("glob");
|
||||
|
||||
var Task = jake.Task;
|
||||
const { task } = require("../../../common.jake");
|
||||
const { filedir } = require("../../../common.jake");
|
||||
var task = Jake.task;
|
||||
var Task = Jake.Task;
|
||||
var filedir = Jake.filedir;
|
||||
|
||||
var path = require("path");
|
||||
var child_process = require("child_process");
|
||||
@@ -57,7 +58,7 @@ function mimeType(aFilename)
|
||||
function BundleTask(aName, anApplication)
|
||||
{
|
||||
Task.apply(this, arguments);
|
||||
var ignoreCommonJS = system.env["CAPP_IGNORE_COMMONJS_ENV"];
|
||||
var ignoreCommonJS = process.env["CAPP_IGNORE_COMMONJS_ENV"];
|
||||
if (ignoreCommonJS && ignoreCommonJS.toLowerCase() == "no" || ignoreCommonJS == "1")
|
||||
this.setEnvironments([environment.Browser]);
|
||||
else
|
||||
@@ -309,6 +310,7 @@ BundleTask.prototype.defineTasks = function()
|
||||
this.defineSpritedImagesTask();
|
||||
CLEAN.include(this.buildIntermediatesProductPath());
|
||||
CLOBBER.include(this.buildProductPath());
|
||||
console.log("at the end of defineTasks");
|
||||
};
|
||||
BundleTask.prototype.packageType = function()
|
||||
{
|
||||
@@ -367,7 +369,7 @@ BundleTask.prototype.defineInfoPlistTask = function()
|
||||
};
|
||||
BundleTask.License = {LGPL_v2_1: "LGPL_v2_1", MIT: "MIT"};
|
||||
|
||||
var LICENSES_PATH = path.join(path.resolve(path.extname(module.path)), "LICENSES"),
|
||||
var LICENSES_PATH = path.join(path.resolve(module.path), "LICENSES"),
|
||||
LICENSE_PATHS = {"LGPL_v2_1": path.join(LICENSES_PATH, "LGPL-v2.1"), "MIT": path.join(LICENSES_PATH, "MIT")};
|
||||
BundleTask.prototype.defineLicenseTask = function()
|
||||
{
|
||||
@@ -461,6 +463,7 @@ function directoryInCommon(filenames)
|
||||
}
|
||||
BundleTask.prototype.defineResourceTasks = function()
|
||||
{
|
||||
console.log("defineResourceTasks");
|
||||
if (!this._resources)
|
||||
return;
|
||||
var resources = [],
|
||||
@@ -473,6 +476,7 @@ BundleTask.prototype.defineResourceTasks = function()
|
||||
} else
|
||||
resources.push(aResourcePath);
|
||||
});
|
||||
console.log(resources);
|
||||
// TODO: too lazy to look this up, assuming it returns the array without duplicates
|
||||
// resources = UTIL.unique(resources);
|
||||
resources = [... new Set(resources)];
|
||||
@@ -630,21 +634,25 @@ BundleTask.prototype.defineStaticTask = function()
|
||||
BundleTask.prototype.defineSourceTasks = function()
|
||||
{
|
||||
var sources = this.sources();
|
||||
if (!sources)
|
||||
if (!sources) {
|
||||
return;
|
||||
var compilerFlags = this.compilerFlags(),
|
||||
flattensSources = this.flattensSources();
|
||||
}
|
||||
var compilerFlags = this.compilerFlags();
|
||||
var flattensSources = this.flattensSources();
|
||||
|
||||
if (!compilerFlags)
|
||||
compilerFlags = "";
|
||||
else if (compilerFlags.join)
|
||||
compilerFlags = compilerFlags.join(" ");
|
||||
console.log("environments");
|
||||
console.log(this.environments());
|
||||
(this.environments()).forEach( function(anEnvironment)
|
||||
{
|
||||
var environmentSources = sources,
|
||||
folder = anEnvironment.name() + ".environment",
|
||||
sourcesPath = path.join(this.buildIntermediatesProductPath(), folder, "Sources", ""),
|
||||
staticPath = this.buildProductStaticPathForEnvironment(anEnvironment);
|
||||
if (!Array.isArray(environmentSources) && environmentSources.constructor !== jake.FileList)
|
||||
if (!Array.isArray(environmentSources) && environmentSources.constructor !== FileList)
|
||||
{
|
||||
environmentSources = environmentSources[anEnvironment];
|
||||
if (!environmentSources)
|
||||
@@ -672,10 +680,12 @@ BundleTask.prototype.defineSourceTasks = function()
|
||||
return;
|
||||
var relativePath = aFilename.substring(basePathLength ? basePathLength + 1 : basePathLength),
|
||||
compiledEnvironmentSource = path.join(sourcesPath, relativePath);
|
||||
filedir(compiledEnvironmentSource, [aFilename], function()
|
||||
|
||||
filedir(compiledEnvironmentSource, [aFilename], async function()
|
||||
{
|
||||
console.log("ran compiledEnvironmentSource");
|
||||
var rhinoUglyFix = false;
|
||||
if (system.engine === "rhino")
|
||||
if (false/* system.engine === "rhino" */)
|
||||
{
|
||||
if (typeof document == "undefined")
|
||||
{
|
||||
@@ -688,36 +698,50 @@ BundleTask.prototype.defineSourceTasks = function()
|
||||
{
|
||||
navigator = {"userAgent": "fakenavigator"};
|
||||
rhinoUglyFix = true;
|
||||
} } var compile;
|
||||
} }
|
||||
|
||||
|
||||
var compile;
|
||||
if ((path.extname(aFilename)).toLowerCase() !== ".j")
|
||||
{
|
||||
console.log("Including [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)");
|
||||
//(TERM.stream.write("Including [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)")).flush();
|
||||
var compiled = fs.readFileSync(aFilename, { encoding: "utf8"});
|
||||
var compiled = fs.readFileSync(aFilename, { encoding: "utf8"}).toString();
|
||||
console.log((Array(Math.round(compiled.length / 1024) + 3)).join("."));
|
||||
return await fs.promises.writeFile(compiledEnvironmentSource, compiled, { encoding: "utf8"});
|
||||
} else
|
||||
{
|
||||
var translatedFilename = translateFilenameToPath[aFilename] ? translateFilenameToPath[aFilename] : aFilename,
|
||||
otherwayTranslatedFilename = otherwayTranslateFilenameToPath[aFilename] ? otherwayTranslateFilenameToPath[aFilename] : aFilename,
|
||||
theTranslatedFilename = otherwayTranslatedFilename ? otherwayTranslatedFilename : translatedFilename,
|
||||
absolutePath = path.absolute(theTranslatedFilename),
|
||||
absolutePath = path.resolve(theTranslatedFilename),
|
||||
basePath = absolutePath.substring(0, absolutePath.length - theTranslatedFilename.length);
|
||||
ObjectiveJ.FileExecutable.setCurrentGccCompilerFlags(environmentCompilerFlags);
|
||||
CFBundle.environments = function()
|
||||
{
|
||||
return [anEnvironment.name(), "ObjJ"];
|
||||
};
|
||||
ObjectiveJ.make_narwhal_factory(absolutePath, basePath, translateFilenameToPath)(require, e, module, system, print);
|
||||
console.log("Compiling [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)");
|
||||
//(TERM.stream.write("Compiling [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)")).flush();
|
||||
var otherwayTranslatedFilename = otherwayTranslateFilenameToPath[aFilename] ? otherwayTranslateFilenameToPath[aFilename] : aFilename,
|
||||
translatedFilename = translateFilenameToPath[aFilename] ? translateFilenameToPath[aFilename] : aFilename,
|
||||
executer = new ObjectiveJ.FileExecutable(otherwayTranslatedFilename);
|
||||
var compiled = executer.toMarkedString();
|
||||
} if (rhinoUglyFix)
|
||||
delete document;
|
||||
console.log(compiledEnvironmentSource);
|
||||
console.log((Array(Math.round(compiled.length / 1024) + 3)).join("."));
|
||||
fs.writeFileSync(compiledEnvironmentSource, compiled, { encoding: "utf8"});
|
||||
console.log("before make_narwhal_factory");
|
||||
console.log("basePath: " + basePath);
|
||||
//absolutePath = "/" + absolutePath;
|
||||
//basePath = "/" + basePath;
|
||||
console.log("absolutePath: " + absolutePath);
|
||||
return new Promise((resolve, reject) => {
|
||||
var callback = function() {
|
||||
console.log("callback called");
|
||||
var otherwayTranslatedFilename = otherwayTranslateFilenameToPath[aFilename] ? otherwayTranslateFilenameToPath[aFilename] : aFilename,
|
||||
translatedFilename = translateFilenameToPath[aFilename] ? translateFilenameToPath[aFilename] : aFilename,
|
||||
executer = new ObjectiveJ.FileExecutable(otherwayTranslatedFilename);
|
||||
var compiled = executer.toMarkedString();
|
||||
console.log((Array(Math.round(compiled.length / 1024) + 3)).join("."));
|
||||
fs.writeFileSync(compiledEnvironmentSource, compiled, { encoding: "utf8"});
|
||||
resolve();
|
||||
}
|
||||
ObjectiveJ.make_narwhal_factory(absolutePath, basePath, translateFilenameToPath, callback)(require, e, module, {}, console.log);
|
||||
console.log("Compiling [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)");
|
||||
//(TERM.stream.write("Compiling [\0blue(" + anEnvironment + "\0)] \0purple(" + aFilename + "\0)")).flush();
|
||||
});
|
||||
}
|
||||
});
|
||||
filedir(staticPath, [compiledEnvironmentSource]);
|
||||
replacedFiles.push(flattensSources ? path.basename(aFilename) : relativePath);
|
||||
|
||||
@@ -12,9 +12,6 @@ require("./common.jake");
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
const { FileList } = require("./common.jake");
|
||||
const { task } = require("./common.jake");
|
||||
const { filedir } = require("./common.jake");
|
||||
|
||||
var subprojects = ["Objective-J", "CommonJS", "Foundation", "AppKit", "Tools"];
|
||||
|
||||
@@ -41,6 +38,7 @@ $BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS = path.join($BUILD_CJS_CAPPUCCINO, "Frame
|
||||
|
||||
filedir ($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, ["debug", "release"], function()
|
||||
{
|
||||
console.log("in the task $BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS");
|
||||
fs.mkdirSync($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS);
|
||||
|
||||
cp_r(path.join($BUILD_DIR, "Debug", "Foundation"), path.join($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "Foundation"));
|
||||
@@ -52,6 +50,7 @@ task ("CommonJS", [$BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, $BUILD_CJS_CAPPUCCIN
|
||||
|
||||
task ("install", ["CommonJS"], function()
|
||||
{
|
||||
console.log("in task install");
|
||||
installCopy($BUILD_CJS_OBJECTIVE_J, false);
|
||||
installCopy($BUILD_CJS_CAPPUCCINO, false);
|
||||
});
|
||||
|
||||
+16
-15
@@ -23,10 +23,6 @@
|
||||
console.log("i jakefilen för obj-j");
|
||||
require("../common.jake");
|
||||
|
||||
const { FileList } = require("../common.jake");
|
||||
const { task } = require("../common.jake");
|
||||
const { filedir } = require("../common.jake");
|
||||
|
||||
// Make sure we can use new functions in an in old javascript engines like Rhino
|
||||
// This is only needed if new things are introduced in OldBrowserCompatibility.js
|
||||
// as we are running in an already built Objective-J environment
|
||||
@@ -53,15 +49,14 @@ $BUILD_BROWSER_FILE = path.join($BUILD_OBJECTIVE_J, "Objective-J.js");
|
||||
|
||||
$INCLUDE_FLAGS = ["'-I" + process.cwd() + "'"];
|
||||
$DEBUG_FLAGS = $CONFIGURATION === "Debug" ? ["-DDEBUG=1"] : [""];
|
||||
$OBJECTIVEJ_FILES = new jake.FileList();
|
||||
$OBJECTIVEJ_FILES.include("*.js");
|
||||
$OBJECTIVEJ_FILES = new FileList("*.js");
|
||||
|
||||
$BROWSER_FILES = new FileList($BROWSER_FILE).include($OBJECTIVEJ_FILES);
|
||||
|
||||
$BROWSER_FILES = new jake.FileList();
|
||||
$BROWSER_FILES.include($BROWSER_FILE);
|
||||
$BROWSER_FILES.include($OBJECTIVEJ_FILES);
|
||||
|
||||
filedir($BUILD_BROWSER_FILE, $BROWSER_FILES, function(aTask)
|
||||
{
|
||||
console.log("in task $BUILD_BROWSER_FILE");
|
||||
gcc($BROWSER_FILE,
|
||||
$BUILD_BROWSER_FILE,
|
||||
environmentFlags("Browser", "ObjJ").concat($INCLUDE_FLAGS, $DEBUG_FLAGS, ["-Wno-unused-but-set-variable"]), $CONFIGURATION !== "Debug");
|
||||
@@ -130,7 +125,7 @@ function environmentFlags()
|
||||
}).concat("-DENVIRONMENTS=" + JSON.stringify(environments));
|
||||
}
|
||||
|
||||
async function compressor(srcCode) {
|
||||
function compressor(srcCode) {
|
||||
return srcCode;
|
||||
}
|
||||
|
||||
@@ -138,12 +133,13 @@ var headerText = fs.readFileSync("header.txt", { encoding: "utf8"});
|
||||
function gcc(inputFilePath, outputFilePath, flags, compress)
|
||||
{
|
||||
console.log("Building... \0green(" + outputFilePath +"\0)");
|
||||
var source = fs.readFileSync(inputFilePath, { charset : "utf8" });
|
||||
var source = fs.readFileSync(inputFilePath, { charset : "utf8" }).toString();
|
||||
//console.log(source.charCodeAt);
|
||||
var compilerOptions = compiler.parseGccCompilerFlags(flags.join(" "));
|
||||
var acornOptions = compilerOptions.acornOptions || (compilerOptions.acornOptions = {});
|
||||
|
||||
acornOptions.preprocessGetIncludeFile = function(filePath, isQuoted) {
|
||||
var includeContent = fs.readFileSync(filePath, { charset : "utf8" });
|
||||
var includeContent = fs.readFileSync(filePath, { charset : "utf8" }).toString();
|
||||
//print ("Include content for file '" + filePath + "': " + includeContent);
|
||||
//print ("Include file '" + filePath + "'");
|
||||
return {include: includeContent, sourceFile: filePath};
|
||||
@@ -160,15 +156,18 @@ function gcc(inputFilePath, outputFilePath, flags, compress)
|
||||
|
||||
// Set anyErrors to 'true' if there are any errors in the list
|
||||
anyErrors = anyErrors || warning.messageType === "ERROR";
|
||||
print(message);
|
||||
console.log(message);
|
||||
}
|
||||
|
||||
if (anyErrors) throw "Compilation Error";
|
||||
|
||||
debugger
|
||||
var code = c.code();
|
||||
//console.log(code);
|
||||
var contents = headerText + code;
|
||||
|
||||
|
||||
//console.log("code");
|
||||
//console.log(c);
|
||||
|
||||
if (path.extname(inputFilePath) === ".js" && compress)
|
||||
contents = compressor(contents);
|
||||
|
||||
@@ -176,3 +175,5 @@ function gcc(inputFilePath, outputFilePath, flags, compress)
|
||||
}
|
||||
|
||||
task("build", [$BUILD_BROWSER_FILE, $BUILD_LICENSE, $BUILD_CJS_OBJECTIVE_J_FRAMEWORK]);
|
||||
|
||||
console.log("at the bottom of Objective-J/jakefile");
|
||||
@@ -893,7 +893,6 @@ var ObjJAcornCompiler = function(/*String*/ aString, /*CFURL*/ aURL, options)
|
||||
this.addWarning(e);
|
||||
return;
|
||||
}
|
||||
|
||||
this.setCompiledCode(this.jsBuffer);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -2,6 +2,6 @@
|
||||
require("../common.jake");
|
||||
|
||||
// nib2cib uses fontinfo and imagesize and capp uses nib2cib
|
||||
subtasks(["fontinfo", "imagesize", "nib2cib", "objj2objcskeleton", "capp", "capp_lint", "capp_env", "dump_theme", "XcodeCapp"], ["build", /*"clean", "clobber"*/]);
|
||||
//subtasks(["fontinfo", "imagesize", "nib2cib", "objj2objcskeleton", "capp", "capp_lint", "capp_env", "dump_theme", "XcodeCapp"], ["build", /*"clean", "clobber"*/]);
|
||||
|
||||
subtasks(["fontinfo", "imagesize"], ["clean", "clobber"]);
|
||||
//subtasks(["fontinfo", "imagesize"], ["clean", "clobber"]);
|
||||
|
||||
@@ -3,7 +3,7 @@ require("../../common.jake");
|
||||
|
||||
var OS = require("os"),
|
||||
task = require("jake").task,
|
||||
stream = require("narwhal/term").stream,
|
||||
// stream = require("narwhal/term").stream;
|
||||
applicationName = "XcodeCapp.app";
|
||||
|
||||
task ("build", function()
|
||||
|
||||
+11
-7
@@ -1,16 +1,20 @@
|
||||
|
||||
require ("../../common.jake");
|
||||
|
||||
var app = require("objective-j/jake").app,
|
||||
BundleTask = require("objective-j/jake").BundleTask,
|
||||
fileCreate = require("jake").fileCreate,
|
||||
var app = require("../../Foundation/objective-j/jake.js").app;
|
||||
|
||||
var BundleTask = require("../../Foundation/objective-j/jake.js").BundleTask;
|
||||
|
||||
/* fileCreate = require("jake").fileCreate,
|
||||
FILE = require("file"),
|
||||
OS = require("os"),
|
||||
stream = require("narwhal/term").stream;
|
||||
stream = require("narwhal/term").stream; */
|
||||
|
||||
const path = require("path");
|
||||
|
||||
app ("capp", function(cappTask)
|
||||
{
|
||||
cappTask.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "capp.build", $CONFIGURATION))
|
||||
cappTask.setBuildIntermediatesPath(path.join($BUILD_DIR, "capp.build", $CONFIGURATION))
|
||||
cappTask.setBuildPath($BUILD_CJS_CAPPUCCINO_LIB);
|
||||
|
||||
cappTask.setAuthor("280 North, Inc.");
|
||||
@@ -22,7 +26,7 @@ app ("capp", function(cappTask)
|
||||
cappTask.setSources(new FileList("*.j"));
|
||||
cappTask.setResources(new FileList("Resources/*"));
|
||||
cappTask.setIncludesNibsAndXibs(true);
|
||||
cappTask.setEnvironments(require("objective-j/jake/environment").CommonJS);
|
||||
cappTask.setEnvironments(require("../../Foundation/objective-j/jake/environment.js").CommonJS);
|
||||
cappTask.setFlattensSources(true);
|
||||
cappTask.setSpritesResources(false);
|
||||
|
||||
@@ -32,7 +36,7 @@ app ("capp", function(cappTask)
|
||||
cappTask.setCompilerFlags("-DDEBUG -g");
|
||||
});
|
||||
|
||||
$BUILD_CJS_CAPP = FILE.join($BUILD_CJS_CAPPUCCINO_BIN, "capp");
|
||||
$BUILD_CJS_CAPP = path.join($BUILD_CJS_CAPPUCCINO_BIN, "capp");
|
||||
|
||||
// executable in environment directory
|
||||
filedir($BUILD_CJS_CAPP, ["capp"], function()
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
|
||||
require ("../../common.jake");
|
||||
|
||||
var FILE = require("file"),
|
||||
/* var FILE = require("file"),
|
||||
SYSTEM = require("system"),
|
||||
path = FILE.Path(FILE.join(SYSTEM.prefix, "bin", "capp_env"));
|
||||
|
||||
sudo(["cp", "-f", "capp_env", path]);
|
||||
sudo(["chmod", "755", path]);
|
||||
*/
|
||||
@@ -1,10 +1,11 @@
|
||||
|
||||
require ("../../common.jake");
|
||||
|
||||
var FILE = require("file"),
|
||||
/* var FILE = require("file"),
|
||||
SYSTEM = require("system"),
|
||||
path = FILE.Path(FILE.join(SYSTEM.prefix, "bin", "dump_theme"));
|
||||
|
||||
sudo(["cp", "-f", "dump_theme", path]);
|
||||
sudo(["chmod", "755", path]);
|
||||
copyManPage("dump_theme", 1);
|
||||
*/
|
||||
+10
-5
@@ -2,8 +2,10 @@
|
||||
require ("../../common.jake");
|
||||
|
||||
var OS = require("os"),
|
||||
task = require("jake").task,
|
||||
SYSTEM = require("system");
|
||||
task = require("../../../jake/lib/jake.js").task;
|
||||
//SYSTEM = require("system");
|
||||
|
||||
const child_process = require("child_process");
|
||||
|
||||
task ("build", function()
|
||||
{
|
||||
@@ -17,10 +19,13 @@ task ("build", function()
|
||||
else
|
||||
args = "-sdk macosx " + args;
|
||||
|
||||
var xcodebuild = SYSTEM.env.CAPP_BUILD ? "xcodebuild " : "CAPP_BUILD=../../Build xcodebuild ";
|
||||
var xcodebuild = process.env.CAPP_BUILD ? "xcodebuild " : "CAPP_BUILD=../../Build xcodebuild ";
|
||||
|
||||
if (OS.system(xcodebuild + args))
|
||||
OS.exit(1);
|
||||
try {
|
||||
child_process.execSync(xcodebuild + args);
|
||||
} catch (error) {
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+12
-8
@@ -1,14 +1,17 @@
|
||||
|
||||
require("../../common.jake");
|
||||
|
||||
var FILE = require("file");
|
||||
// var FILE = require("file");
|
||||
|
||||
var app = require("objective-j/jake").app;
|
||||
var BundleTask = require("objective-j/jake").BundleTask;
|
||||
const path = require("path");
|
||||
const glob = require("glob");
|
||||
|
||||
var app = require("../../Foundation/objective-j/jake.js").app;
|
||||
var BundleTask = require("../../Foundation/objective-j/jake.js").BundleTask;
|
||||
|
||||
app ("nib2cib", function(nib2cibTask)
|
||||
{
|
||||
nib2cibTask.setBuildIntermediatesPath(FILE.join($BUILD_DIR, "nib2cib.build", $CONFIGURATION))
|
||||
nib2cibTask.setBuildIntermediatesPath(path.join($BUILD_DIR, "nib2cib.build", $CONFIGURATION))
|
||||
nib2cibTask.setBuildPath($BUILD_CJS_CAPPUCCINO_LIB);
|
||||
|
||||
nib2cibTask.setIdentifier("com.280n.nib2cib");
|
||||
@@ -17,9 +20,10 @@ app ("nib2cib", function(nib2cibTask)
|
||||
nib2cibTask.setAuthor("280 North, Inc.");
|
||||
nib2cibTask.setEmail("feedback @nospam@ 280north.com");
|
||||
nib2cibTask.setSummary("nib2cib converts Cocoa nib and xibs to Cappuccino cibs");
|
||||
nib2cibTask.setSources(FILE.glob("**/*.j"));
|
||||
nib2cibTask.setResources(FILE.glob("Resources/*"));
|
||||
nib2cibTask.setEnvironments(require("objective-j/jake/environment").CommonJS);
|
||||
|
||||
nib2cibTask.setSources(glob.sync("**/*.j"));
|
||||
nib2cibTask.setResources(glob.sync("Resources/*"));
|
||||
nib2cibTask.setEnvironments(require("../../Foundation/objective-j/jake/environment.js").CommonJS);
|
||||
nib2cibTask.setFlattensSources(true);
|
||||
|
||||
if ($CONFIGURATION === "Release")
|
||||
@@ -28,7 +32,7 @@ app ("nib2cib", function(nib2cibTask)
|
||||
nib2cibTask.setCompilerFlags("-DDEBUG -g -Wno-unused-but-set-variable ");
|
||||
});
|
||||
|
||||
$BUILD_CJS_NIB2CIB = FILE.join($BUILD_CJS_CAPPUCCINO_BIN, 'nib2cib');
|
||||
$BUILD_CJS_NIB2CIB = path.join($BUILD_CJS_CAPPUCCINO_BIN, 'nib2cib');
|
||||
|
||||
// executable in environment directory
|
||||
filedir($BUILD_CJS_NIB2CIB, ["nib2cib"], function()
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
require ("../../common.jake");
|
||||
|
||||
var FILE = require("file"),
|
||||
SYSTEM = require("system"),
|
||||
path = FILE.Path(FILE.join(SYSTEM.prefix, "bin", "objj2objcskeleton"));
|
||||
SYSTEM = require("system");
|
||||
|
||||
sudo(["cp", "-f", "objj2objcskeleton", path]);
|
||||
sudo(["chmod", "755", path]);
|
||||
const path = require("path");
|
||||
|
||||
var p = FILE.Path(path.join(SYSTEM.prefix, "bin", "objj2objcskeleton"));
|
||||
|
||||
sudo(["cp", "-f", "objj2objcskeleton", p]);
|
||||
sudo(["chmod", "755", p]);
|
||||
|
||||
+36
-56
@@ -30,6 +30,9 @@ var fs = require('fs');
|
||||
var child_process = require('child_process');
|
||||
var path = require('path');
|
||||
|
||||
// for testing
|
||||
var JAKE = require("../jake/lib/jake.js");
|
||||
|
||||
requiresSudo = false;
|
||||
|
||||
process.argv.slice(1).forEach(function(arg)
|
||||
@@ -58,9 +61,9 @@ if (!process.env["CONFIG"])
|
||||
|
||||
global.ENV = process.env;
|
||||
|
||||
// FIXA: Skillnad mellan nya jake och 280 jake
|
||||
// changed approach, now we try to port jake from narwhal to node instead
|
||||
|
||||
newJakeTaskWrapper = function() {
|
||||
/* newJakeTaskWrapper = function() {
|
||||
console.log("nu har vi kört taskwrappern");
|
||||
var nArgs = arguments.length;
|
||||
desc(arguments[0])
|
||||
@@ -95,58 +98,29 @@ newJakeFiledirWrapper = function() {
|
||||
jake.file(arguments[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
} */
|
||||
|
||||
exports.task = newJakeTaskWrapper;
|
||||
//global.directory = JAKE.directory;
|
||||
//global.file = JAKE.file;
|
||||
exports.filedir = newJakeFiledirWrapper;
|
||||
exports.FileList = jake.FileList;
|
||||
global.task = JAKE.task;
|
||||
global.directory = JAKE.directory;
|
||||
global.file = JAKE.file;
|
||||
global.filedir = JAKE.filedir;
|
||||
global.FileList = JAKE.FileList;
|
||||
|
||||
global.$CONFIGURATION = process.env['CONFIG'];
|
||||
global.$INLINE_MSG_SEND = process.env['INLINE_MSG_SEND']; // FIXA: I vilket sammanhang kommer denna egentligen användas?
|
||||
global.$INLINE_MSG_SEND = process.env['INLINE_MSG_SEND'];
|
||||
global.$BUILD_DIR = process.env['BUILD_PATH'];
|
||||
global.$BUILD_CONFIGURATION_DIR = path.join($BUILD_DIR, $CONFIGURATION);
|
||||
|
||||
global.$BUILD_CJS_OBJECTIVE_J = path.join($BUILD_CONFIGURATION_DIR, "CommonJS", "objective-j");
|
||||
|
||||
global.$BUILD_CJS_CAPPUCCINO = path.join($BUILD_CONFIGURATION_DIR, "CommonJS", "cappuccino");
|
||||
global.$BUILD_CJS_CAPPUCCINO_BIN = path.join($BUILD_CJS_CAPPUCCINO, "bin");
|
||||
global.$BUILD_CJS_CAPPUCCINO_LIB = path.join($BUILD_CJS_CAPPUCCINO, "lib");
|
||||
global.$BUILD_CJS_CAPPUCCINO_FRAMEWORKS = path.join($BUILD_CJS_CAPPUCCINO, "Frameworks");
|
||||
|
||||
var CLEAN = new jake.FileList();
|
||||
|
||||
CLEAN.include(["**/*~", "**/*.bak", "**/core"]);
|
||||
|
||||
CLEAN.clearExclusions().exclude(function(aFilename) {
|
||||
return path.basename(aFilename) === "core" && fs.lstatSync(aFilename).isDirectory();
|
||||
});
|
||||
|
||||
// desc "Remove any temporary products."
|
||||
task("clean", function() {
|
||||
CLEAN.forEach(function(aFilename) {
|
||||
try {
|
||||
fs.rmSync(aFilename, {recursive: true});
|
||||
} catch(anException) {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var CLOBBER = new jake.FileList();
|
||||
// desc "Remove any generated file."
|
||||
task("clobber", ["clean"], function() {
|
||||
CLOBBER.forEach(function(aFilename) {
|
||||
try {
|
||||
fs.rmSync(aFilename, {recursive: true});
|
||||
} catch(anException) {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// FIXA: Skillnad mellan nya jake och 280 jake
|
||||
// CLEAN och CLOBBER är FileLists
|
||||
global.CLEAN = CLEAN;
|
||||
global.CLOBBER = CLOBBER;
|
||||
// for testing
|
||||
global.CLEAN = require("../jake/lib/jake/clean.js").CLEAN;
|
||||
global.CLOBBER = require("../jake/lib/jake/clean.js").CLOBBER;
|
||||
global.CLEAN.include(path.join(global.$BUILD_DIR, "*.build"));
|
||||
global.CLOBBER.include(global.$BUILD_DIR);
|
||||
|
||||
@@ -157,7 +131,6 @@ global.FIXME_fileDependency = function(destinationPath, sourcePath)
|
||||
{
|
||||
file(destinationPath, [sourcePath], function()
|
||||
{
|
||||
// FIXA: Detta borde vara samma sak som FILE.touch i narwhal
|
||||
var time = new Date();
|
||||
try {
|
||||
fs.utimesSync(destinationPath, time, time);
|
||||
@@ -171,12 +144,11 @@ global.FIXME_fileDependency = function(destinationPath, sourcePath)
|
||||
// used in serializedENV()
|
||||
function additionalPackages()
|
||||
{
|
||||
console.log("in additionalPackages");
|
||||
var builtObjectiveJPackage = path.join(path.resolve($BUILD_CONFIGURATION_DIR), "CommonJS", "objective-j");
|
||||
var builtCappuccinoPackage = path.join(path.resolve($BUILD_CONFIGURATION_DIR), "CommonJS", "cappuccino");
|
||||
|
||||
var packages = [];
|
||||
console.log("packages");
|
||||
console.log(packages);
|
||||
// load built objective-j if exists, otherwise unbuilt
|
||||
if (!fs.existsSync(path.join(builtObjectiveJPackage, "package.json"))) {
|
||||
//if (!packageInCatalog(builtObjectiveJPackage))
|
||||
@@ -188,7 +160,7 @@ function additionalPackages()
|
||||
//if (!packageInCatalog(builtCappuccinoPackage))
|
||||
packages.push(builtCappuccinoPackage);
|
||||
}
|
||||
|
||||
|
||||
return packages;
|
||||
}
|
||||
|
||||
@@ -251,16 +223,18 @@ function getShellConfigFile()
|
||||
|
||||
function reforkWithPackages()
|
||||
{
|
||||
console.log("in reforkWithPackages");
|
||||
if (additionalPackages().length > 0)
|
||||
{
|
||||
var cmd = serializedENV() + " " + process.argv.map(enquote).join(" ");
|
||||
console.log("cmd: " + cmd);
|
||||
// FIXA: oklart om detta är rätt
|
||||
child_process.execSync(cmd, {stdio: 'inherit'});
|
||||
process.exit();
|
||||
}
|
||||
}
|
||||
|
||||
reforkWithPackages();
|
||||
// reforkWithPackages();
|
||||
|
||||
function handleSetupEnvironmentError(e)
|
||||
{
|
||||
@@ -306,7 +280,6 @@ function copyRecursiveSync (src, dest) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
global.cp_r = function(/*String*/ from, /*String*/ to)
|
||||
{
|
||||
@@ -342,12 +315,17 @@ global.mv = function(/*String*/ from, /*String*/ to)
|
||||
|
||||
// FIXA: kör command och returnera exitkoden
|
||||
function systemSync(command)
|
||||
{
|
||||
{
|
||||
console.log("i systemSync");
|
||||
console.log("command: " + command)
|
||||
|
||||
try {
|
||||
child_process.execSync(command);
|
||||
child_process.execSync(command, {stdio: 'inherit'});
|
||||
console.log("exited gracefully")
|
||||
return 0;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
console.log(error.output.toString());
|
||||
return error.status;
|
||||
}
|
||||
}
|
||||
@@ -362,8 +340,8 @@ global.subjake = function(/*Array<String>*/ directories, /*String*/ aTaskName)
|
||||
{
|
||||
if (fs.lstatSync(aDirectory).isDirectory() && fs.lstatSync(path.join(aDirectory, "Jakefile")).isFile())
|
||||
{
|
||||
|
||||
var cmd = "cd " + enquote(aDirectory) + " && " + serializedENV() + " " + "jake" + " " + enquote(aTaskName);
|
||||
// just for testing
|
||||
var cmd = "cd " + enquote(aDirectory) + " && " + serializedENV() + " " + "/Users/alfred/Developer/jake/bin/jake" + " " + enquote(aTaskName);
|
||||
var returnCode = systemSync(cmd);
|
||||
|
||||
if (returnCode)
|
||||
@@ -413,12 +391,13 @@ global.setPackageMetadata = function(packagePath)
|
||||
var pkg = JSON.parse(fs.readFileSync(packagePath, { encoding: "utf8" } ));
|
||||
|
||||
try {
|
||||
var output = child_process.execSync("git", ["rev-parse", "--verify", "HEAD"]);
|
||||
var output = child_process.execSync("git rev-parse --verify HEAD");
|
||||
var sha = output.toString().split("\n")[0];
|
||||
if (sha.length === 40)
|
||||
pkg["cappuccino-revision"] = sha;
|
||||
|
||||
} catch (error) {
|
||||
console.log(error.output.toString());
|
||||
console.log("setPackageMetadata error " + error.status);
|
||||
}
|
||||
|
||||
@@ -523,9 +502,10 @@ global.installCopy = function(sourcePath, useSudo)
|
||||
global.spawnJake = function(/*String*/ aTaskName)
|
||||
{
|
||||
console.log("i spawnJake");
|
||||
if (systemSync(serializedENV() + " " + process.argv[0] + " " + "--inspect-brk" + " " + aTaskName))
|
||||
// for testing
|
||||
if (systemSync(serializedENV() + " " + "/Users/alfred/Developer/jake/bin/jake" + " " + aTaskName))
|
||||
console.log("exited in spawnJake with code 1");
|
||||
process.exit(1); //rake abort if ($? != 0)
|
||||
console.log("hej och hå");
|
||||
};
|
||||
|
||||
var normalizeCommand = function(/*Array or String*/ command)
|
||||
@@ -570,7 +550,7 @@ global.copyManPage = function(/*String*/ name, /*int*/ section)
|
||||
{
|
||||
var manDir = "/usr/local/share/man/man" + section,
|
||||
pageFile = name + "." + section,
|
||||
manPagePath = FILE.join(manDir, pageFile);
|
||||
manPagePath = path.join(manDir, pageFile);
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user