Skip to main content
Oct 15, 2009 1:50 PM UTC
Question

Flex cpd

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 is closed to new replies. Start a new post to keep the conversation going.

6 replies

Inspiring
Nov 19, 2009 7:00 AM UTC

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

Translate
Nov 23, 2009 4:45 PM UTC

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

Translate
Inspiring
Nov 23, 2009 5:18 PM UTC

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

Translate
ledroff
Adobe Employee
Adobe Employee
Oct 19, 2009 1:45 PM UTC

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

Translate