This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 968697 - Add Makefile for system app
- Loading branch information
Showing
12 changed files
with
172 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
.PHONY: remove-old-camera | ||
remove-old-camera: | ||
-include $(PWD)/build/common.mk | ||
|
||
BUILD_DIR=$(PWD)/build_stage/system | ||
|
||
.PHONY: all clean | ||
all: clean | ||
@echo Building system app to build_stage... | ||
@mkdir -p $(BUILD_DIR) | ||
@cp -r * $(BUILD_DIR) | ||
@$(call run-app-js-command, build) | ||
clean: | ||
@rm -rf ./camera | ||
@rm -rf $(BUILD_DIR) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
'use strict'; | ||
|
||
/* global require, exports */ | ||
var utils = require('utils'); | ||
|
||
var SystemAppBuilder = function() { | ||
}; | ||
|
||
SystemAppBuilder.prototype.APP_DIR = 'apps/system'; | ||
SystemAppBuilder.prototype.STAGE_DIR = 'build_stage/system'; | ||
// set options | ||
SystemAppBuilder.prototype.setOptions = function(options) { | ||
var stageDirPath = [options.GAIA_DIR].concat(this.STAGE_DIR.split('/')); | ||
this.stageDir = utils.getFile.apply(utils, stageDirPath); | ||
|
||
var appDirPath = [options.GAIA_DIR].concat(this.STAGE_DIR.split('/')); | ||
this.appDir = utils.getFile.apply(utils, appDirPath); | ||
|
||
this.distDirPath = options.GAIA_DISTRIBUTION_DIR; | ||
}; | ||
|
||
SystemAppBuilder.prototype.addCustomizeFiles = function() { | ||
if (!utils.getFile(this.distDirPath, 'power').exists()) { | ||
return; | ||
} | ||
var self = this; | ||
var fileDir = utils.getFile(this.distDirPath, 'power'); | ||
var files = utils.ls(fileDir); | ||
files.forEach(function(file) { | ||
utils.copyFileTo(file.path, | ||
utils.joinPath(self.stageDir.path, 'resources', 'power'), | ||
file.leafName, true); | ||
}); | ||
}; | ||
|
||
SystemAppBuilder.prototype.initConfigJsons = function() { | ||
var iccDefault = { | ||
'defaultURL': 'http://www.mozilla.org/en-US/firefoxos/' | ||
}; | ||
var wapuaprofDefault = { | ||
}; | ||
var iccFile = utils.getFile(this.stageDir.path, 'js', 'icc.json'); | ||
var wapFile = utils.getFile(this.stageDir.path, 'js', 'wapuaprof.json'); | ||
|
||
utils.writeContent(iccFile, | ||
utils.getDistributionFileContent('icc', iccDefault, this.distDirPath)); | ||
|
||
utils.writeContent(wapFile, | ||
utils.getDistributionFileContent('wapuaprof', | ||
wapuaprofDefault, this.distDirPath)); | ||
|
||
}; | ||
|
||
SystemAppBuilder.prototype.generateManifest = function() { | ||
var manifest = | ||
utils.getJSON(utils.getFile(this.appDir.path, 'manifest.webapp')); | ||
manifest.activities = manifest.activities || {}; | ||
|
||
manifest.activities.view = { | ||
filters: { | ||
type: 'url', | ||
url: { | ||
required: true, | ||
pattern: 'https?:.{1,16384}', | ||
patternFlags: 'i' | ||
} | ||
} | ||
}; | ||
// Write content to build_stage | ||
utils.writeContent(utils.getFile(this.stageDir.path, 'manifest.webapp'), | ||
JSON.stringify(manifest)); | ||
}; | ||
|
||
SystemAppBuilder.prototype.execute = function(options) { | ||
this.setOptions(options); | ||
this.initConfigJsons(); | ||
if (options.ROCKETBAR !== 'none') { | ||
this.generateManifest(); | ||
} | ||
if (this.distDirPath) { | ||
this.addCustomizeFiles(); | ||
} | ||
}; | ||
|
||
exports.execute = function(options) { | ||
(new SystemAppBuilder()).execute(options); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"dir": "../../build_stage/system" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"defaultURL": "testICClink" | ||
} |
3 changes: 3 additions & 0 deletions
3
build/test/resources/distribution_test/power/fakePowerFile.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"test": "test" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"wapprof": "testprof" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters