Skip to content

Commit

Permalink
Merge pull request #132 from monaca/android-minimun-check-build-req
Browse files Browse the repository at this point in the history
* Improve checkBuildAvailability Method with Minimum Requirement Check Flag
* Release Bump 2.7.12
  • Loading branch information
erisu authored Aug 27, 2018
2 parents 39ed76d + cfb3b81 commit 68a9f9a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
CHANGELOG
====

v2.7.12
----
* Added `checkForMinimumRequirements` to the `buildParams` parameter in the `checkBuildAvailability` method.

v2.7.11
----
* appended `path` to the `upload` and `download` request url
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "monaca-lib",
"version": "2.7.11",
"version": "2.7.12",
"description": "Monaca cloud and localkit API bindings for JavaScript",
"main": "./src/main.js",
"scripts": {
Expand Down
33 changes: 20 additions & 13 deletions src/monaca.js
Original file line number Diff line number Diff line change
Expand Up @@ -1092,20 +1092,25 @@
};

/**
* @method
* Checks if the project can be built.
*
* @memberof Monaca
* @description
* Checks if the project can be built.
* @return {Promise}
*
* @param {Object} projectInfo Contains project information such as projectId
* @param {Object} buildParams Contains build parameters. Example: {platform: 'android', purpose: 'release', checkForMinimumRequirements: false}
*
* @example
* monaca.checkBuildAvailability('myProjectID', 'android', 'debug').then(
* function() {
* //Build the project
* },
* function(err) {
* //Cannot build the project
* }
* );
* monaca.checkBuildAvailability({
* projectId: 'myProjectID'
* }, {
* platform: 'android',
* purpose: 'debug'
* }).then(
* () => { //Build the project },
* (err) => { //Cannot build the project }
* );
*
* @return {Promise}
*/
Monaca.prototype.checkBuildAvailability = function(projectInfo, buildParams) {

Expand All @@ -1120,6 +1125,8 @@
platform = buildParams.platform,
buildType = buildParams.purpose;

let checkForMinimumRequirements = !!buildParams.checkForMinimumRequirements;

return this._get('/project/' + projectId + '/can_build_app')
.then(
function(data) {
Expand All @@ -1146,7 +1153,7 @@
if (!platformContent.is_versionname_valid) {
return 'Version name is invalid.';
}
if (buildType === 'release' && !platformContent.has_keysetting) {
if (buildType === 'release' && (!checkForMinimumRequirements && !platformContent.has_keysetting || checkForMinimumRequirements && !platformContent.has_keystore)) {
return 'Missing KeyStore configuration. Configure remote build by executing `monaca remote build --browser`.';
}
}
Expand Down

0 comments on commit 68a9f9a

Please sign in to comment.