Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support android plugin #18

Open
wants to merge 1 commit into
base: android
Choose a base branch
from
Open

Conversation

anserran
Copy link

@anserran anserran commented Oct 5, 2015

This PR is related to #17
I tried your changes but they didn't work, so I started digging. It seems that the android plugin follows the same structure as the java plugin, but the sourceSets are implemented with different classes.
It seems necessary to manually walk through all the android directories to collect the files to be formatted.
This is my first time working with groovy and gradle plugins, so I could've easily done something awful in the code.

@youribonnaffe
Copy link
Owner

Indeed I did not check the API for the Android plugin and assumed it was similar to the Java plugin.
Did you get a specific error when testing?

Although different it seems the API is close, with a getJava() method that returns a SourceDirectorySet, perhaps it is the plus() method that is not implemented?

@anserran
Copy link
Author

anserran commented Oct 6, 2015

Yes, the exact Exception is:

No signature of method: com.android.build.gradle.internal.api.DefaultAndroidSourceDirectorySet.plus() is applicable for argument types: (com.android.build.gradle.internal.api.DefaultAndroidSourceDirectorySet) values: [[src/test/java]]
  Possible solutions: is(java.lang.Object), split(groovy.lang.Closure), use([Ljava.lang.Object;), wait(), grep(), dump()

(This is after changing file?.isEmpty() for !file. Otherwise, condition was always false)

@youribonnaffe
Copy link
Owner

Perhaps it is possible to create a file collection from those without the plus method.

@anserran
Copy link
Author

anserran commented Oct 6, 2015

Yes, that's what I tried in this PR. DefaultAndroidSourceDirectorySet doesn't have a method that returns all the files, so I added a method to FormatTask.groovy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants