6 Replies Latest reply on Nov 25, 2009 11:19 PM by Xavier Agnetti

    Flex cpd

    nico.gomez Level 1

      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

        • 1. Re: Flex cpd
          ledroff Adobe Employee

          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

          • 2. Re: Flex cpd
            Xavier Agnetti Adobe Employee

            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

            • 3. Re: Flex cpd
              nico.gomez Level 1

              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

              • 4. Re: Flex cpd
                Xavier Agnetti Adobe Employee

                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

                • 5. Re: Flex cpd
                  berliner.mauer Level 1

                  Xavier,

                   

                  First of all: thank you very much for fixed bug with html report in flexpmd plugin (in version RC5)

                  I tried to use cpd plugin and current version (RC5) generated xml report but html file is empty (without data).

                  I'm using this plugin in this way:

                   

                  <reporting>
                          <plugins>
                              <plugin>
                                  <groupId>com.adobe.ac</groupId>
                                  <artifactId>flex-pmd-cpd-maven-plugin</artifactId>
                                  <version>1.0.RC5</version>
                                  <configuration>
                                      <minimumTokenCount>50</minimumTokenCount>
                                  </configuration>
                              </plugin>

                   

                  I appreciated your hard work and looking forward for stable version

                   

                  DM

                  • 6. Re: Flex cpd
                    Xavier Agnetti Adobe Employee

                    Hi.

                     

                    At the moment there is no HTML report with the maven CPD plugin.


                    Feel free to add a feature request and pick it up if you need this feature.

                     

                    Glad you like the software

                     

                    Xavier