Coder Social home page Coder Social logo

Comments (5)

szpak avatar szpak commented on June 12, 2024

Added in 1.1.11.

from gradle-pitest-plugin.

FlasH-RUS avatar FlasH-RUS commented on June 12, 2024

I was unable to make it work out of the box for #276 (i.e. running gradle build on windows machine while having a really long dependency list). Since taskClasspath is still automatically constructed from runtime classpaths of testSourceSets the resulting classpath might still be too long for windows machine even if you are using classPathFile.
My WA was to set classPathFile AND provide a fake testSourceSets while still adding all corresponding dependencies into class path file + adding required task dependencies.
Note that you can't just erase testSourceSet because plugin will still generate an empty classpath argument for a command line runner which in turn results in Pitest's OptionParser to omit mutableCodePaths, which comes next.
Working WA code:

task pitestClassPathFile(dependsOn: testClasses) << {
    StringBuilder classPathFileContents = new StringBuilder()
    sourceSets.test.runtimeClasspath.getFiles().forEach { filePath ->
        classPathFileContents.append(filePath).append('\n')
    }

    def classPathFile = new File("${project.buildDir}/pitestClassPathFile")
    classPathFile.write(classPathFileContents.toString())
}

pitest {
...
    def fakeSourceSet = [
        runtimeClasspath: project.sourceSets.test.output.classesDir,
        name: project.sourceSets.test.name
    ]
    testSourceSets = [ fakeSourceSet ]
    classPathFile = file("${project.buildDir}/pitestClassPathFile")
}

tasks['pitest'].dependsOn pitestClassPathFile

from gradle-pitest-plugin.

FlasH-RUS avatar FlasH-RUS commented on June 12, 2024

Probably the quickest fix would be to just omit classPath command line argument if it's empty and/or if classPathFile is provided.

from gradle-pitest-plugin.

szpak avatar szpak commented on June 12, 2024

I was thinking about a similar solution. An additional useClassPathFile boolean property to make the plugin use an automatically created file filled with a classPath and to clear up the classPath parameter passed to PIT.

from gradle-pitest-plugin.

szpak avatar szpak commented on June 12, 2024

The Gradle plugin itself doesn't provide a direct way to specify a classpath passed to PIT - it is based on the project configuration. It was my oversight to expose classPathFile directly in the plugin configuration. Created #56.

Thanks @FlasH-RUS for spotting the issue.

from gradle-pitest-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.