Fixed
Status Update
Comments
me...@thomaskeller.biz <me...@thomaskeller.biz> #2
This was tested on Android Studio 3.1.3 on Mac with Android Build Tools 3.1.3.
uc...@google.com <uc...@google.com> #3
Reproduced in
Android Studio 3.1.4
Build #AI-173.4907809, built on July 23, 2018
JRE: 1.8.0_152-release-1024-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.16.0-3rodete1-amd64
Android Studio 3.1.4
Build #AI-173.4907809, built on July 23, 2018
JRE: 1.8.0_152-release-1024-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.16.0-3rodete1-amd64
le...@google.com <le...@google.com> #4
Michal, would you know what's happening?
be...@google.com <be...@google.com> #5
The problem immediate problem seems to be that the OrderEntry[] table for the module is in wrong order, but as far as I can tell the model we're getting from Gradle already has the order wrong. Lucas, can you verify that? If that's the case, we probably need to re-assign to the Gradle component.
ls...@google.com <ls...@google.com> #6
We are receiving dependencies in the wrong order from AGP.
Actually, dependencies in the model are exposed as a Collection and not a List (despite implementation being an ArrayList).
I'm attaching the dependency resolution by Gradle, the java library dependencies exposed in the model and the classpath used by Studio when running the tests (reflects order in the model).
I think this is something we have to fix in the model builder in the plugin: passing the dependencies in the right order that should be used in the classpath. Can you please assign to the right person, Jerome?
PS: we might also want to expose them as a List in the model (it has no effect now since the implementation is already a List)
Actually, dependencies in the model are exposed as a Collection and not a List (despite implementation being an ArrayList).
I'm attaching the dependency resolution by Gradle, the java library dependencies exposed in the model and the classpath used by Studio when running the tests (reflects order in the model).
I think this is something we have to fix in the model builder in the plugin: passing the dependencies in the right order that should be used in the classpath. Can you please assign to the right person, Jerome?
PS: we might also want to expose them as a List in the model (it has no effect now since the implementation is already a List)
je...@google.com <je...@google.com> #7
this is too risky for 3.3, moving to 3.4
st...@google.com <st...@google.com>
st...@google.com <st...@google.com> #8
I hooked up a debugger and looked into the order in which we receive these dependencies from Gradle before adding them to the model. It looks like they are delivered out of the "CompileClasspath" Configuration in the wrong order (see attachment). I'm not sure why the dependencies are resolved in this order. Investigation is ongoing.
st...@google.com <st...@google.com> #9
I did some more debugger stuff and fished up the classpath used by `.gradlew testDebug` (which passes) as well as, for good measure, the classpath used when the test is run from Studio (which matches Comment #6 ). In both classpaths, Powermock artifacts appear before Mockito artifacts, though the exact ordering differs. (See attachments)
Additional investigation indicates that the dependencies included in the Model (See Comment #8 ) are ordered similarly to the dependencies included in the "testDebugUnitTest" task. In both cases, the artifacts do not surface in the exact order in which their respective dependencies appear in build.gradle because artifacts are resolved in "Consumer First" order. Notably, this causes the "powermock-module-junit4" artifacts to precede "junit4" (and thus appear quite early) and causes "powermock-api-mockito2" to precede "mockito-core" (See the full dependency listing with Comment #6 ). All this is reflected in the classpath used by the Gradle test, and does not appear to cause any problems in that context.
I believe the salient difference between the two classpaths is the ordering of "powermock-api-mockito2" before "mockito-inline" in the classpath used by Studio. This does not appear to be the case in the Model, so I suspect Studio may be reordering the artifacts.
Additional investigation indicates that the dependencies included in the Model (See
I believe the salient difference between the two classpaths is the ordering of "powermock-api-mockito2" before "mockito-inline" in the classpath used by Studio. This does not appear to be the case in the Model, so I suspect Studio may be reordering the artifacts.
st...@google.com <st...@google.com> #10
Passing back to the Studio team for more investigation, since I don't know enough to look at the issue from that side.
Description
I created an example project that shows the issue:
Run `./gradlew testDebug` and all tests succeed. Run the tests from the IDE and see `ModernTest` fail.