FlexPMD and 'pmd' plugin

Nicolas Estrada's Avatar

Nicolas Estrada

27 May, 2013 06:00 PM

Hello,

I was wondering if anyone was able to get FlexPMD to work with the gradle pmd plugin? Just wanted to know before I simply use the flex pmd ant task.

Thanks

Nicolas

  1. 1 Posted by Nicolas Estrada on 28 May, 2013 11:15 AM

    Nicolas Estrada's Avatar

    I was unable to get the built it gradle 'pmd' plugin to work with the flexPMD libraries so I simply created my own task. If anyone has any suggestions on how I make it better I would love you hear your thoughts

    configurations { pmd { description = 'Dependencies for running ant FlexPMD' } }
    dependencies {
        flexSDK group: 'com.adobe', name: 'flex-sdk', version: '4.6', ext: 'zip'
        test group: 'org.flexunit', name: 'flexunit', version: '4.1.0-8', ext: 'swc'
        test group: 'org.flexunit', name: 'flexunit-tasks', version: '4.1.0-8'
        test group: 'org.flexunit', name: 'flexunit-cilistener', version: '4.1.0-8', ext: 'swc'
        test group: 'org.flexunit', name: 'flexunit-aircilistener', version: '4.1.0-8', ext: 'swc'
        pmd group: 'com.adobe.ac', name: 'flex-pmd-ant-task', version: '1.2'
    }
    task check(description: 'Run PMD analysis for main Actionscript classes') {
        def srcDir = file('src')
        def reportsDir = file("${project.buildDir}/reports/pmd")
        doFirst {
            reportsDir.mkdirs()
            copy {
                from (zipTree(configurations.pmd.filter {
                    it.name.startsWith("pmd")
                }.singleFile)) { include '**/pmd-nicerhtml.xsl' }
                into reportsDir
                includeEmptyDirs = false
            }
        }
        inputs.dir srcDir
        outputs.dir reportsDir
        doLast {
            ant {
                taskdef(
                        name: 'flexPmd',
                        classname: 'com.adobe.ac.pmd.ant.FlexPmdAntTask',
                        classpath: configurations.pmd.asPath)
                flexPmd(
                        sourceDirectory: srcDir,
                        outputDirectory: reportsDir)
                xslt(
                        in: "$reportsDir/pmd.xml",
                        style: "$reportsDir/etc/pmd-nicerhtml.xsl",
                        out: "$reportsDir/pmd.html")
            }
        }
    }
    
  2. Support Staff 2 Posted by Maxime Cowez on 28 May, 2013 09:54 PM

    Maxime Cowez's Avatar

    Looks great! You could make it better by making it a "pull request" though ;)

    May I ask where you're downloading that library from? I guess it's on your own Nexus or something similar because I just went to Adobe's opensource site and I couldn't even find a simple download. The "download" link points to the subversion repo...

  3. 3 Posted by Nicolas Estrada on 29 May, 2013 01:46 PM

    Nicolas Estrada's Avatar

    I'm not a big open source contributor, I would like to be but I don't know exactly how a 'pull request' is made (link for beginners?)

    As for the FlexPMD dependencies, I'm using an OSS artifactory here and I added this repository to it (checking only the 'Handle Releases' checkbox)

    http://opensource.adobe.com/svn/opensource/flexpmd/maven-repository/release

    I will need to clean things up a bit in order to pmd both the source and the test sourceSets however. When I get a cleaned up version with Flex CPD I'll let you know ;)

    Cheers :)

  4. Support Staff 4 Posted by Maxime Cowez on 29 May, 2013 09:06 PM

    Maxime Cowez's Avatar

    Right, so the download was in the subversion repo after all :-/ Very intuitive, Adobe.

    I wasn't contributing much myself before I started helping out with GradleFx. Yennick was kind enough to help me take the first "pull request" hurdle. If you're interested I'll gladly walk you through it too.
    Bear in mind that integrating with GradleFx will require a little more work. For instance I think the PMD support should be in a separate subplugin for those interested. But we can talk about the implementation details later.

    I don't think this project would be very high on Yennick's priority list though, so it'll be up to you if you want to make it part of GradleFx ;)

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac