Files
proguard/build.gradle

185 lines
6.2 KiB
Groovy

plugins {
id 'distribution'
id 'io.github.gradle-nexus.publish-plugin'
id 'signing'
id "org.jetbrains.kotlin.jvm" version "$kotlinVersion" apply false
}
allprojects {
group = 'com.guardsquare'
version = proguardVersion
repositories {
mavenLocal()
}
}
task buildDocumentation(type: Exec) {
inputs.dir 'docs/md'
inputs.file 'docs/mkdocs.yml'
outputs.dir 'docs/html'
executable 'sh'
args '-c', "docker run --volume $rootDir/docs:/docs --rm squidfunk/mkdocs-material:5.2.2 build"
}
nexusPublishing {
repositories {
sonatype {
username = findProperty('PROGUARD_STAGING_USERNAME')
password = findProperty('PROGUARD_STAGING_PASSWORD')
}
}
}
// Add Maven repositories
allprojects { Project project ->
afterEvaluate {
if (pluginManager.hasPlugin('maven-publish')) {
configure(project) {
publishing {
repositories {
maven {
name = 'Github'
url = uri('https://maven.pkg.github.com/guardsquare/proguard')
credentials {
username = project.findProperty('PROGUARD_GITHUB_USERNAME')
password = project.findProperty('PROGUARD_GITHUB_TOKEN')
}
}
}
}
}
}
}
}
// Add publication
allprojects { Project project ->
afterEvaluate {
if (pluginManager.hasPlugin('maven-publish')) {
configure(project) {
publishing {
publications {
create(project.name, MavenPublication) {
pom {
artifactId = "proguard-$project.name"
name = "$group:$artifactId"
url = 'https://www.guardsquare.com/proguard'
licenses {
license {
name = 'GNU General Public License, Version 2'
url = 'https://www.gnu.org/licenses/gpl-2.0.txt'
distribution = 'repo'
}
}
issueManagement {
system = 'Github Tracker'
url = 'https://github.com/Guardsquare/proguard/issues'
}
scm {
url = 'https://github.com/Guardsquare/proguard.git'
connection = 'scm:git:https://github.com/Guardsquare/proguard.git'
}
developers {
developer {
id = 'lafortune'
name = 'Eric Lafortune'
organization = 'Guardsquare'
organizationUrl = 'https://www.guardsquare.com/'
roles = ['Project Administrator', 'Developer']
}
}
}
}
}
}
}
}
}
}
// Configure default publication (all Java projects)
allprojects { Project project ->
afterEvaluate {
if (pluginManager.hasPlugin('maven-publish') && pluginManager.hasPlugin('java')) {
configure(project) {
javadoc {
options.addStringOption('Xdoclint:none', '-quiet')
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(8))
}
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
getByName(project.name) {
from components.java
}
}
}
}
}
}
}
// Configure signing
allprojects { Project project ->
afterEvaluate {
if (pluginManager.hasPlugin('maven-publish')) {
configure(project) {
if (project.hasProperty('PROGUARD_SIGNING_KEY')) {
// We use in-memory ascii-armored keys
// See https://docs.gradle.org/current/userguide/signing_plugin.html#sec:in-memory-keys
signing {
String key = project.findProperty('PROGUARD_SIGNING_KEY')
String password = project.findProperty('PROGUARD_SIGNING_PASSWORD')
useInMemoryPgpKeys(key, password)
sign publishing.publications.getByName(project.name)
}
}
}
}
}
}
distributions {
main {
distributionBaseName.set('proguard')
contents {
into('lib') {
from tasks.getByPath(':proguard-app:fatJar').outputs
from tasks.getByPath(':gui:fatJar').outputs
from tasks.getByPath(':retrace:fatJar').outputs
from tasks.getByPath(':ant:fatJar').outputs
}
into('docs') {
from('docs/md') {
includeEmptyDirs = false
include '**/*.md'
}
}
from(rootDir) {
include 'bin/'
include 'examples/'
exclude 'examples/*/build'
exclude 'examples/*/.gradle'
include 'LICENSE'
include 'LICENSE_exception.md'
}
}
}
}
distTar {
compression = Compression.GZIP
archiveExtension.set('tar.gz')
}
clean {
delete file("$rootDir/lib")
// TODO docker runs as root, so cannot clean the HTML yet
// delete buildDocumentation.outputs
}