Skip to content

Commit

Permalink
Bug 979785 - [GAIA][BUILD SYSTEM] Overwrite common-setting.json by GA…
Browse files Browse the repository at this point in the history
…IA_DEVICE_TYPE in build/settings.js
  • Loading branch information
mpizza committed May 12, 2014
1 parent 18871c7 commit 230ee3a
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -461,6 +461,7 @@ define BUILD_CONFIG
"GAIA_ENGINE" : "xpcshell", \
"GAIA_DISTRIBUTION_DIR" : "$(GAIA_DISTRIBUTION_DIR)", \
"GAIA_APPDIRS" : "$(GAIA_APPDIRS)", \
"GAIA_DEVICE_TYPE" : "$(GAIA_DEVICE_TYPE)", \
"NOFTU" : "$(NOFTU)", \
"REMOTE_DEBUGGER" : "$(REMOTE_DEBUGGER)", \
"HAIDA" : $(HAIDA), \
Expand Down
5 changes: 5 additions & 0 deletions build/config/tablet/settings.json
@@ -0,0 +1,5 @@
{
"app.launch_path.blacklist": ["/dialer/index.html#keyboard-view"],
"wap.push.enabled": false,
"layers.composer2d.enabled": false
}
15 changes: 15 additions & 0 deletions build/settings.js
Expand Up @@ -95,6 +95,18 @@ function setDefaultKeyboardLayouts(lang, settings, config) {
settings['keyboard.default-layouts'] = keyboardSettings;
}

function deviceTypeSettings(settings, config) {
// See if any override file exists and eventually override settings
let override = utils.getFile(config.GAIA_DIR,
'build', 'config', config.GAIA_DEVICE_TYPE, 'settings.json');
if (override.exists()) {
let content = utils.getJSON(override);
for (let key in content) {
settings[key] = content[key];
}
}
}

function overrideSettings(settings, config) {
// See if any override file exists and eventually override settings
let override = utils.resolve(config.SETTINGS_PATH,
Expand Down Expand Up @@ -188,6 +200,8 @@ function execute(config) {
setRingtone(settings, config);
}).then(function() {
setNotification(settings, config);
}).then(function() {
deviceTypeSettings(settings, config);
}).then(function() {
overrideSettings(settings, config);
}).then(function() {
Expand All @@ -204,6 +218,7 @@ exports.execute = execute;
exports.setWallpaper = setWallpaper;
exports.setRingtone = setRingtone;
exports.setNotification = setNotification;
exports.deviceTypeSettings = deviceTypeSettings;
exports.overrideSettings = overrideSettings;
exports.writeSettings = writeSettings;
exports.setDefaultKeyboardLayouts = setDefaultKeyboardLayouts;
19 changes: 19 additions & 0 deletions build/test/unit/settings.test.js
Expand Up @@ -135,6 +135,25 @@ suite('settings.js', function() {
testResult.testConfig);
});

test('deviceTypeSettings', function () {
var testResult = {
'testConfig': 'abc'
};
mockUtils.getFile = function() {
return {
exists: function() {
return true;
}
};
};
mockUtils.getJSON = function(json) {
return testResult;
};
app.deviceTypeSettings(settings, config);
assert.equal(settings.testConfig,
testResult.testConfig);
});

test('writeSettings', function () {
var settingsFile = {result: ''};
var settings = { 'testKey': 'testValue' };
Expand Down

0 comments on commit 230ee3a

Please sign in to comment.