How to run HP fortify scan using gradle or Running

2019-07-18 13:06发布

问题:

I'm using the following code to run fortify using Gradle, but this code takes time to generate reports, I'm not sure how to optimize this script to run faster, it will be great if someone can help me to optimize this script

// Add a new configuration
    configurations {
        fortify { extendsFrom compile }
    }

    // pull in the fortify libs for the new configuration
    dependencies {
        fortify fileTree(dir: 'C:/Program Files/Fortify Software/HP Fortify v3.20/Core/lib', include: '*.jar')
    }

    task fortifyReport(dependsOn: compileJava) << {
        ant.properties['build.compiler']='com.fortify.dev.ant.SCACompiler'
        ant.typedef(name: 'sca', classname: 'com.fortify.dev.ant.SourceanalyzerTask',
        classpath: configurations.fortify.asPath)

        ant.sca(jdk:"1.6",
        maxHeap:'4096M' ,
        use64bit:true ,
        debug:true ,
        verbose:true ,
        failonerror:true ,
        scan:true ,
        logFile:file("$buildDir/fortify/Fortify.log"),
        resultsFile:file("$buildDir/fortify/abc.fpr")
        ){
           fileset(dir:'com/abc/xyz') {
              include(name:'**/*.java')}
        }
    }