diff --git a/apache-rat-core/src/main/java/org/apache/rat/OptionCollection.java b/apache-rat-core/src/main/java/org/apache/rat/OptionCollection.java index 7a993cb99..39bf463ca 100644 --- a/apache-rat-core/src/main/java/org/apache/rat/OptionCollection.java +++ b/apache-rat-core/src/main/java/org/apache/rat/OptionCollection.java @@ -71,26 +71,6 @@ private OptionCollection() { /** The Help option */ public static final Option HELP = new Option("?", "help", false, "Print help for the RAT command line interface and exit."); - /** A mapping of {@code argName(value)} values to a description of those values. */ - @Deprecated - private static final Map> ARGUMENT_TYPES; - static { - ARGUMENT_TYPES = new TreeMap<>(); - for (ArgumentType argType : ArgumentType.values()) { - ARGUMENT_TYPES.put(argType.getDisplayName(), argType.description); - } - } - - /** - * Gets the mapping of {@code argName(value)} values to a description of those values. - * @return the mapping of {@code argName(value)} values to a description of those values. - * @deprecated use {@link ArgumentType} - */ - @Deprecated - public static Map> getArgumentTypes() { - return Collections.unmodifiableMap(ARGUMENT_TYPES); - } - /** * Join a collection of objects together as a comma separated list of their string values. * @param args the objects to join together. diff --git a/apache-rat-core/src/main/java/org/apache/rat/analysis/IHeaderMatcher.java b/apache-rat-core/src/main/java/org/apache/rat/analysis/IHeaderMatcher.java index d2086d9f4..338831526 100644 --- a/apache-rat-core/src/main/java/org/apache/rat/analysis/IHeaderMatcher.java +++ b/apache-rat-core/src/main/java/org/apache/rat/analysis/IHeaderMatcher.java @@ -20,14 +20,6 @@ import org.apache.rat.config.parameters.Description; import org.apache.rat.config.parameters.DescriptionBuilder; -import org.apache.rat.configuration.builders.AllBuilder; -import org.apache.rat.configuration.builders.AnyBuilder; -import org.apache.rat.configuration.builders.CopyrightBuilder; -import org.apache.rat.configuration.builders.MatcherRefBuilder; -import org.apache.rat.configuration.builders.NotBuilder; -import org.apache.rat.configuration.builders.RegexBuilder; -import org.apache.rat.configuration.builders.SpdxBuilder; -import org.apache.rat.configuration.builders.TextBuilder; /** * Performs explicit checks against a line from the header of a file. For @@ -91,85 +83,5 @@ interface Builder { default Description getDescription() { return DescriptionBuilder.buildMap(this.getClass()); } - - /** - * @return an instance of the standard TextBuilder. - * @see TextBuilder - * @deprecated Use new TextBuilder() - */ - @Deprecated // since 0.17 - static TextBuilder text() { - return new TextBuilder(); - } - - /** - * @return an instance of the standard AnyBuilder. - * @see AnyBuilder - * @deprecated Use new AnyBuilder() - */ - @Deprecated // since 0.17 - static AnyBuilder any() { - return new AnyBuilder(); - } - - /** - * @return an instance of the standard AllBuilder. - * @see AllBuilder - * @deprecated Use new AllBuilder() - */ - @Deprecated // since 0.17 - static AllBuilder all() { - return new AllBuilder(); - } - - /** - * @return an instance of the standard CopyrightBuilder. - * @see CopyrightBuilder - * @deprecated Use new CopyrightBuilder() - */ - @Deprecated // since 0.17 - static CopyrightBuilder copyright() { - return new CopyrightBuilder(); - } - - /** - * @return an instance of the standard SpdxBuilder. - * @see SpdxBuilder - * @deprecated Use new SpdxBuilder() - */ - @Deprecated // since 0.17 - static SpdxBuilder spdx() { - return new SpdxBuilder(); - } - - /** - * @return an instance of the standard MatcherRefBuilder. - * @see MatcherRefBuilder - * @deprecated Use new MatcherRefBuilder() - */ - @Deprecated // since 0.17 - static MatcherRefBuilder matcherRef() { - return new MatcherRefBuilder(); - } - - /** - * @return an instance of the standard NotBuilder. - * @see NotBuilder - * @deprecated Use new NotBuilder() - */ - @Deprecated // since 0.17 - static NotBuilder not() { - return new NotBuilder(); - } - - /** - * @return an instance of the standard RegexBuilder. - * @see RegexBuilder - * @deprecated Use new RegexBuilder() - */ - @Deprecated // since 0.17 - static RegexBuilder regex() { - return new RegexBuilder(); - } } } diff --git a/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java b/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java deleted file mode 100644 index 83b8494b9..000000000 --- a/apache-rat-core/src/main/java/org/apache/rat/analysis/license/BaseLicense.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 org.apache.rat.analysis.license; - -import org.apache.rat.DeprecationReporter; -import org.apache.rat.license.ILicenseFamily; - -@Deprecated // remove in v1.0 -@DeprecationReporter.Info(since = "0.16", forRemoval = true, use = "new configuration options") -public abstract class BaseLicense implements DeprecatedConfig { - private String licenseFamilyCategory; - private String licenseFamilyName; - private String notes; - - public BaseLicense() { - DeprecationReporter.logDeprecated(BaseLicense.class); - } - - public String getLicenseFamilyCategory() { - return licenseFamilyCategory; - } - - public void setLicenseFamilyCategory(String pDocumentCategory) { - licenseFamilyCategory = pDocumentCategory; - } - - public String getLicenseFamilyName() { - return licenseFamilyName; - } - - public void setLicenseFamilyName(String pLicenseFamilyCategory) { - licenseFamilyName = pLicenseFamilyCategory; - } - - public String getNotes() { - return notes; - } - - public void setNotes(String pNotes) { - notes = pNotes; - } - - @Override - public final ILicenseFamily getLicenseFamily() { - return ILicenseFamily.builder() - .setLicenseFamilyCategory(licenseFamilyCategory) - .setLicenseFamilyName(licenseFamilyName) - .build(); - } -} diff --git a/apache-rat-core/src/main/java/org/apache/rat/analysis/license/DeprecatedConfig.java b/apache-rat-core/src/main/java/org/apache/rat/analysis/license/DeprecatedConfig.java deleted file mode 100644 index d9d40e4fc..000000000 --- a/apache-rat-core/src/main/java/org/apache/rat/analysis/license/DeprecatedConfig.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 org.apache.rat.analysis.license; - -import org.apache.rat.DeprecationReporter; -import org.apache.rat.license.ILicense; -import org.apache.rat.license.ILicenseFamily; - -/** - * A temporary interface for deprecated configuration options. - */ -@Deprecated // remove in v1.0 -@DeprecationReporter.Info(since = "0.16", forRemoval = true, use = "new configuration options") -public interface DeprecatedConfig { - /** - * @return the license definition. - */ - ILicense.Builder getLicense(); - /** - * @return the license family definition. - */ - ILicenseFamily getLicenseFamily(); -} diff --git a/apache-rat-core/src/main/java/org/apache/rat/analysis/license/FullTextMatchingLicense.java b/apache-rat-core/src/main/java/org/apache/rat/analysis/license/FullTextMatchingLicense.java deleted file mode 100644 index 8a16c272e..000000000 --- a/apache-rat-core/src/main/java/org/apache/rat/analysis/license/FullTextMatchingLicense.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 org.apache.rat.analysis.license; - -import org.apache.rat.DeprecationReporter; -import org.apache.rat.configuration.builders.TextBuilder; -import org.apache.rat.license.ILicense; - -/** - * Accumulates all letters and numbers contained inside the header and - * compares it to the full text of a given license (after reducing it - * to letters and numbers as well). - * - *

The text comparison is case-insensitive but assumes only - * characters in the US-ASCII charset are being matched.

- * - * @deprecated Use new configuration options - */ -@Deprecated // Since 0.16 -@DeprecationReporter.Info(since = "0.16", forRemoval = true, use = "new configuration options") -public class FullTextMatchingLicense extends BaseLicense { - - private String text; - - /** constructor */ - public FullTextMatchingLicense() { - DeprecationReporter.logDeprecated(FullTextMatchingLicense.class); - } - - /** - * Set the text to match - * @param text the text to match - */ - public final void setFullText(String text) { - this.text = text; - } - - @Override - public ILicense.Builder getLicense() { - return ILicense.builder() - .setFamily(getLicenseFamilyCategory()) - .setName(getLicenseFamilyName()) - .setMatcher(new TextBuilder().setSimpleText(text)) - .setNote(getNotes()); - } -} diff --git a/apache-rat-core/src/main/java/org/apache/rat/analysis/license/SimplePatternBasedLicense.java b/apache-rat-core/src/main/java/org/apache/rat/analysis/license/SimplePatternBasedLicense.java deleted file mode 100644 index 21a3230ea..000000000 --- a/apache-rat-core/src/main/java/org/apache/rat/analysis/license/SimplePatternBasedLicense.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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 org.apache.rat.analysis.license; - -import java.util.Arrays; - -import org.apache.rat.DeprecationReporter; -import org.apache.rat.configuration.builders.AbstractBuilder; -import org.apache.rat.configuration.builders.AnyBuilder; -import org.apache.rat.configuration.builders.TextBuilder; -import org.apache.rat.license.ILicense; - - -/** - * @since Rat 0.8 - * @deprecated Use new configuration options - */ -@Deprecated // Since 0.16 -@DeprecationReporter.Info(since = "0.16", forRemoval = true, use = "new configuration options") -public class SimplePatternBasedLicense extends BaseLicense { - private String[] patterns; - - public SimplePatternBasedLicense() { - DeprecationReporter.logDeprecated(SimplePatternBasedLicense.class); - } - - public String[] getPatterns() { - return patterns; - } - - public void setPatterns(String[] pPatterns) { - patterns = pPatterns; - } - - private AbstractBuilder getMatcher() { - if (patterns.length == 1) { - return new TextBuilder().setSimpleText(patterns[0]); - } else { - AnyBuilder any = new AnyBuilder(); - Arrays.stream(patterns).map(s -> new TextBuilder().setSimpleText(s)).forEach(any::addEnclosed); - return any; - } - } - - @Override - public ILicense.Builder getLicense() { - return ILicense.builder() - .setFamily(getLicenseFamilyCategory()) - .setName(getLicenseFamilyName()) - .setMatcher(getMatcher()) - .setNote(getNotes()); - } -} diff --git a/apache-rat-core/src/main/java/org/apache/rat/commandline/Arg.java b/apache-rat-core/src/main/java/org/apache/rat/commandline/Arg.java index a9a2d5e79..6b9531318 100644 --- a/apache-rat-core/src/main/java/org/apache/rat/commandline/Arg.java +++ b/apache-rat-core/src/main/java/org/apache/rat/commandline/Arg.java @@ -34,7 +34,6 @@ import org.apache.commons.cli.AlreadySelectedException; import org.apache.commons.cli.CommandLine; -import org.apache.commons.cli.DeprecatedAttributes; import org.apache.commons.cli.Option; import org.apache.commons.cli.OptionGroup; import org.apache.commons.cli.Options; @@ -70,49 +69,31 @@ public enum Arg { * Defines options to add copyright to files */ EDIT_COPYRIGHT(new OptionGroup() - .addOption(Option.builder("c") - .longOpt("copyright").hasArg() - .deprecated(DeprecatedAttributes.builder().setForRemoval(true).setSince("0.17") - .setDescription(StdMsgs.useMsg("--edit-copyright")).get()) - .desc("The copyright message to use in the license headers.") - .build()) .addOption(Option.builder().longOpt("edit-copyright").hasArg() .desc("The copyright message to use in the license headers. Usually in the form of \"Copyright 2008 Foo\". " + "Only valid with --edit-license") - .build())), + .build()) + ), /** * Causes file updates to overwrite existing files. */ EDIT_OVERWRITE(new OptionGroup() - .addOption(Option.builder("f").longOpt("force") - .deprecated(DeprecatedAttributes.builder().setForRemoval(true).setSince("0.17") - .setDescription(StdMsgs.useMsg("--edit-overwrite")).get()) - .desc("Forces any changes in files to be written directly to the source files so that new files are not created.") - .build()) .addOption(Option.builder().longOpt("edit-overwrite") .desc("Forces any changes in files to be written directly to the source files so that new files are not created. " + "Only valid with --edit-license.") - .build())), + .build()) + ), /** * Defines options to add licenses to files */ EDIT_ADD(new OptionGroup() - .addOption(Option.builder("a") - .deprecated(DeprecatedAttributes.builder().setForRemoval(true).setSince("0.17") - .setDescription(StdMsgs.useMsg("--edit-license")).get()) - .build()) - .addOption(Option.builder("A").longOpt("addLicense") - .deprecated(DeprecatedAttributes.builder().setForRemoval(true).setSince("0.17") - .setDescription(StdMsgs.useMsg("--edit-license")).get()) - .desc("Add the Apache-2.0 license header to any file with an unknown license that is not in the exclusion list.") - .build()) .addOption(Option.builder().longOpt("edit-license").desc( "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 --edit-overwrite option.").build() - )), + + "to force the modification of existing files use the --edit-overwrite option.").build()) + ), //////////////////////////// CONFIGURATION OPTIONS /** @@ -124,26 +105,14 @@ public enum Arg { .converter(Converters.FILE_CONVERTER) .type(File.class) .build()) - .addOption(Option.builder().longOpt("licenses").hasArgs().argName("File") - .desc("File names for system configuration.") - .deprecated(DeprecatedAttributes.builder().setSince("0.17").setForRemoval(true).setDescription(StdMsgs.useMsg("--config")).get()) - .converter(Converters.FILE_CONVERTER) - .type(File.class) - .build())), + ), /** * Group of options that skip the default configuration file */ CONFIGURATION_NO_DEFAULTS(new OptionGroup() .addOption(Option.builder().longOpt("configuration-no-defaults") - .desc("Ignore default configuration.").build()) - .addOption(Option.builder().longOpt("no-default-licenses") - .deprecated(DeprecatedAttributes.builder() - .setSince("0.17") - .setForRemoval(true) - .setDescription(StdMsgs.useMsg("--configuration-no-defaults")).get()) - .desc("Ignore default configuration.") - .build())), + .desc("Ignore default configuration.").build())), /** * Option that adds approved licenses to the list @@ -152,7 +121,8 @@ public enum Arg { .desc("A comma separated list of approved License IDs. These licenses will be added to the list of approved licenses.") .converter(Converters.TEXT_LIST_CONVERTER) .type(String[].class) - .build())), + .build()) + ), /** * Option that adds approved licenses from a file @@ -161,7 +131,8 @@ public enum Arg { .desc("Name of file containing comma separated lists of approved License IDs.") .converter(Converters.FILE_CONVERTER) .type(File.class) - .build())), + .build()) + ), /** * Option that specifies approved license families @@ -170,7 +141,8 @@ public enum Arg { .desc("A comma separated list of approved license family IDs. These license families will be added to the list of approved license families.") .converter(Converters.TEXT_LIST_CONVERTER) .type(String[].class) - .build())), + .build()) + ), /** * Option that specifies approved license families from a file @@ -190,7 +162,8 @@ public enum Arg { "Once licenses are removed they can not be added back.") .converter(Converters.TEXT_LIST_CONVERTER) .type(String[].class) - .build())), + .build()) + ), /** * Option to read a file licenses to be removed from the approved list. @@ -201,7 +174,8 @@ public enum Arg { .desc("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.") - .build())), + .build()) + ), /** * Option to list license families to remove from the approved list. @@ -213,7 +187,8 @@ public enum Arg { "Once license families are removed they can not be added back.") .converter(Converters.TEXT_LIST_CONVERTER) .type(String[].class) - .build())), + .build()) + ), /** * Option to read a list of license families to remove from the approved list. @@ -224,7 +199,8 @@ public enum Arg { "Once license families are removed they can not be added back.") .type(File.class) .converter(Converters.FILE_CONVERTER) - .build())), + .build()) + ), /** * Option to specify an acceptable number of various counters. @@ -233,7 +209,8 @@ public enum Arg { .desc("The acceptable maximum number for the specified counter. A value of '-1' specifies an unlimited number.") .converter(Converters.COUNTER_CONVERTER) .type(Pair.class) - .build())), + .build()) + ), /** * Option to specify an acceptable number of various counters. @@ -242,7 +219,8 @@ public enum Arg { .desc("The minimum number for the specified counter.") .converter(Converters.COUNTER_CONVERTER) .type(Pair.class) - .build())), + .build()) + ), ////////////////// INPUT OPTIONS /** @@ -256,37 +234,28 @@ public enum Arg { "argument is located.") .converter(Converters.FILE_CONVERTER) .type(File.class) - .build())), + .build()) + ), /** * Excludes files by expression */ EXCLUDE(new OptionGroup() - .addOption(Option.builder("e").longOpt("exclude").hasArgs().argName("Expression") - .deprecated(DeprecatedAttributes.builder().setForRemoval(true).setSince("0.17") - .setDescription(StdMsgs.useMsg("--input-exclude")).get()) - .desc("Excludes files matching .") - .build()) .addOption(Option.builder().longOpt("input-exclude").hasArgs().argName("Expression") .desc("Excludes files matching .") - .build())), + .build()) + ), /** * Excludes files based on the contents of a file. */ EXCLUDE_FILE(new OptionGroup() - .addOption(Option.builder("E").longOpt("exclude-file") - .argName("File").hasArg().type(File.class) - .converter(Converters.FILE_CONVERTER) - .deprecated(DeprecatedAttributes.builder().setForRemoval(true).setSince("0.17") - .setDescription(StdMsgs.useMsg("--input-exclude-file")).get()) - .desc("Reads entries from a file. Entries will be excluded from processing.") - .build()) .addOption(Option.builder().longOpt("input-exclude-file") .argName("File").hasArg().type(File.class) .converter(Converters.FILE_CONVERTER) .desc("Reads entries from a file. Entries will be excluded from processing.") - .build())), + .build()) + ), /** * Excludes files based on standard groupings. */ @@ -315,11 +284,6 @@ public enum Arg { .addOption(Option.builder().longOpt("input-include").hasArgs().argName("Expression") .desc("Includes files matching . Will override excluded files.") .build()) - .addOption(Option.builder().longOpt("include").hasArgs().argName("Expression") - .desc("Includes files matching . Will override excluded files.") - .deprecated(DeprecatedAttributes.builder().setForRemoval(true).setSince("0.17") - .setDescription(StdMsgs.useMsg("--input-include")).get()) - .build()) ), /** @@ -331,13 +295,7 @@ public enum Arg { .converter(Converters.FILE_CONVERTER) .desc("Reads entries from a file. Entries will override excluded files.") .build()) - .addOption(Option.builder().longOpt("includes-file") - .argName("File").hasArg().type(File.class) - .converter(Converters.FILE_CONVERTER) - .desc("Reads entries from a file. Entries will be excluded from processing.") - .deprecated(DeprecatedAttributes.builder().setForRemoval(true).setSince("0.17") - .setDescription(StdMsgs.useMsg("--input-include-file")).get()) - .build())), + ), /** * Includes files based on standard groups. @@ -349,11 +307,6 @@ public enum Arg { "Includes any path matcher actions but DOES NOT include any file processor actions.") .type(StandardCollection.class) .build()) - .addOption(Option.builder().longOpt("scan-hidden-directories") - .desc("Scans hidden directories.") - .deprecated(DeprecatedAttributes.builder().setForRemoval(true).setSince("0.17") - .setDescription(StdMsgs.useMsg("--input-include-std with 'HIDDEN_DIR' argument")).get()).build() - ) ), /** @@ -369,15 +322,6 @@ public enum Arg { .build()) ), - /** - * Stop processing an input stream and declare an input file. - */ - DIR(new OptionGroup().addOption(Option.builder().option("d").longOpt("dir").hasArg() - .type(File.class) - .desc("Used to indicate end of list when using options that take multiple arguments.").argName("DirOrArchive") - .deprecated(DeprecatedAttributes.builder().setForRemoval(true).setSince("0.17") - .setDescription("Use the standard '--' to signal the end of arguments.").get()).build())), - /////////////// OUTPUT OPTIONS /** * Defines the stylesheet to use. @@ -387,17 +331,7 @@ public enum Arg { .desc("XSLT stylesheet to use when creating the report. " + "Either an external xsl file may be specified or one of the internal named sheets.") .build()) - .addOption(Option.builder("s").longOpt("stylesheet").hasArg().argName("StyleSheet") - .deprecated(DeprecatedAttributes.builder().setSince("0.17").setForRemoval(true).setDescription(StdMsgs.useMsg("--output-style")).get()) - .desc("XSLT stylesheet to use when creating the report.") - .build()) - .addOption(Option.builder("x").longOpt("xml") - .deprecated(DeprecatedAttributes.builder() - .setSince("0.17") - .setForRemoval(true) - .setDescription(StdMsgs.useMsg("--output-style with the 'xml' argument")).get()) - .desc("forces XML output rather than the textual report.") - .build())), + ), /** * Specifies the license definitions that should be included in the output. @@ -407,11 +341,7 @@ public enum Arg { .desc("List the defined licenses.") .converter(s -> LicenseSetFactory.LicenseFilter.valueOf(s.toUpperCase())) .build()) - .addOption(Option.builder().longOpt("list-licenses").hasArg().argName("LicenseFilter") - .desc("List the defined licenses.") - .converter(s -> LicenseSetFactory.LicenseFilter.valueOf(s.toUpperCase())) - .deprecated(DeprecatedAttributes.builder().setSince("0.17").setForRemoval(true).setDescription(StdMsgs.useMsg("--output-licenses")).get()) - .build())), + ), /** * Specifies the license families that should be included in the output. @@ -421,11 +351,7 @@ public enum Arg { .desc("List the defined license families.") .converter(s -> LicenseSetFactory.LicenseFilter.valueOf(s.toUpperCase())) .build()) - .addOption(Option.builder().longOpt("list-families").hasArg().argName("LicenseFilter") - .desc("List the defined license families.") - .converter(s -> LicenseSetFactory.LicenseFilter.valueOf(s.toUpperCase())) - .deprecated(DeprecatedAttributes.builder().setSince("0.17").setForRemoval(true).setDescription(StdMsgs.useMsg("--output-families")).get()) - .build())), + ), /** * Specifies the log level to log messages at. @@ -447,17 +373,12 @@ public enum Arg { * Specifies where the output should be written. */ OUTPUT_FILE(new OptionGroup() - .addOption(Option.builder().option("o").longOpt("out").hasArg().argName("File") - .desc("Define the output file where to write a report to.") - .deprecated(DeprecatedAttributes.builder().setSince("0.17").setForRemoval(true).setDescription(StdMsgs.useMsg("--output-file")).get()) - .type(File.class) - .converter(Converters.FILE_CONVERTER) - .build()) .addOption(Option.builder().longOpt("output-file").hasArg().argName("File") .desc("Define the output file where to write a report to.") .type(File.class) .converter(Converters.FILE_CONVERTER) - .build())), + .build()) + ), /** * Specifies the level of reporting detail for archive files. @@ -870,18 +791,12 @@ private static void processOutputArgs(final ArgumentContext context) { if (OUTPUT_STYLE.isSelected()) { String selected = OUTPUT_STYLE.getSelected().getKey(); // is not null due to above isSelected()-call - if ("x".equals(selected)) { - // display deprecated message. - context.getCommandLine().hasOption("x"); - context.getConfiguration().setStyleSheet(StyleSheets.getStyleSheet("xml")); - } else { - String[] style = context.getCommandLine().getOptionValues(OUTPUT_STYLE.getSelected()); - if (style.length != 1) { - DefaultLog.getInstance().error("Please specify a single stylesheet"); - throw new ConfigurationException("Please specify a single stylesheet"); - } - context.getConfiguration().setStyleSheet(StyleSheets.getStyleSheet(style[0])); + String[] style = context.getCommandLine().getOptionValues(OUTPUT_STYLE.getSelected()); + if (style.length != 1) { + DefaultLog.getInstance().error("Please specify a single stylesheet"); + throw new ConfigurationException("Please specify a single stylesheet"); } + context.getConfiguration().setStyleSheet(StyleSheets.getStyleSheet(style[0])); } } diff --git a/apache-rat-core/src/main/java/org/apache/rat/header/ArrayCharFilter.java b/apache-rat-core/src/main/java/org/apache/rat/header/ArrayCharFilter.java deleted file mode 100644 index d30d6bebb..000000000 --- a/apache-rat-core/src/main/java/org/apache/rat/header/ArrayCharFilter.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 org.apache.rat.header; - -import org.apache.rat.DeprecationReporter; - -@Deprecated // since 0.17 -@DeprecationReporter.Info(since = "0.17", forRemoval = true) -class ArrayCharFilter implements CharFilter { - - private final char[] filtered; - private final int length; - - protected ArrayCharFilter(final char[] filtered) { - super(); - DeprecationReporter.logDeprecated(this.getClass()); - this.filtered = filtered; - length = filtered.length; - } - - public boolean isFilteredOut(char character) { - boolean result = false; - for(int i = 0; i < length; i++) { - if (character == filtered[i]) { - result = true; - break; - } - } - return result; - } - -} diff --git a/apache-rat-core/src/main/java/org/apache/rat/header/CharFilter.java b/apache-rat-core/src/main/java/org/apache/rat/header/CharFilter.java deleted file mode 100644 index be80825f3..000000000 --- a/apache-rat-core/src/main/java/org/apache/rat/header/CharFilter.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 org.apache.rat.header; - -import org.apache.rat.DeprecationReporter; - -@Deprecated // since 0.17 -@DeprecationReporter.Info(since = "0.17", forRemoval = true) -interface CharFilter { - - /** - * Is the given character filtered out? - * @param character character to be filtered - * @return true if this character should be filtered out, - * false if this character should be filtered in - */ - boolean isFilteredOut(char character); -} diff --git a/apache-rat-core/src/main/java/org/apache/rat/header/FilteringSequenceFactory.java b/apache-rat-core/src/main/java/org/apache/rat/header/FilteringSequenceFactory.java deleted file mode 100644 index 07213bf11..000000000 --- a/apache-rat-core/src/main/java/org/apache/rat/header/FilteringSequenceFactory.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 org.apache.rat.header; - -import org.apache.rat.DeprecationReporter; - -import java.io.IOException; -import java.io.Reader; -import java.nio.CharBuffer; -@Deprecated // since 0.17 -@DeprecationReporter.Info(since = "0.17", forRemoval = true) -class FilteringSequenceFactory { - - private static final int BUFFER_CAPACITY = 5000; - - private final CharBuffer buffer; - private final CharFilter filter; - - public FilteringSequenceFactory(final CharFilter filter) { - this(BUFFER_CAPACITY, filter); - } - - public FilteringSequenceFactory(final int capacity, final CharFilter filter) { - DeprecationReporter.logDeprecated(this.getClass()); - this.buffer = CharBuffer.allocate(capacity); - this.filter = filter; - } - - public CharSequence filter(Reader reader) throws IOException { - return filter(new LineNumberReader(reader)); - } - - public CharSequence filter(LineNumberReader reader) throws IOException { - buffer.clear(); - boolean eof = false; - while (!eof) { - final int next = reader.read(); - if (next == -1 || !buffer.hasRemaining()) { - eof = true; - } else { - final char character = (char) next; - if (!filter.isFilteredOut(character)) { - buffer.put(character); - } - } - } - buffer.limit(buffer.position()).rewind(); - return buffer; - } -} diff --git a/apache-rat-core/src/main/java/org/apache/rat/header/HeaderBean.java b/apache-rat-core/src/main/java/org/apache/rat/header/HeaderBean.java deleted file mode 100644 index 30c07b78c..000000000 --- a/apache-rat-core/src/main/java/org/apache/rat/header/HeaderBean.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 org.apache.rat.header; - -import org.apache.rat.DeprecationReporter; - -import java.util.regex.Pattern; - -@Deprecated // since 0.17 -@DeprecationReporter.Info(since = "0.17", forRemoval = true) -public class HeaderBean { - - private Pattern headerPattern; - private boolean match; - - public HeaderBean() { - super(); - } - - public HeaderBean(Pattern headerPattern, boolean match) { - super(); - DeprecationReporter.logDeprecated(this.getClass()); - this.headerPattern = headerPattern; - this.match = match; - } - - /** - * Gets the header pattern to be matched. - * @return Patter - * or null when no match is to be made - */ - public Pattern getHeaderPattern() { - return headerPattern; - } - - /** - * Sets the header pattern to be matched. - * @param headerPattern Patter - * or null when no match is to be made - */ - public void setHeaderPattern(Pattern headerPattern) { - this.headerPattern = headerPattern; - } - - public boolean isMatch() { - return match; - } - public void setMatch(boolean match) { - this.match = match; - } -} diff --git a/apache-rat-core/src/main/java/org/apache/rat/header/HeaderMatcher.java b/apache-rat-core/src/main/java/org/apache/rat/header/HeaderMatcher.java deleted file mode 100644 index 89b71b0a2..000000000 --- a/apache-rat-core/src/main/java/org/apache/rat/header/HeaderMatcher.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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 org.apache.rat.header; - -import org.apache.rat.DeprecationReporter; - -import java.io.IOException; -import java.io.Reader; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - *

Matches headers.

- *

Usage:

- *
    - *
  1. {@link #read(Reader)} content
  2. - *
  3. {@link #matches(Pattern)} against filtered content
  4. - *
- *

Note: use only from a single thread.

- * - */ -@Deprecated // since 0.17 -@DeprecationReporter.Info(since = "0.17", forRemoval = true) -public class HeaderMatcher { - - private final FilteringSequenceFactory factory; - private final HeaderBean[] headers; - private CharSequence read; - private int lines; - - public HeaderMatcher(final CharFilter filter, final int capacity) { - this(filter, capacity, null); - } - - public HeaderMatcher(final CharFilter filter, final int capacity, final HeaderBean[] headers) { - DeprecationReporter.logDeprecated(this.getClass()); - factory = new FilteringSequenceFactory(capacity, filter); - read = null; - this.headers = headers; - } - - public void read(Reader reader) throws IOException { - final LineNumberReader lineNumberReader = new LineNumberReader(reader); - read = factory.filter(lineNumberReader); - if (lineNumberReader.read() == -1) { - lines = lineNumberReader.getLineNumber(); - } else { - lines = -1; - } - if (headers != null) { - for (final HeaderBean headerBean : headers) { - if (headerBean != null) { - final Pattern headerPattern = headerBean.getHeaderPattern(); - if (headerPattern != null) { - final boolean matches = matches(headerPattern); - headerBean.setMatch(matches); - } - } - } - } - } - - /** - *

Seeks a match in the last headers read.

- *

Note that this pattern - * must not contain filtered characters. - *

- * @param pattern Pattern to match - * @return true if the pattern matches, - * false otherwise or if {@link #read(Reader)} has not been - * called - */ - public boolean matches(Pattern pattern) { - boolean result = false; - if (read != null) { - final Matcher matcher = pattern.matcher(read); - result = matcher.matches(); - } - return result; - } - - /** - * Number of lines read. - * @return the number of lines in the file - * or -1 if the file has more lines than were read - */ - public int lines() { - return lines; - } -} diff --git a/apache-rat-core/src/main/java/org/apache/rat/header/LineNumberReader.java b/apache-rat-core/src/main/java/org/apache/rat/header/LineNumberReader.java deleted file mode 100644 index cbf26e241..000000000 --- a/apache-rat-core/src/main/java/org/apache/rat/header/LineNumberReader.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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 org.apache.rat.header; - -import org.apache.rat.DeprecationReporter; - -import java.io.IOException; -import java.io.Reader; - -/** Replacement for {@link java.io.LineNumberReader}. This class - * provides a workaround for an incompatibility in the - * {@link java.io.LineNumberReader}: If the last line in a file - * isn't terminated with LF, or CR, or CRLF, then that line - * is counted in Java 16, and beyond, but wasn't counted before. - * This implementation is compatible with the latter variant, - * thus providing upwards compatibility for RAT. - */ -@Deprecated // since 0.17 -@DeprecationReporter.Info(since = "0.17", forRemoval = true) -public class LineNumberReader { - private final Reader parent; - private boolean previousCharWasCR = false; - private int lineNumber = 0; - - public LineNumberReader(Reader pReader) { - DeprecationReporter.logDeprecated(this.getClass()); - parent = pReader; - } - - public int read() throws IOException { - final int c = parent.read(); - switch (c) { - case 13: - previousCharWasCR = true; - ++lineNumber; - break; - case 10: - if (!previousCharWasCR) { - ++lineNumber; - } - previousCharWasCR = false; - break; - default: - previousCharWasCR = false; - break; - } - return c; - } - - public int getLineNumber() { - return lineNumber; - } -} diff --git a/apache-rat-core/src/main/java/org/apache/rat/license/ILicenseFamilyBuilder.java b/apache-rat-core/src/main/java/org/apache/rat/license/ILicenseFamilyBuilder.java deleted file mode 100644 index 6f0d62406..000000000 --- a/apache-rat-core/src/main/java/org/apache/rat/license/ILicenseFamilyBuilder.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 org.apache.rat.license; - -/** - * An instance of the ILicenseFamily Builder. - * @deprecated use {@link ILicenseFamily.Builder} - */ -@Deprecated -public class ILicenseFamilyBuilder extends ILicenseFamily.Builder { -} diff --git a/apache-rat-core/src/main/java/org/apache/rat/license/SimpleLicenseFamily.java b/apache-rat-core/src/main/java/org/apache/rat/license/SimpleLicenseFamily.java deleted file mode 100644 index 0759f7071..000000000 --- a/apache-rat-core/src/main/java/org/apache/rat/license/SimpleLicenseFamily.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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 org.apache.rat.license; - -import org.apache.rat.DeprecationReporter; - -/** - * An implementation of the ILicenseFamily. - */ -@Deprecated // remove in v1.0 -@DeprecationReporter.Info(since = "0.17", forRemoval = true, use = "ILicenseFamily.Builder") -public class SimpleLicenseFamily { - private String familyName; - private String familyCategory; - - public SimpleLicenseFamily() { - DeprecationReporter.logDeprecated(SimpleLicenseFamily.class); - } - - public void setFamilyName(String familyName) { - this.familyName = familyName; - } - - public void setFamilyCategory(String familyCategory) { - this.familyCategory = familyCategory; - } - - @Override - public String toString() { - return String.format("%s %s", getFamilyCategory(), getFamilyName()); - } - - public final String getFamilyName() { - return familyName; - } - - public String getFamilyCategory() { - return familyCategory; - } -} diff --git a/apache-rat-core/src/main/java/org/apache/rat/report/AbstractReport.java b/apache-rat-core/src/main/java/org/apache/rat/report/AbstractReport.java deleted file mode 100644 index 7268b1d7c..000000000 --- a/apache-rat-core/src/main/java/org/apache/rat/report/AbstractReport.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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 org.apache.rat.report; - -import org.apache.rat.api.Document; - -/** - * Abstract base class for deriving implementations of {@link RatReport}. - * @deprecated use {@link RatReport} directly. - */ -@Deprecated -public abstract class AbstractReport implements RatReport { - /** - * Empty default implementation. - */ - public void startReport() { - // Does nothing - } - - /** - * Empty default implementation. - * @param document the actual document - */ - public void report(final Document document) { - // Does nothing - } - - /** - * Empty default implementation. - */ - public void endReport() { - // Does nothing - } -} diff --git a/apache-rat-core/src/test/java/org/apache/rat/header/SimpleCharFilter.java b/apache-rat-core/src/test/java/org/apache/rat/header/SimpleCharFilter.java deleted file mode 100644 index 2b60a55d1..000000000 --- a/apache-rat-core/src/test/java/org/apache/rat/header/SimpleCharFilter.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 org.apache.rat.header; -@Deprecated // since 0.17 -public class SimpleCharFilter implements CharFilter { - - public boolean filterOut = false; - - public SimpleCharFilter() {} - - public boolean isFilteredOut(char character) { - return filterOut; - } - -} diff --git a/apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java b/apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java index 0ecbe9394..c3e38a8d5 100644 --- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java +++ b/apache-rat-plugin/src/main/java/org/apache/rat/mp/AbstractRatMojo.java @@ -21,38 +21,22 @@ import java.io.File; import java.io.IOException; import java.io.PrintWriter; -import java.net.URI; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Map; -import java.util.Objects; -import java.util.SortedSet; -import java.util.function.Consumer; -import java.util.stream.Collectors; -import java.util.stream.Stream; import org.apache.commons.cli.Option; -import org.apache.commons.lang3.StringUtils; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; -import org.apache.rat.Defaults; import org.apache.rat.OptionCollection; import org.apache.rat.ReportConfiguration; -import org.apache.rat.analysis.license.DeprecatedConfig; import org.apache.rat.commandline.Arg; import org.apache.rat.config.exclusion.StandardCollection; -import org.apache.rat.configuration.Format; -import org.apache.rat.configuration.LicenseReader; -import org.apache.rat.configuration.MatcherReader; import org.apache.rat.document.DocumentName; import org.apache.rat.document.FileDocument; import org.apache.rat.license.ILicense; -import org.apache.rat.license.ILicenseFamily; -import org.apache.rat.license.LicenseSetFactory.LicenseFilter; -import org.apache.rat.license.SimpleLicenseFamily; import org.apache.rat.plugin.BaseRatMojo; import org.apache.rat.utils.DefaultLog; import org.apache.rat.utils.Log; @@ -72,81 +56,6 @@ public abstract class AbstractRatMojo extends BaseRatMojo { @Parameter(property = "rat.basedir", defaultValue = "${basedir}", required = true) private File basedir; - /** - * Specifies the licenses to accept. By default, these are added to the default - * licenses, unless you set <addDefaultLicenseMatchers> to false. Arguments should be - * file name of <Configs> file structure. - * @deprecated Use specific configuration under <configuration>. - * @since 0.8 - */ - @Parameter - @Deprecated - private String[] defaultLicenseFiles; - - /** - * Specifies the additional licenses file. - * @deprecated Use specific configuration under <configuration>. - */ - @Parameter - @Deprecated - private String[] additionalLicenseFiles; - - /** - * Whether to add the default list of licenses. - * @deprecated Deprecated for removal since 0.17: Use <configurationNoDefaults> instead (note the change of state). - */ - @Deprecated - @Parameter(property = "rat.addDefaultLicenses", name = "addDefaultLicenses") - public void setAddDefaultLicenses(final boolean addDefaultLicenses) { - setNoDefaultLicenses(!addDefaultLicenses); - } - - /** - * Whether to add the default list of license matchers. - * @deprecated Use specific configuration under <configuration>. - */ - @Deprecated - @Parameter(property = "rat.addDefaultLicenseMatchers") - private boolean addDefaultLicenseMatchers; - - /** The list of approved licenses - * @deprecated Use specific configuration under <configuration>. - */ - @Deprecated - @Parameter - private String[] approvedLicenses; - - /** The file of approved licenses - * @deprecated Use specific configuration under <configuration>. - */ - @Deprecated - @Parameter(property = "rat.approvedFile") - private String approvedLicenseFile; - - /** - * Specifies the license families to accept. - * - * @since 0.8 - * @deprecated Use LicenseFamily section of configuration file. - */ - @Deprecated - @Parameter - private SimpleLicenseFamily[] licenseFamilies; - - /** The list of license definitions. - * @deprecated Deprecated for removal since 0.17: Use specific configuration under <configuration>. See configuration file documentation. - */ - @Deprecated - @Parameter - private Object[] licenses; - - /** The list of family definitions. - * @deprecated Use specific configuration under <configuration>. - */ - @Deprecated - @Parameter - private Family[] families; - /** * Specifies the include files character set. * If ${project.build.sourceEncoding} is not set defaults to UTF-8. @@ -161,76 +70,6 @@ public void setAddDefaultLicenses(final boolean addDefaultLicenses) { @Parameter(property = "rat.excludesFileCharset", defaultValue = "${project.build.sourceEncoding}") private String excludesFileCharset; - /** - * Whether to use the default excludes when scanning for files. The default - * excludes are: - *
    - *
  • meta data files for source code management / revision control systems, - * see {@link org.apache.rat.config.exclusion.StandardCollection}
  • - *
  • temporary files used by Maven, see - * useMavenDefaultExcludes
  • - *
  • configuration files for Eclipse, see - * useEclipseDefaultExcludes
  • - *
  • configuration files for IDEA, see - * useIdeaDefaultExcludes
  • - *
- * @deprecated When set to true specifies that the STANDARD_PATTERNS are excluded, as are - * the STANDARD_SCMS patterns. Use the various InputExclude and InputInclude elements to - * explicitly specify what to include or exclude. - */ - @Parameter(property = "rat.useDefaultExcludes", defaultValue = "true") - @Deprecated - private boolean useDefaultExcludes; - - /** - * Whether to use the Maven specific default excludes when scanning for files. - * Maven specific default excludes are given by the constant - * MAVEN_DEFAULT_EXCLUDES: The target directory, the - * cobertura.ser file, and so on. - * @deprecated When set to true specifies that the MAVEN patterns are excluded. - * Use "inputIncludeStd MAVEN" to override. - */ - @Parameter(property = "rat.useMavenDefaultExcludes", defaultValue = "true") - @Deprecated - private boolean useMavenDefaultExcludes; - - /** - * Whether to parse source code management system (SCM) ignore files and use - * their contents as excludes. At the moment this works for the following SCMs: - * - * @see org.apache.rat.config.exclusion.StandardCollection - * @deprecated When set to true specifies that the STANDARD_SCMS exclusion file - * processors are used to exclude files and directories (e.g. ".gitignore" or ".hgignore"). - * Use "inputIncludeStd STANDARD_SCMS" to override. - */ - @Parameter(property = "rat.parseSCMIgnoresAsExcludes", defaultValue = "true") - @Deprecated - private boolean parseSCMIgnoresAsExcludes; - - /** - * Whether to use the Eclipse specific default excludes when scanning for files. - * Eclipse specific default excludes are given by the constant - * ECLIPSE_DEFAULT_EXCLUDES: The .classpath and - * .project files, the .settings directory, and so on. - * @deprecated When set to true specifies that the ECLIPSE patterns are excluded. - * Use "inputIncludeStd ECLIPSE" to override. - */ - @Parameter(property = "rat.useEclipseDefaultExcludes", defaultValue = "true") - @Deprecated - private boolean useEclipseDefaultExcludes; - - /** - * Whether to use the IDEA specific default excludes when scanning for files. - * IDEA specific default excludes are given by the constant - * IDEA_DEFAULT_EXCLUDES: The *.iml, *.ipr and - * *.iws files and the .idea directory. - * @deprecated When set to true specifies that the IDEA patterns are excluded. - * Use "inputIncludeStd IDEA" to override. - */ - @Deprecated - @Parameter(property = "rat.useIdeaDefaultExcludes", defaultValue = "true") - private boolean useIdeaDefaultExcludes; - /** * Whether to exclude subprojects. This is recommended, if you want a separate * apache-rat-plugin report for each subproject. @@ -265,56 +104,6 @@ protected MavenProject getProject() { return project; } - protected Defaults.Builder getDefaultsBuilder() { - Defaults.Builder result = Defaults.builder(); - if (defaultLicenseFiles != null) { - for (String defaultLicenseFile : defaultLicenseFiles) { - result.add(defaultLicenseFile); - } - } - return result; - } - - @Deprecated // remove this for version 1.0 - private Stream getLicenses() { - if (licenses == null) { - return Stream.empty(); - } - return Arrays.stream(licenses).filter(s -> s instanceof License).map(License.class::cast); - } - - @Deprecated // remove this for version 1.0 - private Stream getDeprecatedConfigs() { - if (licenses == null) { - return Stream.empty(); - } - return Arrays.stream(licenses).filter(s -> s instanceof DeprecatedConfig).map(DeprecatedConfig.class::cast); - } - - @Deprecated // remove this for version 1.0 - private void reportDeprecatedProcessing() { - if (getDeprecatedConfigs().findAny().isPresent()) { - DefaultLog.getInstance().warn("Configuration uses deprecated configuration. You need to upgrade to v0.17 configuration options."); - } - } - - @Deprecated // remove this for version 1.0 - private void processLicenseFamilies(final ReportConfiguration config) { - List families = getDeprecatedConfigs().map(DeprecatedConfig::getLicenseFamily).filter(Objects::nonNull).collect(Collectors.toList()); - if (licenseFamilies != null) { - for (SimpleLicenseFamily slf : licenseFamilies) { - if (StringUtils.isBlank(slf.getFamilyCategory())) { - families.stream().filter(f -> f.getFamilyName().equalsIgnoreCase(slf.getFamilyName())).findFirst() - .ifPresent(config::addApprovedLicenseCategory); - } else { - config.addApprovedLicenseCategory(ILicenseFamily.builder().setLicenseFamilyCategory(slf.getFamilyCategory()) - .setLicenseFamilyName(StringUtils.defaultIfBlank(slf.getFamilyName(), slf.getFamilyCategory())) - .build()); - } - } - } - } - /** * Reads values for the Arg. * @@ -435,27 +224,6 @@ private void setIncludeExclude() { } List values = getValues(Arg.EXCLUDE); - if (values.isEmpty() && useDefaultExcludes) { - DefaultLog.getInstance().debug("Adding plexus default exclusions..."); - setInputExcludes(StandardCollection.STANDARD_PATTERNS.patterns().toArray(new String[0])); - - DefaultLog.getInstance().debug("Adding SCM default exclusions..."); - setInputExcludes(StandardCollection.STANDARD_SCMS.patterns().toArray(new String[0])); - } - - if (useMavenDefaultExcludes) { - setInputExcludeStd(StandardCollection.MAVEN.name()); - } - if (useEclipseDefaultExcludes) { - setInputExcludeStd(StandardCollection.ECLIPSE.name()); - } - if (useIdeaDefaultExcludes) { - setInputExcludeStd(StandardCollection.IDEA.name()); - } - - if (parseSCMIgnoresAsExcludes) { - setInputExcludeParsedScm(StandardCollection.STANDARD_SCMS.name()); - } } protected ReportConfiguration getConfiguration() throws MojoExecutionException { @@ -479,63 +247,6 @@ protected ReportConfiguration getConfiguration() throws MojoExecutionException { ReportConfiguration config = OptionCollection.parseCommands(basedir, args().toArray(new String[0]), o -> getLog().warn("Help option not supported"), true); - reportDeprecatedProcessing(); - - if (additionalLicenseFiles != null) { - for (String licenseFile : additionalLicenseFiles) { - URI uri = new File(licenseFile).toURI(); - Format fmt = Format.from(licenseFile); - MatcherReader mReader = fmt.matcherReader(); - if (mReader != null) { - mReader.addMatchers(uri); - } - LicenseReader lReader = fmt.licenseReader(); - if (lReader != null) { - lReader.addLicenses(uri); - config.addLicenses(lReader.readLicenses()); - config.addApprovedLicenseCategories(lReader.approvedLicenseId()); - } - } - } - if (families != null || getDeprecatedConfigs().findAny().isPresent()) { - if (log.isEnabled(Log.Level.DEBUG)) { - log.debug(format("%s license families loaded from pom", families.length)); - } - Consumer logger = super.getLog().isDebugEnabled() ? l -> log.debug(format("Family: %s", l)) - : l -> { - }; - - Consumer process = logger.andThen(config::addFamily); - getDeprecatedConfigs().map(DeprecatedConfig::getLicenseFamily).filter(Objects::nonNull).forEach(process); - if (families != null) { // TODO remove if check in v1.0 - Arrays.stream(families).map(Family::build).forEach(process); - } - } - - processLicenseFamilies(config); - - if (approvedLicenses != null && approvedLicenses.length > 0) { - Arrays.stream(approvedLicenses).forEach(config::addApprovedLicenseCategory); - } - - if (licenses != null) { - if (log.isEnabled(Log.Level.DEBUG)) { - log.debug(format("%s licenses loaded from pom", licenses.length)); - } - Consumer logger = log.isEnabled(Log.Level.DEBUG) ? l -> log.debug(format("License: %s", l)) - : l -> { - }; - Consumer addApproved = (approvedLicenses == null || approvedLicenses.length == 0) - ? l -> config.addApprovedLicenseCategory(l.getLicenseFamily()) - : l -> { - }; - - Consumer process = logger.andThen(config::addLicense).andThen(addApproved); - SortedSet families = config.getLicenseFamilies(LicenseFilter.ALL); - getDeprecatedConfigs().map(DeprecatedConfig::getLicense).filter(Objects::nonNull) - .map(x -> x.setLicenseFamilies(families).build()).forEach(process); - getLicenses().map(x -> x.build(families)).forEach(process); - } DocumentName dirName = DocumentName.builder(basedir).build(); config.addSource(new DirectoryWalker(new FileDocument(dirName, basedir, config.getDocumentExcluder(dirName)))); diff --git a/apache-rat-plugin/src/main/java/org/apache/rat/mp/All.java b/apache-rat-plugin/src/main/java/org/apache/rat/mp/All.java deleted file mode 100644 index dc863f021..000000000 --- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/All.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 org.apache.rat.mp; - -import org.apache.rat.analysis.IHeaderMatcher; -import org.apache.rat.analysis.IHeaderMatcher.Builder; -import org.apache.rat.configuration.builders.AllBuilder; - -/** - * @deprecated use Configuration file to define licenses - */ -@Deprecated -public class All extends EnclosingMatcher implements IHeaderMatcher.Builder { - - final AllBuilder builder = Builder.all(); - - public All() { - } - - @Override - protected void setMatcher(IHeaderMatcher.Builder builder) { - this.builder.addEnclosed(builder); - } - - @Override - public IHeaderMatcher build() { - return builder.build(); - } -} diff --git a/apache-rat-plugin/src/main/java/org/apache/rat/mp/Any.java b/apache-rat-plugin/src/main/java/org/apache/rat/mp/Any.java deleted file mode 100644 index 126da9346..000000000 --- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/Any.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 org.apache.rat.mp; - -import org.apache.rat.analysis.IHeaderMatcher; -import org.apache.rat.analysis.IHeaderMatcher.Builder; -import org.apache.rat.configuration.builders.AnyBuilder; - -/** - * @deprecated use Configuration file to define licenses - */ -@Deprecated -public class Any extends EnclosingMatcher implements IHeaderMatcher.Builder { - - final AnyBuilder builder = Builder.any(); - - public Any() { - } - - @Override - protected void setMatcher(IHeaderMatcher.Builder builder) { - this.builder.addEnclosed(builder); - } - - @Override - public IHeaderMatcher build() { - return builder.build(); - } -} diff --git a/apache-rat-plugin/src/main/java/org/apache/rat/mp/Copyright.java b/apache-rat-plugin/src/main/java/org/apache/rat/mp/Copyright.java deleted file mode 100644 index b693f1b90..000000000 --- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/Copyright.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 org.apache.rat.mp; - -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.rat.analysis.matchers.CopyrightMatcher; -import org.apache.rat.configuration.builders.CopyrightBuilder; - -/** - * @deprecated use Configuration file to define licenses - */ -@Deprecated -public class Copyright extends CopyrightBuilder { - - @Parameter(required = false) - private String start; - - @Parameter(required = false) - private String end; - - @Parameter(required = false) - private String owner; - - public Copyright() { - } - - @Override - public CopyrightMatcher build() { - setStart(start).setEnd(end).setOwner(owner); - return super.build(); - } -} diff --git a/apache-rat-plugin/src/main/java/org/apache/rat/mp/EnclosingMatcher.java b/apache-rat-plugin/src/main/java/org/apache/rat/mp/EnclosingMatcher.java deleted file mode 100644 index 9312e3fe8..000000000 --- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/EnclosingMatcher.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 org.apache.rat.mp; - -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.rat.analysis.IHeaderMatcher; - -/** - * @deprecated use Configuration file to define licenses - */ -@Deprecated -abstract class EnclosingMatcher { - - protected abstract void setMatcher(IHeaderMatcher.Builder builder); - - @Parameter(required = false) - public void setAll(final All all) { - setMatcher(all); - } - - @Parameter(required = false) - public void setAny(final Any any) { - setMatcher(any); - } - - @Parameter(required = false) - public void setText(Text text) { - setMatcher(text); - } - - @Parameter(required = false) - public void setCopyright(Copyright copyright) { - setMatcher(copyright); - } - - @Parameter(required = false) - public void setRegex(Regex regex) { - setMatcher(regex); - } - - @Parameter(required = false) - public void setSpdx(Spdx spdx) { - setMatcher(spdx); - } - - @Parameter(required = false) - public void setNot(Not not) { - setMatcher(not); - } -} diff --git a/apache-rat-plugin/src/main/java/org/apache/rat/mp/Family.java b/apache-rat-plugin/src/main/java/org/apache/rat/mp/Family.java deleted file mode 100644 index db9656802..000000000 --- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/Family.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 org.apache.rat.mp; - -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.rat.license.ILicenseFamily; - -/** - * @deprecated use Configuration file to define licenses - */ -@Deprecated -public class Family { - - private final ILicenseFamily.Builder builder = ILicenseFamily.builder(); - - @Parameter(required = true) - private String id; - - @Parameter(required = true) - private String name; - - public Family() { - } - - public ILicenseFamily build() { - return builder.setLicenseFamilyCategory(id).setLicenseFamilyName(name).build(); - } - - @Override - public String toString() { - return '{' + id + ':' + name + '}'; - } -} diff --git a/apache-rat-plugin/src/main/java/org/apache/rat/mp/HeaderMatcherSpecification.java b/apache-rat-plugin/src/main/java/org/apache/rat/mp/HeaderMatcherSpecification.java deleted file mode 100644 index 381f84331..000000000 --- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/HeaderMatcherSpecification.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.apache.rat.mp; - -/* - * 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. - */ - -/** - * Used to specify additional license matchers. A license matcher is basically a class, which implements - * {@link org.apache.rat.analysis.IHeaderMatcher}. - * @deprecated use Configuration file to define licenses - */ -@Deprecated -public class HeaderMatcherSpecification { - /** - * The license matchers class name. - */ - private String className; - - /** - * Returns the license matchers class name. - * - * @return Class name of the license matcher. - */ - public String getClassName() { - return className; - } - - /** - * Sets the license matchers class name. Required. - * - * @param pClassName - * Class name of the license matcher. - */ - public void setClassName(String pClassName) { - className = pClassName; - } -} diff --git a/apache-rat-plugin/src/main/java/org/apache/rat/mp/License.java b/apache-rat-plugin/src/main/java/org/apache/rat/mp/License.java deleted file mode 100644 index 6644f4349..000000000 --- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/License.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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 org.apache.rat.mp; - -import java.util.SortedSet; - -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.rat.analysis.IHeaderMatcher; -import org.apache.rat.license.ILicense; -import org.apache.rat.license.ILicenseFamily; - -/** - * @deprecated use Configuration file to define licenses - */ -@Deprecated -public class License extends EnclosingMatcher { - - private final ILicense.Builder builder = ILicense.builder(); - - @Parameter(required = false) - private String notes; - - @Parameter(required = true) - private String id; - - @Parameter(required = true) - private String family; - - @Parameter(required = true) - private String name; - - public License() { - } - - @Override - protected void setMatcher(IHeaderMatcher.Builder builder) { - this.builder.setMatcher(builder); - } - - public ILicense build(SortedSet context) { - - return builder.setLicenseFamilies(context) - .setFamily(family).setId(id) - .setName(name).setNote(notes).build(); - } - - @Override - public String toString() { - return '{' + family + ':' + id + ':' + name + '}'; - } - -} diff --git a/apache-rat-plugin/src/main/java/org/apache/rat/mp/Not.java b/apache-rat-plugin/src/main/java/org/apache/rat/mp/Not.java deleted file mode 100644 index 343e2baf0..000000000 --- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/Not.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 org.apache.rat.mp; - -import org.apache.rat.analysis.IHeaderMatcher; -import org.apache.rat.analysis.IHeaderMatcher.Builder; -import org.apache.rat.configuration.builders.NotBuilder; - -/** - * @deprecated use Configuration file to define licenses - */ -@Deprecated -public class Not extends EnclosingMatcher implements IHeaderMatcher.Builder { - - final NotBuilder builder = Builder.not(); - - public Not() { - } - - @Override - protected void setMatcher(IHeaderMatcher.Builder builder) { - this.builder.addEnclosed(builder); - } - - @Override - public IHeaderMatcher build() { - return builder.build(); - } -} diff --git a/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java b/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java index 13ea48b27..76b79ec35 100644 --- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java +++ b/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java @@ -48,87 +48,9 @@ @Mojo(name = "check", defaultPhase = LifecyclePhase.VALIDATE, threadSafe = true) public class RatCheckMojo extends AbstractRatMojo { - /** The default output file if no other is specified. - * @deprecated Use <outputFile> instead. - */ - @Deprecated - @Parameter(defaultValue = "${project.build.directory}/rat.txt") + @Parameter(defaultValue = "${project.build.directory}/rat.txt", readonly = true) private File defaultReportFile; - /** - * Where to store the report. - * @deprecated Use 'out' property instead. - */ - @Deprecated - @Parameter - public void setReportFile(final File reportFile) { - if (!reportFile.getParentFile().exists() && !reportFile.getParentFile().mkdirs()) { - getLog().error("Unable to create directory " + reportFile.getParentFile()); - } - setOutputFile(reportFile.getAbsolutePath()); - } - - /** - * Output style of the report. Use "plain" (the default) for a plain text report - * or "xml" for the raw XML report. Alternatively you can give the path of an - * XSL transformation that will be applied on the raw XML to produce the report - * written to the output file. - * @deprecated Use setStyleSheet or xml instead. - */ - @Deprecated - @Parameter(property = "rat.outputStyle") - public void setReportStyle(final String value) { - if (value.equalsIgnoreCase("xml")) { - setXml(true); - } else if (value.equalsIgnoreCase("plain")) { - setStylesheet("plain-rat"); - } else { - setStylesheet(value); - } - } - - /** - * Maximum number of files with unapproved licenses. - * @deprecated Use <counterMax>Unapproved:value</counterMax>. - */ - @Deprecated - @Parameter(property = "rat.numUnapprovedLicenses", defaultValue = "0") - private int numUnapprovedLicenses; - - /** - * Whether to add license headers; possible values are {@code forced}, - * {@code true}, and {@code false} (default). - * @deprecated Use <editLicense> and <editOverwrite>. - */ - @Deprecated - @Parameter(property = "rat.addLicenseHeaders") - public void setAddLicenseHeaders(final String addLicenseHeaders) { - switch (addLicenseHeaders.trim().toUpperCase()) { - case "FALSE": - // do nothing; - break; - case "TRUE": - setAddLicense(true); - break; - case "FORCED": - setAddLicense(true); - setForce(true); - break; - default: - throw new IllegalArgumentException("Unknown addlicense header: " + addLicenseHeaders); - } - } - - /** - * Copyright message to add to license headers. - * @deprecated Deprecated for removal since 0.17: Use <editCopyright> instead. - */ - @Deprecated - @Parameter(property = "rat.copyrightMessage") - public void setCopyrightMessage(final String copyrightMessage) { - setCopyright(copyrightMessage); - } - /** * Will ignore RAT errors and display a log message if any. Its use is NOT * RECOMMENDED, but quite convenient on occasion. @@ -154,9 +76,6 @@ public void setCopyrightMessage(final String copyrightMessage) { @Override protected ReportConfiguration getConfiguration() throws MojoExecutionException { ReportConfiguration result = super.getConfiguration(); - if (numUnapprovedLicenses > 0) { - result.getClaimValidator().setMax(ClaimStatistic.Counter.UNAPPROVED, numUnapprovedLicenses); - } return result; } diff --git a/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java b/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java index 2f883d6ed..08935be67 100644 --- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java +++ b/apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java @@ -52,6 +52,7 @@ import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.reporting.MavenMultiPageReport; import org.apache.maven.reporting.MavenReportException; +import org.apache.rat.Defaults; import org.apache.rat.ReportConfiguration; import org.apache.rat.Reporter; import org.apache.rat.VersionInfo; @@ -214,33 +215,6 @@ private SiteRenderingContext createSiteRenderingContext(final Locale locale) thr return context; } - /** - * Generate a report. - * - * @param sink the sink to use for the generation. - * @param locale the wanted locale to generate the report, could be null. - * @throws MavenReportException if any - * @deprecated use {@link #generate(Sink, SinkFactory, Locale)} instead. - */ - @Deprecated - @Override - public void generate(final org.codehaus.doxia.sink.Sink sink, final Locale locale) throws MavenReportException { - generate(sink, null, locale); - } - - /** - * Generate a report. - * - * @param sink the sink to use for the generation. - * @param locale the wanted locale to generate the report, could be null. - * @throws MavenReportException if any - * @deprecated use {@link #generate(Sink, SinkFactory, Locale)} instead. - */ - @Deprecated - public void generate(final Sink sink, final Locale locale) throws MavenReportException { - generate(sink, null, locale); - } - /** * This method is called when the report generation is invoked by * maven-site-plugin. @@ -390,7 +364,7 @@ protected void executeReport(final Locale locale) throws MavenReportException { sink.verbatim(SinkEventAttributeSet.BOXED); try { ReportConfiguration config = getConfiguration(); - config.setFrom(getDefaultsBuilder().build()); + config.setFrom(Defaults.builder().build()); logLicenses(config.getLicenses(LicenseFilter.ALL)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); config.setOut(() -> baos); diff --git a/apache-rat-plugin/src/main/java/org/apache/rat/mp/Regex.java b/apache-rat-plugin/src/main/java/org/apache/rat/mp/Regex.java deleted file mode 100644 index 8cd7b84d7..000000000 --- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/Regex.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 org.apache.rat.mp; - -import javax.inject.Named; - -import org.apache.rat.configuration.builders.RegexBuilder; - -/** - * @deprecated use Configuration file to define licenses - */ -@Deprecated -public class Regex extends RegexBuilder { - - @Named("expr") - public RegexBuilder setExpression(String expression) { - System.out.format("Calling setText() with %s\n", expression); - return super.setExpression(expression); - } - public void set(String exp) { - System.out.format("Calling set() with %s\n", exp); - setExpression(exp); - } - -} diff --git a/apache-rat-plugin/src/main/java/org/apache/rat/mp/Spdx.java b/apache-rat-plugin/src/main/java/org/apache/rat/mp/Spdx.java deleted file mode 100644 index f8d19a2c0..000000000 --- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/Spdx.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 org.apache.rat.mp; - -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.rat.configuration.builders.SpdxBuilder; - -/** - * @deprecated use Configuration file to define licenses - */ -@Deprecated -public class Spdx extends SpdxBuilder { - - @Parameter(name = "name") - public void set(String name) { - super.setName(name); - } -} diff --git a/apache-rat-plugin/src/main/java/org/apache/rat/mp/Text.java b/apache-rat-plugin/src/main/java/org/apache/rat/mp/Text.java deleted file mode 100644 index 6fc31ebaf..000000000 --- a/apache-rat-plugin/src/main/java/org/apache/rat/mp/Text.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 org.apache.rat.mp; - -import org.apache.rat.configuration.builders.TextBuilder; - -/** - * @deprecated use Configuration file to define licenses - */ -@Deprecated -public class Text extends TextBuilder { - public void set(String text) { - super.setSimpleText(text); - } -} diff --git a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/All.java b/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/All.java deleted file mode 100644 index 46ce8fbef..000000000 --- a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/All.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 org.apache.rat.anttasks; - -import org.apache.rat.DeprecationReporter; -import org.apache.rat.analysis.IHeaderMatcher; -import org.apache.rat.analysis.IHeaderMatcher.Builder; -import org.apache.rat.configuration.builders.AllBuilder; - -/** - * Creates an All matcher. - * @deprecated use configuration file. - */ -@Deprecated // since 0.17 -@DeprecationReporter.Info(since = "0.17", forRemoval = true, use = "Configuration file and element")// since 0.17 -public class All implements IHeaderMatcher.Builder { - - private final AllBuilder builder = Builder.all(); - - @Override - public IHeaderMatcher build() { - return builder.build(); - } - - public void add(IHeaderMatcher.Builder builder) { - this.builder.addEnclosed(builder); - } -} diff --git a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Any.java b/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Any.java deleted file mode 100644 index 86398f1db..000000000 --- a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Any.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 org.apache.rat.anttasks; - -import org.apache.rat.DeprecationReporter; -import org.apache.rat.analysis.IHeaderMatcher; -import org.apache.rat.configuration.builders.AnyBuilder; - -/** - * Creates an Any matcher. - * @deprecated use configuration file. - */ -@Deprecated // since 0.17 -@DeprecationReporter.Info(since = "0.17", forRemoval = true, use = "Configuration file and element")// since 0.17 -public class Any implements IHeaderMatcher.Builder { - - private final AnyBuilder builder = new AnyBuilder(); - - @Override - public IHeaderMatcher build() { - return builder.build(); - } - - public void add(IHeaderMatcher.Builder builder) { - this.builder.addEnclosed(builder); - } -} diff --git a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Copyright.java b/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Copyright.java deleted file mode 100644 index 719b20e38..000000000 --- a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Copyright.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 org.apache.rat.anttasks; - -import org.apache.rat.DeprecationReporter; -import org.apache.rat.analysis.IHeaderMatcher; -import org.apache.rat.configuration.builders.CopyrightBuilder; - -/** - * Creates a Copyright matcher. - * @deprecated use configuration file. - */ -@Deprecated // since 0.17 -@DeprecationReporter.Info(since = "0.17", forRemoval = true, use = "Configuration file and element")// since 0.17 -public class Copyright implements IHeaderMatcher.Builder { - - private final CopyrightBuilder builder = new CopyrightBuilder(); - - public void setStart(String start) { - builder.setStart(start); - } - - public void setEnd(String end) { - builder.setEnd(end); - } - - public void setOwner(String owner) { - builder.setOwner(owner); - } - - @Override - public IHeaderMatcher build() { - return builder.build(); - } - -} diff --git a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Family.java b/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Family.java deleted file mode 100644 index 42fe8b517..000000000 --- a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Family.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 org.apache.rat.anttasks; - -import org.apache.rat.DeprecationReporter; -import org.apache.rat.license.ILicenseFamily; - -/** - * Creates a License Family - * @deprecated use configuration file. - */ -@Deprecated -@DeprecationReporter.Info(since = "0.17", forRemoval = true, use = "Configuration file and element")// since 0.17 -public class Family { - - private final ILicenseFamily.Builder builder = ILicenseFamily.builder(); - - public ILicenseFamily build() { - return builder.build(); - } - - public void setId(String id) { - builder.setLicenseFamilyCategory(id); - } - - public void setName(String name) { - builder.setLicenseFamilyName(name); - } -} diff --git a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/License.java b/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/License.java deleted file mode 100644 index 7b3696237..000000000 --- a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/License.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 org.apache.rat.anttasks; - -import org.apache.rat.DeprecationReporter; -import org.apache.rat.license.ILicense; -import org.apache.rat.license.ILicenseFamily; - -import java.util.SortedSet; - -import org.apache.rat.analysis.IHeaderMatcher; - -/** - * Creates a License definition. - * @deprecated use configuration file. - */ -@Deprecated // since 0.17 -@DeprecationReporter.Info(since = "0.17", forRemoval = true, use = "Configuration file and element")// since 0.17 -public class License { - - private final ILicense.Builder builder = ILicense.builder(); - - ILicense.Builder asBuilder() { - return builder; - } - - public ILicense build(SortedSet context) { - return builder.setLicenseFamilies(context).build(); - } - - public void setNotes(String notes) { - builder.setNote(notes); - } - - public void addNotes(String notes) { - builder.setNote(notes); - } - - - public void setFamily(String licenseFamilyCategory) { - builder.setFamily(licenseFamilyCategory); - } - - public void setId(String id) { - builder.setId(id); - } - - public void setName(String name) { - builder.setName(name); - } - - public void add(IHeaderMatcher.Builder builder) { - this.builder.setMatcher(builder); - } - - public void add(IHeaderMatcher matcher) { - this.builder.setMatcher(matcher); - } -} diff --git a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Not.java b/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Not.java deleted file mode 100644 index f82a00300..000000000 --- a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Not.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 org.apache.rat.anttasks; - -import org.apache.rat.DeprecationReporter; -import org.apache.rat.analysis.IHeaderMatcher; -import org.apache.rat.analysis.IHeaderMatcher.Builder; -import org.apache.rat.configuration.builders.NotBuilder; - -/** - * Creates a Not matcher. - * @deprecated use configuration file. - */ -@Deprecated // since 0.17 -@DeprecationReporter.Info(since = "0.17", forRemoval = true, use = "Configuration file and element")// since 0.17 -public class Not implements IHeaderMatcher.Builder { - - private final NotBuilder builder = Builder.not(); - - @Override - public IHeaderMatcher build() { - return builder.build(); - } - - public void add(IHeaderMatcher.Builder builder) { - this.builder.addEnclosed(builder); - } -} diff --git a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Regex.java b/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Regex.java deleted file mode 100644 index becfcbb16..000000000 --- a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Regex.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 org.apache.rat.anttasks; - -import org.apache.rat.DeprecationReporter; -import org.apache.rat.analysis.IHeaderMatcher; -import org.apache.rat.analysis.matchers.SimpleRegexMatcher; -import org.apache.rat.configuration.builders.RegexBuilder; - -/** - * Creates a Regex matcher. - * @deprecated use configuration file. - */ -@Deprecated // since 0.17 -@DeprecationReporter.Info(since = "0.17", forRemoval = true, use = "Configuration file and element")// since 0.17 -public class Regex implements IHeaderMatcher.Builder { - - private final RegexBuilder builder = new RegexBuilder(); - - public void setExpr(String pattern) { - builder.setExpression(pattern); - } - - public void addText(String pattern) { - builder.setExpression(pattern); - } - - @Override - public SimpleRegexMatcher build() { - return builder.build(); - } -} diff --git a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Report.java b/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Report.java index add845ffa..eaa014058 100644 --- a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Report.java +++ b/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Report.java @@ -23,15 +23,11 @@ import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashSet; import java.util.List; -import java.util.Set; import java.util.stream.Collectors; import org.apache.commons.cli.Option; -import org.apache.commons.io.filefilter.IOFileFilter; import org.apache.rat.ConfigurationException; -import org.apache.rat.DeprecationReporter; import org.apache.rat.ImplementationException; import org.apache.rat.OptionCollection; import org.apache.rat.ReportConfiguration; @@ -46,7 +42,6 @@ import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.LogOutputStream; import org.apache.tools.ant.types.EnumeratedAttribute; -import org.apache.tools.ant.types.Resource; import org.apache.tools.ant.types.ResourceCollection; import org.apache.tools.ant.types.resources.Union; @@ -70,43 +65,12 @@ * */ public class Report extends BaseAntTask { - /** - * The list of licenses - */ - @Deprecated - private final List licenses = new ArrayList<>(); - /** - * The list of license families - */ - @Deprecated - private final List families = new ArrayList<>(); - /** - * the options that are deprecated. TODO remove this. - */ - private final DeprecatedConfig deprecatedConfig = new DeprecatedConfig(); + /** * will hold any nested resource collection */ private Union nestedResources; - /** - * Collection of objects that support Ant specific deprecated options - */ - private static final class DeprecatedConfig { - /** - * The input file filter - */ - private IOFileFilter inputFileFilter; - /** - * the set of approved licence categories - */ - private final Set approvedLicenseCategories = new HashSet<>(); - /** - * the set of removed (unapproved) license categories - */ - private final Set removedLicenseCategories = new HashSet<>(); - } - /** * Constructor. */ @@ -132,244 +96,6 @@ public void add(final ResourceCollection rc) { nestedResources.add(rc); } - /** - * Adds an input file filter. - * - * @param inputFileFilter The input file filter to add. - */ - @Deprecated - public void setInputFileFilter(final IOFileFilter inputFileFilter) { - DeprecationReporter.logDeprecated("element inputFileFilter", "0.17", true, "outputFile element"); - deprecatedConfig.inputFileFilter = inputFileFilter; - } - - /** - * Sets the report file. - * - * @param reportFile the report file. - * @deprecated use outputFile element - */ - @Deprecated - public void setReportFile(final File reportFile) { - DeprecationReporter.logDeprecated("element reportFile", "0.17", true, "outputFile element"); - addArg("output-file", reportFile.getAbsolutePath()); - } - - /** - * Adds an inline License definition to the system. - * - * @param license the license to add. - * @deprecated Create a custom configuration file and use the config option. - */ - @Deprecated - public void addLicense(final License license) { - licenses.add(license); - } - - /** - * Add an inline license family definition to the system. - * - * @param family the license family to add. - * @deprecated Create a custom configuration file and use the config option. - */ - @Deprecated - public void addFamily(final Family family) { - families.add(family); - } - - /** - * Adds a style sheet to the system. - * - * @param styleSheet The style sheet to use for formatting. - * @deprecated use {@link #setStylesheet(String)} - */ - @Deprecated - public void addStylesheet(final Resource styleSheet) { - DeprecationReporter.logDeprecated("element stylesheet", "0.17", true, " element"); - setStylesheet(styleSheet.getName()); - } - - /** - * Adds a given style sheet to the report. - * - * @param styleSheet style sheet to use in this report. - * @deprecated use {@link #setOutputStyle(String)} - */ - @Deprecated - public void addStyleSheet(final Resource styleSheet) { - DeprecationReporter.logDeprecated("attribute styleSheet", "0.17", true, " element"); - setOutputStyle(styleSheet.getName()); - } - - /** - * Styles the report or deliver xml document. - * - * @param styleReport true to use the plain-rat style - * @deprecated use {@link #setOutputStyle(String)} and pass "xml" or "plain-rat". - */ - @Deprecated - public void setStyleReport(final boolean styleReport) { - setOutputStyle(styleReport ? "xml" : "plain-rat"); - } - - /** - * Determines if the output should be styled. - * - * @param style the name of the style sheet ot use, or "styled" for plain-rat style - * @deprecated use {@link #setStylesheet(String)} - */ - @Deprecated - public void setFormat(final String style) { - DeprecationReporter.logDeprecated("attribute format", "0.17", true, "outputStyle element"); - if ("styled".equalsIgnoreCase(style)) { - setOutputStyle("plain-rat"); - } else { - setOutputStyle(style); - } - } - - /** - * Adds as a file containing the definitions of licenses to the system. - * - * @param fileName the file to add. - * @deprecated create a configuration file and use the <config> child element. - */ - @Deprecated - public void setLicenses(final File fileName) { - DeprecationReporter.logDeprecated("attribute licenses", "0.17", true, " element"); - setArg(Arg.CONFIGURATION.option().getLongOpt(), fileName.getAbsolutePath()); - } - - /** - * Specifies whether to add the default list of license matchers. - * - * @param useDefaultLicenses if {@code true} use the default licenses. - * @deprecated use noDefaultLicenses attribute - */ - @Deprecated - public void setUseDefaultLicenses(final boolean useDefaultLicenses) { - DeprecationReporter.logDeprecated("attribute useDefaultLicenses", "0.17", true, "noDefaultLicenses attribute"); - setNoDefaultLicenses(!useDefaultLicenses); - } - - /** - * Adds a family category to the list of approved licenses. - * - * @param familyCategory the category to add. - * @deprecated use licensesApproved child element. - */ - @Deprecated - public void setAddApprovedLicense(final String familyCategory) { - DeprecationReporter.logDeprecated("attribute addApprovedLicense", "0.17", true, " element"); - deprecatedConfig.approvedLicenseCategories.add(familyCategory); - } - - /** - * Adds a family category to the list of approved licenses. - * - * @param familyCategory the category to add - * @deprecated use licensesFamiliesApproved child element - */ - @Deprecated - public void addAddApprovedLicense(final String familyCategory) { - DeprecationReporter.logDeprecated("element ", "0.17", true, " element"); - deprecatedConfig.approvedLicenseCategories.add(familyCategory); - } - - /** - * Removes a family category to the list of approved licenses. - * - * @param familyCategory the category to add. - * @deprecated use licensesFamiliesDenied child element - */ - @Deprecated - public void setRemoveApprovedLicense(final String familyCategory) { - DeprecationReporter.logDeprecated("attribute addApprovedLicense", "0.17", true, " element"); - deprecatedConfig.removedLicenseCategories.add(familyCategory); - } - - /** - * Removes a family category to the list of approved licenses. - * - * @param familyCategory the category to add. - * @deprecated use licensesFamiliesDenied child element - */ - @Deprecated - public void addRemoveApprovedLicense(final String familyCategory) { - DeprecationReporter.logDeprecated("element ", "0.17", true, " element"); - deprecatedConfig.removedLicenseCategories.add(familyCategory); - } - - /** - * Removes a family category to the list of approved licenses. - * - * @param familyCategory the category to remove - * @deprecated use licenseFamiliesDenied element - */ - @Deprecated - public void setRemoveApprovedLicense(final String[] familyCategory) { - DeprecationReporter.logDeprecated("attribute removeApprovedLicense", "0.17", true, " element"); - deprecatedConfig.removedLicenseCategories.addAll(Arrays.asList(familyCategory)); - } - - /** - * Removes a family category to the list of approved licenses. - * - * @param familyCategory the category to remove. - * @deprecated use licenseFamilyDenied element - */ - @Deprecated - public void addRemoveApprovedLicense(final String[] familyCategory) { - DeprecationReporter.logDeprecated("element ", "0.17", true, " element"); - deprecatedConfig.removedLicenseCategories.addAll(Arrays.asList(familyCategory)); - } - - /** - * Sets the copyright message - * - * @param copyrightMessage the copyright message - * @deprecated use copyright attribute - */ - @Deprecated - public void setCopyrightMessage(final String copyrightMessage) { - setCopyright(copyrightMessage); - } - - /** - * Determines if license headers should be added. - * - * @param setting the setting. - * @deprecated use editLicense and editOverwrite attributes - */ - @Deprecated - public void setAddLicenseHeaders(final AddLicenseHeaders setting) { - DeprecationReporter.logDeprecated("attribute addLicenseHeaders", "0.17", true, "editLicense and editOverwrite attributes"); - switch (setting.getNative()) { - case TRUE: - setEditLicense(true); - break; - case FALSE: - setEditLicense(false); - break; - case FORCED: - setEditLicense(true); - setEditOverwrite(true); - break; - } - } - - /** - * Adds definition information - * - * @param fileName the file to add - * @deprecated Use Config child element - */ - @Deprecated - public void setAddDefaultDefinitions(final File fileName) { - DeprecationReporter.logDeprecated("element ", "0.17", true, " element"); - setArg(Arg.CONFIGURATION.option().getLongOpt(), fileName.getAbsolutePath()); - } - /** * Reads values for the Arg. * @@ -420,14 +146,6 @@ public ReportConfiguration getConfiguration() { } DocumentName name = DocumentName.builder(getProject().getBaseDir()).build(); configuration.addSource(new ResourceCollectionContainer(name, configuration, nestedResources)); - configuration.addApprovedLicenseCategories(deprecatedConfig.approvedLicenseCategories); - configuration.removeApprovedLicenseCategories(deprecatedConfig.removedLicenseCategories); - if (deprecatedConfig.inputFileFilter != null) { - configuration.addExcludedFilter(deprecatedConfig.inputFileFilter); - } - families.stream().map(Family::build).forEach(configuration::addFamily); - licenses.stream().map(License::asBuilder) - .forEach(l -> configuration.addApprovedLicenseCategory(configuration.addLicense(l).getLicenseFamily())); if (helpLicenses) { new org.apache.rat.help.Licenses(configuration, new PrintWriter(DefaultLog.getInstance().asWriter())).printHelp(); } @@ -468,69 +186,6 @@ protected ReportConfiguration validate(final ReportConfiguration cfg) { return cfg; } - /** - * Add headers to files that do not have them. - * - * @deprecated use <editCopyright> amd <editOverwrite> instead. - */ - @Deprecated - public static class AddLicenseHeaders extends EnumeratedAttribute { - /** - * add license headers and create *.new file - */ - static final String TRUE = "true"; - /** - * do not add license headers - */ - static final String FALSE = "false"; - /** - * add license headers and overwrite existing files - */ - static final String FORCED = "forced"; - - public AddLicenseHeaders() { - } - - public AddLicenseHeaders(final String s) { - setValue(s); - } - - @Override - public String[] getValues() { - return new String[]{TRUE, FALSE, FORCED}; - } - - public org.apache.rat.config.AddLicenseHeaders getNative() { - return org.apache.rat.config.AddLicenseHeaders.valueOf(getValue().toUpperCase()); - } - } - - /** - * Specify the licenses that are approved. - * - * @deprecated use listLicenses or listFamilies attributes. - */ - @Deprecated - public static class ApprovalFilter extends EnumeratedAttribute { - - public ApprovalFilter() { - } - - public ApprovalFilter(final String s) { - setValue(s); - } - - @Override - public String[] getValues() { - return Arrays.stream(LicenseSetFactory.LicenseFilter.values()).map(LicenseSetFactory.LicenseFilter::name) - .collect(Collectors.toList()).toArray(new String[LicenseSetFactory.LicenseFilter.values().length]); - } - - public LicenseSetFactory.LicenseFilter internalFilter() { - return LicenseSetFactory.LicenseFilter.valueOf(getValue()); - } - } - @Override public void log(final String msg, final int msgLevel) { if (getProject() != null) { diff --git a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Spdx.java b/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Spdx.java deleted file mode 100644 index 228d4805c..000000000 --- a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Spdx.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 org.apache.rat.anttasks; - -import org.apache.rat.DeprecationReporter; -import org.apache.rat.analysis.IHeaderMatcher; -import org.apache.rat.configuration.builders.SpdxBuilder; - -/** - * Creates a SPDX matcher. - * @deprecated use configuration file. - */ -@Deprecated // since 0.17 -@DeprecationReporter.Info(since = "0.17", forRemoval = true, use = "Configuration file and element")// since 0.17 -public class Spdx implements IHeaderMatcher.Builder { - - private final SpdxBuilder builder = new SpdxBuilder(); - - public void setName(String spdxId) { - builder.setName(spdxId); - } - - public void addText(String spdxId) { - builder.setName(spdxId); - } - - @Override - public IHeaderMatcher build() { - return builder.build(); - } -} diff --git a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Text.java b/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Text.java deleted file mode 100644 index 6778343d1..000000000 --- a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/Text.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 org.apache.rat.anttasks; - -import org.apache.rat.DeprecationReporter; -import org.apache.rat.analysis.IHeaderMatcher; -import org.apache.rat.configuration.builders.TextBuilder; - -/** - * Creates a text matcher. - * @deprecated use configuration file. - */ -@Deprecated // since 0.17 -@DeprecationReporter.Info(since = "0.17", forRemoval = true, use = "Configuration file and element")// since 0.17 -public class Text implements IHeaderMatcher.Builder { - - private final TextBuilder builder = new TextBuilder(); - - public void addText(String text) { - builder.setSimpleText(text); - } - - public void setText(String text) { - builder.setSimpleText(text); - } - @Override - public IHeaderMatcher build() { - return builder.build(); - } -}