Files
SCM-Manager/scm-packaging/unix/build.gradle
2024-09-24 09:42:07 +02:00

134 lines
2.8 KiB
Groovy

/*
* Copyright (c) 2020 - present Cloudogu GmbH
*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
import org.gradle.util.VersionNumber
plugins {
id 'org.scm-manager.packaging'
id 'signing'
id 'maven-publish'
id 'org.scm-manager.license'
}
configurations {
server
webapp
jsvc
unixPkg
packageYaml {
canBeConsumed = true
}
}
dependencies {
server project(':scm-server')
webapp project(path: ':scm-webapp', configuration: 'webapp')
jsvc libraries.jsvc
}
task unix(type: Tar) {
VersionNumber version = VersionNumber.parse(project.version)
archiveFileName = "unix-${project.version}.tar.gz"
into('scm-server') {
into('conf') {
from 'src/main/fs/conf'
include 'config.yml'
expand([version: version])
}
from('src/main/fs') {
exclude('**/config.yml')
}
into('bin') {
from('src/main/bin') {
fileMode 0755
}
}
into('lib') {
from project.configurations.server
}
into('var/webapp') {
from project.configurations.webapp
rename {
'scm-webapp.war'
}
}
}
project.configurations.jsvc.each { archive ->
into('.') {
from tarTree(archive)
include '**/jsvc*'
eachFile { fcd ->
fcd.relativePath = new RelativePath(true, "scm-server/libexec/${fcd.name}")
}
includeEmptyDirs = false
}
}
destinationDir file('build/libs')
compression = Compression.GZIP
}
task distribution(type: PackageYaml) {
type = 'unix'
artifact = file("build/libs/unix-${project.version}.tar.gz")
dependsOn unix
}
artifacts {
unixPkg unix
packageYaml(file('build/libs/package.yml')) {
builtBy distribution
}
}
signing {
sign publishing.publications
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId "sonia.scm.packaging"
artifactId project.name
version project.version
artifact(unix) {
extension 'tar.gz'
}
}
}
}
project.rootProject.publishing.repositories.each { r ->
project.publishing.repositories.add(r)
}
license {
header rootProject.file("LICENSE-HEADER.txt")
lineEnding = "\n"
tasks {
build {
files.from("build.gradle", "Dockerfile")
}
main {
files.from("src")
}
}
}