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

138 lines
3.0 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 "de.undercouch.download" version "4.1.1"
id 'org.scm-manager.packaging'
id 'signing'
id 'maven-publish'
id 'org.scm-manager.license'
}
configurations {
server
webapp
windowsPkg
packageYaml {
canBeConsumed = true
}
}
dependencies {
server project(':scm-server')
webapp project(path: ':scm-webapp', configuration: 'webapp')
}
// winsw dependency
def winsw = [
name: 'WinSW.NETCore31.x86.exe',
version: '2.10.3',
checksum: 'd6ad842e104bfb200bca06d6724e3e1fb19d013fa62fa49a21298d2ee9b044b7'
]
task downloadWinSW(type: Download) {
src "https://github.com/winsw/winsw/releases/download/v${winsw.version}/${winsw.name}"
dest new File(project.buildDir, 'winsw/scm-server.exe')
onlyIfModified true
}
task verifyWinSW(type: Verify) {
src new File(project.buildDir, 'winsw/scm-server.exe')
algorithm 'SHA-256'
checksum winsw.checksum
dependsOn 'downloadWinSW'
}
task windows(type: Zip) {
VersionNumber version = VersionNumber.parse(project.version)
archiveFileName = "windows-${project.version}.zip"
into('scm-server') {
into('conf') {
from 'src/main/fs/conf'
include 'config.yml'
expand([version: version])
}
from('src/main/fs') {
exclude('**/config.yml')
}
into('lib') {
from project.configurations.server
}
into('var/webapp') {
from project.configurations.webapp
rename {
'scm-webapp.war'
}
}
from 'build/winsw'
}
destinationDir file('build/libs')
dependsOn 'verifyWinSW'
}
task distribution(type: PackageYaml) {
type = 'windows'
artifact = file("build/libs/windows-${project.version}.zip")
dependsOn windows
}
artifacts {
windowsPkg windows
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(windows) {
extension 'zip'
}
}
}
}
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")
}
}
}