flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [35/46] FlexPMD Donation from Adobe Systems Inc
Date Fri, 25 Apr 2014 06:18:34 GMT
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-automator-workflow/src/main/automator/run.FlexPMD.workflow/Contents/document.wflow
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-automator-workflow/src/main/automator/run.FlexPMD.workflow/Contents/document.wflow b/FlexPMD/flex-pmd-automator-workflow/src/main/automator/run.FlexPMD.workflow/Contents/document.wflow
new file mode 100644
index 0000000..462d407
--- /dev/null
+++ b/FlexPMD/flex-pmd-automator-workflow/src/main/automator/run.FlexPMD.workflow/Contents/document.wflow
@@ -0,0 +1,545 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>AMApplicationBuild</key>
+	<string>153</string>
+	<key>AMApplicationVersion</key>
+	<string>2.0</string>
+	<key>AMDocumentVersion</key>
+	<string>2</string>
+	<key>actions</key>
+	<array>
+		<dict>
+			<key>action</key>
+			<dict>
+				<key>AMAccepts</key>
+				<dict>
+					<key>Container</key>
+					<string>List</string>
+					<key>Optional</key>
+					<true/>
+					<key>Types</key>
+					<array>
+						<string>com.apple.applescript.alias-object</string>
+					</array>
+				</dict>
+				<key>AMActionVersion</key>
+				<string>1.1</string>
+				<key>AMParameterProperties</key>
+				<dict>
+					<key>defaultLocation</key>
+					<dict>
+						<key>isPathPopUp</key>
+						<true/>
+						<key>variableUUIDsInMenu</key>
+						<array/>
+					</dict>
+					<key>granularity</key>
+					<dict/>
+					<key>multipleSelection</key>
+					<dict/>
+					<key>promptMessage</key>
+					<dict>
+						<key>tokenizedValue</key>
+						<array>
+							<string>Choose a source folder for executing FlexPMD against</string>
+						</array>
+					</dict>
+				</dict>
+				<key>AMProvides</key>
+				<dict>
+					<key>Container</key>
+					<string>List</string>
+					<key>Types</key>
+					<array>
+						<string>com.apple.applescript.alias-object</string>
+					</array>
+				</dict>
+				<key>ActionBundlePath</key>
+				<string>/System/Library/Automator/Ask for Finder Items.action</string>
+				<key>ActionName</key>
+				<string>Ask for Finder Items</string>
+				<key>ActionParameters</key>
+				<dict>
+					<key>defaultLocation</key>
+					<string>~</string>
+					<key>granularity</key>
+					<integer>1</integer>
+					<key>multipleSelection</key>
+					<false/>
+					<key>promptMessage</key>
+					<string>Choose a source folder for executing FlexPMD against</string>
+				</dict>
+				<key>Application</key>
+				<array>
+					<string>Finder</string>
+				</array>
+				<key>BundleIdentifier</key>
+				<string>com.apple.Automator.AskForFinderItems</string>
+				<key>CFBundleVersion</key>
+				<string>1.1</string>
+				<key>CanShowSelectedItemsWhenRun</key>
+				<true/>
+				<key>CanShowWhenRun</key>
+				<false/>
+				<key>Category</key>
+				<array>
+					<string>AMCategoryFilesAndFolders</string>
+				</array>
+				<key>Class Name</key>
+				<string>AMAppleScriptAction</string>
+				<key>InputUUID</key>
+				<string>048C977D-98A1-423E-8435-0D294C8AEACB</string>
+				<key>Keywords</key>
+				<array>
+					<string>Find</string>
+					<string>Item</string>
+					<string>File</string>
+					<string>Folder</string>
+					<string>Ask</string>
+					<string>Choose</string>
+					<string>Prompt</string>
+				</array>
+				<key>OutputUUID</key>
+				<string>85D7C03F-8983-4BF2-83C6-7DF3F3838515</string>
+				<key>StartAction</key>
+				<false/>
+				<key>UUID</key>
+				<string>B38DA4F4-3B0A-479A-8996-6FEFB5CE76DE</string>
+				<key>UnlocalizedApplications</key>
+				<array>
+					<string>Finder</string>
+				</array>
+				<key>arguments</key>
+				<dict>
+					<key>0</key>
+					<dict>
+						<key>default value</key>
+						<string>~/Desktop</string>
+						<key>name</key>
+						<string>defaultLocation</string>
+						<key>required</key>
+						<string>0</string>
+						<key>type</key>
+						<string>0</string>
+						<key>uuid</key>
+						<string>0</string>
+					</dict>
+					<key>1</key>
+					<dict>
+						<key>default value</key>
+						<false/>
+						<key>name</key>
+						<string>multipleSelection</string>
+						<key>required</key>
+						<string>0</string>
+						<key>type</key>
+						<string>0</string>
+						<key>uuid</key>
+						<string>1</string>
+					</dict>
+					<key>2</key>
+					<dict>
+						<key>default value</key>
+						<string>Choose a Finder Item:</string>
+						<key>name</key>
+						<string>promptMessage</string>
+						<key>required</key>
+						<string>0</string>
+						<key>type</key>
+						<string>0</string>
+						<key>uuid</key>
+						<string>2</string>
+					</dict>
+					<key>3</key>
+					<dict>
+						<key>default value</key>
+						<integer>0</integer>
+						<key>name</key>
+						<string>granularity</string>
+						<key>required</key>
+						<string>0</string>
+						<key>type</key>
+						<string>0</string>
+						<key>uuid</key>
+						<string>3</string>
+					</dict>
+				</dict>
+				<key>isViewVisible</key>
+				<true/>
+				<key>location</key>
+				<string>457.500000:586.000000</string>
+				<key>nibPath</key>
+				<string>/System/Library/Automator/Ask for Finder Items.action/Contents/Resources/English.lproj/main.nib</string>
+			</dict>
+			<key>isViewVisible</key>
+			<true/>
+		</dict>
+		<dict>
+			<key>action</key>
+			<dict>
+				<key>AMAccepts</key>
+				<dict>
+					<key>Container</key>
+					<string>List</string>
+					<key>Optional</key>
+					<true/>
+					<key>Types</key>
+					<array>
+						<string>com.apple.cocoa.string</string>
+					</array>
+				</dict>
+				<key>AMActionVersion</key>
+				<string>2.0.1</string>
+				<key>AMParameterProperties</key>
+				<dict>
+					<key>COMMAND_STRING</key>
+					<dict/>
+					<key>CheckedForUserDefaultShell</key>
+					<dict/>
+					<key>inputMethod</key>
+					<dict/>
+					<key>shell</key>
+					<dict/>
+					<key>source</key>
+					<dict/>
+				</dict>
+				<key>AMProvides</key>
+				<dict>
+					<key>Container</key>
+					<string>List</string>
+					<key>Types</key>
+					<array>
+						<string>com.apple.cocoa.string</string>
+					</array>
+				</dict>
+				<key>ActionBundlePath</key>
+				<string>/System/Library/Automator/Run Shell Script.action</string>
+				<key>ActionName</key>
+				<string>Run Shell Script</string>
+				<key>ActionParameters</key>
+				<dict>
+					<key>COMMAND_STRING</key>
+					<string>#####################
+#  Script Variables #
+#####################
+
+#
+# The FlexPMD version
+#
+flexPmdVersion=1.0.RC3
+
+#
+# The directory where the FlexPMD automator workflow has been extracted
+#
+flexPmdWorkflowLocation="/Users/xagnetti/Work/repositories/opensource.adobe/flexpmd/trunk/flex-pmd-automator-workflow/target/flex-pmd-automator-${flexPmdVersion}-workflow"
+
+#
+# The directory where the FlexPMD command line client is stored
+#
+flexPmdCommandLineDirectory=${flexPmdWorkflowLocation}/command-line
+
+#
+# The directory where the FlexPMD violations viewer application is stored
+#
+viewerDirectory=${flexPmdWorkflowLocation}/violations-viewer
+
+#
+# The temporary directory where files are stored by the script
+#
+tmpDirectory=~/flexpmd
+
+
+#####################
+#    Script Core    #
+#####################
+
+tmpSourceDirectory=${tmpDirectory}/sourceDirectory
+resultDirectory=${tmpDirectory}
+tmpStdout=${tmpDirectory}/stdout
+tmpStderr=${tmpDirectory}/stderr
+
+rm -rf ${tmpDirectory}
+mkdir ${tmpDirectory}
+rm ${tmpSourceDirectory}
+rm ${resultDirectory}/pmd.xml
+rm ${tmpStderr}
+rm ${tmpStdout}
+
+cat &gt; ${tmpSourceDirectory}
+
+sourceDirectory=`cat ${tmpSourceDirectory}`
+
+cd ${flexPmdCommandLineDirectory}
+
+java -jar flex-pmd-command-line-${flexPmdVersion}.jar -s "${sourceDirectory}" -o ${resultDirectory} &gt; ${tmpStdout} 2&gt; ${tmpStderr}
+
+report=${resultDirectory}/pmd.xml
+
+echo file://${viewerDirectory}/flex-pmd-violations-viewer-${flexPmdVersion}.html?report=$report
+</string>
+					<key>CheckedForUserDefaultShell</key>
+					<true/>
+					<key>inputMethod</key>
+					<integer>0</integer>
+					<key>shell</key>
+					<string>/bin/bash</string>
+					<key>source</key>
+					<string></string>
+				</dict>
+				<key>Application</key>
+				<array>
+					<string>Automator</string>
+				</array>
+				<key>BundleIdentifier</key>
+				<string>com.apple.RunShellScript</string>
+				<key>CFBundleVersion</key>
+				<string>2.0.1</string>
+				<key>CanShowSelectedItemsWhenRun</key>
+				<false/>
+				<key>CanShowWhenRun</key>
+				<true/>
+				<key>Category</key>
+				<array>
+					<string>AMCategoryUtilities</string>
+				</array>
+				<key>Class Name</key>
+				<string>RunShellScriptAction</string>
+				<key>InputUUID</key>
+				<string>403A6D3E-FD99-4B71-8D42-C1C2E54807E3</string>
+				<key>Keywords</key>
+				<array>
+					<string>Shell</string>
+					<string>Script</string>
+					<string>Command</string>
+					<string>Run</string>
+					<string>Unix</string>
+				</array>
+				<key>OutputUUID</key>
+				<string>457C1F3B-569E-467A-95C7-DAFC85801AD5</string>
+				<key>ShowWhenRun</key>
+				<false/>
+				<key>UUID</key>
+				<string>7F7B8E52-6DD4-47FA-AF9D-74246B8DFA1A</string>
+				<key>UnlocalizedApplications</key>
+				<array>
+					<string>Automator</string>
+				</array>
+				<key>arguments</key>
+				<dict>
+					<key>0</key>
+					<dict>
+						<key>default value</key>
+						<integer>0</integer>
+						<key>name</key>
+						<string>inputMethod</string>
+						<key>required</key>
+						<string>0</string>
+						<key>type</key>
+						<string>0</string>
+						<key>uuid</key>
+						<string>0</string>
+					</dict>
+					<key>1</key>
+					<dict>
+						<key>default value</key>
+						<string>/bin/sh</string>
+						<key>name</key>
+						<string>shell</string>
+						<key>required</key>
+						<string>0</string>
+						<key>type</key>
+						<string>0</string>
+						<key>uuid</key>
+						<string>1</string>
+					</dict>
+					<key>2</key>
+					<dict>
+						<key>default value</key>
+						<string></string>
+						<key>name</key>
+						<string>source</string>
+						<key>required</key>
+						<string>0</string>
+						<key>type</key>
+						<string>0</string>
+						<key>uuid</key>
+						<string>2</string>
+					</dict>
+					<key>3</key>
+					<dict>
+						<key>default value</key>
+						<string></string>
+						<key>name</key>
+						<string>COMMAND_STRING</string>
+						<key>required</key>
+						<string>0</string>
+						<key>type</key>
+						<string>0</string>
+						<key>uuid</key>
+						<string>3</string>
+					</dict>
+					<key>4</key>
+					<dict>
+						<key>default value</key>
+						<false/>
+						<key>name</key>
+						<string>CheckedForUserDefaultShell</string>
+						<key>required</key>
+						<string>0</string>
+						<key>type</key>
+						<string>0</string>
+						<key>uuid</key>
+						<string>4</string>
+					</dict>
+				</dict>
+				<key>isViewVisible</key>
+				<true/>
+				<key>location</key>
+				<string>457.500000:431.000000</string>
+				<key>nibPath</key>
+				<string>/System/Library/Automator/Run Shell Script.action/Contents/Resources/English.lproj/main.nib</string>
+			</dict>
+			<key>isViewVisible</key>
+			<true/>
+		</dict>
+		<dict>
+			<key>action</key>
+			<dict>
+				<key>AMAccepts</key>
+				<dict>
+					<key>Container</key>
+					<string>List</string>
+					<key>Optional</key>
+					<false/>
+					<key>Types</key>
+					<array>
+						<string>com.apple.cocoa.url</string>
+					</array>
+				</dict>
+				<key>AMActionVersion</key>
+				<string>1.0</string>
+				<key>AMParameterProperties</key>
+				<dict/>
+				<key>AMProvides</key>
+				<dict>
+					<key>Container</key>
+					<string>List</string>
+					<key>Types</key>
+					<array>
+						<string>com.apple.cocoa.url</string>
+					</array>
+				</dict>
+				<key>AMRequiredResources</key>
+				<array/>
+				<key>ActionBundlePath</key>
+				<string>/System/Library/Automator/Display Webpages 2.action</string>
+				<key>ActionName</key>
+				<string>Display Webpages</string>
+				<key>ActionParameters</key>
+				<dict/>
+				<key>Application</key>
+				<array>
+					<string>Safari</string>
+				</array>
+				<key>BundleIdentifier</key>
+				<string>com.apple.Automator.Display_Webpages</string>
+				<key>CFBundleVersion</key>
+				<string>1.0</string>
+				<key>CanShowSelectedItemsWhenRun</key>
+				<false/>
+				<key>CanShowWhenRun</key>
+				<false/>
+				<key>Category</key>
+				<array>
+					<string>AMCategoryInternet</string>
+				</array>
+				<key>Class Name</key>
+				<string>Display_Webpages</string>
+				<key>InputUUID</key>
+				<string>84EA6E4D-9337-4CF6-9976-60DA2E4DB5FC</string>
+				<key>Keywords</key>
+				<array>
+					<string>URL</string>
+					<string>Web</string>
+					<string>Display</string>
+					<string>Open</string>
+					<string>Show</string>
+				</array>
+				<key>OutputUUID</key>
+				<string>8F04C323-3143-449D-8C71-0C5CACC0C875</string>
+				<key>UUID</key>
+				<string>89B93EE5-8B2B-48D4-B0D9-1AC49BB0AA6D</string>
+				<key>UnlocalizedApplications</key>
+				<array>
+					<string>Safari</string>
+				</array>
+				<key>arguments</key>
+				<dict/>
+			</dict>
+		</dict>
+	</array>
+	<key>connectors</key>
+	<dict>
+		<key>073CDD95-EB15-47E3-AE4D-9667F1C01ECF</key>
+		<dict>
+			<key>from</key>
+			<string>B38DA4F4-3B0A-479A-8996-6FEFB5CE76DE - B38DA4F4-3B0A-479A-8996-6FEFB5CE76DE</string>
+			<key>to</key>
+			<string>7F7B8E52-6DD4-47FA-AF9D-74246B8DFA1A - 7F7B8E52-6DD4-47FA-AF9D-74246B8DFA1A</string>
+		</dict>
+		<key>56A224D4-DCA7-469A-974D-DAAAFF5B5871</key>
+		<dict>
+			<key>from</key>
+			<string>7F7B8E52-6DD4-47FA-AF9D-74246B8DFA1A - 7F7B8E52-6DD4-47FA-AF9D-74246B8DFA1A</string>
+			<key>to</key>
+			<string>89B93EE5-8B2B-48D4-B0D9-1AC49BB0AA6D - 89B93EE5-8B2B-48D4-B0D9-1AC49BB0AA6D</string>
+		</dict>
+	</dict>
+	<key>state</key>
+	<dict>
+		<key>EditorSplitViewPosition</key>
+		<real>576</real>
+		<key>MainSplitViewPosition_v2</key>
+		<real>525</real>
+		<key>windowFrame</key>
+		<string>{{0, 51}, {1440, 827}}</string>
+		<key>windowFrameTopLeft</key>
+		<string>{{0, 0}, {1440, 827}}</string>
+		<key>workflowViewScrollPosition</key>
+		<string>{{0, 0}, {915, 576}}</string>
+	</dict>
+	<key>variables</key>
+	<array>
+		<dict>
+			<key>UUID</key>
+			<string>12F77683-5982-4DA7-A149-C34344BC6E5E</string>
+			<key>identifier</key>
+			<string>com.apple.Automator.Variable.Path</string>
+			<key>name</key>
+			<string>New Path</string>
+			<key>value</key>
+			<string>~/Desktop</string>
+		</dict>
+	</array>
+</dict>
+</plist>

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-bundles/pom.xml
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-bundles/pom.xml b/FlexPMD/flex-pmd-bundles/pom.xml
new file mode 100644
index 0000000..4251e89
--- /dev/null
+++ b/FlexPMD/flex-pmd-bundles/pom.xml
@@ -0,0 +1,129 @@
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<artifactId>${project.parent.artifactId}-all-in-one-bundle</artifactId>
+	<name>Adobe Flex PMD All-in-one bundle</name>
+	<packaging>pom</packaging>
+
+	<parent>
+		<artifactId>flex-pmd-hybrid-parent</artifactId>
+		<groupId>com.adobe.ac</groupId>
+		<version>1.3-SNAPSHOT</version>
+		<relativePath>../flex-pmd-hybrid-parent/pom.xml</relativePath>
+	</parent>
+
+	<dependencies>
+	
+
+		<dependency>
+			<groupId>com.martiansoftware</groupId>
+			<artifactId>jsap</artifactId>
+			<version>${jsap.version}</version>
+		</dependency>
+		
+		<!-- FlexPMD -->
+	
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>flex-pmd-ant-task</artifactId>
+			<version>${project.parent.version}</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>flex-pmd-command-line</artifactId>
+			<version>${project.parent.version}</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>flex-pmd-automator</artifactId>
+			<version>${project.parent.version}</version>
+			<type>pom</type>
+			<scope>compile</scope>
+		</dependency>
+
+		<!-- FlexCPD -->
+
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>flex-pmd-cpd-ant-task</artifactId>
+			<version>${project.parent.version}</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>flex-pmd-cpd-command-line</artifactId>
+			<version>${project.parent.version}</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<!-- FlexMetrics -->
+		
+	    <dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>flex-pmd-metrics-ant-task</artifactId>
+			<version>${project.parent.version}</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>flex-pmd-metrics-command-line</artifactId>
+			<version>${project.parent.version}</version>
+			<scope>compile</scope>
+		</dependency>
+
+	</dependencies>
+
+	<build>
+		<plugins>
+
+			<plugin>
+				<artifactId>maven-antrun-plugin</artifactId>
+				<version>${maven-antrun-plugin.version}</version>
+				<executions>
+					<execution>
+						<id>package-ant-task</id>
+						<phase>install</phase>
+						<configuration>
+							<tasks>
+								<mkdir dir="${project.build.directory}/release" />
+								<unzip src="${project.build.directory}/../../flex-pmd-ant-task/target/flex-pmd-ant-task-${project.parent.version}.zip" dest="${project.build.directory}/release" />
+								<unzip src="${project.build.directory}/../../flex-pmd-cpd-ant-task/target/flex-pmd-cpd-ant-task-${project.parent.version}.zip" dest="${project.build.directory}/release" />
+								<unzip src="${project.build.directory}/../../flex-pmd-metrics-ant-task/target/flex-pmd-metrics-ant-task-${project.parent.version}.zip" dest="${project.build.directory}/release" />
+								<unzip src="${project.build.directory}/../../flex-pmd-command-line/target/flex-pmd-command-line-${project.parent.version}.zip" dest="${project.build.directory}/release" />
+								<unzip src="${project.build.directory}/../../flex-pmd-cpd-command-line/target/flex-pmd-cpd-command-line-${project.parent.version}.zip" dest="${project.build.directory}/release" />
+								<unzip src="${project.build.directory}/../../flex-pmd-metrics-command-line/target/flex-pmd-metrics-command-line-${project.parent.version}.zip" dest="${project.build.directory}/release" />
+								<unzip src="${project.build.directory}/../../flex-pmd-automator-workflow/target/flex-pmd-automator-${project.parent.version}-workflow.zip" dest="${project.build.directory}/release" />
+								<delete dir="${project.build.directory}/release/command-line" />
+								<zip destfile="${project.build.directory}/${project.build.finalName}.zip" basedir="${project.build.directory}/release" excludes="*.zip" />
+							</tasks>
+						</configuration>
+						<goals>
+							<goal>run</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+
+		</plugins>
+	</build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-command-line-api/.pmd
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-command-line-api/.pmd b/FlexPMD/flex-pmd-command-line-api/.pmd
new file mode 100644
index 0000000..b5c19d9
--- /dev/null
+++ b/FlexPMD/flex-pmd-command-line-api/.pmd
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pmd>
+    <useProjectRuleSet>false</useProjectRuleSet>
+    <ruleSetFile>../flex-pmd-parent/pmd.xml</ruleSetFile>
+    <includeDerivedFiles>false</includeDerivedFiles>
+    <violationsAsErrors>true</violationsAsErrors>
+</pmd>

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-command-line-api/pom.xml
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-command-line-api/pom.xml b/FlexPMD/flex-pmd-command-line-api/pom.xml
new file mode 100644
index 0000000..cdd9c3e
--- /dev/null
+++ b/FlexPMD/flex-pmd-command-line-api/pom.xml
@@ -0,0 +1,41 @@
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>com.adobe.ac</groupId>
+	<artifactId>flex-pmd-command-line-api</artifactId>
+	<name>Adobe Flex PMD Command line API</name>
+
+
+  <parent>
+	<groupId>com.adobe.ac</groupId>
+	<artifactId>flex-pmd-java-parent</artifactId>
+	<version>1.3-SNAPSHOT</version>
+	<relativePath>../flex-pmd-java-parent/pom.xml</relativePath>
+  </parent>
+  
+	<dependencies>
+		<dependency>
+			<groupId>com.martiansoftware</groupId>
+			<artifactId>jsap</artifactId>
+			<version>${jsap.version}</version>
+		</dependency>
+	</dependencies>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-command-line-api/src/main/java/com/adobe/ac/pmd/CommandLineOptions.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-command-line-api/src/main/java/com/adobe/ac/pmd/CommandLineOptions.java b/FlexPMD/flex-pmd-command-line-api/src/main/java/com/adobe/ac/pmd/CommandLineOptions.java
new file mode 100644
index 0000000..e8aa66e
--- /dev/null
+++ b/FlexPMD/flex-pmd-command-line-api/src/main/java/com/adobe/ac/pmd/CommandLineOptions.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.pmd;
+
+public enum CommandLineOptions implements ICommandLineOptions
+{
+   EXLUDE_PACKAGE("excludePackage"),
+   MXML_FACTOR("mxmlFactor"),
+   OUTPUT("outputDirectory"),
+   RULE_SET("ruleSet"),
+   SOURCE_DIRECTORY("sourceDirectory");
+
+   private String name;
+
+   private CommandLineOptions( final String nameToBeSet )
+   {
+      name = nameToBeSet;
+   }
+
+   @Override
+   public String toString()
+   {
+      return name;
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-command-line-api/src/main/java/com/adobe/ac/pmd/CommandLineUtils.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-command-line-api/src/main/java/com/adobe/ac/pmd/CommandLineUtils.java b/FlexPMD/flex-pmd-command-line-api/src/main/java/com/adobe/ac/pmd/CommandLineUtils.java
new file mode 100644
index 0000000..ba212a4
--- /dev/null
+++ b/FlexPMD/flex-pmd-command-line-api/src/main/java/com/adobe/ac/pmd/CommandLineUtils.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.pmd;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.martiansoftware.jsap.FlaggedOption;
+import com.martiansoftware.jsap.JSAP;
+import com.martiansoftware.jsap.JSAPException;
+
+public final class CommandLineUtils
+{
+   public static List< File > computeSourceList( final String source )
+   {
+      if ( !source.contains( "," ) )
+      {
+         return null;
+      }
+      final List< File > sourceList = new ArrayList< File >();
+      for ( int i = 0; i < source.split( "," ).length; i++ )
+      {
+         sourceList.add( new File( source.split( "," )[ i ] ) ); // NOPMD
+      }
+      return sourceList;
+   }
+
+   public static void registerParameter( final JSAP jsap,
+                                         final ICommandLineOptions option,
+                                         final boolean required ) throws JSAPException
+   {
+      final String optionName = option.toString();
+
+      jsap.registerParameter( new FlaggedOption( optionName ).setStringParser( JSAP.STRING_PARSER )
+                                                             .setRequired( required )
+                                                             .setShortFlag( optionName.charAt( 0 ) )
+                                                             .setLongFlag( optionName ) );
+   }
+
+   private CommandLineUtils()
+   {
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-command-line-api/src/main/java/com/adobe/ac/pmd/ICommandLineOptions.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-command-line-api/src/main/java/com/adobe/ac/pmd/ICommandLineOptions.java b/FlexPMD/flex-pmd-command-line-api/src/main/java/com/adobe/ac/pmd/ICommandLineOptions.java
new file mode 100644
index 0000000..8d0e250
--- /dev/null
+++ b/FlexPMD/flex-pmd-command-line-api/src/main/java/com/adobe/ac/pmd/ICommandLineOptions.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.pmd;
+
+public interface ICommandLineOptions
+{
+
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-command-line-api/src/test/java/com/adobe/ac/pmd/CommandLineOptionsTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-command-line-api/src/test/java/com/adobe/ac/pmd/CommandLineOptionsTest.java b/FlexPMD/flex-pmd-command-line-api/src/test/java/com/adobe/ac/pmd/CommandLineOptionsTest.java
new file mode 100644
index 0000000..9ced093
--- /dev/null
+++ b/FlexPMD/flex-pmd-command-line-api/src/test/java/com/adobe/ac/pmd/CommandLineOptionsTest.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.pmd;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class CommandLineOptionsTest
+{
+   @Test
+   public void testToString()
+   {
+      assertEquals( "outputDirectory",
+                    CommandLineOptions.OUTPUT.toString() );
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-command-line-api/src/test/java/com/adobe/ac/pmd/CommandLineUtilsTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-command-line-api/src/test/java/com/adobe/ac/pmd/CommandLineUtilsTest.java b/FlexPMD/flex-pmd-command-line-api/src/test/java/com/adobe/ac/pmd/CommandLineUtilsTest.java
new file mode 100644
index 0000000..305315c
--- /dev/null
+++ b/FlexPMD/flex-pmd-command-line-api/src/test/java/com/adobe/ac/pmd/CommandLineUtilsTest.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.pmd;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import com.martiansoftware.jsap.JSAP;
+import com.martiansoftware.jsap.JSAPException;
+
+public class CommandLineUtilsTest
+{
+   @Test
+   public void testComputeSourceList()
+   {
+      assertEquals( 3,
+                    CommandLineUtils.computeSourceList( "lala,toto,tyty" ).size() );
+      assertNull( CommandLineUtils.computeSourceList( "lala" ) );
+   }
+
+   @Test
+   public void testRegisterParameter() throws JSAPException
+   {
+      final JSAP jsap = new JSAP();
+
+      CommandLineUtils.registerParameter( jsap,
+                                          new ICommandLineOptions()
+                                          {
+                                             @Override
+                                             public String toString()
+                                             {
+                                                return "name";
+                                             }
+                                          },
+                                          true );
+
+      assertTrue( jsap.getByShortFlag( 'n' ) != null );
+      assertNull( jsap.getByShortFlag( 'm' ) );
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-command-line/.pmd
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-command-line/.pmd b/FlexPMD/flex-pmd-command-line/.pmd
new file mode 100644
index 0000000..b5c19d9
--- /dev/null
+++ b/FlexPMD/flex-pmd-command-line/.pmd
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pmd>
+    <useProjectRuleSet>false</useProjectRuleSet>
+    <ruleSetFile>../flex-pmd-parent/pmd.xml</ruleSetFile>
+    <includeDerivedFiles>false</includeDerivedFiles>
+    <violationsAsErrors>true</violationsAsErrors>
+</pmd>

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-command-line/pom.xml
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-command-line/pom.xml b/FlexPMD/flex-pmd-command-line/pom.xml
new file mode 100644
index 0000000..f930a8a
--- /dev/null
+++ b/FlexPMD/flex-pmd-command-line/pom.xml
@@ -0,0 +1,198 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>com.adobe.ac</groupId>
+	<artifactId>flex-pmd-command-line</artifactId>
+	<name>Adobe Flex PMD Command line</name>
+
+	<parent>
+		<groupId>com.adobe.ac</groupId>
+		<artifactId>flex-pmd-java-parent</artifactId>
+		<version>1.3-SNAPSHOT</version>
+		<relativePath>../flex-pmd-java-parent/pom.xml</relativePath>
+	</parent>
+
+	<description />
+	<packaging>jar</packaging>
+
+	<properties>
+		<maven.jar.plugin.version>2.2</maven.jar.plugin.version>
+	</properties>
+
+	<dependencies>
+		<dependency>
+			<groupId>com.martiansoftware</groupId>
+			<artifactId>jsap</artifactId>
+			<version>${jsap.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<version>${project.version}</version>
+			<artifactId>flex-pmd-core</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<version>${project.version}</version>
+			<artifactId>${project.artifactId}-api</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<version>${project.version}</version>
+			<artifactId>flex-pmd-ruleset</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>flex-pmd-test-resources</artifactId>
+			<version>${project.parent.version}</version>
+			<classifier>resources</classifier>
+			<type>zip</type>
+			<scope>provided</scope>
+		</dependency>
+
+		<!-- Dependencies for packaging from ANT -->
+
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<version>${project.version}</version>
+			<artifactId>flex-pmd-files</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<version>${project.version}</version>
+			<artifactId>flex-pmd-ruleset-api</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<artifactId>as3-plugin-utils</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<artifactId>as3-parser</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<artifactId>as3-parser-api</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>pmd</groupId>
+			<artifactId>pmd</artifactId>
+			<version>${pmd.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>plexus</groupId>
+			<artifactId>plexus-utils</artifactId>
+			<version>${plexus-utils.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-lang</groupId>
+			<artifactId>commons-lang</artifactId>
+			<version>${commons-lang.version}</version>
+		</dependency>
+	</dependencies>
+
+	<build>
+
+		<testResources>
+			<testResource>
+				<directory>${project.build.directory}/test/generated-resources</directory>
+			</testResource>
+		</testResources>
+
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-dependency-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>unpack-test-resources</id>
+						<phase>generate-resources</phase>
+						<goals>
+							<goal>unpack-dependencies</goal>
+						</goals>
+						<configuration>
+							<includeGroupIds>${project.groupId}</includeGroupIds>
+							<includes>**/*.as,**/*.mxml</includes>
+							<outputDirectory>${project.build.directory}/test/generated-resources</outputDirectory>
+							<excludeTransitive>true</excludeTransitive>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-jar-plugin</artifactId>
+				<version>${maven.jar.plugin.version}</version>
+				<configuration>
+					<archive>
+						<manifest>
+							<mainClass>com.adobe.ac.pmd.commandline.FlexPMD</mainClass>
+							<packageName>com.adobe.ac.pmd.commandline</packageName>
+							<addClasspath>true</addClasspath>
+						</manifest>
+					</archive>
+				</configuration>
+			</plugin>
+			<plugin>
+				<artifactId>maven-antrun-plugin</artifactId>
+				<version>${maven-antrun-plugin.version}</version>
+				<executions>
+					<execution>
+						<id>package-ant-task</id>
+						<phase>install</phase>
+						<configuration>
+							<tasks>
+								<echo message="Building ant-task" />
+								<mkdir dir="${project.build.directory}/release" />
+								<echo message="" />
+								<echo message="Copying Flex PMD dependencies..." />
+								<copy file="${project.build.directory}/${project.build.finalName}.jar" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.adobe.ac.flex-pmd-command-line-api.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.adobe.ac.flex-pmd-core.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.adobe.ac.flex-pmd-ruleset.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.adobe.ac.flex-pmd-files.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.adobe.ac.flex-pmd-ruleset-api.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.adobe.ac.as3-parser-api.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.adobe.ac.as3-parser.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<echo message="Copying Command line dependencies..." />
+								<copy file="${maven.dependency.com.adobe.ac.as3-plugin-utils.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.pmd.pmd.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.plexus.plexus-utils.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.commons-lang.commons-lang.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<copy file="${maven.dependency.com.martiansoftware.jsap.jar.path}" todir="${project.build.directory}/release" overwrite="true" />
+								<echo message="Extracting license..." />
+								<copy file="../flex-pmd-parent/src/etc/header.txt" tofile="${project.build.directory}/release/LICENSE.txt" overwrite="true" />
+								<echo message="Compressing zip..." />
+								<zip destfile="${project.build.directory}/${project.build.finalName}.zip" basedir="${project.build.directory}/release" excludes="*.zip" />
+							</tasks>
+						</configuration>
+						<goals>
+							<goal>run</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-command-line/src/main/assemble/bin.xml
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-command-line/src/main/assemble/bin.xml b/FlexPMD/flex-pmd-command-line/src/main/assemble/bin.xml
new file mode 100644
index 0000000..3f5dd15
--- /dev/null
+++ b/FlexPMD/flex-pmd-command-line/src/main/assemble/bin.xml
@@ -0,0 +1,41 @@
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<assembly>
+  <id>command-line</id>
+  <formats>
+    <format>jar</format>
+  </formats>  
+  <fileSets>
+   <fileSet>
+      
+   </fileSet>
+  </fileSets>
+  <dependencySets>
+    <dependencySet>
+      <includes>
+         <include>com.adobe.ac:flex-pmd-core</include>
+         <include>com.adobe.ac:as3-parser</include>
+         <include>com.adobe.ac:as3-plugin-utils</include>
+         <include>com.adobe.ac:flex-pmd-ruleset</include>
+         <include>com.adobe.ac:flex-pmd-ruleset-api</include>
+         <include>com.martiansoftware:jsap</include>
+      </includes>
+    </dependencySet>
+  </dependencySets>    
+</assembly>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-command-line/src/main/java/com/adobe/ac/pmd/commandline/FlexPMD.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-command-line/src/main/java/com/adobe/ac/pmd/commandline/FlexPMD.java b/FlexPMD/flex-pmd-command-line/src/main/java/com/adobe/ac/pmd/commandline/FlexPMD.java
new file mode 100644
index 0000000..4b293fa
--- /dev/null
+++ b/FlexPMD/flex-pmd-command-line/src/main/java/com/adobe/ac/pmd/commandline/FlexPMD.java
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.pmd.commandline;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import net.sourceforge.pmd.PMDException;
+
+import com.adobe.ac.pmd.CommandLineOptions;
+import com.adobe.ac.pmd.CommandLineUtils;
+import com.adobe.ac.pmd.FlexPmdParameters;
+import com.adobe.ac.pmd.FlexPmdViolations;
+import com.adobe.ac.pmd.LoggerUtils;
+import com.adobe.ac.pmd.engines.FlexPmdXmlEngine;
+import com.martiansoftware.jsap.JSAP;
+import com.martiansoftware.jsap.JSAPException;
+import com.martiansoftware.jsap.JSAPResult;
+
+public final class FlexPMD // NO_UCD
+{
+   private static JSAPResult   config;
+   private static final Logger LOGGER = Logger.getLogger( FlexPMD.class.getName() );
+
+   /**
+    * @param args
+    * @throws JSAPException
+    * @throws PMDException
+    * @throws URISyntaxException
+    * @throws IOException
+    * @throws Exception
+    */
+   public static void main( final String[] args ) throws JSAPException,
+                                                 PMDException,
+                                                 URISyntaxException,
+                                                 IOException
+   {
+      new LoggerUtils().loadConfiguration();
+      startFlexPMD( args );
+      LOGGER.info( "FlexPMD terminated" );
+      System.exit( 0 ); // NOPMD
+   }
+
+   static boolean areCommandLineOptionsCorrect( final String[] args ) throws JSAPException
+   {
+      final JSAP jsap = new JSAP();
+      config = parseCommandLineArguments( args,
+                                          jsap );
+
+      if ( !config.success() )
+      {
+         LOGGER.log( Level.SEVERE,
+                     "Usage: java "
+                           + FlexPMD.class.getName() + " " + jsap.getUsage() );
+      }
+
+      return config.success();
+   }
+
+   static String getParameterValue( final CommandLineOptions option )
+   {
+      return config.getString( option.toString() );
+   }
+
+   static boolean startFlexPMD( final String[] args ) throws JSAPException,
+                                                     PMDException,
+                                                     URISyntaxException,
+                                                     IOException
+   {
+      if ( areCommandLineOptionsCorrect( args ) )
+      {
+         final String rulesetRef = getParameterValue( CommandLineOptions.RULE_SET );
+         final String excludePackage = getParameterValue( CommandLineOptions.EXLUDE_PACKAGE );
+         final String source = getParameterValue( CommandLineOptions.SOURCE_DIRECTORY );
+         final File sourceDirectory = source.contains( "," ) ? null
+                                                            : new File( source );
+         final List< File > sourceList = CommandLineUtils.computeSourceList( source );
+         final File outputDirectory = new File( getParameterValue( CommandLineOptions.OUTPUT ) );
+         final FlexPmdParameters parameters = new FlexPmdParameters( excludePackage == null ? ""
+                                                                                           : excludePackage,
+                                                                     outputDirectory,
+                                                                     rulesetRef == null ? null
+                                                                                       : new File( rulesetRef ),
+                                                                     sourceDirectory,
+                                                                     sourceList );
+         final FlexPmdXmlEngine engine = new FlexPmdXmlEngine( parameters );
+
+         engine.executeReport( new FlexPmdViolations() );
+      }
+
+      return config.success();
+   }
+
+   private static JSAPResult parseCommandLineArguments( final String[] args,
+                                                        final JSAP jsap ) throws JSAPException
+   {
+      CommandLineUtils.registerParameter( jsap,
+                                          CommandLineOptions.SOURCE_DIRECTORY,
+                                          true );
+      CommandLineUtils.registerParameter( jsap,
+                                          CommandLineOptions.OUTPUT,
+                                          true );
+      CommandLineUtils.registerParameter( jsap,
+                                          CommandLineOptions.RULE_SET,
+                                          false );
+      CommandLineUtils.registerParameter( jsap,
+                                          CommandLineOptions.EXLUDE_PACKAGE,
+                                          false );
+
+      return jsap.parse( args );
+   }
+
+   private FlexPMD()
+   {
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-command-line/src/test/java/com/adobe/ac/pmd/commandline/FlexPMDTest.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-command-line/src/test/java/com/adobe/ac/pmd/commandline/FlexPMDTest.java b/FlexPMD/flex-pmd-command-line/src/test/java/com/adobe/ac/pmd/commandline/FlexPMDTest.java
new file mode 100644
index 0000000..764b118
--- /dev/null
+++ b/FlexPMD/flex-pmd-command-line/src/test/java/com/adobe/ac/pmd/commandline/FlexPMDTest.java
@@ -0,0 +1,187 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.pmd.commandline;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import junit.framework.Assert;
+import net.sourceforge.pmd.PMDException;
+
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.io.SAXReader;
+import org.junit.Test;
+
+import com.adobe.ac.pmd.CommandLineOptions;
+import com.adobe.ac.pmd.FlexPmdTestBase;
+import com.martiansoftware.jsap.JSAPException;
+
+public class FlexPMDTest extends FlexPmdTestBase
+{
+   @Test
+   public void testAreCommandLineOptionsCorrect() throws FileNotFoundException,
+                                                 JSAPException,
+                                                 PMDException,
+                                                 URISyntaxException
+   {
+      assertFalse( FlexPMD.areCommandLineOptionsCorrect( new String[]
+      {} ) );
+
+      assertFalse( FlexPMD.areCommandLineOptionsCorrect( new String[]
+      { "-y",
+                  "sourceDirectory",
+                  "-p",
+                  "outPutDirectory" } ) );
+
+      assertTrue( FlexPMD.areCommandLineOptionsCorrect( new String[]
+      { "-s",
+                  "sourceDirectory",
+                  "-o",
+                  "target",
+                  "-r",
+                  "valid.xml" } ) );
+
+      assertTrue( FlexPMD.areCommandLineOptionsCorrect( new String[]
+      { "-s",
+                  "sourceDirectory",
+                  "-o",
+                  "target" } ) );
+   }
+
+   @Test
+   public void testFlexPMD114() throws JSAPException,
+                               PMDException,
+                               URISyntaxException,
+                               IOException,
+                               DocumentException
+   {
+      final String[] args = new String[]
+      { "-s",
+                  getTestDirectory().getAbsolutePath()
+                        + File.separatorChar + "flexpmd114",
+                  "-o",
+                  new File( "target/test2" ).getAbsolutePath() };
+
+      FlexPMD.startFlexPMD( args );
+
+      assertEquals( 3,
+                    loadDocument( new File( "target/test2/pmd.xml" ) ).selectNodes( "//pmd/file" ).size() );
+   }
+
+   @Test
+   public void testFlexPMD88() throws JSAPException,
+                              PMDException,
+                              URISyntaxException,
+                              IOException,
+                              DocumentException
+   {
+      final String[] args = new String[]
+      { "-s",
+                  getTestDirectory().getAbsolutePath()
+                        + File.separatorChar + "bug" + File.separatorChar + "FlexPMD88.as",
+                  "-o",
+                  new File( "target/test3" ).getAbsolutePath() };
+
+      FlexPMD.startFlexPMD( args );
+
+      Assert.assertTrue( loadDocument( new File( "target/test3/pmd.xml" ) ).selectNodes( "//pmd/file[1]/violation" )
+                                                                           .size() > 0 );
+   }
+
+   @Test
+   public void testGetCommandLineValue() throws JSAPException
+   {
+      FlexPMD.areCommandLineOptionsCorrect( new String[]
+      { "-s",
+                  "sourceDirectory",
+                  "-o",
+                  "target",
+                  "-r",
+                  "valid.xml" } );
+
+      assertEquals( "sourceDirectory",
+                    FlexPMD.getParameterValue( CommandLineOptions.SOURCE_DIRECTORY ) );
+      assertEquals( "target",
+                    FlexPMD.getParameterValue( CommandLineOptions.OUTPUT ) );
+      assertEquals( "valid.xml",
+                    FlexPMD.getParameterValue( CommandLineOptions.RULE_SET ) );
+   }
+
+   @Test
+   public void testStartFlexPMD() throws JSAPException,
+                                 PMDException,
+                                 URISyntaxException,
+                                 IOException
+   {
+      final String[] args = new String[]
+      { "-s",
+                  getTestDirectory().getAbsolutePath(),
+                  "-o",
+                  new File( "target/test" ).getAbsolutePath(),
+                  "--excludePackage",
+                  "cairngorm." };
+
+      FlexPMD.startFlexPMD( args );
+   }
+
+   @Test
+   public void testStartFlexPMDOnAFile() throws JSAPException,
+                                        PMDException,
+                                        URISyntaxException,
+                                        IOException
+   {
+      final String filePath = getTestFiles().get( "AbstractRowData.as" ).getFilePath();
+
+      final String[] args = new String[]
+      { "-s",
+                  filePath,
+                  "-o",
+                  new File( "target/test" ).getAbsolutePath(),
+                  "--excludePackage",
+                  "cairngorm." };
+
+      FlexPMD.startFlexPMD( args );
+   }
+
+   @Test
+   public void testStartFlexPMDOnSeveralFolders() throws JSAPException,
+                                                 PMDException,
+                                                 URISyntaxException,
+                                                 IOException
+   {
+      final String[] args = new String[]
+      { "-s",
+                  new File( "target/test/bug" ).getAbsolutePath()
+                        + "," + new File( "target/test/cairngorm" ).getAbsolutePath(),
+                  "-o",
+                  new File( "target/test" ).getAbsolutePath(), };
+
+      FlexPMD.startFlexPMD( args );
+   }
+
+   private Document loadDocument( final File outputFile ) throws DocumentException
+   {
+      return new SAXReader().read( outputFile );
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-core/.p4ignore
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-core/.p4ignore b/FlexPMD/flex-pmd-core/.p4ignore
new file mode 100644
index 0000000..eb5a316
--- /dev/null
+++ b/FlexPMD/flex-pmd-core/.p4ignore
@@ -0,0 +1 @@
+target

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-core/.pmd
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-core/.pmd b/FlexPMD/flex-pmd-core/.pmd
new file mode 100644
index 0000000..b5c19d9
--- /dev/null
+++ b/FlexPMD/flex-pmd-core/.pmd
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+-->
+<pmd>
+    <useProjectRuleSet>false</useProjectRuleSet>
+    <ruleSetFile>../flex-pmd-parent/pmd.xml</ruleSetFile>
+    <includeDerivedFiles>false</includeDerivedFiles>
+    <violationsAsErrors>true</violationsAsErrors>
+</pmd>

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-core/pom.xml
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-core/pom.xml b/FlexPMD/flex-pmd-core/pom.xml
new file mode 100644
index 0000000..1c9b175
--- /dev/null
+++ b/FlexPMD/flex-pmd-core/pom.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>com.adobe.ac</groupId>
+	<artifactId>flex-pmd-core</artifactId>
+	<name>Adobe Flex PMD Core</name>
+	<description />
+	<packaging>jar</packaging>
+
+  <parent>
+	<groupId>com.adobe.ac</groupId>
+	<artifactId>flex-pmd-java-parent</artifactId>
+	<version>1.3-SNAPSHOT</version>
+	<relativePath>../flex-pmd-java-parent/pom.xml</relativePath>
+  </parent>
+  
+	<properties>
+		<doxia-core.version>1.0-alpha-4</doxia-core.version>
+	</properties>
+
+	<dependencies>
+	   <dependency>
+			<groupId>doxia</groupId>
+			<artifactId>doxia-core</artifactId>
+			<version>${doxia-core.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>flex-pmd-ruleset-api</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+		<!-- Test dependencies -->
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>flex-pmd-test-resources</artifactId>
+			<version>${project.version}</version>
+			<classifier>resources</classifier>
+			<type>zip</type>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>flex-pmd-ruleset</artifactId>
+			<version>${project.parent.version}</version>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+
+	<build>
+		<testResources>
+			<testResource>
+				<directory>${project.build.directory}/test/generated-resources</directory>
+			</testResource>
+			<testResource>
+				<directory>${basedir}/src/test/resources</directory>
+			</testResource>
+		</testResources>
+		<resources>
+			<resource>
+				<directory>${project.build.directory}/test/generated-resources</directory>
+			</resource>
+		</resources>
+
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-dependency-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>unpack-test-resources</id>
+						<phase>generate-resources</phase>
+						<goals>
+							<goal>unpack-dependencies</goal>
+						</goals>
+						<configuration>
+							<includeGroupIds>${project.groupId}</includeGroupIds>
+							<includes>**/*.as,**/*.mxml,**/*.xml</includes>
+							<outputDirectory>${project.build.directory}/test/generated-resources</outputDirectory>
+							<excludeTransitive>true</excludeTransitive>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-core/src/main/java/com/adobe/ac/pmd/FlexPmdParameters.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-core/src/main/java/com/adobe/ac/pmd/FlexPmdParameters.java b/FlexPMD/flex-pmd-core/src/main/java/com/adobe/ac/pmd/FlexPmdParameters.java
new file mode 100644
index 0000000..5bab526
--- /dev/null
+++ b/FlexPMD/flex-pmd-core/src/main/java/com/adobe/ac/pmd/FlexPmdParameters.java
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.pmd;
+
+import java.io.File;
+import java.util.List;
+
+public class FlexPmdParameters
+{
+   private final String       excludePackage;
+   private final boolean      failOnError;
+   private final boolean      failOnRuleViolation;
+   private final File         outputDirectory;
+   private final File         ruleSet;
+   private final File         source;
+   private final List< File > sourceList;
+
+   public FlexPmdParameters( final String excludePackageToBeSet,
+                             final boolean failOnErrorToBeSet,
+                             final boolean failOnRuleViolationToBeSet,
+                             final File outputDirectoryToBeSet,
+                             final File ruleSetToBeSet,
+                             final File sourceToBeSet )
+   {
+      this( excludePackageToBeSet,
+            failOnErrorToBeSet,
+            failOnRuleViolationToBeSet,
+            outputDirectoryToBeSet,
+            ruleSetToBeSet,
+            sourceToBeSet,
+            null );
+   }
+
+   public FlexPmdParameters( final String excludePackageToBeSet,
+                             final boolean failOnErrorToBeSet,
+                             final boolean failOnRuleViolationToBeSet,
+                             final File outputDirectoryToBeSet,
+                             final File ruleSetToBeSet,
+                             final File sourceToBeSet,
+                             final List< File > sourceListToBeSet )
+   {
+      super();
+      excludePackage = excludePackageToBeSet;
+      failOnError = failOnErrorToBeSet;
+      failOnRuleViolation = failOnRuleViolationToBeSet;
+      outputDirectory = outputDirectoryToBeSet;
+      ruleSet = ruleSetToBeSet;
+      source = sourceToBeSet;
+      sourceList = sourceListToBeSet;
+   }
+
+   public FlexPmdParameters( final String excludePackageToBeSet,
+                             final File outputDirectoryToBeSet,
+                             final File ruleSetToBeSet,
+                             final File sourceToBeSet )
+   {
+      this( excludePackageToBeSet, false, false, outputDirectoryToBeSet, ruleSetToBeSet, sourceToBeSet, null );
+   }
+
+   public FlexPmdParameters( final String excludePackageToBeSet,
+                             final File outputDirectoryToBeSet,
+                             final File ruleSetToBeSet,
+                             final File sourceToBeSet,
+                             final List< File > sourceListToBeSet )
+   {
+      this( excludePackageToBeSet,
+            false,
+            false,
+            outputDirectoryToBeSet,
+            ruleSetToBeSet,
+            sourceToBeSet,
+            sourceListToBeSet );
+   }
+
+   public final String getExcludePackage()
+   {
+      return excludePackage;
+   }
+
+   public final File getOutputDirectory()
+   {
+      return outputDirectory;
+   }
+
+   public final File getRuleSet()
+   {
+      return ruleSet;
+   }
+
+   public final File getSource()
+   {
+      return source;
+   }
+
+   public List< File > getSourceList()
+   {
+      return sourceList;
+   }
+
+   public final boolean isFailOnError()
+   {
+      return failOnError;
+   }
+
+   public boolean isFailOnRuleViolation()
+   {
+      return failOnRuleViolation;
+   }
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-core/src/main/java/com/adobe/ac/pmd/FlexPmdViolations.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-core/src/main/java/com/adobe/ac/pmd/FlexPmdViolations.java b/FlexPMD/flex-pmd-core/src/main/java/com/adobe/ac/pmd/FlexPmdViolations.java
new file mode 100644
index 0000000..607610d
--- /dev/null
+++ b/FlexPMD/flex-pmd-core/src/main/java/com/adobe/ac/pmd/FlexPmdViolations.java
@@ -0,0 +1,244 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.pmd;
+
+import java.io.File;
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import net.sourceforge.pmd.PMDException;
+import net.sourceforge.pmd.Rule;
+import net.sourceforge.pmd.RuleReference;
+import net.sourceforge.pmd.RuleSet;
+
+import com.adobe.ac.pmd.files.FileSetUtils;
+import com.adobe.ac.pmd.files.IFlexFile;
+import com.adobe.ac.pmd.files.impl.FileUtils;
+import com.adobe.ac.pmd.nodes.IPackage;
+import com.adobe.ac.pmd.rules.core.IFlexAstRule;
+import com.adobe.ac.pmd.rules.core.IFlexRule;
+import com.adobe.ac.utils.StackTraceUtils;
+
+public class FlexPmdViolations implements Serializable
+{
+   private static final Logger                            LOGGER;
+
+   /**
+    * 
+    */
+   private static final long                              serialVersionUID = -3683680443330143504L;
+
+   static
+   {
+      LOGGER = Logger.getLogger( FlexPmdViolations.class.getName() );
+   }
+
+   private Map< String, IPackage >                        asts;
+   private Map< String, IFlexFile >                       files;
+   private boolean                                        hasBeenComputed;
+   private final Map< String, IFlexRule >                 rules;
+   private final Map< IFlexRule, Long >                   ruleSpeeds;
+   private final Map< IFlexFile, List< IFlexViolation > > violations;
+
+   public FlexPmdViolations()
+   {
+      violations = new LinkedHashMap< IFlexFile, List< IFlexViolation > >();
+      rules = new LinkedHashMap< String, IFlexRule >();
+      ruleSpeeds = new LinkedHashMap< IFlexRule, Long >();
+      hasBeenComputed = false;
+   }
+
+   public final void computeViolations( final File source,
+                                        final List< File > sourceList,
+                                        final RuleSet ruleSet,
+                                        final String packageToExclude ) throws PMDException
+   {
+      hasBeenComputed = true;
+
+      if ( ruleSet != null )
+      {
+         computeRules( ruleSet );
+         computeFiles( source,
+                       sourceList,
+                       packageToExclude,
+                       ruleSet.getExcludePatterns() );
+         computeAsts();
+         processRules();
+         sortViolations();
+      }
+   }
+
+   public final Map< IFlexFile, List< IFlexViolation >> getViolations()
+   {
+      return violations;
+   }
+
+   public final boolean hasViolationsBeenComputed()
+   {
+      return hasBeenComputed;
+   }
+
+   private void computeAsts() throws PMDException
+   {
+      LOGGER.info( "computing Asts" );
+
+      final long startTime = System.currentTimeMillis();
+      asts = FileSetUtils.computeAsts( files );
+
+      LOGGER.info( "computed Asts in "
+            + ( System.currentTimeMillis() - startTime ) + " ms" );
+   }
+
+   private void computeFiles( final File source,
+                              final List< File > sourceList,
+                              final String packageToExclude,
+                              final List< String > excludePatterns ) throws PMDException
+   {
+      LOGGER.info( "computing FilesList" );
+
+      final long startTime = System.currentTimeMillis();
+
+      files = FileUtils.computeFilesList( source,
+                                          sourceList,
+                                          packageToExclude,
+                                          excludePatterns );
+      LOGGER.info( "computed FilesList in "
+            + ( System.currentTimeMillis() - startTime ) + " ms" );
+   }
+
+   private void computeRules( final RuleSet ruleSet )
+   {
+      LOGGER.info( "computing RulesList" );
+
+      final long startTime = System.currentTimeMillis();
+      Set< String > excludes = new HashSet< String >( ruleSet.getExcludePatterns() );
+
+      for ( Rule rule : ruleSet.getRules() )
+      {
+         while ( rule instanceof RuleReference )
+         {
+            excludes = ( ( RuleReference ) rule ).getRuleSetReference().getExcludes();
+            rule = ( ( RuleReference ) rule ).getRule();
+         }
+         final IFlexRule flexRule = ( IFlexRule ) rule;
+
+         if ( excludes != null
+               && !excludes.isEmpty() )
+         {
+            flexRule.setExcludes( excludes );
+         }
+         rules.put( flexRule.getRuleName(),
+                    flexRule );
+      }
+
+      LOGGER.info( "computed RulesList in "
+            + ( System.currentTimeMillis() - startTime ) + " ms" );
+   }
+
+   private void processFile( final IFlexRule currentRule,
+                             final IFlexFile currentFile )
+   {
+      try
+      {
+         final String fullyQualifiedName = currentFile.getFullyQualifiedName();
+         final IPackage ast = currentRule instanceof IFlexAstRule ? asts.get( fullyQualifiedName )
+                                                                 : null;
+         final List< IFlexViolation > foundViolations = currentRule.processFile( currentFile,
+                                                                                 ast,
+                                                                                 files );
+
+         if ( !foundViolations.isEmpty() )
+         {
+            if ( violations.containsKey( currentFile ) )
+            {
+               violations.get( currentFile ).addAll( foundViolations );
+            }
+            else
+            {
+               violations.put( currentFile,
+                               foundViolations );
+            }
+         }
+      }
+      catch ( final Exception e )
+      {
+         LOGGER.warning( StackTraceUtils.print( currentFile.getFullyQualifiedName(),
+                                                e ) );
+      }
+   }
+
+   private void processRule( final IFlexRule currentRule )
+   {
+      LOGGER.fine( "Processing "
+            + currentRule.getRuleName() + "..." );
+
+      for ( final Entry< String, IFlexFile > currentFileEntry : files.entrySet() )
+      {
+         processFile( currentRule,
+                      currentFileEntry.getValue() );
+      }
+   }
+
+   private void processRule( final String currentRuleName,
+                             final IFlexRule currentRule )
+   {
+      final long startTime = System.currentTimeMillis();
+
+      processRule( currentRule );
+      final long ellapsedTime = System.currentTimeMillis()
+            - startTime;
+
+      if ( LOGGER.isLoggable( Level.FINE ) )
+      {
+         LOGGER.fine( "rule "
+               + currentRuleName + " computed in " + ellapsedTime + "ms" );
+      }
+      if ( LOGGER.isLoggable( Level.FINER ) )
+      {
+         ruleSpeeds.put( currentRule,
+                         ellapsedTime );
+      }
+   }
+
+   private void processRules()
+   {
+      for ( final Entry< String, IFlexRule > currentRuleEntry : rules.entrySet() )
+      {
+         processRule( currentRuleEntry.getKey(),
+                      currentRuleEntry.getValue() );
+      }
+   }
+
+   private void sortViolations()
+   {
+      for ( final Entry< String, IFlexFile > entry : files.entrySet() )
+      {
+         if ( violations.containsKey( entry.getValue() ) )
+         {
+            Collections.sort( violations.get( entry.getValue() ) );
+         }
+      }
+   }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-core/src/main/java/com/adobe/ac/pmd/engines/AbstractFlexPmdEngine.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-core/src/main/java/com/adobe/ac/pmd/engines/AbstractFlexPmdEngine.java b/FlexPMD/flex-pmd-core/src/main/java/com/adobe/ac/pmd/engines/AbstractFlexPmdEngine.java
new file mode 100644
index 0000000..be8f747
--- /dev/null
+++ b/FlexPMD/flex-pmd-core/src/main/java/com/adobe/ac/pmd/engines/AbstractFlexPmdEngine.java
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.pmd.engines;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URISyntaxException;
+import java.util.List;
+import java.util.logging.Logger;
+
+import net.sourceforge.pmd.PMDException;
+import net.sourceforge.pmd.RuleSet;
+import net.sourceforge.pmd.RuleSetFactory;
+
+import org.apache.commons.lang.StringUtils;
+import org.codehaus.plexus.util.IOUtil;
+
+import com.adobe.ac.pmd.FlexPmdParameters;
+import com.adobe.ac.pmd.FlexPmdViolations;
+import com.adobe.ac.pmd.IFlexViolation;
+import com.adobe.ac.utils.StackTraceUtils;
+
+public abstract class AbstractFlexPmdEngine
+{
+   private static final Logger LOGGER = Logger.getLogger( AbstractFlexPmdEngine.class.getName() );
+
+   private static int computeViolationNumber( final FlexPmdViolations flexPmdViolations )
+   {
+      int foundViolations = 0;
+      for ( final List< IFlexViolation > violations : flexPmdViolations.getViolations().values() )
+      {
+         foundViolations += violations.size();
+      }
+      LOGGER.info( "Violations number found: "
+            + foundViolations );
+      return foundViolations;
+   }
+
+   private static File extractDefaultRuleSet() throws URISyntaxException,
+                                              IOException
+   {
+      final String rulesetURI = "/com/adobe/ac/pmd/default_flex.xml";
+      final InputStream resourceAsStream = AbstractFlexPmdEngine.class.getResourceAsStream( rulesetURI );
+      final File temporaryRuleset = File.createTempFile( "default_flex",
+                                                         ".xml" );
+      temporaryRuleset.deleteOnExit();
+      final FileOutputStream writter = new FileOutputStream( temporaryRuleset );
+      IOUtil.copy( resourceAsStream,
+                   writter );
+
+      resourceAsStream.close();
+      return temporaryRuleset;
+   }
+
+   private final File         outputDirectory;
+   private final String       packageToExclude;
+   private RuleSet            ruleSet;
+   private final File         source;
+   private final List< File > sourceList;
+
+   public AbstractFlexPmdEngine( final FlexPmdParameters parameters )
+   {
+      super();
+
+      source = parameters.getSource();
+      sourceList = parameters.getSourceList();
+      outputDirectory = parameters.getOutputDirectory();
+      packageToExclude = parameters.getExcludePackage();
+      try
+      {
+         ruleSet = loadRuleset( parameters.getRuleSet() );
+      }
+      catch ( final URISyntaxException e )
+      {
+         LOGGER.warning( StackTraceUtils.print( e ) );
+      }
+      catch ( final IOException e )
+      {
+         LOGGER.warning( StackTraceUtils.print( e ) );
+      }
+   }
+
+   /**
+    * @param flexPmdViolations
+    * @return The number of violations with the given ruleset and the result
+    *         wrapper in case of reuse
+    * @throws PMDException
+    * @throws URISyntaxException
+    * @throws IOException
+    */
+   public final void executeReport( final FlexPmdViolations flexPmdViolations ) throws PMDException
+   {
+      if ( source == null
+            && sourceList == null )
+      {
+         throw new PMDException( "unspecified sourceDirectory" );
+      }
+      if ( outputDirectory == null )
+      {
+         throw new PMDException( "unspecified outputDirectory" );
+      }
+
+      if ( ruleSet != null )
+      {
+         if ( !flexPmdViolations.hasViolationsBeenComputed() )
+         {
+            computeViolations( flexPmdViolations );
+         }
+         computeViolationNumber( flexPmdViolations );
+         writeAnyReport( flexPmdViolations );
+      }
+   }
+
+   public final RuleSet getRuleSet()
+   {
+      return ruleSet;
+   }
+
+   protected File getOutputDirectory()
+   {
+      return outputDirectory;
+   }
+
+   protected abstract void writeReport( final FlexPmdViolations pmd ) throws PMDException;
+
+   private void computeViolations( final FlexPmdViolations flexPmdViolations ) throws PMDException
+   {
+      final long startTime = System.currentTimeMillis();
+
+      flexPmdViolations.computeViolations( source,
+                                           sourceList,
+                                           ruleSet,
+                                           packageToExclude );
+      final long ellapsedTime = System.currentTimeMillis()
+            - startTime;
+      LOGGER.info( "It took "
+            + ellapsedTime + "ms to compute violations" );
+   }
+
+   private File extractRuleset( final File ruleSetFile ) throws URISyntaxException,
+                                                        IOException
+   {
+      return ruleSetFile == null ? extractDefaultRuleSet()
+                                : ruleSetFile;
+   }
+
+   private String getReportType()
+   {
+      return StringUtils.substringBefore( StringUtils.substringAfter( getClass().getName(),
+                                                                      "FlexPmd" ),
+                                          "Engine" );
+   }
+
+   private RuleSet loadRuleset( final File ruleSetFile ) throws URISyntaxException,
+                                                        IOException
+   {
+      final File realRuleSet = extractRuleset( ruleSetFile );
+      final FileInputStream inputStream = new FileInputStream( realRuleSet );
+      final RuleSet loadedRuleSet = new RuleSetFactory().createRuleSet( inputStream );
+
+      LOGGER.info( "Ruleset: "
+            + realRuleSet.getAbsolutePath() );
+      LOGGER.info( "Rules number in the ruleSet: "
+            + loadedRuleSet.getRules().size() );
+      inputStream.close();
+
+      return loadedRuleSet;
+   }
+
+   private void writeAnyReport( final FlexPmdViolations flexPmdViolations ) throws PMDException
+   {
+      long startTime;
+      long ellapsedTime;
+      startTime = System.currentTimeMillis();
+      writeReport( flexPmdViolations );
+      ellapsedTime = System.currentTimeMillis()
+            - startTime;
+
+      LOGGER.info( "It took "
+            + ellapsedTime + "ms to write the " + getReportType() + " report" );
+   }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/b0fc5f17/FlexPMD/flex-pmd-core/src/main/java/com/adobe/ac/pmd/engines/FlexPMDFormat.java
----------------------------------------------------------------------
diff --git a/FlexPMD/flex-pmd-core/src/main/java/com/adobe/ac/pmd/engines/FlexPMDFormat.java b/FlexPMD/flex-pmd-core/src/main/java/com/adobe/ac/pmd/engines/FlexPMDFormat.java
new file mode 100644
index 0000000..f3f11d4
--- /dev/null
+++ b/FlexPMD/flex-pmd-core/src/main/java/com/adobe/ac/pmd/engines/FlexPMDFormat.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.adobe.ac.pmd.engines;
+
+public enum FlexPMDFormat
+{
+   HTML("flexPmd.html"), XML("pmd.xml");
+
+   private final String name;
+
+   private FlexPMDFormat( final String formatName )
+   {
+      name = formatName;
+   }
+
+   @Override
+   public String toString()
+   {
+      return name;
+   }
+}


Mime
View raw message