View Javadoc

1   /*
2    * Derivative Work
3    * Copyright 2010 SOFTEC sa. All rights reserved.
4    *
5    * Original Work
6    * Copyright 2010 Justin Searls
7    * 
8    * Licensed under the Apache License, Version 2.0 (the "License");
9    * you may not use this file except in compliance with the License.
10   * You may obtain a copy of the License at
11   *
12   *      http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  
21  package searls.jasmine;
22  
23  import java.io.File;
24  import java.util.List;
25  
26  import org.apache.maven.artifact.Artifact;
27  import org.apache.maven.plugin.AbstractMojo;
28  import org.apache.maven.project.MavenProject;
29  
30  public abstract class AbstractJasmineMojo extends AbstractMojo {
31  	/** Properties in order of most-to-least interesting for client projects to override **/
32  	
33  	/**
34  	 * @parameter default-value="${project.basedir}${file.separator}src${file.separator}main${file.separator}javascript" expression="${sourceDirectory}"
35  	 */
36  	protected File sourceDirectory;
37  
38      /**
39       * Base directory for jsunit test.
40       *
41       * @parameter default-value="${project.basedir}${file.separator}src${file.separator}test${file.separator}javascript" expression="${jsunitTestSourceDirectory}"
42       */
43      protected File jsunitTestSourceDirectory;
44  
45  	/**
46  	 * @parameter default-value="${project.basedir}${file.separator}src${file.separator}test${file.separator}javascript" expression="${jsunitTestSourceDirectory}"
47  	 */
48  	protected File jasmineTestSourceDirectory;
49  
50  	/**
51  	 * @parameter default-value="js" expression="${packageJavaScriptPath}"
52  	 */
53  	protected String packageJavaScriptPath;
54  	
55  	/**
56  	 * JavaScript sources (typically vendor/lib dependencies) that need to be loaded
57  	 * before other sources (and specs) in a particular order, these are relative to the ${sourceDirectory}
58  	 * directory! Therefore, if jquery.js is in `${sourceDirectory}/vendor`, you would configure:
59  	 * 
60  	 *  	<preloadSources>
61  	 *			<source>vendor/z.js</source>
62  	 *		</preloadSources>
63  	 * 
64  	 * And z.js would load before all the other sources and specs.
65  	 * 
66  	 * @parameter
67  	 */
68  	protected List<String> preloadSources;
69  	
70  	/**
71  	 * @parameter default-value="${project.build.directory}${file.separator}jasmine"
72  	 */
73  	protected File jasmineTargetDir;
74  
75      /**
76       * The folder for javascripts dependencies
77       *
78       * @parameter expression="${scripts}" default-value="lib"
79       */
80      protected String libsDirectory;
81  
82      /**
83       * The Browser simulation used for Unit tests (default to FF3.6)
84       *
85       * @parameter
86       */
87      protected String[] browsers;
88  
89      /**
90       * Use the artifactId as folder
91       *
92       * @parameter
93       */
94      protected boolean useArtifactId;    
95  	
96      /**
97       * Set this to 'true' to bypass unit tests entirely. Its use is NOT
98       * RECOMMENDED, but quite convenient on occasion.
99       *
100      * @parameter expression="${maven.test.skip}"
101      */
102     protected boolean skipTests;
103 
104     /**
105      * Set this to true to ignore a failure during testing. Its use is NOT
106      * RECOMMENDED, but quite convenient on occasion.
107      *
108      * @parameter expression="${maven.test.failure.ignore}"
109      */
110     protected boolean testFailureIgnore;
111 	
112 	/**
113 	 * @parameter default-value="${project.build.directory}${file.separator}${project.build.finalName}"
114 	 */
115 	protected File packageDir;
116 	
117 	/**
118 	 * @parameter default-value="SpecRunner.html"
119 	 */
120 	protected String specRunnerHtmlFileName;
121 	
122 	/**
123 	 * @parameter default-value="ManualSpecRunner.html"
124 	 */
125 	protected String manualSpecRunnerHtmlFileName;
126 	
127 	/**
128 	 * @parameter default-value="spec"
129 	 */
130 	protected String specDirectoryName;
131 	
132 	/**
133 	 * @parameter default-value="src"
134 	 */
135 	protected String srcDirectoryName;
136 
137 	/**
138 	 * @parameter default-value="${project}"
139 	 */
140 	protected MavenProject mavenProject;
141 
142 	/**
143 	 * @parameter default-value="${plugin.artifacts}"
144 	 */
145 	protected List<Artifact> pluginArtifacts;
146 }