Hi,

since Xav wrote that he is interested in a feedback on newly introduced API
to add extra variants to an Android project here is my initial take.

First of all I am glad that Google folks are now more seriously thinking
about testing support! If there are too many robolectric plugins or ways
how to integrate it it is what you get if you ignore (non-instrumented)
testing for too long (that's my sarcasm in response to some rant ;-) ).

It will take a while for me to absorb what changed and how to apply this to
NBAndroid. At the moment I think android plugin is aiming at too much if it
will try to extend what was just added. My idea how it can work was like
this:
Android gradle plugin provides a model that is accessible through Gradle's
Tooling API. This is used by plugin/module in IDE to set up
project/module(s) (in AS/IJ) or simply projects (NetBeans). An important
part is classpath (source sets with their dependencies). This is already
there and using the information from gradle IDE is aware of build variants
and can switch some classpath elements on and off based on current build
variant. What was added in 0.7 is a hook to add more artifacts with their
sources - the problem is that android IDE plugin does not know how to work
with these sources: how to run or debug the test (one or all); to extend
this 'how to bind actions to these sources?'; I am also curious if the
bootclasspath is rt.jar + some special jar or android.jar.

To improve this I suggest to change plugins like
https://github.com/JakeWharton/gradle-android-test-plugin by adding
ToolingModelBuilder (
http://www.gradle.org/docs/current/javadoc/org/gradle/tooling/provider/model/package-frame.html)
and write an IDE plugin. This robolectric IDE plugin will depend on
Android's builder/builder-model and can add source roots on its own. Its
model can use SourceProviders or mix or wrap it with something else to add
an extra information useful for the IDE. As a result it can add better
handling of these sources, for example properly bind 'run test' actions to
run it directly from IDE and get the output displayed in a way that you
expect from your IDE. It can smoothly support debugging too. As a bonus the
build script can get simple again:
apply plugin: 'android'; apply plugin: 'robolectric'
and the heavylifting will be moved to more proper place - Gradle plugin and
its IDE counterpart.

Now I am going to update NBAndroid to 0.7.1. Maybe I will realize it can be
used as it is or will find there is something extra what I want to get from
Gradle.

-Radim

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to