You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "janhoy (via GitHub)" <gi...@apache.org> on 2023/04/03 20:46:28 UTC

[GitHub] [solr] janhoy opened a new pull request, #1537: Tolerate comments in versions.props

janhoy opened a new pull request, #1537:
URL: https://github.com/apache/solr/pull/1537

   This will not fail the build even if `versions.props` contains lines starting with `#`.


-- 
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@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] dsmiley commented on a diff in pull request #1537: Tolerate comments in versions.props

Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #1537:
URL: https://github.com/apache/solr/pull/1537#discussion_r1156459500


##########
gradle/validation/versions-props-sorted.gradle:
##########
@@ -21,7 +21,7 @@ configure(rootProject) {
   task versionsPropsAreSorted() {
     doFirst {
       def versionsProps = file('versions.props')
-      def lines = versionsProps.readLines("UTF-8")
+      def lines = versionsProps.readLines("UTF-8").stream().filter(l -> !l.startsWith("#")).collect(java.util.stream.Collectors.toList())

Review Comment:
   Okay but we also should then remove the generation / overwriting of the file below as it would wipe out all comments.



-- 
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@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] dsmiley commented on a diff in pull request #1537: Tolerate comments in versions.props

Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #1537:
URL: https://github.com/apache/solr/pull/1537#discussion_r1156730296


##########
versions.props:
##########
@@ -1,3 +1,5 @@
+# The lines in this file needs to be lexicographically sorted.
+# Please only add first-party dependencies. Overrides of transitive versions should be called out in a comment.

Review Comment:
   ```suggestion
   # Please only add direct dependencies. Overrides of transitive versions should be called out in a comment.
   ```



##########
gradle/validation/versions-props-sorted.gradle:
##########
@@ -17,17 +17,17 @@
 
 // This ensures 'versions.props' file is sorted lexicographically.
 
+import java.util.stream.Collectors
+
 configure(rootProject) {
   task versionsPropsAreSorted() {
     doFirst {
       def versionsProps = file('versions.props')
-      def lines = versionsProps.readLines("UTF-8")
+      def lines = versionsProps.readLines("UTF-8").stream().filter(l -> !l.matches(/^(#.*|\s*)$/)).collect(Collectors.toList())

Review Comment:
   ```suggestion
         // remove # commented lines and blank lines
         def lines = versionsProps.readLines("UTF-8").stream().filter(l -> !l.matches(/^(#.*|\s*)$/)).collect(Collectors.toList())
   ```



-- 
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@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] janhoy commented on a diff in pull request #1537: Tolerate comments in versions.props

Posted by "janhoy (via GitHub)" <gi...@apache.org>.
janhoy commented on code in PR #1537:
URL: https://github.com/apache/solr/pull/1537#discussion_r1156478907


##########
gradle/validation/versions-props-sorted.gradle:
##########
@@ -21,7 +21,7 @@ configure(rootProject) {
   task versionsPropsAreSorted() {
     doFirst {
       def versionsProps = file('versions.props')
-      def lines = versionsProps.readLines("UTF-8")
+      def lines = versionsProps.readLines("UTF-8").stream().filter(l -> !l.startsWith("#")).collect(java.util.stream.Collectors.toList())

Review Comment:
   Should be good now. Even checked in a comment to the file to prove it :) 



-- 
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@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] janhoy merged pull request #1537: Tolerate comments in versions.props

Posted by "janhoy (via GitHub)" <gi...@apache.org>.
janhoy merged PR #1537:
URL: https://github.com/apache/solr/pull/1537


-- 
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@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] janhoy commented on pull request #1537: Tolerate comments in versions.props

Posted by "janhoy (via GitHub)" <gi...@apache.org>.
janhoy commented on PR #1537:
URL: https://github.com/apache/solr/pull/1537#issuecomment-1495478235

   The consistent-versions plugin does not require sorted lines, but I guess we do to make it easier for devs to navigate the file. I think we'll come a long way just adding comments for special cases, but if we really wanted to we could also allow two (or more) \n\n separated sections in this file, where we apply the sort requirement per section instead of the entire file. But let's try with some comments first..


-- 
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@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


[GitHub] [solr] janhoy commented on a diff in pull request #1537: Tolerate comments in versions.props

Posted by "janhoy (via GitHub)" <gi...@apache.org>.
janhoy commented on code in PR #1537:
URL: https://github.com/apache/solr/pull/1537#discussion_r1156468897


##########
gradle/validation/versions-props-sorted.gradle:
##########
@@ -21,7 +21,7 @@ configure(rootProject) {
   task versionsPropsAreSorted() {
     doFirst {
       def versionsProps = file('versions.props')
-      def lines = versionsProps.readLines("UTF-8")
+      def lines = versionsProps.readLines("UTF-8").stream().filter(l -> !l.startsWith("#")).collect(java.util.stream.Collectors.toList())

Review Comment:
   Yea, the code below writes out a sorted file to the build area, but in that file, all `#` lines will be on top or something, so it is useless. Perhaps better just throwing the exception and asking a human to fix the sorting!



-- 
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@solr.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org