Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix gradle deprecations and update to gradle 8.11.1 #43668

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build-config/checkstyle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ tasks.register('downloadFile', Download) {
'https://raw.githubusercontent.com/wso2/code-quality-tools/v1.4/checkstyle/jdk-17/checkstyle.xml',
'https://raw.githubusercontent.com/wso2/code-quality-tools/v1.4/checkstyle/jdk-17/suppressions.xml'
])
dest buildDir
dest getLayout().getBuildDirectory().get()
overwrite false
outputs.files("$project.buildDir/checkstyle.xml")
outputs.files("${project.getLayout().getBuildDirectory().get()}/checkstyle.xml")
}

artifacts.add('default', file("$project.buildDir/checkstyle.xml")) {
artifacts.add('default', file("${project.getLayout().getBuildDirectory().get()}/checkstyle.xml")) {
builtBy('downloadFile')
}

20 changes: 7 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,12 @@ subprojects {
buildTasks = ['build']
git {
// To release from any branch
requireBranch = null
requireBranch.set('')
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A general question: is this gradle plugin currently still used to release the official versions? If not, then this could be removed. It currently also includes a deprecation warning see also (researchgate/gradle-release#379)


}

dependencies {
constraints {
//implementation 'org.springframework:spring-web:5.0.2.RELEASE'
}
}

def classFilesArray = []
def execFilesArray = []
def skipDirectories = [
Expand All @@ -80,7 +74,7 @@ def skipDirectories = [

tasks.register('copyExecFilesAndJavaClassFiles') {
subprojects.forEach { subproject ->
fileTree("${subproject.buildDir}/jacoco").matching {
fileTree("${subproject.getLayout().getBuildDirectory().get()}/jacoco").matching {
include "**/*.exec"
}.each {
execFilesArray.push(it)
Expand All @@ -98,7 +92,7 @@ tasks.register('copyExecFilesAndJavaClassFiles') {
if (skipProject) {
return
}
fileTree("${subproject.buildDir}/classes").matching {
fileTree("${subproject.getLayout().getBuildDirectory().get()}/classes").matching {
exclude '**/java/test/**'
exclude '**/default/**'
exclude '**/module-info.class'
Expand All @@ -110,9 +104,9 @@ tasks.register('copyExecFilesAndJavaClassFiles') {

tasks.register('copyBallerinaClassFiles') {
subprojects.forEach { subproject ->
def ballerinaSourceDirectory = new File("${subproject.buildDir}/ballerina-src")
def ballerinaSourceDirectory = new File("${subproject.getLayout().getBuildDirectory().get()}/ballerina-src")
if (ballerinaSourceDirectory.exists() && subproject.projectDir.getParentFile().getName() == "langlib") {
fileTree("${subproject.buildDir}/ballerina-src/target").include("**/*.zip").forEach { zip ->
fileTree("${subproject.getLayout().getBuildDirectory().get()}/ballerina-src/target").include("**/*.zip").forEach { zip ->
def jarFiles = zipTree(zip).matching { include '**/*.jar' }
jarFiles.forEach { jar ->
zipTree(jar).matching {
Expand All @@ -130,8 +124,8 @@ tasks.register('createCodeCoverageReport', JacocoReport) {
reports {
xml.required = true
html.required = true
xml.destination new File("${rootDir}/.jacoco/reports/jacoco/report.xml")
html.destination new File("${rootDir}/.jacoco/reports/jacoco/report.html")
xml.outputLocation = new File("${rootDir}/.jacoco/reports/jacoco/report.xml")
html.outputLocation = new File("${rootDir}/.jacoco/reports/jacoco/report.html")
}
onlyIf = {
true
Expand Down
12 changes: 6 additions & 6 deletions cli/ballerina-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ dependencies {
testImplementation libs.commons.codec
testImplementation libs.jline

distributionBala project(path: ':ballerina-langlib:test', configuration: 'distributionBala')
distributionBala project(path: ':ballerina-lang:test', configuration: 'distributionBala')
distributionBala project(path: ':testerina:testerina-core', configuration: 'distributionBala')
distributionBirJar project(path: ':testerina:testerina-core', configuration: 'distributionBirJar')

Expand All @@ -93,25 +93,25 @@ dependencies {
tasks.register('createTestDistributionCache', Copy) {
dependsOn configurations.distributionBala
from configurations.distributionBala
into "$buildDir/repo"
into "${getLayout().getBuildDirectory().get()}/repo"
}

tasks.register('copyCompilerPluginJars', Copy) {
from configurations.compilerPluginJar
into "$buildDir/compiler-plugin-jars"
into "${getLayout().getBuildDirectory().get()}/compiler-plugin-jars"
}

tasks.register('copyProfilerResources', Copy) {
from project(':jballerina-tools').file('resources/profiler')
into "$buildDir/resources/profiler"
into "${getLayout().getBuildDirectory().get()}/resources/profiler"
}

tasks.register('createTestBre', Copy) {
from configurations.balRt
from configurations.testRt
from configurations.testCore
from configurations.distributionBirJar
into "$buildDir/bre/lib"
into "${getLayout().getBuildDirectory().get()}/bre/lib"
}

test {
Expand All @@ -120,7 +120,7 @@ test {
dependsOn copyCompilerPluginJars
dependsOn copyProfilerResources

systemProperty "ballerina.home", "$buildDir"
systemProperty "ballerina.home", "${getLayout().getBuildDirectory().get()}".toString()

useTestNG() {
suites 'src/test/resources/testng.xml'
Expand Down
8 changes: 4 additions & 4 deletions cli/central-client/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ dependencies {
tasks.register('createTestDistributionCache', Copy) {
dependsOn configurations.distributionBala
from configurations.distributionBala
into "$buildDir/repo"
into "${getLayout().getBuildDirectory().get()}/repo"
}

tasks.register('createBirCache') {
Expand All @@ -60,13 +60,13 @@ tasks.register('createBirCache') {
configurations.bir.each { artifact ->
copy {
from artifact
into "$buildDir/bir-cache/"
into "${getLayout().getBuildDirectory().get()}/bir-cache/"
}
}
}

inputs.files configurations.bir
outputs.dir "$buildDir/bir-cache"
outputs.dir "${getLayout().getBuildDirectory().get()}/bir-cache"
outputs.cacheIf { false }
}

Expand All @@ -76,7 +76,7 @@ test {
dependsOn configurations.birJar
dependsOn configurations.birJarCompile

systemProperty "ballerina.home", "$buildDir"
systemProperty "ballerina.home", "${getLayout().getBuildDirectory().get()}".toString()
useTestNG() {
suites 'src/test/resources/testng.xml'
}
Expand Down
22 changes: 12 additions & 10 deletions distribution/zip/jballerina-tools/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ dependencies {

tasks.register('configured') {
configurations.distBal.allDependencies.withType(ProjectDependency) {
def path = it.getDependencyProject().path
// def path = it.getDependencyProject().path
// dependencies.add("bir", dependencies.project(path: path, configuration: 'bir'))
// dependencies.add("birJar", dependencies.project(path: path, configuration: 'birJar'))
}
Expand All @@ -246,7 +246,9 @@ def copyBalaSpec = {
path -> copySpec {
from configurations.distBal
into(path + 'lib')
fileMode 0644
filePermissions {
unix(0644)
}
}
}

Expand Down Expand Up @@ -378,7 +380,7 @@ def apiDocsSpec = {
}

tasks.register('extractBalxBirs', Copy) {
// def path = "$buildDir/bir-cache"
// def path = "${getLayout().getBuildDirectory().get()}/bir-cache"
// from configurations.balxBir.files
// into path
}
Expand All @@ -398,7 +400,7 @@ tasks.register('pathingJar', Jar) {
tasks.register('copyApiDocs', Copy) {
dependsOn configurations.balDoc
from configurations.balDoc.files
into "$buildDir/api-docs"
into "${getLayout().getBuildDirectory().get()}/api-docs"
exclude "index.html"
exclude "html-template-resources"
exclude "syntax-highlighter"
Expand All @@ -408,12 +410,12 @@ tasks.register('generateDocs', JavaExec) {
dependsOn pathingJar
dependsOn copyApiDocs
dependsOn ':docerina-gradle-plugin:build'
outputs.dir("$buildDir/api-docs")
outputs.dir("${getLayout().getBuildDirectory().get()}/api-docs")
outputs.cacheIf { true }
systemProperty("ballerina.home", "$buildDir")
systemProperty("ballerina.home", "${getLayout().getBuildDirectory().get()}".toString())
classpath = files(pathingJar.archiveFile)
mainClass = 'org.ballerinalang.plugin.gradle.doc.DocerinaGen'
args("$buildDir/api-docs")
args("${getLayout().getBuildDirectory().get()}/api-docs")
}

tasks.register('createApiDocsZip', Zip) {
Expand Down Expand Up @@ -469,7 +471,7 @@ tasks.register('updateBalHome', Copy) {

tasks.register('createDistribution', Copy) {
mustRunAfter(':language-server:language-server-core:createZip')
def filePath = "$buildDir/extracted-distributions/${project.name}-${project.version}"
def filePath = "${getLayout().getBuildDirectory().get()}/extracted-distributions/${project.name}-${project.version}"
file(filePath).mkdirs()
with copyJarSpec("")
with copyBirSpec("")
Expand Down Expand Up @@ -501,8 +503,8 @@ build {

artifacts {
bala configurations.distBal.files
zip file: file("$buildDir/distributions/${project.name}-${project.version}.zip"), builtBy: createZip
unzipped file: file("$buildDir/extracted-distributions/${project.name}-${project.version}"), builtBy: createDistribution
zip file: file("${getLayout().getBuildDirectory().get()}/distributions/${project.name}-${project.version}.zip"), builtBy: createZip
unzipped file: file("${getLayout().getBuildDirectory().get()}/extracted-distributions/${project.name}-${project.version}"), builtBy: createDistribution
}

// This section makes sure that checkstyle/spotbug runs when dist is build.
Expand Down
2 changes: 1 addition & 1 deletion distribution/zip/jballerina/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ artifacts {
bin file('bin')
staticFiles configurations.staticArtifacts.files
resourceFiles file('resources')
zip file: file("$buildDir/distributions/${basePath}.zip"), builtBy: createZip
zip file: file("${getLayout().getBuildDirectory().get()}/distributions/${basePath}.zip"), builtBy: createZip
}

build {
Expand Down
4 changes: 2 additions & 2 deletions docs/bir-spec/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ kaitai {
cacheDir = new File("${project.gradle.gradleUserHomeDir}/kaitai-cache")
executionTimeout = 10_000
version = "${libs.versions.kaitaiStructCompilerVersion.get()}"
url = new URL("https://github.com/kaitai-io/kaitai_struct_compiler/releases/download/"+
url = URI.create("https://github.com/kaitai-io/kaitai_struct_compiler/releases/download/"+
"${libs.versions.kaitaiStructCompilerVersion.get()}"+"/kaitai-struct-compiler-" +
"${libs.versions.kaitaiStructCompilerVersion.get()}"+".zip")
"${libs.versions.kaitaiStructCompilerVersion.get()}"+".zip").toURL()
}

sourceSets.main.java.srcDirs += 'build/generated/kaitai'
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ ow2AsmUtilVersion="9.7"
ow2AsmVersion="9.7"
picocliVersion="4.0.1"
puppycrawlCheckstyleVersion="10.12.0"
researchgateReleaseVersion="2.8.0"
researchgateReleaseVersion = "3.0.2"
scalaLibraryVersion="2.11.7"
slf4jApiVersion="2.0.7"
slf4jJdk14Version="2.0.7"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ tasks.register('createDistributionCache') {
configurations.distributionBala.each { artifact ->
copy {
from zipTree( artifact.getPath() )
into "$buildDir/repo"
into "${getLayout().getBuildDirectory().get()}/repo"
}
}
}
Expand All @@ -117,7 +117,7 @@ def jarFileName = modOrg + "-" + project.ext.modName + "-" + modVersion

tasks.register('copyBallerinaProject', Copy) {
from project.projectDir.toString() + "/src/main/ballerina/"
into project.buildDir.toString() + "/ballerina-src"
into project.getLayout().getBuildDirectory().get().toString() + "/ballerina-src"
}

tasks.register('ballerinaLangLibBuild', BallerinaLangLibBuildTask) {
Expand All @@ -129,13 +129,13 @@ tasks.register('ballerinaLangLibBuild', BallerinaLangLibBuildTask) {
}

artifacts {
distributionBala file("$buildDir/ballerina-src/target/" + modName + ".zip"), {
distributionBala file("${getLayout().getBuildDirectory().get()}/ballerina-src/target/" + modName + ".zip"), {
builtBy(ballerinaLangLibBuild)
}
distributionBirJar file("$buildDir/ballerina-src/target/${jarFileName}.jar"), {
distributionBirJar file("${getLayout().getBuildDirectory().get()}/ballerina-src/target/${jarFileName}.jar"), {
builtBy(ballerinaLangLibBuild)
}
balDoc file("$buildDir/ballerina-src/target/apidocs/"), {
balDoc file("${getLayout().getBuildDirectory().get()}/ballerina-src/target/apidocs/"), {
builtBy(ballerinaLangLibBuild)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ tasks.register('loadDistributionCache') {
configurations.distributionBala.each { artifact ->
copy {
from zipTree( artifact.getPath() )
into "$buildDir/repo"
into "${getLayout().getBuildDirectory().get()}/repo"
}
}
}
Expand All @@ -117,7 +117,7 @@ tasks.register('loadDistributionCache') {
test {
dependsOn loadDistributionCache
systemProperty "java.util.logging.config.file", "src/test/resources/logging.properties"
systemProperty "ballerina.home", "$buildDir"
systemProperty "ballerina.home", "${getLayout().getBuildDirectory().get()}".toString()

afterSuite { suite, result ->
result.exception?.printStackTrace()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ tasks.register('createDistributionCache') {
configurations.distributionBala.each { artifact ->
copy {
from zipTree(artifact.getPath())
into "$buildDir/repo"
into "${getLayout().getBuildDirectory().get()}/repo"
}
}
}
Expand All @@ -141,14 +141,14 @@ tasks.register('copyRuntime') {
configurations.dist.each { artifact ->
copy {
from artifact.getPath()
into "$buildDir/bre/lib"
into "${getLayout().getBuildDirectory().get()}/bre/lib"
}
}
}
}

tasks.register('copyInteropImports', Copy) {
into "$buildDir/libs"
into "${getLayout().getBuildDirectory().get()}/libs"
from configurations.interopImports
}

Expand All @@ -168,7 +168,7 @@ def jarFileName = modOrg + "-" + project.ext.modName + "-" + modVersion

tasks.register('copyBallerinaProject', Copy) {
from project.projectDir.toString() + "/src/main/ballerina/"
into project.buildDir.toString() + "/ballerina-src"
into project.getLayout().getBuildDirectory().get().toString() + "/ballerina-src"
}

tasks.register('ballerinaLangLibBuild', BallerinaLangNativeLibBuildTask) {
Expand All @@ -185,13 +185,13 @@ tasks.register('ballerinaLangLibBuild', BallerinaLangNativeLibBuildTask) {
}

artifacts {
distributionBala file("$buildDir/ballerina-src/target/${project.ext.modName}.zip"), {
distributionBala file("${getLayout().getBuildDirectory().get()}/ballerina-src/target/${project.ext.modName}.zip"), {
builtBy(ballerinaLangLibBuild)
}
distributionBirJar file("$buildDir/ballerina-src/target/${jarFileName}.jar"), {
distributionBirJar file("${getLayout().getBuildDirectory().get()}/ballerina-src/target/${jarFileName}.jar"), {
builtBy(ballerinaLangLibBuild)
}
balDoc file("$buildDir/ballerina-src/target/apidocs/"), {
balDoc file("${getLayout().getBuildDirectory().get()}/ballerina-src/target/apidocs/"), {
builtBy(ballerinaLangLibBuild)
}
}
Expand Down
Loading
Loading