1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20 package org.apache.rat.plugin;
21
22 import org.apache.commons.cli.Option;
23 import org.apache.commons.lang.StringUtils;
24 import org.apache.maven.plugin.AbstractMojo;
25 import org.apache.maven.plugins.annotations.Parameter;
26 import org.apache.rat.commandline.Arg;
27 import org.apache.rat.DeprecationReporter;
28 import org.apache.rat.utils.CasedString;
29 import org.apache.rat.utils.DefaultLog;
30 import org.apache.rat.utils.Log;
31
32 import java.util.ArrayList;
33 import java.util.Arrays;
34 import java.util.Collections;
35 import java.util.HashMap;
36 import java.util.List;
37 import java.util.Map;
38 import java.util.Objects;
39 import java.util.stream.Collectors;
40
41 /* DO NOT EDIT - GENERATED FILE */
42
43 /**
44 * Generated class to provide Maven support for standard RAT command line options
45 */
46 public abstract class BaseRatMojo extends AbstractMojo {
47
48 private static final Map<String, String> xlateName = new HashMap<>();
49
50 private static final List<String> unsupportedArgs = new ArrayList<>();
51
52 private static final Map<String, String> deprecatedArgs = new HashMap<>();
53
54 static {
55 xlateName.put("addLicense", "add-license");
56 unsupportedArgs.add("help");
57 unsupportedArgs.add("dir");
58 unsupportedArgs.add("log-level");
59 deprecatedArgs.put("copyright", "Use of deprecated option 'copyright'. Deprecated for removal since 0.17: Use <editCopyright> instead.");
60 deprecatedArgs.put("force", "Use of deprecated option 'force'. Deprecated for removal since 0.17: Use <editOverwrite> instead.");
61 deprecatedArgs.put("addLicense", "Use of deprecated option 'addLicense'. Deprecated for removal since 0.17: Use <editLicense> instead.");
62 deprecatedArgs.put("licenses", "Use of deprecated option 'licenses'. Deprecated for removal since 0.17: Use <config> instead.");
63 deprecatedArgs.put("no-default-licenses", "Use of deprecated option 'noDefaultLicenses'. Deprecated for removal since 0.17: Use <configurationNoDefaults> instead.");
64 deprecatedArgs.put("exclude", "Use of deprecated option 'exclude'. Deprecated for removal since 0.17: Use <inputExclude> instead.");
65 deprecatedArgs.put("exclude-file", "Use of deprecated option 'excludeFile'. Deprecated for removal since 0.17: Use <inputExcludeFile> instead.");
66 deprecatedArgs.put("include", "Use of deprecated option 'include'. Deprecated for removal since 0.17: Use <inputInclude> instead.");
67 deprecatedArgs.put("includes-file", "Use of deprecated option 'includesFile'. Deprecated for removal since 0.17: Use <inputIncludeFile> instead.");
68 deprecatedArgs.put("scan-hidden-directories", "Use of deprecated option 'scanHiddenDirectories'. Deprecated for removal since 0.17: Use <inputIncludeStd> with 'HIDDEN_DIR' argument instead.");
69 deprecatedArgs.put("stylesheet", "Use of deprecated option 'stylesheet'. Deprecated for removal since 0.17: Use <outputStyle> instead.");
70 deprecatedArgs.put("xml", "Use of deprecated option 'xml'. Deprecated for removal since 0.17: Use <outputStyle> with the 'xml' argument instead.");
71 deprecatedArgs.put("list-licenses", "Use of deprecated option 'listLicenses'. Deprecated for removal since 0.17: Use <outputLicenses> instead.");
72 deprecatedArgs.put("list-families", "Use of deprecated option 'listFamilies'. Deprecated for removal since 0.17: Use <outputFamilies> instead.");
73 deprecatedArgs.put("out", "Use of deprecated option 'out'. Deprecated for removal since 0.17: Use <outputFile> instead.");
74 }
75
76 /**
77 * Creates a Maven name from a long option.
78 * Will map excluded long options to null.
79 * @param longOpt the kebab name.
80 * @return The CamelCased name for Maven use.
81 */
82 public static String createName(String longOpt) {
83 String name = xlateName.get(longOpt);
84 return name != null ? name : new CasedString(CasedString.StringCase.KEBAB, longOpt).toCase(CasedString.StringCase.CAMEL);
85 }
86
87 /**
88 * Creates a kebab case name from a camel case name.
89 * @param camelCase the camel case name to convert.
90 * @return the kebab format.
91 */
92 public static String toKebabForm(String camelCase) {
93 return new CasedString(CasedString.StringCase.CAMEL, camelCase).toCase(CasedString.StringCase.KEBAB);
94 }
95
96 /**
97 * Returns the list of unsupported args.
98 * @return the list of kebab style names that are unsupported by the Maven UI.
99 */
100 public static List<String> unsupportedArgs() {
101 return Collections.unmodifiableList(unsupportedArgs);
102 }
103
104 ///////////////////////// Start common Arg manipulation code
105
106 /**
107 * Sets the deprecation report method.
108 */
109 private static void setDeprecationReporter() {
110 DeprecationReporter.setLogReporter(opt -> {
111 String msg = deprecatedArgs.get(argsKey(opt));
112 if (msg == null) {
113 DeprecationReporter.getDefault().accept(opt);
114 } else {
115 DefaultLog.getInstance().warn(msg);
116 }
117 });
118 }
119
120 private static String argsKey(Option opt) {
121 return StringUtils.defaultIfEmpty(opt.getLongOpt(), opt.getKey());
122 }
123
124 /**
125 * A map of CLI-based arguments to values.
126 */
127 protected final Map<String, List<String>> args = new HashMap<>();
128
129 /**
130 * Gets the list of arguments prepared for the CLI code to parse.
131 * @return the List of arguments for the CLI command line.
132 */
133 protected List<String> args() {
134 List<String> result = new ArrayList<>();
135 for (Map.Entry<String, List<String>> entry : args.entrySet()) {
136 result.add("--" + entry.getKey());
137 result.addAll(entry.getValue().stream().filter(Objects::nonNull).collect(Collectors.toList()));
138 }
139 return result;
140 }
141
142 private boolean validateSet(String key) {
143 Arg arg = Arg.findArg(key);
144 if (arg != null) {
145 Option opt = arg.find(key);
146 Option main = arg.option();
147 if (opt.isDeprecated()) {
148 args.remove(argsKey(main));
149 // deprecated options must be explicitly set so let it go.
150 return true;
151 }
152 // non-deprecated options may have default so ignore it if another option has already been set.
153 for (Option o : arg.group().getOptions()) {
154 if (!o.equals(main)) {
155 if (args.containsKey(argsKey(o))) {
156 return false;
157 }
158 }
159 }
160 return true;
161 }
162 return false;
163 }
164
165 /**
166 * Set a key and value into the argument list.
167 * Replaces any existing value.
168 * @param key the key for the map.
169 * @param value the value to set.
170 */
171 protected void setArg(String key, String value) {
172 if (value == null || StringUtils.isNotBlank(value)) {
173 if (validateSet(key)) {
174 List<String> values = new ArrayList<>();
175 if (DefaultLog.getInstance().isEnabled(Log.Level.DEBUG)) {
176 DefaultLog.getInstance().debug(String.format("Setting %s to '%s'", key, value));
177 }
178 values.add(value);
179 args.put(key, values);
180 }
181 }
182 }
183
184 /**
185 * Get the list of values for a key.
186 * @param key the key for the map.
187 * @return the list of values for the key or {@code null} if not set.
188 */
189 public List<String> getArg(String key) {
190 return args.get(key);
191 }
192
193 /**
194 * Add values to the key in the argument list.
195 * empty values are ignored. If no non-empty values are present no change is made.
196 * If the key does not exist, adds it.
197 * @param key the key for the map.
198 * @param value the array of values to set.
199 */
200 protected void addArg(String key, String[] value) {
201 List<String> newValues = Arrays.stream(value).filter(StringUtils::isNotBlank).collect(Collectors.toList());
202 if (!newValues.isEmpty()) {
203 if (validateSet(key)) {
204 if (DefaultLog.getInstance().isEnabled(Log.Level.DEBUG)) {
205 DefaultLog.getInstance().debug(String.format("Adding [%s] to %s", String.join(", ", Arrays.asList(value)), key));
206 }
207 List<String> values = args.computeIfAbsent(key, k -> new ArrayList<>());
208 values.addAll(newValues);
209 }
210 }
211 }
212
213 /**
214 * Add a value to the key in the argument list.
215 * If the key does not exist, adds it.
216 * @param key the key for the map.
217 * @param value the value to set.
218 */
219 protected void addArg(String key, String value) {
220 if (StringUtils.isNotBlank(value)) {
221 if (validateSet(key)) {
222 List<String> values = args.get(key);
223 if (DefaultLog.getInstance().isEnabled(Log.Level.DEBUG)) {
224 DefaultLog.getInstance().debug(String.format("Adding [%s] to %s", String.join(", ", Arrays.asList(value)), key));
225 }
226 if (values == null) {
227 values = new ArrayList<>();
228 args.put(key, values);
229 }
230 values.add(value);
231 }
232 }
233 }
234
235 /**
236 * Remove a key from the argument list.
237 * @param key the key to remove from the map.
238 */
239 protected void removeArg(String key) {
240 args.remove(key);
241 }
242
243 ///////////////////////// End common Arg manipulation code
244
245 protected BaseRatMojo() {
246 setDeprecationReporter();
247 }
248
249 /* GENERATED METHODS */
250
251
252 /**
253 * The copyright message to use in the license headers. Argument should be a Arg. (See Argument Types for clarification)
254 * @param copyright Copyright message to use in the license headers.
255 * @deprecated Deprecated for removal since 0.17: Use <editCopyright> instead.
256 */
257 @Deprecated
258 @Parameter(property = "rat.Copyright")
259 public void setCopyright(String copyright) {
260 setArg("copyright", copyright);
261 }
262 /**
263 * The copyright message to use in the license headers. Usually in the form of "Copyright 2008 Foo". Only valid with <editLicense> Argument should be a Arg. (See Argument Types for clarification)
264 * @param editCopyright Copyright message to use in the license headers.
265 */
266 @Parameter(property = "rat.EditCopyright")
267 public void setEditCopyright(String editCopyright) {
268 setArg("edit-copyright", editCopyright);
269 }
270 /**
271 * Forces any changes in files to be written directly to the source files so that new files are not created.
272 * @param force The state
273 * @deprecated Deprecated for removal since 0.17: Use <editOverwrite> instead.
274 */
275 @Deprecated
276 @Parameter(property = "rat.Force")
277 public void setForce(boolean force) {
278 if (force) {
279 setArg("force", null);
280 } else {
281 removeArg("force");
282 }
283 }
284 /**
285 * Forces any changes in files to be written directly to the source files so that new files are not created. Only valid with <editLicense>.
286 * @param editOverwrite The state
287 */
288 @Parameter(property = "rat.EditOverwrite")
289 public void setEditOverwrite(boolean editOverwrite) {
290 if (editOverwrite) {
291 setArg("edit-overwrite", null);
292 } else {
293 removeArg("edit-overwrite");
294 }
295 }
296 /**
297 * Add the Apache-2.0 license header to any file with an unknown license that is not in the exclusion list.
298 * @param addLicense The state
299 * @deprecated Deprecated for removal since 0.17: Use <editLicense> instead.
300 */
301 @Deprecated
302 @Parameter(property = "rat.AddLicense")
303 public void setAddLicense(boolean addLicense) {
304 if (addLicense) {
305 setArg("addLicense", null);
306 } else {
307 removeArg("addLicense");
308 }
309 }
310 /**
311 * Add the Apache-2.0 license header to any file with an unknown license that is not in the exclusion list. By default new files will be created with the license header, to force the modification of existing files use the <editOverwrite> option.
312 * @param editLicense The state
313 */
314 @Parameter(property = "rat.EditLicense")
315 public void setEditLicense(boolean editLicense) {
316 if (editLicense) {
317 setArg("edit-license", null);
318 } else {
319 removeArg("edit-license");
320 }
321 }
322 /**
323 * File names for system configuration. Arguments should be File. (See Argument Types for clarification)
324 * @param config Names for system configuration.
325 */
326 @Parameter
327 public void setConfigs(String[] config) {
328 addArg("config", config);
329 }
330 /**
331 * File names for system configuration. Arguments should be File. (See Argument Types for clarification)
332 * @param config Names for system configuration.
333 */
334 @Parameter
335 public void setConfig(String config) {
336 addArg("config", config);
337 }
338 /**
339 * File names for system configuration. Arguments should be File. (See Argument Types for clarification)
340 * @param licenses Names for system configuration.
341 * @deprecated Deprecated for removal since 0.17: Use <config> instead.
342 */
343 @Deprecated
344 @Parameter
345 public void setLicenses(String[] licenses) {
346 addArg("licenses", licenses);
347 }
348 /**
349 * File names for system configuration. Arguments should be File. (See Argument Types for clarification)
350 * @param licenses Names for system configuration.
351 * @deprecated Deprecated for removal since 0.17: Use <config> instead.
352 */
353 @Deprecated
354 @Parameter
355 public void setLicenses(String licenses) {
356 addArg("licenses", licenses);
357 }
358 /**
359 * Ignore default configuration.
360 * @param configurationNoDefaults The state
361 */
362 @Parameter(property = "rat.ConfigurationNoDefaults")
363 public void setConfigurationNoDefaults(boolean configurationNoDefaults) {
364 if (configurationNoDefaults) {
365 setArg("configuration-no-defaults", null);
366 } else {
367 removeArg("configuration-no-defaults");
368 }
369 }
370 /**
371 * Ignore default configuration.
372 * @param noDefaultLicenses The state
373 * @deprecated Deprecated for removal since 0.17: Use <configurationNoDefaults> instead.
374 */
375 @Deprecated
376 @Parameter(property = "rat.NoDefaultLicenses")
377 public void setNoDefaultLicenses(boolean noDefaultLicenses) {
378 if (noDefaultLicenses) {
379 setArg("no-default-licenses", null);
380 } else {
381 removeArg("no-default-licenses");
382 }
383 }
384 /**
385 * A comma separated list of approved License IDs. These licenses will be added to the list of approved licenses. Argument should be a LicenseID. (See Argument Types for clarification)
386 * @param licensesApproved Comma separated list of approved License IDs.
387 */
388 @Parameter(property = "rat.LicensesApproved")
389 public void setLicensesApproved(String licensesApproved) {
390 setArg("licenses-approved", licensesApproved);
391 }
392 /**
393 * Name of file containing comma separated lists of approved License IDs. Argument should be a File. (See Argument Types for clarification)
394 * @param licensesApprovedFile Of file containing comma separated lists of approved License IDs.
395 */
396 @Parameter(property = "rat.LicensesApprovedFile")
397 public void setLicensesApprovedFile(String licensesApprovedFile) {
398 setArg("licenses-approved-file", licensesApprovedFile);
399 }
400 /**
401 * A comma separated list of approved license family IDs. These license families will be added to the list of approved license families. Argument should be a FamilyID. (See Argument Types for clarification)
402 * @param licenseFamiliesApproved Comma separated list of approved license family IDs.
403 */
404 @Parameter(property = "rat.LicenseFamiliesApproved")
405 public void setLicenseFamiliesApproved(String licenseFamiliesApproved) {
406 setArg("license-families-approved", licenseFamiliesApproved);
407 }
408 /**
409 * Name of file containing comma separated lists of approved family IDs. Argument should be a File. (See Argument Types for clarification)
410 * @param licenseFamiliesApprovedFile Of file containing comma separated lists of approved family IDs.
411 */
412 @Parameter(property = "rat.LicenseFamiliesApprovedFile")
413 public void setLicenseFamiliesApprovedFile(String licenseFamiliesApprovedFile) {
414 setArg("license-families-approved-file", licenseFamiliesApprovedFile);
415 }
416 /**
417 * A comma separated list of denied License IDs. These licenses will be removed from the list of approved licenses. Once licenses are removed they can not be added back. Argument should be a LicenseID. (See Argument Types for clarification)
418 * @param licensesDenied Comma separated list of denied License IDs.
419 */
420 @Parameter(property = "rat.LicensesDenied")
421 public void setLicensesDenied(String licensesDenied) {
422 setArg("licenses-denied", licensesDenied);
423 }
424 /**
425 * Name of file containing comma separated lists of the denied license IDs. These licenses will be removed from the list of approved licenses. Once licenses are removed they can not be added back. Argument should be a File. (See Argument Types for clarification)
426 * @param licensesDeniedFile Of file containing comma separated lists of the denied license IDs.
427 */
428 @Parameter(property = "rat.LicensesDeniedFile")
429 public void setLicensesDeniedFile(String licensesDeniedFile) {
430 setArg("licenses-denied-file", licensesDeniedFile);
431 }
432 /**
433 * A comma separated list of denied License family IDs. These license families will be removed from the list of approved licenses. Once license families are removed they can not be added back. Argument should be a FamilyID. (See Argument Types for clarification)
434 * @param licenseFamiliesDenied Comma separated list of denied License family IDs.
435 */
436 @Parameter(property = "rat.LicenseFamiliesDenied")
437 public void setLicenseFamiliesDenied(String licenseFamiliesDenied) {
438 setArg("license-families-denied", licenseFamiliesDenied);
439 }
440 /**
441 * Name of file containing comma separated lists of denied license IDs. These license families will be removed from the list of approved licenses. Once license families are removed they can not be added back. Argument should be a File. (See Argument Types for clarification)
442 * @param licenseFamiliesDeniedFile Of file containing comma separated lists of denied license IDs.
443 */
444 @Parameter(property = "rat.LicenseFamiliesDeniedFile")
445 public void setLicenseFamiliesDeniedFile(String licenseFamiliesDeniedFile) {
446 setArg("license-families-denied-file", licenseFamiliesDeniedFile);
447 }
448 /**
449 * The acceptable maximum number for the specified counter. A value of '-1' specifies an unlimited number. Arguments should be CounterPattern. (See Argument Types for clarification)
450 * @param counterMax Acceptable maximum number for the specified counter.
451 */
452 @Parameter
453 public void setCounterMaxs(String[] counterMax) {
454 addArg("counter-max", counterMax);
455 }
456 /**
457 * The acceptable maximum number for the specified counter. A value of '-1' specifies an unlimited number. Arguments should be CounterPattern. (See Argument Types for clarification)
458 * @param counterMax Acceptable maximum number for the specified counter.
459 */
460 @Parameter
461 public void setCounterMax(String counterMax) {
462 addArg("counter-max", counterMax);
463 }
464 /**
465 * The minimum number for the specified counter. Arguments should be CounterPattern. (See Argument Types for clarification)
466 * @param counterMin Minimum number for the specified counter.
467 */
468 @Parameter
469 public void setCounterMins(String[] counterMin) {
470 addArg("counter-min", counterMin);
471 }
472 /**
473 * The minimum number for the specified counter. Arguments should be CounterPattern. (See Argument Types for clarification)
474 * @param counterMin Minimum number for the specified counter.
475 */
476 @Parameter
477 public void setCounterMin(String counterMin) {
478 addArg("counter-min", counterMin);
479 }
480 /**
481 * A file containing file names to process. File names must use linux directory separator ('/') or none at all. File names that do not start with '/' are relative to the directory where the argument is located. Arguments should be File. (See Argument Types for clarification)
482 * @param inputSource File containing file names to process.
483 */
484 @Parameter
485 public void setInputSources(String[] inputSource) {
486 addArg("input-source", inputSource);
487 }
488 /**
489 * A file containing file names to process. File names must use linux directory separator ('/') or none at all. File names that do not start with '/' are relative to the directory where the argument is located. Arguments should be File. (See Argument Types for clarification)
490 * @param inputSource File containing file names to process.
491 */
492 @Parameter
493 public void setInputSource(String inputSource) {
494 addArg("input-source", inputSource);
495 }
496 /**
497 * Excludes files matching <Expression>. Arguments should be Expression. (See Argument Types for clarification)
498 * @param exclude Files matching <Expression>.
499 * @deprecated Deprecated for removal since 0.17: Use <inputExclude> instead.
500 */
501 @Deprecated
502 @Parameter
503 public void setExcludes(String[] exclude) {
504 addArg("exclude", exclude);
505 }
506 /**
507 * Excludes files matching <Expression>. Arguments should be Expression. (See Argument Types for clarification)
508 * @param exclude Files matching <Expression>.
509 * @deprecated Deprecated for removal since 0.17: Use <inputExclude> instead.
510 */
511 @Deprecated
512 @Parameter
513 public void setExclude(String exclude) {
514 addArg("exclude", exclude);
515 }
516 /**
517 * Excludes files matching <Expression>. Arguments should be Expression. (See Argument Types for clarification)
518 * @param inputExclude Files matching <Expression>.
519 */
520 @Parameter
521 public void setInputExcludes(String[] inputExclude) {
522 addArg("input-exclude", inputExclude);
523 }
524 /**
525 * Excludes files matching <Expression>. Arguments should be Expression. (See Argument Types for clarification)
526 * @param inputExclude Files matching <Expression>.
527 */
528 @Parameter
529 public void setInputExclude(String inputExclude) {
530 addArg("input-exclude", inputExclude);
531 }
532 /**
533 * Reads <Expression> entries from a file. Entries will be excluded from processing. Argument should be a File. (See Argument Types for clarification)
534 * @param excludeFile <Expression> entries from a file.
535 * @deprecated Deprecated for removal since 0.17: Use <inputExcludeFile> instead.
536 */
537 @Deprecated
538 @Parameter(property = "rat.ExcludeFile")
539 public void setExcludeFile(String excludeFile) {
540 setArg("exclude-file", excludeFile);
541 }
542 /**
543 * Reads <Expression> entries from a file. Entries will be excluded from processing. Argument should be a File. (See Argument Types for clarification)
544 * @param inputExcludeFile <Expression> entries from a file.
545 */
546 @Parameter(property = "rat.InputExcludeFile")
547 public void setInputExcludeFile(String inputExcludeFile) {
548 setArg("input-exclude-file", inputExcludeFile);
549 }
550 /**
551 * Excludes files defined in standard collections based on commonly occurring groups. Excludes any path matcher actions but DOES NOT exclude any file processor actions. Arguments should be StandardCollection. (See Argument Types for clarification)
552 * @param inputExcludeStd Files defined in standard collections based on commonly occurring groups.
553 */
554 @Parameter
555 public void setInputExcludeStds(String[] inputExcludeStd) {
556 addArg("input-exclude-std", inputExcludeStd);
557 }
558 /**
559 * Excludes files defined in standard collections based on commonly occurring groups. Excludes any path matcher actions but DOES NOT exclude any file processor actions. Arguments should be StandardCollection. (See Argument Types for clarification)
560 * @param inputExcludeStd Files defined in standard collections based on commonly occurring groups.
561 */
562 @Parameter
563 public void setInputExcludeStd(String inputExcludeStd) {
564 addArg("input-exclude-std", inputExcludeStd);
565 }
566 /**
567 * Excludes files with sizes less than the number of bytes specified. Argument should be a Integer. (See Argument Types for clarification)
568 * @param inputExcludeSize Files with sizes less than the number of bytes specified.
569 */
570 @Parameter(property = "rat.InputExcludeSize")
571 public void setInputExcludeSize(String inputExcludeSize) {
572 setArg("input-exclude-size", inputExcludeSize);
573 }
574 /**
575 * Includes files matching <Expression>. Will override excluded files. Arguments should be Expression. (See Argument Types for clarification)
576 * @param inputInclude Files matching <Expression>.
577 */
578 @Parameter
579 public void setInputIncludes(String[] inputInclude) {
580 addArg("input-include", inputInclude);
581 }
582 /**
583 * Includes files matching <Expression>. Will override excluded files. Arguments should be Expression. (See Argument Types for clarification)
584 * @param inputInclude Files matching <Expression>.
585 */
586 @Parameter
587 public void setInputInclude(String inputInclude) {
588 addArg("input-include", inputInclude);
589 }
590 /**
591 * Includes files matching <Expression>. Will override excluded files. Arguments should be Expression. (See Argument Types for clarification)
592 * @param include Files matching <Expression>.
593 * @deprecated Deprecated for removal since 0.17: Use <inputInclude> instead.
594 */
595 @Deprecated
596 @Parameter
597 public void setIncludes(String[] include) {
598 addArg("include", include);
599 }
600 /**
601 * Includes files matching <Expression>. Will override excluded files. Arguments should be Expression. (See Argument Types for clarification)
602 * @param include Files matching <Expression>.
603 * @deprecated Deprecated for removal since 0.17: Use <inputInclude> instead.
604 */
605 @Deprecated
606 @Parameter
607 public void setInclude(String include) {
608 addArg("include", include);
609 }
610 /**
611 * Reads <Expression> entries from a file. Entries will override excluded files. Argument should be a File. (See Argument Types for clarification)
612 * @param inputIncludeFile <Expression> entries from a file.
613 */
614 @Parameter(property = "rat.InputIncludeFile")
615 public void setInputIncludeFile(String inputIncludeFile) {
616 setArg("input-include-file", inputIncludeFile);
617 }
618 /**
619 * Reads <Expression> entries from a file. Entries will be excluded from processing. Argument should be a File. (See Argument Types for clarification)
620 * @param includesFile <Expression> entries from a file.
621 * @deprecated Deprecated for removal since 0.17: Use <inputIncludeFile> instead.
622 */
623 @Deprecated
624 @Parameter(property = "rat.IncludesFile")
625 public void setIncludesFile(String includesFile) {
626 setArg("includes-file", includesFile);
627 }
628 /**
629 * Includes files defined in standard collections based on commonly occurring groups. Includes any path matcher actions but DOES NOT include any file processor actions. Arguments should be StandardCollection. (See Argument Types for clarification)
630 * @param inputIncludeStd Files defined in standard collections based on commonly occurring groups.
631 */
632 @Parameter
633 public void setInputIncludeStds(String[] inputIncludeStd) {
634 addArg("input-include-std", inputIncludeStd);
635 }
636 /**
637 * Includes files defined in standard collections based on commonly occurring groups. Includes any path matcher actions but DOES NOT include any file processor actions. Arguments should be StandardCollection. (See Argument Types for clarification)
638 * @param inputIncludeStd Files defined in standard collections based on commonly occurring groups.
639 */
640 @Parameter
641 public void setInputIncludeStd(String inputIncludeStd) {
642 addArg("input-include-std", inputIncludeStd);
643 }
644 /**
645 * Scans hidden directories.
646 * @param scanHiddenDirectories The state
647 * @deprecated Deprecated for removal since 0.17: Use <inputIncludeStd> with 'HIDDEN_DIR' argument instead.
648 */
649 @Deprecated
650 @Parameter(property = "rat.ScanHiddenDirectories")
651 public void setScanHiddenDirectories(boolean scanHiddenDirectories) {
652 if (scanHiddenDirectories) {
653 setArg("scan-hidden-directories", null);
654 } else {
655 removeArg("scan-hidden-directories");
656 }
657 }
658 /**
659 * Parse SCM based exclusion files to exclude specified files and directories. This action can apply to any standard collection that implements a file processor. Arguments should be StandardCollection. (See Argument Types for clarification)
660 * @param inputExcludeParsedScm SCM based exclusion files to exclude specified files and directories.
661 */
662 @Parameter
663 public void setInputExcludeParsedScms(String[] inputExcludeParsedScm) {
664 addArg("input-exclude-parsed-scm", inputExcludeParsedScm);
665 }
666 /**
667 * Parse SCM based exclusion files to exclude specified files and directories. This action can apply to any standard collection that implements a file processor. Arguments should be StandardCollection. (See Argument Types for clarification)
668 * @param inputExcludeParsedScm SCM based exclusion files to exclude specified files and directories.
669 */
670 @Parameter
671 public void setInputExcludeParsedScm(String inputExcludeParsedScm) {
672 addArg("input-exclude-parsed-scm", inputExcludeParsedScm);
673 }
674 /**
675 * XSLT stylesheet to use when creating the report. Either an external xsl file may be specified or one of the internal named sheets. Argument should be a StyleSheet. (See Argument Types for clarification)
676 * @param outputStyle Stylesheet to use when creating the report.
677 */
678 @Parameter(property = "rat.OutputStyle")
679 public void setOutputStyle(String outputStyle) {
680 setArg("output-style", outputStyle);
681 }
682 /**
683 * XSLT stylesheet to use when creating the report. Argument should be a StyleSheet. (See Argument Types for clarification)
684 * @param stylesheet Stylesheet to use when creating the report.
685 * @deprecated Deprecated for removal since 0.17: Use <outputStyle> instead.
686 */
687 @Deprecated
688 @Parameter(property = "rat.Stylesheet")
689 public void setStylesheet(String stylesheet) {
690 setArg("stylesheet", stylesheet);
691 }
692 /**
693 * forces XML output rather than the textual report.
694 * @param xml The state
695 * @deprecated Deprecated for removal since 0.17: Use <outputStyle> with the 'xml' argument instead.
696 */
697 @Deprecated
698 @Parameter(property = "rat.Xml")
699 public void setXml(boolean xml) {
700 if (xml) {
701 setArg("xml", null);
702 } else {
703 removeArg("xml");
704 }
705 }
706 /**
707 * List the defined licenses. Argument should be a LicenseFilter. (See Argument Types for clarification)
708 * @param outputLicenses The defined licenses.
709 */
710 @Parameter(property = "rat.OutputLicenses", defaultValue = "NONE")
711 public void setOutputLicenses(String outputLicenses) {
712 setArg("output-licenses", outputLicenses);
713 }
714 /**
715 * List the defined licenses. Argument should be a LicenseFilter. (See Argument Types for clarification)
716 * @param listLicenses The defined licenses.
717 * @deprecated Deprecated for removal since 0.17: Use <outputLicenses> instead.
718 */
719 @Deprecated
720 @Parameter(property = "rat.ListLicenses")
721 public void setListLicenses(String listLicenses) {
722 setArg("list-licenses", listLicenses);
723 }
724 /**
725 * List the defined license families. Argument should be a LicenseFilter. (See Argument Types for clarification)
726 * @param outputFamilies The defined license families.
727 */
728 @Parameter(property = "rat.OutputFamilies", defaultValue = "NONE")
729 public void setOutputFamilies(String outputFamilies) {
730 setArg("output-families", outputFamilies);
731 }
732 /**
733 * List the defined license families. Argument should be a LicenseFilter. (See Argument Types for clarification)
734 * @param listFamilies The defined license families.
735 * @deprecated Deprecated for removal since 0.17: Use <outputFamilies> instead.
736 */
737 @Deprecated
738 @Parameter(property = "rat.ListFamilies")
739 public void setListFamilies(String listFamilies) {
740 setArg("list-families", listFamilies);
741 }
742 /**
743 * If set do not update the files but generate the reports.
744 * @param dryRun The state
745 */
746 @Parameter(property = "rat.DryRun")
747 public void setDryRun(boolean dryRun) {
748 if (dryRun) {
749 setArg("dry-run", null);
750 } else {
751 removeArg("dry-run");
752 }
753 }
754 /**
755 * Define the output file where to write a report to. Argument should be a File. (See Argument Types for clarification)
756 * @param out The output file where to write a report to.
757 * @deprecated Deprecated for removal since 0.17: Use <outputFile> instead.
758 */
759 @Deprecated
760 @Parameter(property = "rat.Out")
761 public void setOut(String out) {
762 setArg("out", out);
763 }
764 /**
765 * Define the output file where to write a report to. Argument should be a File. (See Argument Types for clarification)
766 * @param outputFile The output file where to write a report to.
767 */
768 @Parameter(property = "rat.OutputFile", defaultValue = "${project.build.directory}/rat.txt")
769 public void setOutputFile(String outputFile) {
770 setArg("output-file", outputFile);
771 }
772 /**
773 * Specifies the level of detail in ARCHIVE file reporting. Argument should be a ProcessingType. (See Argument Types for clarification)
774 * @param outputArchive The level of detail in ARCHIVE file reporting.
775 */
776 @Parameter(property = "rat.OutputArchive", defaultValue = "NOTIFICATION")
777 public void setOutputArchive(String outputArchive) {
778 setArg("output-archive", outputArchive);
779 }
780 /**
781 * Specifies the level of detail in STANDARD file reporting. Argument should be a ProcessingType. (See Argument Types for clarification)
782 * @param outputStandard The level of detail in STANDARD file reporting.
783 */
784 @Parameter(property = "rat.OutputStandard", defaultValue = "ABSENCE")
785 public void setOutputStandard(String outputStandard) {
786 setArg("output-standard", outputStandard);
787 }
788 /**
789 * Print information about registered licenses.
790 * @param helpLicenses The state
791 */
792 @Parameter(property = "rat.HelpLicenses")
793 public void setHelpLicenses(boolean helpLicenses) {
794 if (helpLicenses) {
795 setArg("help-licenses", null);
796 } else {
797 removeArg("help-licenses");
798 }
799 }
800 }