Creating a Custom Buildship Configuration for Android

I’m a committer on the Andmore project, and now that Buildship has custom configurators that other plugins can contribute too, I wanted to see what would be needed to get Android specific items added.

I have several questions.

It looks like the BaseConfigurator is correctly adding the Gradle Classpath Container, the JDT Nature, and the gradle nature to to the Android app and library projects. However, the source folders are not being recognized as another reporter has also reported. I could add these manually, but also need to take into accoun the Android Flavors and the various source folders that it introduces as well. What would be the correct way to go about getting this? Is there a way to get the model that the android gradel plugin introduces? Also it does not look like the Gradle Container for Android projects ever resolves dependencies as none show up like they do for the Java projects I have.

I took a look at the WTP Configurator but that just basically adds the missing deployment items. In the ecllipse Maven project you could configure based on the existance of a particular plugin (i.e. android-gradle-plugin). If the project configuator is not the appropriate extension point can you point me to a couple of other examples that might get me going?

Thanks.

Dave

1 Like

Hi. Apologies for the super-late reply.

Is there a way to get the model that the android gradel plugin introduces?

In your project configurator, you can query any models you want (see the argument of the init() method) via the Tooling API. In your case, I can imagine that your plugin depends on the android plugin jar, queries the Android TAPI model defined in the jar and sets up the returned source folders on the target projects.

Also it does not look like the Gradle Container for Android projects ever resolves dependencies as none show up as they do for the Java projects I have.

I’m not sure about the correct behavior, but it might be that there are configuration scopes missed in the configuration. Buildship resolves the eclipse.classpath.(plus|minus)Configurations scopes and assigns them to the project. You could adjust the configuration with an init script that is injected via the invocationCustomizers extension point.

I took a look at the WTP Configurator but that just basically adds the missing deployment items. In the ecllipse Maven project you could configure based on the existance of a particular plugin (i.e. android-gradle-plugin)

You can do the same in ProjectConfigurator.init().

If the project configuator is not the appropriate extension point can you point me to a couple of other examples that might get me going?

It’s definitely the project configurator where you should contribute to Android support.

Again sorry for the late reply and let me know if I help with anything more.