You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/10/16 21:00:01 UTC

[GitHub] [maven-plugin-tools] bmarwell opened a new pull request, #152: [MPLUGIN-426] add @Description annotation

bmarwell opened a new pull request, #152:
URL: https://github.com/apache/maven-plugin-tools/pull/152

   ITs missing, tests missing, draft.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-plugin-tools] pzygielo commented on a diff in pull request #152: [MPLUGIN-426] add @Description annotation

Posted by GitBox <gi...@apache.org>.
pzygielo commented on code in PR #152:
URL: https://github.com/apache/maven-plugin-tools/pull/152#discussion_r996665939


##########
maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Description.java:
##########
@@ -0,0 +1,79 @@
+package org.apache.maven.plugins.annotations;
+
+/*
+ * 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.
+ */
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Describes a {@code Mojo} or a Mojo’s {@code Parameter} when JavaDoc extraction is not feasible (because of deviating
+ * documentation goals) or not possible (e.g. for other JVM languages like Scala, Groovy or Kotlin).
+ */
+@Documented
+@Retention( RetentionPolicy.CLASS )
+@Target( { ElementType.TYPE, ElementType.FIELD } )
+@Inherited
+public @interface Description
+{
+    /**
+     * Description content for the {@code Mojo} or Mojo {@code Parameter}.
+     *
+     * <p>A &quot;Safe HTML&quot; subset can be used. This is achieved by running
+     * the content through the <a href="https://github.com/owasp/java-html-sanitizer"<OWASP Java HTML Sanitizer</a>
+     * before rendering.</p>
+     *
+     * @return a description of the Mojo or the parameter.
+     */
+    String content();

Review Comment:
   With this named as `value`, could annotation be used as `@Description("xxx yyy")`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-plugin-tools] bmarwell commented on a diff in pull request #152: [MPLUGIN-426] add @Description annotation

Posted by GitBox <gi...@apache.org>.
bmarwell commented on code in PR #152:
URL: https://github.com/apache/maven-plugin-tools/pull/152#discussion_r996494406


##########
maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Description.java:
##########
@@ -0,0 +1,79 @@
+package org.apache.maven.plugins.annotations;
+
+/*
+ * 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.
+ */
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Describes a {@code Mojo} or a Mojo’s {@code Parameter} when JavaDoc extraction is not feasible (because of deviating
+ * documentation goals) or not possible (e.g. for other JVM languages like Scala, Groovy or Kotlin).
+ */
+@Documented
+@Retention( RetentionPolicy.CLASS )
+@Target( { ElementType.TYPE, ElementType.FIELD } )
+@Inherited
+public @interface Description
+{
+    /**
+     * Description content for the {@code Mojo} or Mojo {@code Parameter}.
+     *
+     * <p>A &quot;Safe HTML&quot; subset can be used. This is achieved by running
+     * the content through the <a href="https://github.com/owasp/java-html-sanitizer"<OWASP Java HTML Sanitizer</a>
+     * before rendering.</p>
+     *
+     * @return a description of the Mojo or the parameter.
+     */
+    String content();
+
+    /**
+     * The version of the plugin since when this goal or parameter was introduced (inclusive, optional).
+     *
+     * @return The version of the plugin since when this goal or parameter was introduced (inclusive) or an empty string
+     * of no since version has been given.
+     */
+    String since() default "";
+
+    /**
+     * Marks this Mojo goal or parameter as deprecated.
+     *
+     * @return {@code true} whether this Mojo goal or parameter is deprecated.
+     */
+    boolean deprecated() default false;
+
+    /**
+     * Deprecation reason (optional).
+     *
+     * @return an empty String if no deprecation reason has been given or a description.
+     */
+    String deprecatedBecause() default "";
+
+    /**
+     * Version since when this goal or parameter has been deprecated.
+     *
+     * @return the version since when this goal or parameter has been deprecated (inclusive) or an empty String if no
+     * version was given.
+     */
+    String deprecatedSince() default "";

Review Comment:
   Unused atm, wdyt? was in original proposal



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-plugin-tools] bmarwell commented on pull request #152: [MPLUGIN-426] add @Description annotation

Posted by GitBox <gi...@apache.org>.
bmarwell commented on PR #152:
URL: https://github.com/apache/maven-plugin-tools/pull/152#issuecomment-1317465986

   > Should the new annotation contain a `since` field to be able to avoid the `since` javadoc tag ?
   
   Sounds like a plan!
   But we still have a "dispute", some favour an approach where we instead implement a kotlin kdoc, scala doc and groovy doc parser as well. I am pretty sure if we went that way (ie support external parsers for other JVM languages), we should provide the appropriate parsers/extractors as well. This option here is WAY simpler, but not necessarily better.
   Maybe this should go to the mailing list AGAIN? WDYT?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-plugin-tools] bmarwell commented on a diff in pull request #152: [MPLUGIN-426] add @Description annotation

Posted by GitBox <gi...@apache.org>.
bmarwell commented on code in PR #152:
URL: https://github.com/apache/maven-plugin-tools/pull/152#discussion_r996695910


##########
maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Description.java:
##########
@@ -0,0 +1,79 @@
+package org.apache.maven.plugins.annotations;
+
+/*
+ * 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.
+ */
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Describes a {@code Mojo} or a Mojo’s {@code Parameter} when JavaDoc extraction is not feasible (because of deviating
+ * documentation goals) or not possible (e.g. for other JVM languages like Scala, Groovy or Kotlin).
+ */
+@Documented
+@Retention( RetentionPolicy.CLASS )
+@Target( { ElementType.TYPE, ElementType.FIELD } )
+@Inherited
+public @interface Description
+{
+    /**
+     * Description content for the {@code Mojo} or Mojo {@code Parameter}.
+     *
+     * <p>A &quot;Safe HTML&quot; subset can be used. This is achieved by running
+     * the content through the <a href="https://github.com/owasp/java-html-sanitizer"<OWASP Java HTML Sanitizer</a>
+     * before rendering.</p>
+     *
+     * @return a description of the Mojo or the parameter.
+     */
+    String content();

Review Comment:
   Yes, that was my first idea. But since it contains HTML, I thought it might be a good idea to not use "value". But then, what would value be if added later...
   Can change that. Will also add tests.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-plugin-tools] bmarwell commented on a diff in pull request #152: [MPLUGIN-426] add @Description annotation

Posted by GitBox <gi...@apache.org>.
bmarwell commented on code in PR #152:
URL: https://github.com/apache/maven-plugin-tools/pull/152#discussion_r996494652


##########
maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/JavaAnnotationsMojoDescriptorExtractor.java:
##########
@@ -288,16 +288,19 @@ protected void populateDataFromJavadoc( Map<String, MojoAnnotatedClass> mojoAnno
             MojoAnnotationContent mojoAnnotationContent = entry.getValue().getMojo();
             if ( mojoAnnotationContent != null )
             {
-                mojoAnnotationContent.setDescription( javaClass.getComment() );
+                if ( StringUtils.isEmpty( mojoAnnotationContent.getDescription() ) )
+                {
+                    mojoAnnotationContent.setDescription( javaClass.getComment() );
+                }
 
                 DocletTag since = findInClassHierarchy( javaClass, "since" );
-                if ( since != null )
+                if ( since != null && StringUtils.isEmpty( mojoAnnotationContent.getSince() ) )
                 {
                     mojoAnnotationContent.setSince( since.getValue() );
                 }
 
                 DocletTag deprecated = findInClassHierarchy( javaClass, "deprecated" );
-                if ( deprecated != null )
+                if ( deprecated != null && StringUtils.isEmpty( mojoAnnotationContent.getDeprecated() ) )
                 {

Review Comment:
   New behaviour (compatible): Only set from javadoc annotation if not already set by Java annotation..



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-plugin-tools] cstamas commented on pull request #152: [MPLUGIN-426] add @Description annotation

Posted by GitBox <gi...@apache.org>.
cstamas commented on PR #152:
URL: https://github.com/apache/maven-plugin-tools/pull/152#issuecomment-1280512208

   Looks ok to me


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-plugin-tools] bmarwell commented on a diff in pull request #152: [MPLUGIN-426] add @Description annotation

Posted by GitBox <gi...@apache.org>.
bmarwell commented on code in PR #152:
URL: https://github.com/apache/maven-plugin-tools/pull/152#discussion_r996494722


##########
maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScanner.java:
##########
@@ -306,11 +318,21 @@ protected void analyzeVisitors( MojoClassVisitor mojoClassVisitor )
 
                 populateAnnotationContent( parameterAnnotationContent, fieldAnnotationVisitor );
 
+                DescriptionAnnotationContent descriptionAnnotationContent = new DescriptionAnnotationContent();
+                final MojoAnnotationVisitor descriptionAnnotationVisitor =
+                        annotationVisitorMap.get( Description.class.getName() );
+                if ( descriptionAnnotationVisitor != null )
+                {
+                    populateAnnotationContent( descriptionAnnotationContent, descriptionAnnotationVisitor );
+                }

Review Comment:
   `@Description` is optional and thus can be `null`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-plugin-tools] gnodet commented on pull request #152: [MPLUGIN-426] add @Description annotation

Posted by GitBox <gi...@apache.org>.
gnodet commented on PR #152:
URL: https://github.com/apache/maven-plugin-tools/pull/152#issuecomment-1315969450

   Should the new annotation contain a `since` field to be able to avoid the `since` javadoc tag ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-plugin-tools] bmarwell commented on a diff in pull request #152: [MPLUGIN-426] add @Description annotation

Posted by GitBox <gi...@apache.org>.
bmarwell commented on code in PR #152:
URL: https://github.com/apache/maven-plugin-tools/pull/152#discussion_r996494611


##########
maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Description.java:
##########
@@ -0,0 +1,79 @@
+package org.apache.maven.plugins.annotations;
+
+/*
+ * 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.
+ */
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Describes a {@code Mojo} or a Mojo’s {@code Parameter} when JavaDoc extraction is not feasible (because of deviating
+ * documentation goals) or not possible (e.g. for other JVM languages like Scala, Groovy or Kotlin).
+ */
+@Documented
+@Retention( RetentionPolicy.CLASS )
+@Target( { ElementType.TYPE, ElementType.FIELD } )
+@Inherited
+public @interface Description
+{
+    /**
+     * Description content for the {@code Mojo} or Mojo {@code Parameter}.
+     *
+     * <p>A &quot;Safe HTML&quot; subset can be used. This is achieved by running
+     * the content through the <a href="https://github.com/owasp/java-html-sanitizer"<OWASP Java HTML Sanitizer</a>
+     * before rendering.</p>
+     *
+     * @return a description of the Mojo or the parameter.
+     */
+    String content();

Review Comment:
   Naming?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-plugin-tools] bmarwell commented on a diff in pull request #152: [MPLUGIN-426] add @Description annotation

Posted by GitBox <gi...@apache.org>.
bmarwell commented on code in PR #152:
URL: https://github.com/apache/maven-plugin-tools/pull/152#discussion_r996494406


##########
maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Description.java:
##########
@@ -0,0 +1,79 @@
+package org.apache.maven.plugins.annotations;
+
+/*
+ * 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.
+ */
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Describes a {@code Mojo} or a Mojo’s {@code Parameter} when JavaDoc extraction is not feasible (because of deviating
+ * documentation goals) or not possible (e.g. for other JVM languages like Scala, Groovy or Kotlin).
+ */
+@Documented
+@Retention( RetentionPolicy.CLASS )
+@Target( { ElementType.TYPE, ElementType.FIELD } )
+@Inherited
+public @interface Description
+{
+    /**
+     * Description content for the {@code Mojo} or Mojo {@code Parameter}.
+     *
+     * <p>A &quot;Safe HTML&quot; subset can be used. This is achieved by running
+     * the content through the <a href="https://github.com/owasp/java-html-sanitizer"<OWASP Java HTML Sanitizer</a>
+     * before rendering.</p>
+     *
+     * @return a description of the Mojo or the parameter.
+     */
+    String content();
+
+    /**
+     * The version of the plugin since when this goal or parameter was introduced (inclusive, optional).
+     *
+     * @return The version of the plugin since when this goal or parameter was introduced (inclusive) or an empty string
+     * of no since version has been given.
+     */
+    String since() default "";
+
+    /**
+     * Marks this Mojo goal or parameter as deprecated.
+     *
+     * @return {@code true} whether this Mojo goal or parameter is deprecated.
+     */
+    boolean deprecated() default false;
+
+    /**
+     * Deprecation reason (optional).
+     *
+     * @return an empty String if no deprecation reason has been given or a description.
+     */
+    String deprecatedBecause() default "";
+
+    /**
+     * Version since when this goal or parameter has been deprecated.
+     *
+     * @return the version since when this goal or parameter has been deprecated (inclusive) or an empty String if no
+     * version was given.
+     */
+    String deprecatedSince() default "";

Review Comment:
   Unused atm, wdyt? was in original proposal



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-plugin-tools] hboutemy commented on pull request #152: [MPLUGIN-426] add @Description annotation

Posted by GitBox <gi...@apache.org>.
hboutemy commented on PR #152:
URL: https://github.com/apache/maven-plugin-tools/pull/152#issuecomment-1281885599

   commits added as a review
   build is failing on GH: does not seem related to this updates, but we'll need to fix because additional failure (like the rat failure I fixed) are not visible


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org