chg: ironed out some details in build tasks
This commit is contained in:
parent
b1c60cbf00
commit
207091aee8
2 changed files with 72 additions and 27 deletions
62
build.gradle
62
build.gradle
|
|
@ -30,19 +30,11 @@ allprojects {
|
|||
return packageData.version
|
||||
}
|
||||
|
||||
project.ext.antvilleBuildDir = "${rootProject.buildDir}/install/antville"
|
||||
project.ext.antvilleBuildDir = "${rootProject.buildDir}/tmp/antville"
|
||||
project.ext.antvilleInstallDir = "${rootProject.buildDir}/install/antville"
|
||||
|
||||
project.ext.antvilleDistFiles = copySpec {
|
||||
from fileTree(antvilleBuildDir).matching {
|
||||
exclude '*gradle*'
|
||||
exclude '.*'
|
||||
exclude 'node_modules'
|
||||
exclude 'package.json'
|
||||
exclude 'i18n/*.po*'
|
||||
exclude 'tests'
|
||||
exclude 'tools/antclick'
|
||||
exclude 'tools/client'
|
||||
exclude 'yarn.lock'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -55,6 +47,8 @@ allprojects {
|
|||
project.tasks.testClasses.group = null;
|
||||
}
|
||||
|
||||
version = distVersion()
|
||||
|
||||
dependencies {
|
||||
implementation 'com.atlassian.commonmark:commonmark:0.14.0'
|
||||
implementation 'com.atlassian.commonmark:commonmark-ext-autolink:0.14.0'
|
||||
|
|
@ -70,20 +64,54 @@ dependencies {
|
|||
}
|
||||
}
|
||||
|
||||
assemble {
|
||||
task assemble(type: Copy, overwrite: true) {
|
||||
dependsOn 'installAntville'
|
||||
dependsOn 'installJars'
|
||||
dependsOn 'buildStaticFiles'
|
||||
|
||||
from fileTree(antvilleBuildDir).matching {
|
||||
exclude 'node_modules'
|
||||
exclude 'package.json'
|
||||
exclude 'tests'
|
||||
exclude 'tools/client'
|
||||
exclude 'tools/antclick'
|
||||
exclude 'yarn.lock'
|
||||
} into antvilleInstallDir
|
||||
}
|
||||
|
||||
task installAntville {
|
||||
description 'Clone the Antville repository and remove all unnecessary files.'
|
||||
group 'installation'
|
||||
|
||||
outputs.dir antvilleBuildDir
|
||||
def tempDir = "$project.buildDir/tmp/repo"
|
||||
|
||||
outputs.dirs tempDir, antvilleBuildDir
|
||||
|
||||
doFirst {
|
||||
Grgit.clone(dir: antvilleBuildDir, uri: project.ext['antville.repo.url'])
|
||||
Grgit.clone(dir: tempDir, uri: project.ext['antville.repo.url'])
|
||||
}
|
||||
|
||||
doLast {
|
||||
def git = Grgit.open(dir: tempDir)
|
||||
def hash = git.head().abbreviatedId
|
||||
def date = new Date().format('d MMM yyyy')
|
||||
|
||||
copy {
|
||||
from "$tempDir/code/app.properties"
|
||||
into "$antvilleBuildDir/code"
|
||||
filter { line -> line.replaceAll('(version =) 0.0.0', "\$1 $version.$hash")
|
||||
.replaceAll('(buildDate =) 18 Oct 1971', "\$1 $date")
|
||||
}
|
||||
}
|
||||
|
||||
copy {
|
||||
from fileTree(tempDir).matching {
|
||||
exclude 'code/app.properties'
|
||||
exclude '*gradle*'
|
||||
exclude '.*'
|
||||
exclude 'i18n/*.po*'
|
||||
} into antvilleBuildDir
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -232,10 +260,10 @@ task distZip(type: Zip) {
|
|||
def outputDir = "${project.buildDir}/distributions"
|
||||
def outputFile = "antville-${version}.zip"
|
||||
|
||||
inputs.dir antvilleBuildDir
|
||||
inputs.dir antvilleInstallDir
|
||||
outputs.file "$outputDir/$outputFile"
|
||||
|
||||
with(antvilleDistFiles)
|
||||
from antvilleInstallDir
|
||||
destinationDirectory = file(outputDir)
|
||||
archiveFileName = outputFile
|
||||
}
|
||||
|
|
@ -249,10 +277,10 @@ task distTar(type: Tar) {
|
|||
def outputDir = "${project.buildDir}/distributions"
|
||||
def outputFile = "antville-${version}.tbz"
|
||||
|
||||
inputs.dir antvilleBuildDir
|
||||
inputs.dir antvilleInstallDir
|
||||
outputs.file "$outputDir/$outputFile"
|
||||
|
||||
with(antvilleDistFiles)
|
||||
from antvilleInstallDir
|
||||
compression = Compression.BZIP2
|
||||
destinationDirectory = file(outputDir)
|
||||
archiveFileName = outputFile
|
||||
|
|
|
|||
|
|
@ -6,6 +6,10 @@ def helmaInstallDir = "${rootProject.buildDir}/install/antclick"
|
|||
|
||||
tasks.build.dependsOn ':build', 'assemble'
|
||||
|
||||
clean {
|
||||
delete helmaInstallDir
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.h2database:h2:1.4.200'
|
||||
}
|
||||
|
|
@ -23,6 +27,7 @@ assemble {
|
|||
dependsOn 'installAntville'
|
||||
dependsOn 'installJars'
|
||||
dependsOn 'buildDatabase'
|
||||
dependsOn 'buildLicenses'
|
||||
}
|
||||
|
||||
task downloadHelma {
|
||||
|
|
@ -70,15 +75,21 @@ task installAntville(type: Copy) {
|
|||
group 'installation'
|
||||
dependsOn 'installHelma'
|
||||
|
||||
inputs.dir antvilleBuildDir
|
||||
outputs.dir helmaInstallDir
|
||||
def appsProperties = "$antvilleBuildDir/tools/antclick/apps.properties"
|
||||
def outputDir = "$helmaInstallDir/apps/antville"
|
||||
|
||||
with antvilleDistFiles
|
||||
into "$helmaInstallDir/apps/antville"
|
||||
inputs.dir antvilleInstallDir
|
||||
inputs.file appsProperties
|
||||
|
||||
outputs.dir outputDir
|
||||
outputs.file appsProperties
|
||||
|
||||
from antvilleInstallDir
|
||||
into outputDir
|
||||
|
||||
doLast {
|
||||
copy {
|
||||
from "$antvilleBuildDir/tools/antclick/apps.properties"
|
||||
from appsProperties
|
||||
into helmaInstallDir
|
||||
}
|
||||
}
|
||||
|
|
@ -102,7 +113,7 @@ task buildDatabase(type: JavaExec) {
|
|||
description 'Builds the H2 SQL database file.'
|
||||
group 'build'
|
||||
|
||||
def inputFile = "$antvilleBuildDir/db/postgre.sql"
|
||||
def inputFile = "$antvilleInstallDir/db/postgre.sql"
|
||||
def outputDir = "$helmaInstallDir/db"
|
||||
|
||||
inputs.file inputFile
|
||||
|
|
@ -122,6 +133,9 @@ task buildDatabase(type: JavaExec) {
|
|||
'-user', 'antville',
|
||||
'-password', 'antville'
|
||||
]
|
||||
|
||||
standardOutput = new ByteArrayOutputStream()
|
||||
ignoreExitValue true
|
||||
}
|
||||
|
||||
task buildLicenses(type: Copy) {
|
||||
|
|
@ -129,8 +143,13 @@ task buildLicenses(type: Copy) {
|
|||
group 'build'
|
||||
dependsOn 'installJars'
|
||||
|
||||
from("${project.buildDir}/reports/dependency-license")
|
||||
into "$antvilleBuildDir/licenses"
|
||||
def licensesDir = "$antvilleInstallDir/licenses"
|
||||
|
||||
inputs.files generateLicenseReport
|
||||
outputs.dir licensesDir
|
||||
|
||||
from generateLicenseReport
|
||||
into licensesDir
|
||||
}
|
||||
|
||||
task assembleDist {
|
||||
|
|
@ -140,8 +159,6 @@ task assembleDist {
|
|||
dependsOn 'assemble'
|
||||
dependsOn 'distZip'
|
||||
dependsOn 'distTar'
|
||||
|
||||
outputs.dir "${rootProject.buildDir}/distributions"
|
||||
}
|
||||
|
||||
task distZip(type: Zip) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue