rmuir commented on code in PR #15195:
URL: https://github.com/apache/lucene/pull/15195#discussion_r2356113016


##########
build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/licenses/CheckLicensesPlugin.java:
##########
@@ -0,0 +1,126 @@
+/*
+ * 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.licenses;
+
+import org.apache.lucene.gradle.plugins.LuceneGradlePlugin;
+import org.gradle.api.Project;
+
+/** This configures ASL and other license checks. */
+public class CheckLicensesPlugin extends LuceneGradlePlugin {
+  @Override
+  public void apply(Project project) {
+    applicableToRootProjectOnly(project);
+
+    // Add check licenses task to the top-level project, configure it to scan 
all files, including
+    // those from subprojects. It's fast and simple.
+    var checkLicensesTask =
+        project
+            .getTasks()
+            .register("checkLicenses", CheckLicensesTask.class, 
this::configureCheckLicenses);
+
+    // Link any 'check' task from any subproject to this top-level task.
+    project.subprojects(
+        subproject -> {
+          subproject
+              .getTasks()
+              .named("check")
+              .configure(
+                  checkTask -> {
+                    checkTask.dependsOn(checkLicensesTask);
+                  });
+        });
+  }
+
+  private void configureCheckLicenses(CheckLicensesTask task) {
+    Project project = task.getProject();
+
+    
task.getReportFile().set(project.getLayout().getBuildDirectory().file("licenses-report.txt"));
+    task.getFiles()
+        .from(
+            project.fileTree(
+                ".",
+                tree -> {
+                  // Exclude build outputs, ide files, .git.

Review Comment:
   First problem is solved by passing some additional parameters. For example, 
try `git ls-files -c -o --exclude-standard`.
   
   



-- 
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