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

Add android variants check and format tasks #170

Closed
Tapchicoma opened this issue Nov 10, 2018 · 11 comments
Closed

Add android variants check and format tasks #170

Tapchicoma opened this issue Nov 10, 2018 · 11 comments

Comments

@Tapchicoma
Copy link
Collaborator

Currently, plugin checks SourceSet for particular android variant, but it doesn't check sources that variant depends on as well.

Need to add special meta tasks for each android variant that will trigger tasks for all dependent variant sources.

@bitsydarel
Copy link

Any prognostic when this fix will be available?

I'm trying to run variant specific check to speed up the build on CI.
I saw No-source message, I taught it's was a configuration issue from my side.

@Tapchicoma
Copy link
Collaborator Author

Tasks with NO-SOURCE message has a very small impact on a build time - it means there are no inputs and task execution will be skipped.

Regarding task that runs check for particular variant, should be available in next version (though plans are also bump minimal supported Gradle version to 5.0.0). Regarding time - can't promise anything.

@bitsydarel
Copy link

It's seems that flavor specific task currently work but not variant one.

Example if I have flavor a and build type x and y.

Ktlint work for task KtlintA but not for KtlintAx or ktlintAy.

@tasomaniac
Copy link
Contributor

It's not necessarily speed vs tasks with no source. It's a common practice in Android projects to only run a single build variant to speed up the build.

Instead of running ktlintCheck task you would run ktlintDebugCheck.

But that returns NO-SOURCE since the debug specific sourceSet is empty. Debug variant has main and debug sourceSets in it.

@tasomaniac
Copy link
Contributor

@bitsydarel can you double check if an error in main folder is detected when you run ktlintA?

ktlintA would check sources within a folder. You must have some code in a

@bitsydarel
Copy link

bitsydarel commented Dec 4, 2018

@tasomaniac Yes you were right, Its only founded issue for the flavor A, executing flavor task and Ktlintmaincheck sounds like a workarounds for my issue. But still strange why flavor A task does not include the main folder too...

@tasomaniac
Copy link
Contributor

It was checking main folder too in 5.1.0 The behavior was changed in version 6.0. At our company, we are using 5.1.0 still.

I did this change in Novoda's plugin to support both versions in a nice way. Will be available in the next version of that plugin novoda/gradle-static-analysis-plugin#153

@Tapchicoma
Copy link
Collaborator Author

I am trying to add kind of same meta tasks for multiplatform targets - should running ktlintCheckAndroid trigger ktlintCheckCommon (if android target has dependency on common sources) or it is ok just to run checks only for android target sources?

@Tapchicoma
Copy link
Collaborator Author

Opened new issue for multiplatform: #182

Currently new mpp plugin kind of messy and there is no straghtforward way to get all sourcesets for target (with dependent sources)

@tasomaniac
Copy link
Contributor

I feel like that would be a separate task. Does this plugin support checking other dependencies already?

@Tapchicoma
Copy link
Collaborator Author

Currently new MPP plugin is a little mess and it is not straightforward to get all source sets for given target. As for target dependOn source sets - it is not possible 😞

Anyway, as I said - I've opened separate issue for this.

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

No branches or pull requests

3 participants