FINERACT-2122: Add devRun gradle task, optimize build caching, fix deprecations
This commit is contained in:
committed by
Adam Saghy
parent
ddc8b1a0a7
commit
384a52bbaf
+95
-20
@@ -23,28 +23,58 @@ apply plugin: 'distribution'
|
||||
apply from: "${rootDir}/buildSrc/src/main/groovy/org.apache.fineract.dependencies.gradle"
|
||||
|
||||
war {
|
||||
description = 'Assembles a WAR archive containing the web application'
|
||||
archiveFileName = 'fineract-provider.war'
|
||||
from("$rootDir/licenses/binary/") {
|
||||
// notice the parens
|
||||
into "WEB-INF/licenses/binary/" // no leading slash
|
||||
|
||||
// Enable caching
|
||||
outputs.cacheIf { true }
|
||||
|
||||
// Track inputs explicitly
|
||||
inputs.files(project.configurations.runtimeClasspath)
|
||||
.withPropertyName("runtimeClasspath")
|
||||
.withPathSensitivity(PathSensitivity.RELATIVE)
|
||||
inputs.files(project.sourceSets.main.output.classesDirs)
|
||||
.withPropertyName("classes")
|
||||
.withPathSensitivity(PathSensitivity.RELATIVE)
|
||||
|
||||
def licensesDir = file("$rootDir/licenses/binary/")
|
||||
if (licensesDir.exists()) {
|
||||
inputs.dir(licensesDir)
|
||||
.withPropertyName("licenses")
|
||||
.withPathSensitivity(PathSensitivity.RELATIVE)
|
||||
|
||||
from(licensesDir) {
|
||||
into "WEB-INF/licenses/binary/"
|
||||
}
|
||||
}
|
||||
from("$rootDir/LICENSE_RELEASE") {
|
||||
// notice the parens
|
||||
into "WEB-INF/" // no leading slash
|
||||
|
||||
def legalFiles = [
|
||||
file("$rootDir/LICENSE_RELEASE"),
|
||||
file("$rootDir/NOTICE_RELEASE"),
|
||||
file("$rootDir/DISCLAIMER")
|
||||
].findAll { it.exists() }
|
||||
|
||||
if (!legalFiles.empty) {
|
||||
inputs.files(legalFiles)
|
||||
.withPropertyName("legalFiles")
|
||||
.withPathSensitivity(PathSensitivity.RELATIVE)
|
||||
}
|
||||
from("$rootDir/NOTICE_RELEASE") {
|
||||
// notice the parens
|
||||
into "WEB-INF/" // no leading slash
|
||||
|
||||
legalFiles.each { file ->
|
||||
from(file) {
|
||||
into "WEB-INF/"
|
||||
}
|
||||
}
|
||||
|
||||
rename ('LICENSE_RELEASE', 'LICENSE')
|
||||
rename ('NOTICE_RELEASE', 'NOTICE')
|
||||
|
||||
from("$rootDir/DISCLAIMER") {
|
||||
// notice the parens
|
||||
into "WEB-INF/" // no leading slash
|
||||
}
|
||||
|
||||
enabled = true
|
||||
archiveClassifier = ''
|
||||
|
||||
// Ensure reproducible output
|
||||
preserveFileTimestamps = false
|
||||
reproducibleFileOrder = true
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -64,12 +94,24 @@ dependencies {
|
||||
tasks.withType(Tar) {
|
||||
compression Compression.GZIP
|
||||
archiveExtension = 'tar.gz'
|
||||
|
||||
// Enable caching for all tar tasks
|
||||
outputs.cacheIf { true }
|
||||
|
||||
// Ensure reproducible output
|
||||
preserveFileTimestamps = false
|
||||
reproducibleFileOrder = true
|
||||
}
|
||||
|
||||
distributions {
|
||||
binary {
|
||||
distributionBaseName = 'apache-fineract-binary'
|
||||
contents {
|
||||
// Track inputs explicitly for binary distribution
|
||||
filesMatching('**/*.jar') {
|
||||
it.path = it.path.replaceAll('-\\d+\\.\\d+\\.\\d+(-SNAPSHOT)?', '-' + version)
|
||||
}
|
||||
|
||||
from ("$rootDir/fineract-client/build/libs/") {
|
||||
include 'fineract-client-*.jar'
|
||||
}
|
||||
@@ -99,19 +141,52 @@ distributions {
|
||||
src {
|
||||
distributionBaseName = 'apache-fineract-src'
|
||||
contents {
|
||||
from "$rootDir/"
|
||||
exclude '**/build' , '.git', '**/.gradle', '.github', '**/.settings', '**/.project', '**/.classpath', '.idea', 'out', '._.DS_Store', '.DS_Store', 'WebContent', '**/.externalToolbuilders', '.theia', '.gitpod.yml', 'LICENSE_RELEASE', 'NOTICE_RELEASE', '**/licenses', '*.class', '**/bin', '*.log', '.dockerignore', '**/.gitkeep'
|
||||
// Track inputs explicitly for source distribution
|
||||
from("$rootDir/") {
|
||||
exclude '**/build' , '.git', '**/.gradle', '.github', '**/.settings', '**/.project',
|
||||
'**/.classpath', '.idea', 'out', '._.DS_Store', '.DS_Store', 'WebContent',
|
||||
'**/.externalToolbuilders', '.theia', '.gitpod.yml', 'LICENSE_RELEASE',
|
||||
'NOTICE_RELEASE', '**/licenses', '*.class', '**/bin', '*.log', '.dockerignore',
|
||||
'**/.gitkeep'
|
||||
|
||||
// Ensure consistent file paths for caching
|
||||
eachFile { details ->
|
||||
details.path = details.path.replace('\\', '/')
|
||||
}
|
||||
}
|
||||
rename ('LICENSE_SOURCE', 'LICENSE')
|
||||
rename ('NOTICE_SOURCE', 'NOTICE')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Configure specific tar tasks
|
||||
tasks.named('binaryDistTar') {
|
||||
description = 'Assembles the binary distribution as a tar archive'
|
||||
outputs.cacheIf { true }
|
||||
|
||||
// Track dependencies explicitly
|
||||
dependsOn(war, ':fineract-client:jar', ':fineract-avro-schemas:jar',
|
||||
':fineract-provider:build', ':fineract-doc:doc',
|
||||
':fineract-client:javadocJar', ':fineract-client:sourcesJar',
|
||||
':fineract-avro-schemas:javadocJar', ':fineract-avro-schemas:sourcesJar')
|
||||
|
||||
doLast {
|
||||
file("${buildDir}/distributions/apache-fineract-binary-${version}.tar.gz").renameTo("${buildDir}/distributions/apache-fineract-${version}-binary.tar.gz")
|
||||
file("${buildDir}/distributions/apache-fineract-src-${version}.tar.gz").renameTo("${buildDir}/distributions/apache-fineract-${version}-src.tar.gz")
|
||||
file("${buildDir}/distributions/apache-fineract-binary-${version}.tar.gz")
|
||||
.renameTo("${buildDir}/distributions/apache-fineract-${version}-binary.tar.gz")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named('srcDistTar') {
|
||||
description = 'Assembles the source distribution as a tar archive'
|
||||
outputs.cacheIf { true }
|
||||
|
||||
doLast {
|
||||
file("${buildDir}/distributions/apache-fineract-src-${version}.tar.gz")
|
||||
.renameTo("${buildDir}/distributions/apache-fineract-${version}-src.tar.gz")
|
||||
}
|
||||
}
|
||||
|
||||
// Disable zip distributions as they're not needed
|
||||
binaryDistZip.enabled false
|
||||
srcDistZip.enabled false
|
||||
// NOTE: Gradle suggested these dependencies
|
||||
binaryDistTar.dependsOn(war, ':fineract-client:jar', ':fineract-avro-schemas:jar', ':fineract-provider:build', ':fineract-doc:doc')
|
||||
|
||||
Reference in New Issue
Block a user