You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2019/06/02 15:39:15 UTC

[lucene-solr] branch jira/SOLR-13452_gradle_3 updated (b407ba4 -> 3dbf78d)

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a change to branch jira/SOLR-13452_gradle_3
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git.


    from b407ba4  SOLR-13452: Add a target to reset working copy to a pristine state.
     new f86da4b  SOLR-13452: Fix logging message.
     new 7089884  SOLR-13452: Don't run standard jflex tasks at same time.
     new 1eae2c6  SOLR-13452: Rename git clean task to pristineClean.
     new 3be713b  SOLR-13452: Don't include internal module outputs in jarChecksums.
     new 3dbf78d  SOLR-13452: Add task group and desc for checkLicenses task.

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 build.gradle                                       |  6 +-
 .../org/apache/lucene/gradle/JarChecksum.groovy    | 80 ++++++++++++++--------
 ...ristineCheckout.groovy => PristineClean.groovy} |  8 +--
 .../org/apache/lucene/gradle/LicenseCheckTask.java |  2 +
 lucene/analysis/common/build.gradle                |  4 ++
 lucene/build.gradle                                |  9 +--
 solr/build.gradle                                  |  8 +--
 7 files changed, 70 insertions(+), 47 deletions(-)
 rename buildSrc/src/main/groovy/org/apache/lucene/gradle/{PristineCheckout.groovy => PristineClean.groovy} (85%)


[lucene-solr] 05/05: SOLR-13452: Add task group and desc for checkLicenses task.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch jira/SOLR-13452_gradle_3
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 3dbf78d6bd3392318a5422328472716334e0c28f
Author: markrmiller <ma...@apache.org>
AuthorDate: Sun Jun 2 10:39:02 2019 -0500

    SOLR-13452: Add task group and desc for checkLicenses task.
---
 buildSrc/src/main/java/org/apache/lucene/gradle/LicenseCheckTask.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/buildSrc/src/main/java/org/apache/lucene/gradle/LicenseCheckTask.java b/buildSrc/src/main/java/org/apache/lucene/gradle/LicenseCheckTask.java
index 271d1b8..d6f3c16 100644
--- a/buildSrc/src/main/java/org/apache/lucene/gradle/LicenseCheckTask.java
+++ b/buildSrc/src/main/java/org/apache/lucene/gradle/LicenseCheckTask.java
@@ -60,6 +60,8 @@ public class LicenseCheckTask extends DefaultTask {
 
   @Inject
   public LicenseCheckTask(File licenseDirectory) {
+    setGroup("Verification");
+    setDescription("Check licenses for dependencies.");
     this.licenseDirectory = licenseDirectory;
     doLast(task -> {
       Set<ResolvedArtifact> deps = new HashSet<>();


[lucene-solr] 02/05: SOLR-13452: Don't run standard jflex tasks at same time.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch jira/SOLR-13452_gradle_3
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 7089884295c7e0700155755e54082ab02a6f1383
Author: markrmiller <ma...@apache.org>
AuthorDate: Sun Jun 2 06:34:52 2019 -0500

    SOLR-13452: Don't run standard jflex tasks at same time.
---
 build.gradle                        | 2 ++
 lucene/analysis/common/build.gradle | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/build.gradle b/build.gradle
index 3d48f29..46b90ff 100644
--- a/build.gradle
+++ b/build.gradle
@@ -22,6 +22,8 @@ plugins {
   id "com.palantir.consistent-versions" version "1.8.0"
 }
 
+buildDir = new File("build")
+
 // define lucene-solr project lists that exclude buildSrc
 def luceneSolrProjects = allprojects.findAll { project -> project.name != 'buildSrc'};
 def luceneSolrSubProjects = subprojects.findAll { project -> project.name != 'buildSrc'}
diff --git a/lucene/analysis/common/build.gradle b/lucene/analysis/common/build.gradle
index 69cc292..d212691 100644
--- a/lucene/analysis/common/build.gradle
+++ b/lucene/analysis/common/build.gradle
@@ -86,6 +86,8 @@ task jflexWikiTokenizer(type: org.apache.lucene.gradle.JFlex) {
   fileName = "WikipediaTokenizerImpl"
   disableBufferExpansion = false
   target = new File("${projectDir}/src/java/org/apache/lucene/analysis/wikipedia")
+  
+  mustRunAfter project.rootProject.project(":lucene:lucene-core").runJflex
 }
 
 task jflexClassicAnalyzer(type: org.apache.lucene.gradle.JFlex) {
@@ -93,6 +95,8 @@ task jflexClassicAnalyzer(type: org.apache.lucene.gradle.JFlex) {
   fileName = "ClassicTokenizerImpl"
   disableBufferExpansion = false
   target = new File("${projectDir}/src/java/org/apache/lucene/analysis/standard")
+
+  mustRunAfter project.rootProject.project(":lucene:lucene-core").runJflex
 }
 
 task jflexUAX29URLEmailTokenizer(type: org.apache.lucene.gradle.JFlex) {


[lucene-solr] 03/05: SOLR-13452: Rename git clean task to pristineClean.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch jira/SOLR-13452_gradle_3
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 1eae2c6594ddd9084223af8efaa95dccb7bb5092
Author: markrmiller <ma...@apache.org>
AuthorDate: Sun Jun 2 09:31:44 2019 -0500

    SOLR-13452: Rename git clean task to pristineClean.
---
 build.gradle                                                        | 4 +---
 .../lucene/gradle/{PristineCheckout.groovy => PristineClean.groovy} | 6 +++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/build.gradle b/build.gradle
index 46b90ff..34712ee 100644
--- a/build.gradle
+++ b/build.gradle
@@ -141,9 +141,7 @@ configure(rootProject) {
     description = "Show the slowest tests (averages)."
   }
   
-  task pristineCheckout(type: org.apache.lucene.gradle.PristineCheckout) {
-
-  }
+  task pristineClean(type: org.apache.lucene.gradle.PristineClean) {}
   
 }
 
diff --git a/buildSrc/src/main/groovy/org/apache/lucene/gradle/PristineCheckout.groovy b/buildSrc/src/main/groovy/org/apache/lucene/gradle/PristineClean.groovy
similarity index 88%
rename from buildSrc/src/main/groovy/org/apache/lucene/gradle/PristineCheckout.groovy
rename to buildSrc/src/main/groovy/org/apache/lucene/gradle/PristineClean.groovy
index a1f9572..619082c 100644
--- a/buildSrc/src/main/groovy/org/apache/lucene/gradle/PristineCheckout.groovy
+++ b/buildSrc/src/main/groovy/org/apache/lucene/gradle/PristineClean.groovy
@@ -28,12 +28,12 @@ import org.gradle.api.tasks.Input
 import org.gradle.api.tasks.TaskAction
 
 
-class PristineCheckout extends DefaultTask {
+class PristineClean extends DefaultTask {
 
 
-  PristineCheckout() {
+  PristineClean() {
     this.group = 'Build'
-    this.description = "Cleans the checkout for a pristine state (WARNING: the ultimate clean task - removes all files unknown by or ignored by git: git clean -d -x -f!)."
+    this.description = "Cleans the checkout for a pristine local state (WARNING: the ultimate clean task - removes all files unknown by or ignored by git: git clean -d -x -f!)."
   }
 
   @TaskAction


[lucene-solr] 01/05: SOLR-13452: Fix logging message.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch jira/SOLR-13452_gradle_3
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit f86da4b42e475a8db5f9c1d9a82ba4b8f82d1d4b
Author: markrmiller <ma...@apache.org>
AuthorDate: Sun Jun 2 02:49:41 2019 -0500

    SOLR-13452: Fix logging message.
---
 .../src/main/groovy/org/apache/lucene/gradle/PristineCheckout.groovy    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/buildSrc/src/main/groovy/org/apache/lucene/gradle/PristineCheckout.groovy b/buildSrc/src/main/groovy/org/apache/lucene/gradle/PristineCheckout.groovy
index 0f88f39..a1f9572 100644
--- a/buildSrc/src/main/groovy/org/apache/lucene/gradle/PristineCheckout.groovy
+++ b/buildSrc/src/main/groovy/org/apache/lucene/gradle/PristineCheckout.groovy
@@ -39,7 +39,7 @@ class PristineCheckout extends DefaultTask {
   @TaskAction
   void check() {
     try {
-      logger.info('Reseting working copy...')
+      logger.info('Cleaning working copy to pristine state...')
       final Repository repository = new FileRepositoryBuilder()
         .setWorkTree(project.getRootDir())
         .setMustExist(true)


[lucene-solr] 04/05: SOLR-13452: Don't include internal module outputs in jarChecksums.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch jira/SOLR-13452_gradle_3
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit 3be713bcbb88a0c424b2b248323846e55e753d03
Author: markrmiller <ma...@apache.org>
AuthorDate: Sun Jun 2 10:38:41 2019 -0500

    SOLR-13452: Don't include internal module outputs in jarChecksums.
---
 .../org/apache/lucene/gradle/JarChecksum.groovy    | 80 ++++++++++++++--------
 lucene/build.gradle                                |  9 +--
 solr/build.gradle                                  |  8 +--
 3 files changed, 57 insertions(+), 40 deletions(-)

diff --git a/buildSrc/src/main/groovy/org/apache/lucene/gradle/JarChecksum.groovy b/buildSrc/src/main/groovy/org/apache/lucene/gradle/JarChecksum.groovy
index 3a32b30..e21bccc 100644
--- a/buildSrc/src/main/groovy/org/apache/lucene/gradle/JarChecksum.groovy
+++ b/buildSrc/src/main/groovy/org/apache/lucene/gradle/JarChecksum.groovy
@@ -15,6 +15,10 @@ package org.apache.lucene.gradle
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
+import org.gradle.api.artifacts.ResolvedArtifact
+
+import javax.inject.Inject
 import org.gradle.api.DefaultTask
 import org.gradle.api.artifacts.Configuration
 import org.gradle.api.file.RelativePath
@@ -29,43 +33,65 @@ import java.nio.file.Files
 
 class JarChecksum extends DefaultTask {
   
-  @InputDirectory
-  File inputDir
+  private File inputDir
   
-  @OutputDirectory
-  File target
+  private File target
   
-  @TaskAction
-  void checksums() {
-    def skip = ['testRuntimeClasspath', 'testCompileClasspath']
-    
-    project.delete project.fileTree(dir: target.getAbsolutePath(), include: '**/*.jar.sha1')
+  @Inject
+  public JarChecksum(File inputDir,  File target) {
     
-    File tmpDir = File.createTempDir()
-    tmpDir.deleteOnExit()
-    tmpDir.mkdirs()
     
-    project.allprojects.each { p ->
-      p.configurations.each { Configuration config ->
-        if (skip.contains(config.name)) {  
-          config.files.each {
-            File destFile = new File(tmpDir, it.name)
-            if (it.name.endsWith(".jar") && it.exists() && !destFile.exists()) {
-              Files.copy(it.toPath(), destFile.toPath());
+    doLast({
+      File tmpDir = File.createTempDir()
+      tmpDir.deleteOnExit()
+      tmpDir.mkdirs()
+      
+      List<File> deps = new ArrayList<>()
+      project.allprojects.each { p ->
+        p.configurations.each { Configuration config ->
+          if (config.isCanBeResolved()) {
+            config.getResolvedConfiguration().getResolvedArtifacts().forEach( { ra -> deps.add(ra.getFile()) })
+            // exclude our jar and jarTest outputs
+            def ourJars = new ArrayList()
+            project.rootProject.subprojects.each{ subproject ->
+              if (subproject.hasProperty('jar')) {
+                ourJars.addAll(subproject.jar.outputs.files)
+                if (subproject.hasProperty('jarTest')) {
+                  ourJars.addAll(subproject.jarTest.outputs.files)
+                }
+              }
+            }
+            deps = deps - ourJars
+            
+            // copy files to tmp dir
+            deps.each {
+              def file = it
+              File destFile = new File(tmpDir, file.name)
+              if (file.name.endsWith(".jar") && file.exists() && !destFile.exists()) {
+                Files.copy(file.toPath(), destFile.toPath())
+              }
             }
           }
         }
-        
       }
-    }
-    
-    ant.checksum(algorithm: "SHA1", fileext: ".sha1", todir: target.getAbsolutePath()) {
-      ant.fileset(dir: tmpDir.getAbsolutePath())
-    }
+      
+      project.delete project.fileTree(dir: target.getAbsolutePath(), include: '**/*.jar.sha1')
+      
+      ant.checksum(algorithm: "SHA1", fileext: ".sha1", todir: target.getAbsolutePath()) {
+        ant.fileset(dir: tmpDir.getAbsolutePath())
+      }
+      
+      project.delete(tmpDir)
+      
+      ant.fixcrlf(srcdir: target.getAbsolutePath(), includes: "**/*.jar.sha1", eol: "lf", fixlast: "true", encoding: "US-ASCII")
+      
+    })
     
-    project.delete(tmpDir)
+  }
+  
+  @TaskAction
+  void checksums() {
     
-    ant.fixcrlf(srcdir: target.getAbsolutePath(), includes: "**/*.jar.sha1", eol: "lf", fixlast: "true", encoding: "US-ASCII")
   }
 }
 
diff --git a/lucene/build.gradle b/lucene/build.gradle
index c2c726c..712389e 100644
--- a/lucene/build.gradle
+++ b/lucene/build.gradle
@@ -16,6 +16,7 @@
  */
 
 import org.apache.lucene.gradle.LicenseCheckTask
+import org.apache.lucene.gradle.JarChecksum
 
 subprojects {
   group = 'org.apache.lucene'
@@ -26,13 +27,7 @@ def distDir = "dist"
 tasks.create("checkLicenses", LicenseCheckTask, new File(projectDir.getAbsolutePath()
     + System.properties['file.separator'] + "licenses"))
 
-
-task jarChecksum(type: org.apache.lucene.gradle.JarChecksum) {
-  group = 'Build'
-  description = "Generates checksums for Lucene dependency jars."
-  inputDir = new File(project.rootProject.projectDir, "/lucene")
-  target = new File(project.rootProject.projectDir, "/lucene/licenses")
-}
+tasks.create("jarChecksums", JarChecksum, new File(project.rootProject.projectDir, "/lucene"), new File(project.rootProject.projectDir, "/lucene/licenses"))
 
 task packageDist(type: org.apache.lucene.gradle.PackageLuceneSolrDist) {
   group = 'Dist'
diff --git a/solr/build.gradle b/solr/build.gradle
index d1f7dad..2f06581 100644
--- a/solr/build.gradle
+++ b/solr/build.gradle
@@ -16,6 +16,7 @@
  */
 
 import org.apache.lucene.gradle.LicenseCheckTask
+import org.apache.lucene.gradle.JarChecksum
 
 subprojects {
   group = 'org.apache.solr'
@@ -26,12 +27,7 @@ def distDir = "dist"
 tasks.create("checkLicenses", LicenseCheckTask, new File(projectDir.getAbsolutePath()
     + System.properties['file.separator'] + "licenses"))
 
-task jarChecksum(type: org.apache.lucene.gradle.JarChecksum) {
-  group = 'Build'
-  description = "Generates checksums for dependency Solr jars."
-  inputDir = new File(project.rootProject.projectDir, "/solr")
-  target = new File(project.rootProject.projectDir, "/solr/licenses")
-}
+tasks.create("jarChecksums", JarChecksum, new File(project.rootProject.projectDir, "/solr"), new File(project.rootProject.projectDir, "/solr/licenses"))
 
 task packageDist(type: org.apache.lucene.gradle.PackageLuceneSolrDist) {
   group = 'Dist'