2013-08-13 08:07:23 +08:00
|
|
|
#!/usr/bin/env node
|
2012-09-18 05:19:02 +08:00
|
|
|
|
2013-08-13 08:07:23 +08:00
|
|
|
/*
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
or more contributor license agreements. See the NOTICE file
|
|
|
|
distributed with this work for additional information
|
|
|
|
regarding copyright ownership. The ASF licenses this file
|
|
|
|
to you under the Apache License, Version 2.0 (the
|
|
|
|
"License"); you may not use this file except in compliance
|
|
|
|
with the License. You may obtain a copy of the License at
|
2012-06-16 09:35:34 +08:00
|
|
|
|
2013-08-13 08:07:23 +08:00
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing,
|
|
|
|
software distributed under the License is distributed on an
|
|
|
|
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
KIND, either express or implied. See the License for the
|
|
|
|
specific language governing permissions and limitations
|
|
|
|
under the License.
|
|
|
|
*/
|
|
|
|
|
2018-06-19 05:48:02 +08:00
|
|
|
var args = process.argv;
|
2015-10-20 15:30:31 +08:00
|
|
|
var Api = require('./Api');
|
|
|
|
var nopt = require('nopt');
|
|
|
|
var path = require('path');
|
2013-08-13 08:07:23 +08:00
|
|
|
|
|
|
|
// Support basic help commands
|
2018-06-19 05:48:02 +08:00
|
|
|
if (['--help', '/?', '-h', 'help', '-help', '/help'].indexOf(args[2]) >= 0) {
|
2015-10-20 15:30:31 +08:00
|
|
|
require('./lib/build').help();
|
2018-06-19 05:48:02 +08:00
|
|
|
}
|
2015-10-20 15:30:31 +08:00
|
|
|
|
|
|
|
// Do some basic argument parsing
|
|
|
|
var buildOpts = nopt({
|
2018-06-19 05:48:02 +08:00
|
|
|
'verbose': Boolean,
|
|
|
|
'silent': Boolean,
|
|
|
|
'debug': Boolean,
|
|
|
|
'release': Boolean,
|
2015-10-20 15:30:31 +08:00
|
|
|
'nobuild': Boolean,
|
2018-06-19 05:48:02 +08:00
|
|
|
'buildConfig': path
|
|
|
|
}, { 'd': '--verbose' });
|
2015-10-20 15:30:31 +08:00
|
|
|
|
|
|
|
// Make buildOptions compatible with PlatformApi build method spec
|
2016-01-28 15:51:50 +08:00
|
|
|
buildOpts.argv = buildOpts.argv.original;
|
2015-10-20 15:30:31 +08:00
|
|
|
|
2016-03-09 21:56:47 +08:00
|
|
|
require('./loggingHelper').adjustLoggerLevel(buildOpts);
|
|
|
|
|
2015-10-20 15:30:31 +08:00
|
|
|
new Api().build(buildOpts)
|
2019-01-08 13:31:14 +08:00
|
|
|
.catch(function (err) {
|
|
|
|
console.error(err.stack);
|
|
|
|
process.exit(2);
|
|
|
|
});
|