Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
41
gaia/apps/clock/build/build.js
Executable file
41
gaia/apps/clock/build/build.js
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
'use strict';
|
||||
|
||||
/* jshint node: true */
|
||||
|
||||
var utils = require('utils');
|
||||
|
||||
exports.execute = function(options) {
|
||||
var appName = utils.basename(options.APP_DIR);
|
||||
var config = utils.getFile(options.APP_DIR, 'build',
|
||||
'require_config.jslike');
|
||||
var rjsPath = utils.joinPath(options.GAIA_DIR, 'build', 'r.js');
|
||||
var requirejs;
|
||||
|
||||
if (utils.isNode()) {
|
||||
requirejs = require(rjsPath);
|
||||
} else {
|
||||
var sandbox = utils.createSandbox();
|
||||
sandbox.arguments = [];
|
||||
sandbox.requirejsAsLib = true;
|
||||
sandbox.print = function() {
|
||||
utils.log(appName, Array.prototype.join.call(arguments, ' '));
|
||||
};
|
||||
utils.runScriptInSandbox(rjsPath, sandbox);
|
||||
requirejs = sandbox.requirejs;
|
||||
}
|
||||
|
||||
// logLevel set 4 for silent, set 0 for all
|
||||
var log = 'logLevel=' + (options.VERBOSE === '1' ? '0' : '4');
|
||||
var optimize = 'optimize=none';
|
||||
var build = new Promise(function(resolve, reject) {
|
||||
requirejs.optimize([config.path, optimize, log], resolve, reject);
|
||||
});
|
||||
|
||||
return build
|
||||
.then(function() {
|
||||
utils.log(appName, 'require.js optimize done');
|
||||
}).catch(function(err) {
|
||||
utils.log(appName, 'require.js optimize failed');
|
||||
utils.log(appName, err);
|
||||
});
|
||||
};
|
||||
110
gaia/apps/clock/build/make_gaia_shared.js
Executable file
110
gaia/apps/clock/build/make_gaia_shared.js
Executable file
|
|
@ -0,0 +1,110 @@
|
|||
'use strict';
|
||||
/**
|
||||
* Scans the built directory's JS and CSS files looking for shared resources
|
||||
* to generate a gaia_shared.json
|
||||
*/
|
||||
/*jshint moz: true */
|
||||
/*global load */
|
||||
/* jshint unused:false */
|
||||
var requirejsAsLib = true;
|
||||
load('../../build/r.js');
|
||||
|
||||
var shared = {
|
||||
js: [],
|
||||
style: [],
|
||||
style_unstable: []
|
||||
};
|
||||
|
||||
// This file is run from the clock directory.
|
||||
var srcDir = './',
|
||||
buildDir = '../../build_stage/clock/';
|
||||
|
||||
// Taken from r.js css optimizing step.
|
||||
var cssImportRegExp = /\@import\s+(url\()?\s*([^);]+)\s*(\))?([\w, ]*)(;)?/ig;
|
||||
|
||||
function stripCssComments(contents) {
|
||||
var index,
|
||||
start = 0,
|
||||
end = contents.length,
|
||||
result = '',
|
||||
startComment = '/*',
|
||||
endComment = '*/';
|
||||
|
||||
while ((index = contents.indexOf(startComment, start)) !== -1) {
|
||||
result += contents.substring(start, index);
|
||||
start = index;
|
||||
index = contents.indexOf(endComment, start);
|
||||
if (index === -1) {
|
||||
start = end - 1;
|
||||
} else {
|
||||
start = index + 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (start !== end - 1) {
|
||||
result += contents.substring(start, end);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
requirejs.tools.useLib(function(require) {
|
||||
require(['env!env/file', 'parse'], function(file, parse) {
|
||||
var jsExtRegExp = /\.js$/;
|
||||
|
||||
// Find all the HTML and JS files. Use the srcDir instead of
|
||||
// buildDir since uglification can mangle the files such that
|
||||
// the dependency scanning fails.
|
||||
var files = file.getFilteredFileList(srcDir + 'js', /\.js$|\.html$/);
|
||||
files.forEach(function(fileName) {
|
||||
var contents = file.readFile(fileName);
|
||||
|
||||
// If JS, scan for shared resources.
|
||||
if (jsExtRegExp.test(fileName)) {
|
||||
var deps = parse.findDependencies(fileName, contents);
|
||||
deps.forEach(function(dep) {
|
||||
|
||||
if (dep.indexOf('shared/') === 0) {
|
||||
var sharedDep = dep.replace(/shared\/js\//, '') + '.js';
|
||||
// Avoid duplicate entries for cleanliness
|
||||
if (shared.js.indexOf(sharedDep) === -1) {
|
||||
shared.js.push(sharedDep);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Find CSS references. Use the source area, instead of the build
|
||||
// area since the built version has @import statements inlined.
|
||||
files = file.getFilteredFileList(srcDir + 'style', /\.css$/);
|
||||
files.forEach(function(fileName) {
|
||||
var url, match, index,
|
||||
contents = file.readFile(fileName);
|
||||
|
||||
contents = stripCssComments(contents);
|
||||
cssImportRegExp.lastIndex = 0;
|
||||
|
||||
while ((match = cssImportRegExp.exec(contents))) {
|
||||
// Grab the URL without quotes
|
||||
url = match[2].replace(/['"]/g, '');
|
||||
if (url) {
|
||||
index = url.indexOf('/shared/');
|
||||
if (index !== -1) {
|
||||
if (url.indexOf('style_unstable') === -1) {
|
||||
shared.style.push(url.substring(index + 1)
|
||||
.replace(/shared\/style\//, ''));
|
||||
} else {
|
||||
shared.style_unstable.push(url.substring(index + 1)
|
||||
.replace(/shared\/style_unstable\//, ''));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Save the shared resources file.
|
||||
file.saveFile(buildDir + 'gaia_shared.json',
|
||||
JSON.stringify(shared, null, ' '));
|
||||
});
|
||||
});
|
||||
79
gaia/apps/clock/build/require_config.jslike
Executable file
79
gaia/apps/clock/build/require_config.jslike
Executable file
|
|
@ -0,0 +1,79 @@
|
|||
{
|
||||
appDir: '..',
|
||||
baseUrl: 'js',
|
||||
dir: '../../../build_stage/clock',
|
||||
mainConfigFile: '../js/require_config.js',
|
||||
paths: {
|
||||
prim: 'empty:'
|
||||
},
|
||||
findNestedDependencies: true,
|
||||
|
||||
// Be sure to normalize all define() calls by extracting
|
||||
// dependencies so Function toString is not needed, and
|
||||
// lower capability devices like Tarako can optimize
|
||||
// memory by discarding function sources. This is
|
||||
// automatically done when an 'optimize' value other than
|
||||
// 'none' is used. This setting makes sure it happens for
|
||||
// builds where 'none' is used for 'optimize'.
|
||||
normalizeDirDefines: 'all',
|
||||
|
||||
// Build a separate module for each panel. Because the application
|
||||
// consistently initializes with the `startup` module, this module and all
|
||||
// its dependencies do not need to be included by the "secondary" panels
|
||||
// ("Alarm Edit", "Timer", and "Stopwatch").
|
||||
modules: [
|
||||
{
|
||||
name: 'startup',
|
||||
include: ['panels/alarm/main']
|
||||
},
|
||||
{
|
||||
name: 'onring'
|
||||
},
|
||||
{
|
||||
name: 'panels/alarm_edit/main',
|
||||
exclude: ['startup']
|
||||
},
|
||||
{
|
||||
name: 'panels/timer/main',
|
||||
exclude: ['startup']
|
||||
},
|
||||
{
|
||||
name: 'panels/stopwatch/main',
|
||||
exclude: ['startup']
|
||||
}
|
||||
],
|
||||
|
||||
// Set to 'uglify2' to get uglify to run using the
|
||||
// uglify2 settings below.
|
||||
optimize: 'none',
|
||||
|
||||
// Just strip comments, no code compression or mangling.
|
||||
// Only active if optimize: 'uglify2'
|
||||
uglify2: {
|
||||
// Comment out the output section to get rid of line
|
||||
// returns and tabs spacing.
|
||||
output: {
|
||||
beautify: true
|
||||
},
|
||||
compress: false,
|
||||
mangle: false
|
||||
},
|
||||
|
||||
// Rewrite the waitSeconds directive so that we never time out
|
||||
// waiting for modules to load in production. See
|
||||
// js/require_config.js for more details.
|
||||
onBuildWrite: function(id, url, contents) {
|
||||
if (id === 'require_config') {
|
||||
return contents.replace(/waitSeconds:\s*\d+/, 'waitSeconds: 0');
|
||||
} else {
|
||||
return contents;
|
||||
}
|
||||
},
|
||||
|
||||
fileExclusionRegExp: /^\.|^test$|^build$/,
|
||||
|
||||
// Keeping build dir since Makefile cleans it up and
|
||||
// preps build dir with the shared directory
|
||||
keepBuildDir: true,
|
||||
removeCombined: true
|
||||
}
|
||||
Loading…
Reference in a new issue