dweiss commented on code in PR #14862:
URL: https://github.com/apache/lucene/pull/14862#discussion_r2173616055


##########
build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/java/JavaFolderLayoutPlugin.java:
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.lucene.gradle.plugins.java;
+
+import java.io.File;
+import java.util.List;
+import org.gradle.api.GradleException;
+import org.gradle.api.Plugin;
+import org.gradle.api.Project;
+import org.gradle.api.artifacts.ConfigurationContainer;
+import org.gradle.api.plugins.JavaPlugin;
+import org.gradle.api.plugins.JavaPluginExtension;
+import org.gradle.api.tasks.SourceSet;
+import org.gradle.api.tasks.SourceSetContainer;
+import org.gradle.language.jvm.tasks.ProcessResources;
+
+/** Configure up non-standard, legacy folder structure in Lucene projects. */
+public class JavaFolderLayoutPlugin implements Plugin<Project> {
+  @Override
+  public void apply(Project project) {
+    JavaPlugin javaPlugin = project.getPlugins().findPlugin(JavaPlugin.class);
+    if (javaPlugin == null) {
+      throw new GradleException(
+          getClass().getName()
+              + " should be applied to java projects only (after the java 
plugin is applied).");
+    }
+
+    JavaPluginExtension javaExt = 
project.getExtensions().getByType(JavaPluginExtension.class);
+    SourceSetContainer sourceSets = javaExt.getSourceSets();
+
+    SourceSet mainSrcSet = sourceSets.named("main").get();
+    mainSrcSet.java(srcSetDir -> srcSetDir.setSrcDirs(List.of("src/java")));
+    mainSrcSet.resources(resources -> 
resources.setSrcDirs(List.of("src/resources")));
+
+    SourceSet testSrcSet = sourceSets.named("test").get();
+    testSrcSet.java(srcSetDir -> srcSetDir.setSrcDirs(List.of("src/test")));
+    testSrcSet.resources(resources -> 
resources.setSrcDirs(List.of("src/test-files")));
+

Review Comment:
   This is way more verbose than groovy code but it has advantages - type 
checking among them.



##########
build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/spotless/ParentGoogleJavaFormatTask.java:
##########
@@ -114,6 +114,9 @@ protected static String applyFormatter(Formatter formatter, 
String input)
     input = ImportOrderer.reorderImports(input, 
JavaFormatterOptions.Style.GOOGLE);
     input = RemoveUnusedImports.removeUnusedImports(input);
     input = formatter.formatSource(input);
+
+    // input = StringWrapper.wrap(input, formatter);
+
     return input;

Review Comment:
   This would add long string reflowing. I didn't enable it because it entails 
reformatting quite a number of sources. Let's leave it for later to clean up.



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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to