/* Copyright (C) 2000 - 2026 Silverpeas 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, either version 3 of the License, or (at your option) any later version. As a special exception to the terms and conditions of version 3.0 of the GPL, you may redistribute this Program in connection with Free/Libre Open Source Software ("FLOSS") applications as described in Silverpeas's FLOSS exception. You should have received a copy of the text describing the FLOSS exception, and it is also available here: "https://www.silverpeas.org/legal/floss_exception.html" 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 . */ import org.apache.tools.ant.filters.ReplaceTokens buildscript { repositories { maven { url = 'https://nexus3.silverpeas.org/repository/silverpeas' } mavenLocal() } } plugins { id 'java-gradle-plugin' id 'org.ajoberstar.grgit' version '5.3.3' apply true id 'idea' id 'maven-publish' id 'groovy' } description = 'The Gradle plugin to set up Silverpeas. It is used both to install or to upgrade Silverpeas.' group = 'org.silverpeas' version = '6.5-build260906' gradlePlugin { plugins { silversetup { id = 'silversetup' implementationClass = 'org.silverpeas.setup.SilverpeasSetupPlugin' } } } /* cache management configurations { all { resolutionStrategy { cacheDynamicVersionsFor 0, 'seconds' cacheChangingModulesFor 0, 'seconds' } } }*/ project.configure(project) { if (project.version.endsWith('-SNAPSHOT')) { project.extensions.snapshot = true } else { project.extensions.snapshot = false } } repositories { maven { name = 'silverpeas' url = 'https://nexus3.silverpeas.org/repository/silverpeas' } maven { name = 'gradle-plugins' url = 'https://plugins.gradle.org/m2/' } mavenLocal() } java { // use a Java 21 toolchain so that the compilation and the tests execution both run on a // JDK 21, regardless of the JVM launching Gradle. This makes the build reproducible even when // Gradle itself is started with another Java version (for example Java 11). toolchain { languageVersion = JavaLanguageVersion.of(21) } withSourcesJar() } publishing { publications { maven(MavenPublication) { from components.java } } repositories { maven { if (project.snapshot) { name = 'silverpeas-snapshots' url = 'https://nexus3.silverpeas.org/repository/snapshots/' } else { name = 'silverpeas' url = 'https://nexus3.silverpeas.org/repository/builds/' } // the credentials to publish into Nexus are expected to be defined by the two following // Gradle properties, usually set in the gradle.properties file of the user (that is to say // in ~/.gradle/gradle.properties) or, for a CI, by the environment variables // ORG_GRADLE_PROJECT_nexusUsername and ORG_GRADLE_PROJECT_nexusPassword. // (They were previously read from the servers section of the Maven settings.xml file by the // net.linguica.maven-settings plugin, no more maintained and incompatible with Gradle 10.) credentials { username = providers.gradleProperty('nexusUsername').orNull password = providers.gradleProperty('nexusPassword').orNull } } } } dependencies { api gradleApi() // groovy-sql isn't anymore bundled within the Gradle distribution since Gradle 9 api 'org.apache.groovy:groovy-sql:4.0.32' api 'org.apache.commons:commons-lang3:3.20.0' api 'org.apache.commons:commons-text:1.15.0' api 'commons-io:commons-io:2.22.0' api 'org.apache.commons:commons-dbcp2:2.14.0' api 'commons-codec:commons-codec:1.22.0' api 'com.google.guava:guava:33.0.0-jre' api 'javax.jcr:jcr:2.0' api 'org.apache.jackrabbit:oak-jcr:2.4.0' api 'org.apache.jackrabbit:oak-segment-tar:2.4.0' api 'org.apache.jackrabbit:oak-store-document:2.4.0' runtimeOnly 'org.eclipse.jetty:jetty-jndi:12.1.11' runtimeOnly 'org.eclipse.jetty:jetty-util:12.1.11' runtimeOnly 'com.h2database:h2:2.2.224' runtimeOnly 'org.postgresql:postgresql:42.7.12' runtimeOnly 'net.sourceforge.jtds:jtds:1.3.1' runtimeOnly 'io.dropwizard.metrics:metrics-core:4.2.26' runtimeOnly 'org.mongodb:mongodb-driver-sync:5.6.2' testImplementation gradleTestKit() // groovy-test isn't anymore bundled within the Gradle distribution since Gradle 9 testImplementation 'org.apache.groovy:groovy-test:4.0.32' testImplementation platform("org.spockframework:spock-bom:2.4-groovy-4.0") testImplementation 'org.spockframework:spock-core' testImplementation 'org.spockframework:spock-junit4' testImplementation 'junit:junit:4.13.2' } ext { revision = grgit.head().abbreviatedId } jar { manifest { attributes( "Build-Version": project.version, "Git-Commit": grgit.head().abbreviatedId) } } tasks.register('sourceJar', Jar) { from sourceSets.main.allSource } processTestResources { filesMatching('**/*.properties') { filter(ReplaceTokens, tokens: [buildDir: layout.buildDirectory.get().asFile.path.replace('\\', '/')], beginToken: '${', endToken: '}') } filesMatching('**/*.xml') { filter(ReplaceTokens, tokens: [buildDir: layout.buildDirectory.get().asFile.path.replace('\\', '/')], beginToken: '${', endToken: '}') } }