Skip to content

Commit

Permalink
move all android-related files together into devices/android
Browse files Browse the repository at this point in the history
  • Loading branch information
jlipps committed Oct 17, 2013
1 parent 059a7dc commit 5ad5df4
Show file tree
Hide file tree
Showing 77 changed files with 49 additions and 46 deletions.
12 changes: 5 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ test/functional/_joined
*.autosave
.idea/
appium*.log*
android/bootstrap/bin/*
android/bootstrap/local.properties
android/bootstrap/project.properties
android/bootstrap/.classpath
lib/devices/android/bootstrap/bin/*
lib/devices/android/bootstrap/local.properties
lib/devices/android/bootstrap/project.properties
lib/devices/android/bootstrap/.classpath
lib/devices/android/bootstrap/target/
sample-code/apps/ApiDemos
lib/android/AndroidManifest.xml.apk
lib/android/AndroidManifest.xml
.*~
*~
android/bootstrap/target/
org.eclipse.ltk.core.refactoring.prefs
/selendroid
.appiumconfig
Expand Down
8 changes: 5 additions & 3 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ reset.bat
bin/test.sh
sample-code/
test/
android/bootstrap/bin/
android/bootstrap/target/
lib/android/AndroidManifest.xml.apk
lib/devices/android/bootstrap/bin/
lib/devices/android/bootstrap/target/
lib/devices/android/bootstrap/local.properties
lib/devices/android/bootstrap/project.properties
lib/devices/android/bootstrap/.classpath
_vimrc_local.vim
*.swp
*.swo
Expand Down
6 changes: 4 additions & 2 deletions grunt-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ var setupAndroidProj = function(grunt, projPath, args, cb) {
};

module.exports.setupAndroidBootstrap = function(grunt, cb) {
var projPath = path.resolve(__dirname, "android", "bootstrap");
var projPath = path.resolve(__dirname, "lib", "devices", "android",
"bootstrap");
var args = ["create", "uitest-project", "-n", "AppiumBootstrap", "-t",
"android-18", "-p", "."];
// TODO: possibly check output of `android list target` to make sure api level 18 is available?
Expand Down Expand Up @@ -392,7 +393,8 @@ var buildAndroidProj = function(grunt, projPath, target, cb) {
};

module.exports.buildAndroidBootstrap = function(grunt, cb) {
var projPath = path.resolve(__dirname, "android", "bootstrap");
var projPath = path.resolve(__dirname, "lib", "devices", "android",
"bootstrap");
var binSrc = path.resolve(projPath, "bin", "AppiumBootstrap.jar");
var binDestDir = path.resolve(__dirname, "build", "android_bootstrap");
var binDest = path.resolve(binDestDir, "AppiumBootstrap.jar");
Expand Down
6 changes: 3 additions & 3 deletions lib/appium.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ var routing = require('./server/routing.js')
, _ = require('underscore')
, fs = require('fs')
, ios = require('./devices/ios/ios.js')
, android = require('./devices/android.js')
, selendroid = require('./devices/selendroid.js')
, chrome = require('./devices/chrome_android.js')
, android = require('./devices/android/android.js')
, selendroid = require('./devices/android/selendroid.js')
, chrome = require('./devices/android/chrome.js')
, firefoxOs = require('./devices/firefoxos/firefoxos.js')
, status = require("./server/status.js")
, helpers = require('./helpers.js')
Expand Down
16 changes: 9 additions & 7 deletions android/adb.js → lib/devices/android/adb.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ var spawn = require('win-spawn')
, path = require('path')
, fs = require('fs')
, net = require('net')
, logger = require('../lib/server/logger.js').get('appium')
, status = require('../lib/server/status.js')
, logger = require('../../server/logger.js').get('appium')
, status = require('../../server/status.js')
, async = require('async')
, ncp = require('ncp')
, mkdirp = require('mkdirp')
, _ = require('underscore')
, helpers = require('../lib/helpers.js')
, helpers = require('../../helpers.js')
, unzipFile = helpers.unzipFile
, testZipArchive = helpers.testZipArchive
, AdmZip = require('adm-zip')
Expand Down Expand Up @@ -158,8 +158,8 @@ ADB.prototype.insertSelendroidManifest = function(serverPath, cb) {
logger.info("Inserting selendroid manifest");
var newServerPath = this.selendroidServerPath
, newPackage = this.appPackage + '.selendroid'
, srcManifest = path.resolve(__dirname, '..', 'build', 'selendroid',
'AndroidManifest.xml')
, srcManifest = path.resolve(__dirname, '..', '..', '..', 'build',
'selendroid', 'AndroidManifest.xml')
, dstDir = path.resolve(getTempPath(), this.appPackage)
, dstManifest = path.resolve(dstDir, 'AndroidManifest.xml');

Expand Down Expand Up @@ -1122,7 +1122,8 @@ ADB.prototype.getLogcatLogs = function() {

ADB.prototype.pushAppium = function(cb) {
this.debug("Pushing appium bootstrap to device...");
var binPath = path.resolve(__dirname, "..", "build", "android_bootstrap", "AppiumBootstrap.jar");
var binPath = path.resolve(__dirname, "..", "..", "..", "build",
"android_bootstrap", "AppiumBootstrap.jar");
fs.stat(binPath, function(err) {
if (err) {
cb(new Error("Could not find AppiumBootstrap.jar; please run " +
Expand All @@ -1146,7 +1147,8 @@ ADB.prototype.pushUnlock = function(cb) {
// TODO: calling `adb install` may not be necessary if its already there.
// can we check if app exists first? may speed this up.
this.debug("Pushing unlock helper app to device...");
var unlockPath = path.resolve(__dirname, "..", "build", "unlock_apk", "unlock_apk-debug.apk");
var unlockPath = path.resolve(__dirname, "..", "..", "..", "build",
"unlock_apk", "unlock_apk-debug.apk");
fs.stat(unlockPath, function(err) {
if (err) {
cb(new Error("Could not find unlock.apk; please run " +
Expand Down
15 changes: 7 additions & 8 deletions lib/devices/android.js → lib/devices/android/android.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"use strict";

var errors = require('../server/errors.js')
, adb = require('../../android/adb.js')
var errors = require('../../server/errors.js')
, adb = require('./adb.js')
, _ = require('underscore')
, logger = require('../server/logger.js').get('appium')
, deviceCommon = require('./common.js')
, status = require("../server/status.js")
, logger = require('../../server/logger.js').get('appium')
, deviceCommon = require('../common.js')
, status = require("../../server/status.js")
, NotYetImplementedError = errors.NotYetImplementedError
, parseXpath = require('../xpath.js').parseXpath
, parseXpath = require('../../xpath.js').parseXpath
, exec = require('child_process').exec
, fs = require('fs')
, temp = require('temp')
Expand Down Expand Up @@ -576,8 +576,7 @@ Android.prototype.getPageSource = function(cb) {
});
}.bind(this),
function(cb) {
var jar = path.resolve(__dirname, '..', '..', 'android', 'helpers',
'dump2json.jar');
var jar = path.resolve(__dirname, 'helpers', 'dump2json.jar');
var cmd = 'java -jar "' + jar + '" "' + xmlFile + '"';
logger.debug('json command: ' + cmd);
exec(cmd, { maxBuffer: 524288 }, function(err, stdout, stderr) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

var Android = require('./android.js').Android
, _ = require('underscore')
, proxyTo = require('./common.js').proxyTo
, logger = require('../server/logger.js').get('appium')
, proxyTo = require('../common.js').proxyTo
, logger = require('../../server/logger.js').get('appium')
, exec = require('child_process').exec
, spawn = require('child_process').spawn
, async = require('async')
, through = require('through')
, isWindows = require('../helpers.js').isWindows()
, adb = require('../../android/adb.js');
, isWindows = require('../../helpers.js').isWindows()
, adb = require('./adb.js');

var ChromeAndroid = function(opts) {
this.initialize(opts);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";

var exec = require('child_process').exec
, logger = require('../lib/server/logger.js').get('appium');
, logger = require('../../server/logger.js').get('appium');

function log(msg) {
logger.info("[ADB] " + msg);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion android/logcat.js → lib/devices/android/logcat.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var spawn = require('win-spawn')
, through = require('through')
, _ = require('underscore')
, logger = require('../lib/server/logger.js').get('appium');
, logger = require('../../server/logger.js').get('appium');

var Logcat = function(opts) {
this.adbCmd = opts.adbCmd;
Expand Down
12 changes: 6 additions & 6 deletions lib/devices/selendroid.js → lib/devices/android/selendroid.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"use strict";

var errors = require('../server/errors.js')
, adb = require('../../android/adb.js')
var errors = require('../../server/errors.js')
, adb = require('./adb.js')
, _ = require('underscore')
, deviceCommon = require('./common.js')
, deviceCommon = require('../common.js')
, request = deviceCommon.request
, proxyTo = deviceCommon.proxyTo
, getLog = deviceCommon.getLog
, getLogTypes = deviceCommon.getLogTypes
, logger = require('../server/logger.js').get('appium')
, status = require("../server/status.js")
, logger = require('../../server/logger.js').get('appium')
, status = require("../../server/status.js")
, fs = require('fs')
, async = require('async')
, path = require('path')
Expand Down Expand Up @@ -66,7 +66,7 @@ Selendroid.prototype.keyevent = function(body, cb) {

Selendroid.prototype.ensureServerExists = function(cb) {
logger.info("Checking whether selendroid is built yet");
var selBin = path.resolve(__dirname, "..", "..", "build", "selendroid",
var selBin = path.resolve(__dirname, "..", "..", "..", "build", "selendroid",
"selendroid.apk");
fs.stat(selBin, function(err) {
if (err) {
Expand Down
4 changes: 2 additions & 2 deletions reset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,11 @@ reset_selendroid() {
echo "* Linking selendroid test app: WebViewDemo"
run_cmd rm -rf $appium_home/sample-code/apps/WebViewDemo
run_cmd ln -s $appium_home/submodules/selendroid/selendroid-test-app $appium_home/sample-code/apps/WebViewDemo
uninstall_android_app io.selendroid.testapp
uninstall_android_app io.selendroid.testapp.selendroid
uninstall_android_app io.selendroid.testapp
# keep older versions of package around to clean up
uninstall_android_app org.openqa.selendroid.testapp
uninstall_android_app org.openqa.selendroid.testapp.selendroid
uninstall_android_app org.openqa.selendroid.testapp
fi
echo "* Setting Selendroid config to Appium's version"
run_cmd $grunt setConfigVer:selendroid
Expand Down
4 changes: 2 additions & 2 deletions test/functional/android/device-state.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*global describe:true, it:true, beforeEach:true */
"use strict";

var deviceState = require('../../../android/device-state.js')
var deviceState = require('../../../lib/devices/android/device-state.js')
, should = require('should')
, childProcess = require('child_process')
, it = require("../../helpers/driverblock.js").it
, ADB = require('../../../android/adb');
, ADB = require('../../../lib/devices/android/adb');

describe('Android Device State module', function() {
beforeEach(function(done) {
Expand Down

0 comments on commit 5ad5df4

Please sign in to comment.