Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Upgrade to spoon2.0.0-snapshot, android3.0.0 and gradle 4.1 #161

Closed

Conversation

dweebo
Copy link

@dweebo dweebo commented Oct 12, 2017

To fix issues discussed in #155 and to prepare for android build tools 3.0.0.

@ligi
Copy link
Contributor

ligi commented Oct 26, 2017

Great initiative - but I have the same problem travis has - as the PR uses a SnapShot of spoon but does not add the SnapShot maven repo. This should help:

--- a/build.gradle
+++ b/build.gradle
@@ -33,6 +33,7 @@ repositories {
   mavenLocal()
   google()
   jcenter()
+  maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } 
 }
 

@dweebo
Copy link
Author

dweebo commented Oct 26, 2017

Oh nice thanks! I couldn't figure out where spoon kept snapshots. I'll update in a bit

@dweebo
Copy link
Author

dweebo commented Oct 26, 2017

3.0.0 is officially out now too so will upgrade to that and test as soon as i can

@ligi
Copy link
Contributor

ligi commented Oct 27, 2017

one question (blocks me from using 3.0.0 for now) don't you experience: https://issuetracker.google.com/issues/68275433

@dweebo
Copy link
Author

dweebo commented Oct 27, 2017

@ligi haven't seen that error

@dweebo dweebo changed the title Upgrade to spoon2.0.0-snapshot, android3.0.0-beta7 and gradle 4.1 Upgrade to spoon2.0.0-snapshot, android3.0.0 and gradle 4.1 Oct 27, 2017
@autonomousapps
Copy link

Hi! Just wondering when this might get merged and published? I also tried to find a snapshot build, but it doesn't seem to be available. https://oss.sonatype.org/content/repositories/snapshots/com/stanfy/spoon/spoon-gradle-plugin/

@ligi
Copy link
Contributor

ligi commented Oct 27, 2017

@dweebo thanks for the info and good for you ;-)
@autonomousapps you can get a snapshot via jitpack

@autonomousapps
Copy link

autonomousapps commented Oct 27, 2017

@ligi can you show me the code for that? Gradle still can't find it. I have:

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        maven { url 'https://plugins.gradle.org/m2/' }
        maven { url 'https://maven.google.com' }
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        // elided
        classpath 'com.stanfy.spoon:spoon-gradle-plugin:2.0.0-SNAPSHOT'
    }
}

@ligi
Copy link
Contributor

ligi commented Oct 27, 2017

classpath 'com.github.dweebo:spoon-gradle-plugin:5c318830a43c01dc098b745278168e12fb55dedc' should do the trick

@autonomousapps
Copy link

Thank you, that worked (almost), but now it's complaining it can't find com.squareup.spoon:spoon-runner:2.0.0-SNAPSHOT, which it says is required by com.github.dweebo:spoon-gradle-plugin:5c318830a43c01dc098b745278168e12fb55dedc

@ligi
Copy link
Contributor

ligi commented Oct 27, 2017

you need to add
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
to the repositories for your app

@autonomousapps
Copy link

Yes, sorry! I removed that after you said to use jitpack. All is well now with that re-added to repos block. For anyone else that sees this, here is a complete working example:

buildscript {
    repositories {
        maven { url 'https://jitpack.io' }
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
    }
    dependencies {
        classpath 'com.github.dweebo:spoon-gradle-plugin:5c318830a43c01dc098b745278168e12fb55dedc'
    }
}

@jaredsburrows
Copy link

@autonomousapps @ligi When can we get a new release. The last release on this plugin was over a year ago :(

@ligi
Copy link
Contributor

ligi commented Oct 27, 2017

@jaredsburrows I cannot tell you as I am not the maintainer ..-)

@jaredsburrows
Copy link

jaredsburrows commented Oct 27, 2017

@ligi Alright.

@autonomousapps Combining it all together:

buildscript {
    repositories {
        maven { url "https://jitpack.io" }
        maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
    }

    dependencies {
        classpath "com.squareup.spoon:spoon-runner:2.0.0-SNAPSHOT"
        classpath "com.github.dweebo:spoon-gradle-plugin:5c318830a43c01dc098b745278168e12fb55dedc"
    }
}

Both tasks show up again:

spoon - Runs all the instrumentation test variations on all the connected devices
spoonDebugAndroidTest - Runs instrumentation tests on all the connected devices for 'debugAndroidTest' variation and generates a report with screenshots

@autonomousapps
Copy link

Cool. I didn't have to add an explicit dependency on the spoon-runner, since the spoon-gradle-plugin pulled that in automatically. 🤷‍♂️

@jaredsburrows
Copy link

@autonomousapps did the output change of the artifacts?

@autonomousapps
Copy link

@jaredsburrows Good question. I'm currently wrestling with Jenkins to get it to build my project with all the updates. The last build didn't have usual Spoon report, so it's possible the artifact location has changed.

@ligi
Copy link
Contributor

ligi commented Nov 16, 2017

square/spoon@53a63fe was just merged - @jaredsburrows can you ping when a version of your plugin contains this?

@jaredsburrows
Copy link

jaredsburrows commented Nov 16, 2017

@ligi Support added here in 1.1.11-SNAPSHOT.

@jaredsburrows
Copy link

@dweebo @ligi @autonomousapps Are you all seeing this? square/spoon#498

No xml junit reports are being generated.

@jaredsburrows
Copy link

@ligi Can you verify that "single instrumentation" is working for you?

Also, @dweebo @autonomousapps are you all seeing what I am seeing?

@ligi
Copy link
Contributor

ligi commented Nov 23, 2017

@jaredsburrows sorry - did not yet find time to try - also a bit reluctant using such snapshot versions as I want my builds to be reproducible as possible - as far as I see this way the plugin could change from build to build - which means the build could pass one time and fail another time.
But might try to use it via jitpack with a referenced commit-hash soon - should also work. PS does your plugin support the spoon flag --fail-if-no-device-connected ?

@jaredsburrows
Copy link

@ligi I need to publish a new release but the SNAPSHOT is stable and does support fail-if-no-device-connected. I also have updated it to support "single instrumentation". Regardless of snapshot or not, you still have to use the SPOON 2.0.0 SNAPSHOT for this plugin to work.

@ligi
Copy link
Contributor

ligi commented Nov 23, 2017

Ah right - dam - do you have any idea when spoon 2.0.0 will be released?

@jaredsburrows
Copy link

@ligi No :(

@hram
Copy link

hram commented Nov 23, 2017

Hi all
Can you check SNAPSHOT how it works if specify package for running tests only from this package?
In my project when I set instrumentation arguments like this

instrumentationArgs = ["package=my.app.package.name"]

I haw exception in logcat

E/AndroidJUnitRunner: Fatal exception when running tests
java.lang.IllegalArgumentException: Ambiguous arguments: cannot provide both test package and test class(es) to run
at android.support.test.internal.runner.TestRequestBuilder.validate(TestRequestBuilder.java:828)
at android.support.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:789)
at android.support.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:487)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:373)
at my.package.app.runner.UnlockDeviceAndroidJUnitRunner.onStart(UnlockDeviceAndroidJUnitRunner.java:44)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2075)

@jaredsburrows
Copy link

@hram Yes. This is because by default Spoon 2 runs in separate instrumentation. So you need to use the singleInstrumentationCall = true from https://github.com/jaredsburrows/gradle-spoon-plugin to make it work. Or you can use annotations such as @SmallTest.

@hram
Copy link

hram commented Nov 23, 2017

@jaredsburrows thank you very much!
I will try
As workaround I configure Suite with all testes what I needed
And configure spoon with parameter 'className' to run this Suite

@jaredsburrows
Copy link

@hram Great! It really should be reported to spoon. As it is a limitation to adb shell am instrumentation.

build.gradle Outdated

compile 'com.android.tools.build:gradle:1.5.0'
compile('com.android.tools.build:gradle:3.0.0') {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update it to 3.0.1 ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I am trying :)

@dweebo
Copy link
Author

dweebo commented Nov 29, 2017

@jimxj I upgraded to 3.0.1 and fixed an issue with a recent change to spoon snapshot 2.0.0

@jaredsburrows
Copy link

@dweebo I love the map.

@hram
Copy link

hram commented Nov 30, 2017

@jaredsburrows can you help me?
I was trying to set package name as

instrumentationArgs = ["package my.app.testspoon"]

and set parameter as you sad

singleInstrumentationCall = true

but spoon task execuded fith error

java.lang.NoSuchMethodError: com.squareup.spoon.SpoonRunner$Builder.setInstrumentationArgs(Ljava/util/List;)Lcom/squareup/spoon/SpoonRunner$Builder;
at com.jaredsburrows.spoon.SpoonTask.spoonTask(SpoonTask.kt:73)

I changed params as

instrumentationArgs = ["package=my.app.testspoon"]

and no luck (

@jaredsburrows
Copy link

@hram Sorry. I need to update the documentation. Your instrumentationArgs = ["package my.app.testspoon"] should be instrumentationArgs = ["package=my.app.testspoon"].

I need to support both List and Map.

@hram
Copy link

hram commented Nov 30, 2017

@jaredsburrows but as I sad

I changed params as
instrumentationArgs = ["package=my.app.testspoon"]
and no luck (

@jaredsburrows
Copy link

@hram Maybe it is a bug. Can you post an issue in that projects issues?

@hram
Copy link

hram commented Dec 1, 2017

@Igorshp
Copy link

Igorshp commented Aug 8, 2018

Is anythig blocking this from being merged?

@dweebo dweebo closed this Sep 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.