-
Notifications
You must be signed in to change notification settings - Fork 6
/
Jakefile
150 lines (128 loc) · 5.04 KB
/
Jakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
* Jakefile
*
* Copyright (C) 2010 Antoine Mercadal <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
require("./common.jake")
var ENV = require("system").env,
FILE = require("file"),
OS = require("os"),
JAKE = require("jake"),
task = JAKE.task,
CLEAN = require("jake/clean").CLEAN,
FileList = JAKE.FileList,
stream = require("narwhal/term").stream,
framework = require("cappuccino/jake").framework,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Release";
$DOCUMENTATION_BUILD = FILE.join("Build", "Documentation");
framework ("StropheCappuccino", function(task)
{
task.setBuildIntermediatesPath(FILE.join("Build", "StropheCappuccino.build", configuration));
task.setBuildPath(FILE.join("Build", configuration));
task.setProductName("StropheCappuccino");
task.setIdentifier("org.archipelproject.strophecappuccino");
task.setVersion("1.0");
task.setAuthor("Antoine Mercadal");
task.setEmail("antoine.mercadal @nospam@ inframonde.eu");
task.setSummary("StropheCappuccino");
task.setSources(new FileList("*.j", "MUC/*.j", "PubSub/*.j"));
task.setResources(new FileList("Resources/*"));
task.setInfoPlistPath("Info.plist");
if (configuration === "Debug")
task.setCompilerFlags("-DDEBUG -g");
else
task.setCompilerFlags("-O");
});
task("build", ["StropheCappuccino"]);
task("debug", ["build-strophe-debug"], function()
{
ENV["CONFIG"] = "Debug"
JAKE.subjake(["."], "build", ENV);
});
task("release", ["build-strophe-release"], function()
{
ENV["CONFIG"] = "Release"
JAKE.subjake(["."], "build", ENV);
});
task ("documentation", function()
{
// try to find a doxygen executable in the PATH;
var doxygen = executableExists("doxygen");
// If the Doxygen application is installed on Mac OS X, use that
if (!doxygen && executableExists("mdfind"))
{
var p = OS.popen(["mdfind", "kMDItemContentType == 'com.apple.application-bundle' && kMDItemCFBundleIdentifier == 'org.doxygen'"]);
if (p.wait() === 0)
{
var doxygenApps = p.stdout.read().split("\n");
if (doxygenApps[0])
doxygen = FILE.join(doxygenApps[0], "Contents/Resources/doxygen");
}
}
if (doxygen && FILE.exists(doxygen))
{
stream.print("\0green(Using " + doxygen + " for doxygen binary.\0)");
var documentationDir = FILE.join("Doxygen");
if (OS.system([FILE.join(documentationDir, "make_headers.sh")]))
OS.exit(1); //rake abort if ($? != 0)
if (!OS.system([doxygen, FILE.join(documentationDir, "StropheCappuccino.doxygen")]))
{
rm_rf($DOCUMENTATION_BUILD);
// mv("debug.txt", FILE.join("Documentation", "debug.txt"));
mv("Documentation", $DOCUMENTATION_BUILD);
}
OS.system(["ruby", FILE.join(documentationDir, "cleanup_headers")]);
}
else
stream.print("\0yellow(Doxygen not installed, skipping documentation generation.\0)");
});
task("test", function()
{
var tests = new FileList('Test/*Test.j');
var cmd = ["ojtest"].concat(tests.items());
var cmdString = cmd.map(OS.enquote).join(" ");
var code = OS.system(cmdString);
if (code !== 0)
OS.exit(code);
});
task("build-strophe", function()
{
var cmdString = "cd strophejs && make && cp strophe.js ../strophe.js && cd ../";
var code = OS.system(cmdString);
if (code !== 0)
OS.exit(code);
});
task("build-strophe-release", ["build-strophe"], function()
{
// var miniInput = FILE.read(FILE.join("strophe.js"), { charset:"UTF-8" });
// var minified = require("minify/yuicompressor").compress(miniInput, { charset : "UTF-8", useServer : true });
// FILE.path("Resources/Strophe").absolute().join("strophe.js").write(minified, { charset : "UTF-8" });
var cmdString = "mkdir -p Resources/Strophe && cp strophe.js Resources/Strophe/strophe.js";
var code = OS.system(cmdString);
if (code !== 0)
OS.exit(code);
});
task("build-strophe-debug", ["build-strophe"], function()
{
var cmdString = "mkdir -p Resources/Strophe && cp strophe.js Resources/Strophe/strophe.js";
var code = OS.system(cmdString);
if (code !== 0)
OS.exit(code);
});
task ("default", ["release"]);
task ("docs", ["documentation"]);
task ("all", ["release", "debug", "documentation"]);