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

dweiss pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new c3bef8c  SOLR-15603: Add an option to activate Gradle build cache, 
build task cleanups (#277)
c3bef8c is described below

commit c3bef8cde5eb732f5b1e14a05f911cee502586ce
Author: Alexis Tual <[email protected]>
AuthorDate: Mon Sep 6 10:49:36 2021 +0200

    SOLR-15603: Add an option to activate Gradle build cache, build task 
cleanups (#277)
---
 gradle/documentation/render-javadoc.gradle  | 10 ++++++----
 gradle/generation/local-settings.gradle     |  5 +++++
 gradle/validation/check-broken-links.gradle |  9 +++++++--
 solr/CHANGES.txt                            |  2 ++
 solr/solr-ref-guide/build.gradle            | 11 +++++++----
 5 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/gradle/documentation/render-javadoc.gradle 
b/gradle/documentation/render-javadoc.gradle
index 61cd8af..27cc73d 100644
--- a/gradle/documentation/render-javadoc.gradle
+++ b/gradle/documentation/render-javadoc.gradle
@@ -188,11 +188,13 @@ configure(subprojects) {
   }
 }
 
+@CacheableTask
 class RenderJavadocTask extends DefaultTask {
   @InputFiles
+  @PathSensitive(PathSensitivity.RELATIVE)
   @SkipWhenEmpty
   SourceDirectorySet srcDirSet;
-  
+
   @OutputDirectory
   File outputDir
 
@@ -258,10 +260,10 @@ class RenderJavadocTask extends DefaultTask {
   public void render() {
     def srcDirs = srcDirSet.srcDirs.findAll { dir -> dir.exists() }
     def optionsFile = project.file("${getTemporaryDir()}/javadoc-options.txt")
-    
+
     // create the directory, so relative link calculation knows that it's a 
directory:
     outputDir.mkdirs();
-    
+
     def opts = []
     opts << [ '-overview', project.file("${srcDirs[0]}/overview.html") ]
     opts << [ '-sourcepath', srcDirs.join(File.pathSeparator) ]
@@ -336,7 +338,7 @@ class RenderJavadocTask extends DefaultTask {
             }
           }
     }
-    
+
     // Add offline links.
     allOfflineLinks.each { url, dir ->
       // Some sanity check/ validation here to ensure dir/package-list or 
dir/element-list is present.
diff --git a/gradle/generation/local-settings.gradle 
b/gradle/generation/local-settings.gradle
index f41ad03..1fd1f72 100644
--- a/gradle/generation/local-settings.gradle
+++ b/gradle/generation/local-settings.gradle
@@ -55,6 +55,11 @@ org.gradle.jvmargs=-Xmx3g \\
 org.gradle.parallel=true
 org.gradle.priority=normal
 
+# This setting enables local task output caches. This will speed up
+# your local builds in most cases but will also consume disk space in your
+# gradle home. See SOLR-15603 for details.
+# org.gradle.caching=true
+
 # Silence gradle warnings. We'll deal with them when we upgrade the wrapper.
 org.gradle.warning.mode=none
 
diff --git a/gradle/validation/check-broken-links.gradle 
b/gradle/validation/check-broken-links.gradle
index 9aabcd3..d032f41 100644
--- a/gradle/validation/check-broken-links.gradle
+++ b/gradle/validation/check-broken-links.gradle
@@ -29,22 +29,27 @@ configure(project(':solr:documentation')) {
   check.dependsOn checkBrokenLinks
 }
 
+@CacheableTask
 class CheckBrokenLinksTask extends DefaultTask {
 
   // wraps input directory location in DirectoryProperty so as to lazily 
evaluate 'docroot' property
   // (see gradle/documentation/documentation.gradle)
   @InputDirectory
+  @PathSensitive(PathSensitivity.RELATIVE)
   final DirectoryProperty docsDir = project.objects.directoryProperty()
     .fileProvider(project.providers.provider { project.docroot })
 
   @InputFile
+  @PathSensitive(PathSensitivity.RELATIVE)
   File script = 
project.rootProject.file("dev-tools/scripts/checkJavadocLinks.py")
 
+  @OutputFile
+  Provider<RegularFile> outputFile = 
project.layout.buildDirectory.file('check-broken-links-output.txt')
+
   @TaskAction
   def check() {
-    def outputFile = 
project.file("${getTemporaryDir()}/check-broken-links-output.txt")
     def result
-    outputFile.withOutputStream { output ->
+    outputFile.get().asFile.withOutputStream { output ->
       result = project.exec {
         executable project.externalTool("python3")
         ignoreExitValue = true
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 45b68e7..b6a4fdc 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -145,6 +145,8 @@ when told to. The admin UI now tells it to. (Nazerke 
Seidan, David Smiley)
 
 Other Changes
 ----------------------
+* SOLR-15603: Add an option to activate Gradle build cache, build task 
cleanups (Alexis Tual, Dawid Weiss)
+
 * SOLR-14656: Autoscaling framework removed (Ishan Chattopadhyaya, noble, Ilan 
Ginzburg)
 
 * SOLR-14616: CDCR support removed (Ishan Chattopadhyaya)
diff --git a/solr/solr-ref-guide/build.gradle b/solr/solr-ref-guide/build.gradle
index 866ed52..6b6ab62 100644
--- a/solr/solr-ref-guide/build.gradle
+++ b/solr/solr-ref-guide/build.gradle
@@ -184,6 +184,7 @@ ext {
         group "Documentation"
         description "Builds the ${details.desc}"
 
+        outputs.cacheIf { true }
         inputs.dir contentDir
         outputs.dir htmlDir
 
@@ -215,20 +216,22 @@ check.dependsOn checkLocalJavadocLinksSite, checkSite
 // Hook site building to assemble.
 assemble.dependsOn buildSite
 
-class PrepareSources extends DefaultTask {
+@CacheableTask
+abstract class PrepareSources extends DefaultTask {
     // Original Source files we'll be syncing <b>FROM</b>
     @InputDirectory
-    final DirectoryProperty srcDir = project.objects.directoryProperty()
+    @PathSensitive(PathSensitivity.RELATIVE)
+    abstract DirectoryProperty getSrcDir()
 
     // Destination folder.
     @OutputDirectory
-    final DirectoryProperty outDir = project.objects.directoryProperty()
+    abstract DirectoryProperty getOutDir()
 
     /**
      * Task specific props (lazy provider)
      */
     @Input
-    final MapProperty<String, String> props = 
project.objects.mapProperty(String, String)
+    abstract MapProperty<String, String> getProps()
 
     public PrepareSources() {
         // setup 'dependsOn classes, configurations.depVer' here

Reply via email to