Skip to main content
October 15, 2009
Question

Flex cpd

  • October 15, 2009
  • 2 replies
  • 1681 views

Hi all,

what happened to flex-cpd , I've seen in svn  (tag 1.0-RC1) that there was a flex-cpd project,.

I don't know if it was a complete or uncompleted project.

Has someone tried it? Is it planned to support flex-cpd?

Thanks,

Nico

This topic has been closed for replies.

2 replies

Adobe Employee
November 19, 2009

Hi Nico,

Flex-CPD reappeared in trunk (1.0.RC5-SNAPSHOT).

I will be released as part of 1.0.RC5.

There are currently a ANT task and a Maven plugin.

You can then add as part of your build. By default, the minimumTokenSize is 25.

In case you build the trunk yourself, here is what you need to add in your ANT build:

    <taskdef name="cpd" classname="com.adobe.ac.cpd.ant.FlexCpdAntTask"
       classpath="${flexpmd.libs}/flex-pmd-cpd-ant-task-${flexpmd.version}.jar">
      <classpath>
         <pathelement location="${flexpmd.libs}/flex-pmd-files-${flexpmd.version}.jar" />
         <pathelement location="${flexpmd.libs}/flex-pmd-cpd-${flexpmd.version}.jar" />
         <pathelement location="${flexpmd.libs}/as3-plugin-utils-${flexpmd.version}.jar" />
         <pathelement location="${flexpmd.libs}/as3-parser-${flexpmd.version}.jar" />
         <pathelement location="${flexpmd.libs}/as3-parser-api${flexpmd.version}.jar" />
         <pathelement location="${flexpmd.libs}/pmd-4.2.5.jar" />
      </classpath>
     </taskdef>

    <target name="cpd">

       <cpd minimumTokenCount="50" outputFile="${flexpmd.output}/cpd.xml">

          <fileset dir="${src}">

             <include name="**/*.as"/>

             <include name="**/*.mxml"/>

          </fileset>

       </cpd>

    </target>

In your Maven pom.xml:

            <plugin>
                <groupId>com.adobe.ac</groupId>
                <artifactId>flex-pmd-cpd-maven-plugin</artifactId>
                <version>1.0.RC5-SNAPSHOT</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <minimumTokenCount>50</minimumTokenCount>
                </configuration>
            </plugin>

HTH

Xavier

November 23, 2009

Hi Xavier,

many thanks for this, I've compiled from source and integrated into my hudson build (with DRY plugin) and everything seems to work.

I'm embarrased to ask new things again, I'd better have a look at the code and try to contribute myself, trying to add an agregate capability, it will be a good start point for me to start wiritting maven plugins.

Thanks again 
Nico

Adobe Employee
November 23, 2009

Hi Nico,

Glad it worked from the source

For the aggregation feature, please feel free to add a feature request. We will prioritize it.

And if you want to pick it up, you are more than welcome!

Xavier

ledroff
Adobe Employee
Adobe Employee
October 19, 2009

I promised Xavier I'll do it one day.

But meanwhile feel free to submit a patch:

Cf. http://bugs.adobe.com/jira/browse/FLEXPMD-20

Cheers,

François