Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 162 lines (123 sloc) 5.621 kb
9dc0c3a Francisco Ryan Tolmasky I First set of jake files.
tolmasky authored
1 #!/usr/bin/env narwhal
27c2285 Francisco Ryan Tolmasky I Jakefile cleanup, beginnings of "install" task.
tolmasky authored
2
9dc0c3a Francisco Ryan Tolmasky I First set of jake files.
tolmasky authored
3 var FILE = require("file"),
4 ENV = require("system").env,
5 OS = require("os"),
6 jake = require("jake");
7
8 require(FILE.absolute("common.jake"));
9
64a8e4c Francisco Ryan Tolmasky I More transition to jake.
tolmasky authored
10 var subprojects = [/*"External", */"Objective-J", "Foundation", "AppKit", "Tools", "External/ojunit"];
9dc0c3a Francisco Ryan Tolmasky I First set of jake files.
tolmasky authored
11
12 ["build", "clean", "clobber"].forEach(function(/*String*/ aTaskName)
13 {
14 task (aTaskName, function()
15 {
16 subjake(subprojects, aTaskName);
17 });
18 });
19
20 global.$TOOLS_README = FILE.join('Tools', 'READMEs', 'TOOLS-README');
21 global.$TOOLS_EDITORS = FILE.join('Tools', 'Editors');
22 global.$TOOLS_INSTALLER = FILE.join('Tools', 'Install', 'install-tools');
23 global.$TOOLS_DOWNLOAD = FILE.join($BUILD_DIR, 'Cappuccino', 'Tools');
24 global.$TOOLS_DOWNLOAD_EDITORS = FILE.join($TOOLS_DOWNLOAD, 'Editors');
25 global.$TOOLS_DOWNLOAD_README = FILE.join($TOOLS_DOWNLOAD, 'README');
26 global.$TOOLS_DOWNLOAD_INSTALLER = FILE.join($TOOLS_DOWNLOAD, 'install-tools');
27
28 global.$STARTER_README = FILE.join('Tools', 'READMEs', 'STARTER-README');
29 global.$STARTER_DOWNLOAD = FILE.join($BUILD_DIR, 'Cappuccino', 'Starter');
30 global.$STARTER_DOWNLOAD_APPLICATION = FILE.join($STARTER_DOWNLOAD, 'NewApplication');
31 global.$STARTER_DOWNLOAD_README = FILE.join($STARTER_DOWNLOAD, 'README');
32
9ee71e7 Francisco Ryan Tolmasky I Added install call, stil won't work until parallel changes take place in...
tolmasky authored
33 global.$COMMONJS = FILE.join($BUILD_DIR, "Release", "CommonJS", "objective-j");
34 global.$COMMONJS_DEBUG_FRAMEWORKS = FILE.join($COMMONJS, "objective-j", "lib", "Frameworks", "Debug");
e5c5378 Francisco Ryan Tolmasky I A bit of work on top level tasks.
tolmasky authored
35 global.$TOOLS_COMMONJS = FILE.join($BUILD_DIR, "Cappuccino", "Tools", "CommonJS", "objective-j");
9dc0c3a Francisco Ryan Tolmasky I First set of jake files.
tolmasky authored
36
27c2285 Francisco Ryan Tolmasky I Jakefile cleanup, beginnings of "install" task.
tolmasky authored
37 filedir ($COMMONJS_DEBUG_FRAMEWORKS, ["debug", "release"], function()
38 {
39 FILE.mkdirs($COMMONJS_DEBUG_FRAMEWORKS);
40
41 cp_r(FILE.join($BUILD_DIR, "Debug", "Objective-J"), FILE.join($COMMONJS_DEBUG_FRAMEWORKS, "Objective-J"));
42 cp_r(FILE.join($BUILD_DIR, "Debug", "Foundation"), FILE.join($COMMONJS_DEBUG_FRAMEWORKS, "Foundation"));
43 cp_r(FILE.join($BUILD_DIR, "Debug", "AppKit"), FILE.join($COMMONJS_DEBUG_FRAMEWORKS, "AppKit"));
44 cp_r(FILE.join($BUILD_DIR, "Debug", "BlendKit"), FILE.join($COMMONJS_DEBUG_FRAMEWORKS, "BlendKit"));
45 });
46
47 task ("install", [$COMMONJS_DEBUG_FRAMEWORKS, "release", "debug"], function()
48 {
9ee71e7 Francisco Ryan Tolmasky I Added install call, stil won't work until parallel changes take place in...
tolmasky authored
49 // FIXME: require("narwhal/tusk/install").install({}, $COMMONJS);
50 // Doesn't work due to some weird this.print business.
51 OS.system("tusk install " + $COMMONJS);
27c2285 Francisco Ryan Tolmasky I Jakefile cleanup, beginnings of "install" task.
tolmasky authored
52 });
53
54 // Documentation
55
56 $DOCUMENTATION_BUILD = FILE.join($BUILD_DIR, "Documentation");
57
58 task ("documentation", function()
59 {
60 if (executableExists("doxygen"))
61 {
62 if (OS.system("doxygen " + FILE.join("Tools", "Documentation", "Cappuccino.doxygen")))
63 OS.exit(1); //rake abort if ($? != 0)
64
65 rm_rf($DOCUMENTATION_BUILD);
66 mv("debug.txt", FILE.join("Documentation", "debug.txt"));
67 mv("Documentation", $DOCUMENTATION_BUILD);
68 }
69 else
70 print("doxygen not installed. skipping documentation generation.");
71 });
72
73 task ("docs", ["documentation"]);
74
75 // Downloads
76
1d1f664 Francisco Ryan Tolmasky I Made starter_download and docs tasks jake compliant.
tolmasky authored
77 task ("downloads", ["starter_download", "tools_download"]);
9dc0c3a Francisco Ryan Tolmasky I First set of jake files.
tolmasky authored
78
79 filedir ($TOOLS_DOWNLOAD_EDITORS, [$TOOLS_EDITORS], function()
80 {
81 cp_r(FILE.join($TOOLS_EDITORS, '.'), $TOOLS_DOWNLOAD_EDITORS);
82 });
83
84 filedir ($TOOLS_DOWNLOAD_README, [$TOOLS_README], function()
85 {
86 cp($TOOLS_README, $TOOLS_DOWNLOAD_README);
87 });
88
89 filedir ($TOOLS_DOWNLOAD_INSTALLER, [$TOOLS_INSTALLER], function()
90 {
91 cp($TOOLS_INSTALLER, $TOOLS_DOWNLOAD_INSTALLER);
92 });
93
e5c5378 Francisco Ryan Tolmasky I A bit of work on top level tasks.
tolmasky authored
94 task ("tools_download", [$TOOLS_DOWNLOAD_EDITORS, $TOOLS_DOWNLOAD_README, $TOOLS_DOWNLOAD_INSTALLER, $TOOLS_COMMONJS]);
9dc0c3a Francisco Ryan Tolmasky I First set of jake files.
tolmasky authored
95
96 task ("starter_download", [$STARTER_DOWNLOAD_APPLICATION, $STARTER_DOWNLOAD_README]);
97
e5c5378 Francisco Ryan Tolmasky I A bit of work on top level tasks.
tolmasky authored
98 filedir ($TOOLS_COMMONJS, ["build"], function()
9dc0c3a Francisco Ryan Tolmasky I First set of jake files.
tolmasky authored
99 {
e5c5378 Francisco Ryan Tolmasky I A bit of work on top level tasks.
tolmasky authored
100 rm_rf($TOOLS_COMMONJS);
101 cp_r($COMMONJS_PRODUCT, $TOOLS_COMMONJS);
9dc0c3a Francisco Ryan Tolmasky I First set of jake files.
tolmasky authored
102 });
103
104 task ("deploy", ["downloads", "docs"], function()
105 {
106 // copy the docs into the starter pack
107 cp_r(FILE.join($DOCUMENTATION_BUILD, 'html', '.'), FILE.join($STARTER_DOWNLOAD, 'Documentation'));
108
109 var cappuccino_output_path = FILE.join($BUILD_DIR, 'Cappuccino');
110
111 // zip the starter pack
112 var starter_zip_output = FILE.join($BUILD_DIR, 'Cappuccino', 'Starter.zip');
113 rm_rf(starter_zip_output);
114
115 OS.system("cd " + cappuccino_output_path + " && zip -ry -8 Starter.zip Starter");
116
117 // zip the tools pack
118 var tools_zip_output = FILE.join($BUILD_DIR, 'Cappuccino', 'Tools.zip')
119 rm_rf(tools_zip_output);
120
121 OS.system("cd " + cappuccino_output_path + " && zip -ry -8 Tools.zip Tools");
122 });
123
e5c5378 Francisco Ryan Tolmasky I A bit of work on top level tasks.
tolmasky authored
124 filedir ($STARTER_DOWNLOAD_APPLICATION, ["build"], function()
9dc0c3a Francisco Ryan Tolmasky I First set of jake files.
tolmasky authored
125 {
e5c5378 Francisco Ryan Tolmasky I A bit of work on top level tasks.
tolmasky authored
126 //ENV["PATH"] = FILE.join($TOOLS_DOWNLOAD_ENV, "bin") + ':' + ENV["PATH"];
9dc0c3a Francisco Ryan Tolmasky I First set of jake files.
tolmasky authored
127
128 rm_rf($STARTER_DOWNLOAD_APPLICATION);
129 FILE.mkdirs($STARTER_DOWNLOAD);
130
1d1f664 Francisco Ryan Tolmasky I Made starter_download and docs tasks jake compliant.
tolmasky authored
131 if (OS.system("capp gen " + $STARTER_DOWNLOAD_APPLICATION + " -t Application --noconfig"))
132 OS.exit(1); // rake abort if ($? != 0)
9dc0c3a Francisco Ryan Tolmasky I First set of jake files.
tolmasky authored
133
134 // No tools means no objective-j gem
e5c5378 Francisco Ryan Tolmasky I A bit of work on top level tasks.
tolmasky authored
135 // FILE.rm(FILE.join($STARTER_DOWNLOAD_APPLICATION, 'Rakefile'))
9dc0c3a Francisco Ryan Tolmasky I First set of jake files.
tolmasky authored
136 });
137
138 filedir ($STARTER_DOWNLOAD_README, [$STARTER_README], function()
139 {
140 cp($STARTER_README, $STARTER_DOWNLOAD_README);
141 });
142
143 task ("test", ["build"], function()
144 {
27c2285 Francisco Ryan Tolmasky I Jakefile cleanup, beginnings of "install" task.
tolmasky authored
145 var tests = "'" + FileList('Tests/**/*.j').join("' '") + "'",
9dc0c3a Francisco Ryan Tolmasky I First set of jake files.
tolmasky authored
146 build_result = OS.system("ojtest " + tests);
147
148 if (build_result.match(/Test suite failed/i))
149 {
150 print("tests failed, aborting the build");
151 print (build_result);
1d1f664 Francisco Ryan Tolmasky I Made starter_download and docs tasks jake compliant.
tolmasky authored
152
153 OS.exit(1);
9dc0c3a Francisco Ryan Tolmasky I First set of jake files.
tolmasky authored
154 }
155 else
156 print(build_result);
157 });
158
1d1f664 Francisco Ryan Tolmasky I Made starter_download and docs tasks jake compliant.
tolmasky authored
159 /*
9dc0c3a Francisco Ryan Tolmasky I First set of jake files.
tolmasky authored
160 TODO: zip/tar.
161 */
Something went wrong with that request. Please try again.