Files
SCM-Manager/scm-packaging/deb/build.gradle
Matthias Thieroff 8136aa1cbd Set the line ending used for license files to LF (#1904)
Set line ending explicitly to LF because on Windows using the system line ending does not get along well with our git settings.

Co-authored-by: Sebastian Sdorra <sebastian.sdorra@cloudogu.com>
2021-12-23 09:43:32 +01:00

194 lines
5.1 KiB
Groovy

/*
* MIT License
*
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import org.gradle.util.VersionNumber
plugins {
id 'nebula.ospackage' version '8.5.6'
id 'org.scm-manager.packaging'
id 'org.scm-manager.license'
}
configurations {
server
webapp
jsvc
packageYaml {
canBeConsumed = true
}
}
dependencies {
server project(':scm-server')
webapp project(path: ':scm-webapp', configuration: 'webapp')
}
task deb(type: Deb) {
packageName 'scm-server'
packageGroup 'devel'
summary 'SCM-Manager Server'
packageDescription 'The easiest way to share and manage your Git, Mercurial and Subversion repositories'
version expandedVersionWithDot
arch 'all'
priority 'extra'
maintainer 'SCM-Team <scm-team@cloudogu.com>'
packager 'SCM-Team <scm-team@cloudogu.com>'
uploaders 'SCM-Team <scm-team@cloudogu.com>'
url 'https://scm-manager.org'
requires 'adduser'
requires 'procps'
requires 'psmisc'
requires 'net-tools'
recommends 'openjdk-11-jre-headless'
recommends 'mercurial'
preInstallFile file('src/main/scripts/preinst')
postInstallFile file('src/main/scripts/postinst')
if (project.hasProperty("signing.keyId")) {
signingKeyId project.property("signing.keyId")
}
if (project.hasProperty("signing.password")) {
signingKeyPassphrase project.property("signing.password")
}
if (project.hasProperty("signing.secretKeyRingFile")) {
signingKeyRingFile file(project.property("signing.secretKeyRingFile"))
}
VersionNumber version = VersionNumber.parse(project.version)
from('src/main/bin') {
into '/opt/scm-server/bin'
user 'root'
permissionGroup 'scm'
fileMode 0750
}
from('src/main/fs/etc/default/scm-server') {
fileType CONFIG | NOREPLACE
into '/etc/default'
user 'root'
permissionGroup 'scm'
fileMode 0640
}
// https://github.com/nebula-plugins/gradle-ospackage-plugin/issues/118
configurationFile('/etc/default/scm-server')
from('src/main/fs/etc/scm') {
fileType CONFIG | NOREPLACE
into '/etc/scm'
user 'root'
permissionGroup 'scm'
fileMode 0640
expand([version: version])
}
// https://github.com/nebula-plugins/gradle-ospackage-plugin/issues/118
configurationFile('/etc/scm/server-config.xml')
configurationFile('/etc/scm/logging.xml')
from('src/main/fs/etc/systemd') {
into '/etc/systemd'
user 'root'
permissionGroup 'root'
fileMode 0644
}
from('src/main/fs/opt') {
into '/opt'
user 'root'
permissionGroup 'scm'
fileMode 0644
}
from(project.configurations.server) {
into '/opt/scm-server/lib'
user 'root'
permissionGroup 'scm'
fileMode 0644
}
from(project.configurations.webapp) {
into '/opt/scm-server/var/webapp'
user 'root'
permissionGroup 'scm'
fileMode 0644
rename {
'scm-webapp.war'
}
}
['/run/scm', '/var/log/scm', '/var/lib/scm', '/var/cache/scm', '/var/cache/scm/work'].each { dir ->
from('src/main/emptydir') {
into dir
user 'scm'
permissionGroup 'scm'
fileMode 0750
createDirectoryEntry true
}
}
link '/opt/scm-server/var/log', '/var/log/scm'
link '/opt/scm-server/conf', '/etc/scm'
link '/opt/scm-server/work', '/var/cache/scm/work'
}
task distribution(type: PackageYaml) {
type = 'debian'
dependsOn deb
}
artifacts {
packageYaml(file('build/libs/package.yml')) {
builtBy distribution
}
}
license {
header rootProject.file("LICENSE.txt")
lineEnding = "\n"
tasks {
build {
files.from("build.gradle", "Vagrantfile")
}
main {
files.from("src")
}
}
}
task publish(type: HttpUploadTask) {
artifact deb
releaseUrl "https://packages.scm-manager.org/repository/apt-v2-releases/"
snapshotUrl "https://packages.scm-manager.org/repository/apt-v2-snapshots/"
if (project.hasProperty("packagesScmManagerUsername") && project.hasProperty("packagesScmManagerPassword")) {
username project.property("packagesScmManagerUsername")
password project.property("packagesScmManagerPassword")
}
dependsOn deb
}