Gradle task cache

Gradle 7 prep
This commit is contained in:
Steve Ebersole 2021-07-26 13:51:22 -05:00
parent 967553add4
commit 9f2ae95397
7 changed files with 25 additions and 3 deletions

View File

@ -6,6 +6,10 @@ toolchain.launcher.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOf
org.gradle.parallel=true org.gradle.parallel=true
# enable Gradle's Task Cache. worst case:
# > rm -rf ~/.gradle/caches/build-cache-1
org.gradle.caching=true
# JDK auto-detection is not quite ready yet in Gradle 6.7. # JDK auto-detection is not quite ready yet in Gradle 6.7.
# On Fedora in particular, if you have the package java-1.8.0-openjdk-headless-1.8.0.265.b01-1.fc32.x86_64 installed, # On Fedora in particular, if you have the package java-1.8.0-openjdk-headless-1.8.0.265.b01-1.fc32.x86_64 installed,
# Gradle will look for the Java binaries in /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/bin/java # Gradle will look for the Java binaries in /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/bin/java

View File

@ -358,6 +358,8 @@ jar {
'Hibernate-JpaVersion': project.jpaVersion.name, 'Hibernate-JpaVersion': project.jpaVersion.name,
// BND Plugin instructions (for OSGi): // BND Plugin instructions (for OSGi):
'-reproducible': true,
'-noextraheaders': true,
'Bundle-Name': project.name, 'Bundle-Name': project.name,
'Bundle-SymbolicName': project.java9ModuleName, 'Bundle-SymbolicName': project.java9ModuleName,
'Bundle-Vendor': 'Hibernate.org', 'Bundle-Vendor': 'Hibernate.org',

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -233,10 +233,14 @@ task copyBundleResources (type: Copy) {
} }
} }
processTestResources.dependsOn copyBundleResources processTestResources {
dependsOn copyBundleResources
duplicatesStrategy = DuplicatesStrategy.WARN
}
sourcesJar { sourcesJar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE duplicatesStrategy = DuplicatesStrategy.EXCLUDE
} }
task testJar(type: Jar, dependsOn: testClasses) { task testJar(type: Jar, dependsOn: testClasses) {

View File

@ -14,13 +14,17 @@ import org.gradle.api.DefaultTask;
import org.gradle.api.file.Directory; import org.gradle.api.file.Directory;
import org.gradle.api.file.RegularFile; import org.gradle.api.file.RegularFile;
import org.gradle.api.provider.Provider; import org.gradle.api.provider.Provider;
import org.gradle.api.tasks.CacheableTask;
import org.gradle.api.tasks.InputFile; import org.gradle.api.tasks.InputFile;
import org.gradle.api.tasks.OutputDirectory; import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.PathSensitive;
import org.gradle.api.tasks.PathSensitivity;
import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.TaskAction;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@CacheableTask
public abstract class GeneratorTask extends DefaultTask { public abstract class GeneratorTask extends DefaultTask {
private final Provider<RegularFile> grammarFile; private final Provider<RegularFile> grammarFile;
private final Provider<Directory> outputDirectory; private final Provider<Directory> outputDirectory;
@ -34,6 +38,7 @@ public abstract class GeneratorTask extends DefaultTask {
} }
@InputFile @InputFile
@PathSensitive( PathSensitivity.RELATIVE )
public Provider<RegularFile> getGrammarFile() { public Provider<RegularFile> getGrammarFile() {
return grammarFile; return grammarFile;
} }

View File

@ -30,6 +30,11 @@ if ( !JavaVersion.current().java8Compatible ) {
throw new GradleException( "Gradle must be run with Java 8 or later" ) throw new GradleException( "Gradle must be run with Java 8 or later" )
} }
buildCache {
local { enabled = true }
remote(HttpBuildCache) { enabled = false }
}
gradle.ext.baselineJavaVersion = JavaLanguageVersion.of( 8 ) gradle.ext.baselineJavaVersion = JavaLanguageVersion.of( 8 )
// Gradle does bytecode transformation on tests. // Gradle does bytecode transformation on tests.

View File

@ -59,7 +59,9 @@ task jaxb {
package: 'org.hibernate.jpamodelgen.xml.jaxb', package: 'org.hibernate.jpamodelgen.xml.jaxb',
extension: 'true' extension: 'true'
) { ) {
schema ( dir: xsdDir.path, includes: "*.xsd" ) project.ant.arg line: '-no-header'
project.ant.arg line: '-npa'
schema( dir: xsdDir.path, includes: "*.xsd" )
} }
} }
} }