Code Monkey home page Code Monkey logo

gradle-android-command-plugin's Introduction

novoda

This repo contains information that is common to all Novoda's Open Source projects.

gradle-android-command-plugin's People

Contributors

arok avatar blundell avatar charroch avatar danybony avatar devisnik avatar electryc avatar emanuelez avatar florianmski avatar frankiesardo avatar frapontillo avatar friedger avatar grujo avatar jaredsburrows avatar jszmltr avatar juankysoriano avatar mr-archano avatar orrc avatar ouchadam avatar rock3r avatar sebastianengel avatar sschuberth avatar stefanhoth avatar tasomaniac avatar tobiasheine avatar xrigau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gradle-android-command-plugin's Issues

Refactor monkey configuration

Problem

Currently I think monkey configuration is not clean and confusing.

There are currently 3 ways to modify the behavior of the monkey task.

  1. Having a new task extending from the task Monkey and defining closure's for its properties:
    task('monkey2', com.novoda.gradle.command.Monkey) {
        categories {
            ['android.intent.category.ONLY_ME']
        }
    }

As it can be seen here, it doesn't look very good and you need to have another task name. Because monkey is taken.

  1. Using the properties of the extension:
command {
    events 1000
    categories = ['android.intent.category.ONLY_ME']
}

Although it looks clean, having these configurations in the parent command closure doesn't make sense to me because they are only valid for the task monkey

  1. Having a command line argument -Pcategories

Suggested solution:

My suggestion is to remove closures from the Monkey task and have a method in the main extension named monkey which will allow users to define the properties with something like this

command {
    monkey {
        events 1000
        categories = ['android.intent.category.ONLY_ME']
    }
}

apkPath source defined in VariantConfigurator

I don't know why it is really bug.
But in the VariantConfigurator.groovy you are using variant.outputs[0].packageApplication.outputFile as source for the final APK which will be deployed to the phone.

But if I use this to the remote sign:
https://gist.github.com/ducrohet/e0d854c54bd0ceeb7044
output[0].packageApplication.outputFile contain only usigned apk.

But real target name is output[0].outputFile

So why you are using packageApplication.outputFile instead?

Collect mokeyrunner log

Thank you for the plugin!

I have a question which I was not able to grab from sources or documentation. Is log from monkeyrunner collected somewhere?

Restore "defaults" after running the monkey

Tablets can run out of battery when the brightness is full and the monkey runner has a nasty habit of turning it up to full.

It would be good if we could change these values -brightness, volume etc after the monkey has ran.

Also links #57 as the commands will probably adb shell prop edits

Input adds quotes to the text on Genymotion

Using plugin with Genymotion:

    task autoLogin (type: com.novoda.gradle.command.Input) {
      script {
        text 'user'
        tab()
        text 'password'
        enter()
        enter()

Adds quotes to the text that appeared in text fields

Monkey output is not being propagated to gradle

The gradle output isn't too helpful!

Caused by: groovy.lang.GroovyRuntimeException: Monkey run failed
    at com.novoda.gradle.command.Monkey.handleCommandOutput(Monkey.groovy:12)
    at com.novoda.gradle.command.AdbTask.runCommand(AdbTask.groovy:48)
    at com.novoda.gradle.command.AdbTask.assertDeviceAndRunCommand(AdbTask.groovy:42)
    at com.novoda.gradle.command.Monkey.exec(Monkey.groovy:17)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:218)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:579)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:562)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 47 more

No license

Hello,

I don't see a license anywhere in this code. Did I miss it? I'd like to contribute but the legal department at my company has a problem with me using 3rd party source when permission hasn't been explicitly granted. Are you using an open source license? If not can you email me permission to use this source?

I have two new tasks that are ready for a pull request. I have a Pulll task to grab files from the device and a Logcat task to collect device logs for the duration of a task (like connectedAndroidTest).

thanks,
Tim

PR-10: Add file transfer task

Issue by stefanodacchille
Saturday Mar 29, 2014 at 08:35 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/pull/10


I'm not entirely happy with the API atm, I'd have loved to have a configuration closure instead, something like:

command {
  ...
  push {
    localFile 'img.jpg'
    remoteFile 'sdcard/Pictures/img.jpg
  }
}

but I'm not sure how to implement this. If anyone can give me any inputs on how to achieve it, I'd be happy to put more work on it.


stefanodacchille included the following code: https://github.com/novoda/legacy-gradle-android-command-plugin/pull/10/commits

The install task is broken on Nougat

The problem is that it simply does not accept the argument -rd when r and d are together. -r -d works.

As far as I see, it is only on Nougat (both my Nexus 6 and emulator). It could be because of the many changes/refactorings they did on adb on Nougat.

Exception occurred while dumping:
java.lang.IllegalArgumentException: No argument expected after "-rd"
        at android.os.ShellCommand.getNextOption(ShellCommand.java:195)
        at com.android.server.pm.PackageManagerShellCommand.makeInstallParams(PackageManagerShellCommand.java:999)
        at com.android.server.pm.PackageManagerShellCommand.runInstall(PackageManagerShellCommand.java:139)
        at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:94)
        at android.os.ShellCommand.exec(ShellCommand.java:94)
        at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:18167)
        at android.os.Binder.shellCommand(Binder.java:468)
        at android.os.Binder.onTransact(Binder.java:367)
        at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2387)
        at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:3143)
        at android.os.Binder.execTransact(Binder.java:565)

ProjectConfigurationException seems to be used incorrectly

Related to pull request #42, in the main plugin class, it seems that the plugin tries to warn users if the Android plugin hasn't been applied.

But since ProjectConfigurationException seems to require both a String and a Throwable, the plugin just fails in this case with the message:

Could not find matching constructor for: org.gradle.api.ProjectConfigurationException(java.lang.String)

Configure monkey tests?

I know that's a bad place to ask questions... but I can't find better place:)

Could you explain a little how to:

  1. Choose device for monkey tests
  2. How to pass additional params to monkey runner, for example swipe frequency?

I found that I could do

command {
    deviceId "deviceName"
}

But how to pass those in commandLine

Import to IntelliJ

I'm trying to import project to IntelliJ but without luck. I even created an issue on IntelliJ issue tracker:
https://youtrack.jetbrains.com/issue/IDEA-132303

First of all I don't understand why importing is running tests and failing the IDEA. Is it gradle plugin specific or it is fault of IDE?

Another question of course why gradle doesn't see Environment variable. I tried to switch off daemon running.

Can you help? What IDE do you use for development?

Only install on current profile

I am seeing an issue on Lollipop and up, where the plugin installs the application for "all users". This forces me to do:

./gradlew uninstallAll

or manually go into the phones Settings and view the applications and manually "uninstall for all users".

Commands listed as "others"

It's a small thing but the commands show up as "others" when you call gradle(w) tasks

I guess there's a group ID missing or something.

Stop using deprecated APIs from the android gradle plugin

We're using variant.getPackageApplication() which is now deprecated!

The warning when trying to build is
WARNING [Project: :sample] variant.getPackageApplication() is deprecated. Call it on one of variant.getOutputs() instead.

Consider removing `-d` flag from install task

Related to #108 and #110, I found this conversation and discussed a little bit with @keyboardsurfer about the implications of -d flag in adb install
https://plus.google.com/u/0/+BenjaminWeiss/posts/Pq1Pr1vy9kE

I can see that it was added as a side-effect commit in another PR that is not really related.

I couldn't find any explanation why we needed this.

I think, we also shouldn't have it on by default. It can be dangerous when you checkout a very old commit to test something. The downgrade can cause un-expected problems with the persisted data.

We should instead maybe have a sample that shows how to enable this if wanted.

Provide monkey start parameters

Expose in the api the ability to provide the monkey package/action/activity start parameters

adb shell am start in order to start the desired subactivity

adb shell am start -a my.package.app.ACTION1 -n my.package.app/.sub.MyActivity

Support for android graddle plugin 0.13+ and Gradle 2.1

It looks like the plugin works also on the new version of the android gradle plugin, only with this warning

WARNING [Project: :app] variant.getPackageApplication() is deprecated. Call it on one of variant.getOutputs() instead.

Documentation improvements

I believe the plugin needs more documentation.

In the README file, only the tasks are mentioned. Some of the configurations can be seen in the sample project.

Ideally, these can also be in the README or a wiki file.

Things that can go there:

  • Command line extra arguments like -DdeviceId
  • Possible configurations
  • Some considerations about creating your own tasks
  • Listing available methods like devices(), device.brand() etc.

[CLOSED] Command wrapper

Issue by devisnik
Friday Jan 17, 2014 at 13:04 GMT
Originally opened as https://github.com/novoda/legacy-gradle-android-command-plugin/pull/1


Introduces tasks for the different commands. Properties are managed by the extension to enable configuration via

variant {
     deviceId '123456'
}

This reduces the definition overhead in the applying project. (Could be further reduced now by registering the tasks during plugin registration).

Note that the device name is no longer used in the automatic task naming.

I've also included the files under buildSrc from my local dev environment for easier testing. It expects a link to the plugin source named command.


devisnik included the following code: https://github.com/novoda/legacy-gradle-android-command-plugin/pull/1/commits

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.