Skip to content

Commit

Permalink
Fix the meteor build behavior since it was broken by Cordova 5.0 up…
Browse files Browse the repository at this point in the history
…grade

The Cordova 5.0 is featuring Cordova Android 4.0, which now ships with a gradle project and not Ant.
  • Loading branch information
Slava committed May 22, 2015
1 parent 1f2f584 commit 77c341f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
5 changes: 3 additions & 2 deletions tools/commands-cordova.js
Original file line number Diff line number Diff line change
Expand Up @@ -926,11 +926,12 @@ var buildCordova = function (projectContext, platforms, options) {
// XXX a hack to reset the debuggable mode
var manifest = files.readFile(manifestPath, 'utf8');
manifest = manifest.replace(/android:debuggable=.(true|false)./g, '');
manifest = manifest.replace(/<application /g, '<application android:debuggable="' + !!options.debug + '" ');
if (options.debug)
manifest = manifest.replace(/<application /g, '<application android:debuggable="' + !!options.debug + '" ');
files.writeFile(manifestPath, manifest, 'utf8');

// XXX workaround the problem of cached apk invalidation
files.rm_recursive(files.pathJoin(androidBuildPath, 'ant-build'));
files.rm_recursive(files.pathJoin(androidBuildPath, 'build'));
}

if (!options.debug) {
Expand Down
16 changes: 5 additions & 11 deletions tools/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -947,11 +947,11 @@ var buildCommand = function (options) {
"utf8");
} else if (platformName === 'android') {
files.cp_r(buildPath, files.pathJoin(platformPath, 'project'));
var apkPath = findApkPath(files.pathJoin(buildPath, 'ant-build'));
files.copyFile(apkPath, files.pathJoin(platformPath, 'unaligned.apk'));
var apkPath = findApkPath(files.pathJoin(buildPath, 'build'), options.debug);
files.copyFile(apkPath, files.pathJoin(platformPath, options.debug ? 'debug.apk' : 'release-unsigned.apk'));
files.writeFile(
files.pathJoin(platformPath, 'README'),
"This is an auto-generated Ant project for your Android application.\n\n" +
"This is an auto-generated Gradle project for your Android application.\n\n" +
"Instructions for publishing your Android app to Play Store can be found at:\n" +
"https://github.com/meteor/meteor/wiki/How-to-submit-your-Android-app-to-Play-Store\n",
"utf8");
Expand All @@ -961,14 +961,8 @@ var buildCommand = function (options) {
files.rm_recursive(buildDir);
};

var findApkPath = function (dirPath) {
var apkPath = _.find(files.readdir(dirPath), function (filePath) {
return files.pathExtname(filePath) === '.apk';
});

if (! apkPath)
throw new Error('The APK file for the Android build was not found.');
return files.pathJoin(dirPath, apkPath);
var findApkPath = function (dirPath, debug) {
return files.pathJoin(dirPath, 'outputs', 'apk', debug ? 'android-debug.apk' : 'android-release-unsigned.apk');
};

///////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 77c341f

Please sign in to comment.