You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2014/03/27 15:22:13 UTC
[04/34] js commit: CB-5438 Remove test symlinks & fix some build
errors on windows.
CB-5438 Remove test symlinks & fix some build errors on windows.
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/19f9c02a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/19f9c02a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/19f9c02a
Branch: refs/heads/browserify
Commit: 19f9c02ac7d09b371b78d7ff7489f91de021a7e6
Parents: 799eed5
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Feb 11 11:51:46 2014 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Feb 11 11:51:46 2014 -0500
----------------------------------------------------------------------
Gruntfile.js | 2 +-
src/test/androidexec.js | 1 -
src/test/iosexec.js | 1 -
tasks/lib/bundle.js | 41 +++++++++++++++++++------------------
tasks/lib/collect-files.js | 2 +-
tasks/lib/compute-commit-id.js | 39 +++++++++++++++++------------------
tasks/lib/packager.js | 32 ++++++++++++++---------------
test/android/test.exec.js | 2 +-
test/ios/test.exec.js | 2 +-
9 files changed, 60 insertions(+), 62 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/19f9c02a/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index b1e456a..d69b233 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -38,7 +38,7 @@ module.exports = function(grunt) {
options: {
jshintrc: '.jshintrc',
},
- src: ['src/**/*.js', '!src/test/androidexec.js', '!src/test/iosexec.js']
+ src: ['src/**/*.js']
},
});
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/19f9c02a/src/test/androidexec.js
----------------------------------------------------------------------
diff --git a/src/test/androidexec.js b/src/test/androidexec.js
deleted file mode 120000
index 30a13f8..0000000
--- a/src/test/androidexec.js
+++ /dev/null
@@ -1 +0,0 @@
-../android/exec.js
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/19f9c02a/src/test/iosexec.js
----------------------------------------------------------------------
diff --git a/src/test/iosexec.js b/src/test/iosexec.js
deleted file mode 120000
index 7979e03..0000000
--- a/src/test/iosexec.js
+++ /dev/null
@@ -1 +0,0 @@
-../ios/exec.js
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/19f9c02a/tasks/lib/bundle.js
----------------------------------------------------------------------
diff --git a/tasks/lib/bundle.js b/tasks/lib/bundle.js
index cf3c455..8cdf11e 100644
--- a/tasks/lib/bundle.js
+++ b/tasks/lib/bundle.js
@@ -1,19 +1,19 @@
/*
- * Licensed to the Apache Software Foundation (ASF
- * or more contributor license agreements. See th
- * distributed with this work for additional infor
- * regarding copyright ownership. The ASF license
- * to you under the Apache License, Version 2.0 (t
- * "License"); you may not use this file except in
- * with the License. You may obtain a copy of the
+ * 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to
- * software distributed under the License is distr
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- * KIND, either express or implied. See the Licen
- * specific language governing permissions and lim
+ * 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.
*/
var fs = require('fs');
@@ -24,22 +24,22 @@ var writeModule = require('./write-module');
var writeScript = require('./write-script');
var licensePath = path.join(__dirname, '..', 'templates', 'LICENSE-for-js-file.txt');
-
module.exports = function bundle(platform, debug, commitId) {
- var modules = collectFiles('src/common')
- var scripts = collectFiles('src/scripts')
-
- modules[''] = 'src/cordova.js'
+ var modules = collectFiles(path.join('src', 'common'));
+ var scripts = collectFiles(path.join('src', 'scripts'));
+ modules[''] = path.join('src', 'cordova.js');
copyProps(modules, collectFiles(path.join('src', platform)));
if (platform === 'test') {
- // FIXME why does 'test' resolve a bunch of android stuff?!
+ // Add any platform-specific modules that have tests to the test bundle.
var testFilesPath = path.join('src', 'android', 'android');
- copyProps(modules, collectFiles(testFilesPath, 'android/'));
+ copyProps(modules, collectFiles(testFilesPath, 'android'));
+ modules['android/exec'] = path.join('src', 'android' , 'exec.js');
+ modules['ios/exec'] = path.join('src', 'ios' , 'exec.js');
}
var output = [];
-
+
output.push("// Platform: " + platform);
output.push("// " + commitId);
@@ -84,3 +84,4 @@ module.exports = function bundle(platform, debug, commitId) {
return output.join('\n')
}
+
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/19f9c02a/tasks/lib/collect-files.js
----------------------------------------------------------------------
diff --git a/tasks/lib/collect-files.js b/tasks/lib/collect-files.js
index 51d4575..35982a8 100644
--- a/tasks/lib/collect-files.js
+++ b/tasks/lib/collect-files.js
@@ -39,7 +39,7 @@ function collectFiles(dir, id) {
})
entries.forEach(function(entry) {
- var moduleId = path.join(id, entry)
+ var moduleId = (id ? id + '/' : '') + entry;
var fileName = path.join(dir, entry)
var stat = fs.statSync(fileName)
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/19f9c02a/tasks/lib/compute-commit-id.js
----------------------------------------------------------------------
diff --git a/tasks/lib/compute-commit-id.js b/tasks/lib/compute-commit-id.js
index af0cc37..6fb5500 100644
--- a/tasks/lib/compute-commit-id.js
+++ b/tasks/lib/compute-commit-id.js
@@ -1,23 +1,24 @@
/*
- * Licensed to the Apache Software Foundation (ASF
- * or more contributor license agreements. See th
- * distributed with this work for additional infor
- * regarding copyright ownership. The ASF license
- * to you under the Apache License, Version 2.0 (t
- * "License"); you may not use this file except in
- * with the License. You may obtain a copy of the
+ * 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to
- * software distributed under the License is distr
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- * KIND, either express or implied. See the Licen
- * specific language governing permissions and lim
+ * 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.
*/
-var fs = require('fs')
var childProcess = require('child_process');
+var fs = require('fs');
+var path = require('path');
module.exports = function computeCommitId(callback, cachedGitVersion) {
@@ -28,7 +29,7 @@ module.exports = function computeCommitId(callback, cachedGitVersion) {
}
var versionFileId = fs.readFileSync('VERSION', { encoding: 'utf8' }).trim();
-
+
if (/-dev$/.test(versionFileId) && fs.existsSync('.git')) {
var gitPath = 'git';
var args = 'rev-list HEAD --max-count=1 --abbrev-commit';
@@ -38,13 +39,15 @@ module.exports = function computeCommitId(callback, cachedGitVersion) {
gitPath = '"' + path.join(process.env['ProgramFiles'], 'Git', 'bin', 'git.exe') + '"';
childProcess.exec(gitPath + ' ' + args, function(err, stdout, stderr) {
if (err) {
- error(err);
+ console.warn('Error during git describe: ' + err);
+ done(versionFileId + '-??');
} else {
done(versionFileId + '-' + stdout);
}
});
} else if (err) {
- error(err);
+ console.warn('Error during git describe: ' + err);
+ done(versionFileId + '-??');
} else {
done(versionFileId + '-' + stdout);
}
@@ -53,10 +56,6 @@ module.exports = function computeCommitId(callback, cachedGitVersion) {
done(fs.readFileSync('VERSION', { encoding: 'utf8' }));
}
- function error(err) {
- throw new Error(err);
- }
-
function done(stdout) {
var version = stdout.trim();
cachedGitVersion = version;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/19f9c02a/tasks/lib/packager.js
----------------------------------------------------------------------
diff --git a/tasks/lib/packager.js b/tasks/lib/packager.js
index 3380768..0fd2bcc 100644
--- a/tasks/lib/packager.js
+++ b/tasks/lib/packager.js
@@ -1,21 +1,21 @@
/*
- * Licensed to the Apache Software Foundation (ASF
- * or more contributor license agreements. See th
- * distributed with this work for additional infor
- * regarding copyright ownership. The ASF license
- * to you under the Apache License, Version 2.0 (t
- * "License"); you may not use this file except in
- * with the License. You may obtain a copy of the
+ * 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to
- * software distributed under the License is distr
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- * KIND, either express or implied. See the Licen
- * specific language governing permissions and lim
+ * 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.
- */
+*/
var fs = require('fs');
var path = require('path');
var bundle = require('./bundle');
@@ -33,7 +33,7 @@ module.exports = function generate(platform, useWindowsLineEndings, callback) {
libraryRelease = "\ufeff" + libraryRelease.split(/\r?\n/).join("\r\n");
}
var libraryDebug = bundle(platform, true, commitId);
-
+
time = new Date().valueOf() - time;
if (!fs.existsSync('pkg')) {
fs.mkdirSync('pkg');
@@ -44,10 +44,10 @@ module.exports = function generate(platform, useWindowsLineEndings, callback) {
outFile = path.join('pkg', 'cordova.' + platform + '.js');
fs.writeFileSync(outFile, libraryRelease, 'utf8');
-
+
outFile = path.join('pkg', 'debug', 'cordova.' + platform + '-debug.js');
fs.writeFileSync(outFile, libraryDebug, 'utf8');
-
+
console.log('generated cordova.' + platform + '.js @ ' + commitId + ' in ' + time + 'ms');
callback();
});
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/19f9c02a/test/android/test.exec.js
----------------------------------------------------------------------
diff --git a/test/android/test.exec.js b/test/android/test.exec.js
index b97f066..5271d81 100644
--- a/test/android/test.exec.js
+++ b/test/android/test.exec.js
@@ -21,7 +21,7 @@
describe('exec.processMessages', function () {
var cordova = require('cordova'),
- exec = require('cordova/androidexec'),
+ exec = require('cordova/android/exec'),
nativeApiProvider = require('cordova/android/nativeapiprovider'),
origNativeApi = nativeApiProvider.get();
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/19f9c02a/test/ios/test.exec.js
----------------------------------------------------------------------
diff --git a/test/ios/test.exec.js b/test/ios/test.exec.js
index bf279e6..0f051f1 100644
--- a/test/ios/test.exec.js
+++ b/test/ios/test.exec.js
@@ -25,7 +25,7 @@ describe('iOS exec', function () {
var VC_ADDR = '1234';
var cordova = require('cordova');
- var exec = require('cordova/iosexec');
+ var exec = require('cordova/ios/exec');
var mockxhr = require('cordova/mockxhr');
var winSpy = jasmine.createSpy('win');
var failSpy = jasmine.createSpy('fail');