1 /*
2 * Derivative Work
3 * Copyright 2010 SOFTEC sa. All rights reserved.
4 *
5 * Original Work
6 * Copyright 2001-2005 The Apache Software Foundation.
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 org.codehaus.mojo.javascript;
22
23 import java.io.File;
24
25 /**
26 * Goal used to strip and compress the JavaScript files from the target script directory
27 *
28 * @goal compress
29 * @phase prepare-package
30 */
31 public class CompressMojo
32 extends AbstractCompressMojo
33 {
34 /**
35 * The output directory of the compressed javascript files.
36 *
37 * @parameter default-value="${project.build.directory}/compressed"
38 */
39 private File compressedDirectory;
40
41 /**
42 * The output directory of the compressed javascript files.
43 *
44 * @parameter default-value="${project.build.directory}/stripped"
45 */
46 private File strippedDirectory;
47
48 /**
49 * The output directory of the compressed javascript archive.
50 *
51 * @parameter default-value="${project.build.directory}"
52 */
53 private File buildDirectory;
54
55 /**
56 * optional extension for the compressed artifact. Example "compressed"
57 *
58 * @parameter
59 */
60 private String scriptClassifier;
61
62 /**
63 * The intput directory for the source javascript files.
64 *
65 * @parameter default-value="${project.build.outputDirectory}"
66 */
67 private File scriptsDirectory;
68
69 /**
70 * {@inheritDoc}
71 *
72 * @see org.codehaus.mojo.javascript.AbstractCompressMojo#getExtension()
73 */
74 public String getExtension()
75 {
76 return scriptClassifier;
77 }
78
79 /**
80 * {@inheritDoc}
81 *
82 * @see org.codehaus.mojo.javascript.AbstractCompressMojo#getOutputDirectory()
83 */
84 protected File getOutputDirectory()
85 {
86 return compressedDirectory;
87 }
88
89 /**
90 * {@inheritDoc}
91 *
92 * @see org.codehaus.mojo.javascript.AbstractCompressMojo#getOutputDirectory()
93 */
94 protected File getStrippedDirectory()
95 {
96 return strippedDirectory;
97 }
98
99 /**
100 * {@inheritDoc}
101 *
102 * @see org.codehaus.mojo.javascript.AbstractCompressMojo#getSourceDirectory()
103 */
104 protected File getSourceDirectory()
105 {
106 return scriptsDirectory;
107 }
108 }