-
Notifications
You must be signed in to change notification settings - Fork 460
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
Automatic Android support without specifying target "src/*/java/**/*.java" #111
Comments
It should support Android. If it doesn't work with Android projects, I'd consider it a bug, in which case please let us know. :) |
@jbduncan Why close this so fast? I just tried this plugin on my project here: https://github.com/jaredsburrows/android-gif-example and it does seem to work. Based on your README.md, are you expecting |
This does not work:
Even trying
|
Oh, sorry! I thought that was the end, as I assumed you just had a question out of curiosity. My bad.
Glad to hear. 👍
By "excepting", did you mean "expecting"? Yes, that's one of 3 ways one can use Spotless for non-Android Java projects:
The reason all 3 of these tasks work (on non-Android Java builds at least) is because the From your example, I can't tell what about it doesn't work or why. Can you provide an minimal, verifiable, and complete example for us to try out? |
@jbduncan I gave you an example to try out already in the previous comment.
Nothing happens. I have even tried the following: This does not work:
Even trying
|
This worked for me now: For Android, you have to specify a target: The
|
@jaredsburrows Glad to hear to that It's annoying that you have to manually specify the target as @nedtwigg I'm not terribly familiar with Spotless's internals yet, so do you have any thoughts on what we could do allow Spotless to support Android? |
The android plugin must not be friends with this code. |
@jaredsburrows Can you clarify for me what you mean when you say "You just have to specify Just to make sure we're on the same page, I want to clarify that |
@jbduncan I was talking about the
|
I added the workaround in the top comment for others to find, along with links to the places where the code would need to be fixed if anyone wants to submit a PR for this. |
@jaredsburrows @nedtwigg Does someone have a full example of where to embed the plugin into the android gradle files? The android-gif example does not include these sections. Thanks in advance. I always wind up with a |
I posted the example in this thread. The android-gif-repo does not use
spotless.
…On May 30, 2017 11:02 PM, "Peter Spiess-Knafl" ***@***.***> wrote:
@jaredsburrows <https://github.com/jaredsburrows> @nedtwigg
<https://github.com/nedtwigg> Does someone have a full example of where
to embed the plugin into the android gradle files? The android-gif example
does not include these sections. Thanks in advance.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#111 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABqMSAYOCC-OBC-n-Vogy5CcagPQV0Ugks5r_QKOgaJpZM4NagKb>
.
|
I manged to solve it. I was missing what was mentioned in #103. Maybe others find it useful, so I post my final solution here.
|
@nedtwigg maybe you could add this to the documentation somewhere? |
@cinemast I believe your example could be shortened. Does the build file below work? // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id "com.diffplug.gradle.spotless" version "3.4.0"
}
allprojects {
buildscript {
repositories {
jcenter() // to allow Spotless to download formatters
}
}
// @cinemast "apply plugin: ..." shouldn't be needed because it is already applied implicitly through the "plugin {}" block above.
spotless {
java {
target "**/*.java"
trimTrailingWhitespace()
removeUnusedImports()
googleJavaFormat()
}
}
}
// @cinemast No clean task should be needed, I think? (In non-Android Java projects, clean automatically exists and cleans the root project's build directory.) |
I required the |
The When you start having plugins dependent upon other plugins you end up tied to their breaking changes version bumping. I've had to deal with this in my own plugin. |
That's fine. Where can/should we document this? |
Probably the plugin |
Just a bump that |
Does this support Android?
EDIT BY @nedtwigg, TOP COMMENT FOR VISIBILITY
On Android, your config file needs to look like this:
We'd love a PR which fixes this, see this comment and this comment for what needs to be done.
The text was updated successfully, but these errors were encountered: