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

Discover sourceSets automatically that have scala sources and create dynamic tasks for them #45

Open
olisikh opened this issue Aug 2, 2018 · 1 comment

Comments

@olisikh
Copy link

olisikh commented Aug 2, 2018

Hello,

It's a great plugin, but I really miss some of the functionality.
For example I have not only main/scala and test/scala but also integrationTest/scala and gatling/scala and I can't just run scalastyle on all of them.

Maybe we could improve the plugin so that it will create scalastyleMain, scalastyleTest, scalastyleIntegrationTest, scalastyleGatling automatically and the parent task scalastyle to run them all?

We could make an extension scalastyle using named domain object container e.g.

scalaStyle {
  // global config (use in case there is no override for specific source set)
  config = file("$rootDir/scalastyle.xml")
  // globally configure to fail on warnings
  failOnWarnings = true  
  
  // not sure it's the right name, or 
  // maybe even we don't need this nesting and should just handle a missing method call
  sourceSets {
    // gatling is supposed to be a DSL, 
    // so I don't really want production code checks to be run on it, 
    // but rather some basic checks and DSL specific
    gatling {
      config = file("$rootDir/scalastyle-test.xml")
    }
  
    test {
      // do not fail on warnings when checking test source set
      failOnWarnings = false  
    }

    garbage {
      // do not even create a task for this source set
      skip = true
    }
  }
}

Usage:

// runs main source set checks
gradlew scalaStyleMain
// error, no task for garbage source set
gradlew scalaStyleGarbage
// runs all (scalaStyleMain, scalaStyleTest)
gradlew scalaStyle 

If somebody else is interested, I can work on that.
I have something similar like I proposed implemented as a plugin in buildSrc, however I made it as a JavaExec task (just running a scalastyle jar with needed arguments)

@willis7
Copy link

willis7 commented Sep 21, 2018

I'm hitting the same problem with integration tests not having their own task

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

No branches or pull requests

2 participants