Skip to content

Commit

Permalink
Replace deprecated API usages
Browse files Browse the repository at this point in the history
  • Loading branch information
airsquared committed Sep 24, 2023
1 parent 38707f5 commit c93aa9b
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/main/groovy/org/beryx/jlink/JPackageImageTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ class JPackageImageTask extends BaseTask {

@Internal
File getImageDirFromName() {
project.file("$project.buildDir/${imageName}")
project.file("${project.layout.buildDirectory.get()}/${imageName}")
}
}
2 changes: 1 addition & 1 deletion src/main/groovy/org/beryx/jlink/JPackageTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ class JPackageTask extends BaseTask {

@Internal
File getImageDirFromName() {
project.file("$project.buildDir/${imageName}")
project.file("${project.layout.buildDirectory.get()}/${imageName}")
}
}
2 changes: 1 addition & 1 deletion src/main/groovy/org/beryx/jlink/JlinkTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,6 @@ class JlinkTask extends BaseTask {

@Internal
File getImageDirFromName() {
project.file("$project.buildDir/$imageName")
project.file("${project.layout.buildDirectory.get()}/$imageName")
}
}
8 changes: 6 additions & 2 deletions src/main/groovy/org/beryx/jlink/JlinkZipTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,15 @@ class JlinkZipTask extends BaseTask {

@Internal
File getImageDirFromName() {
project.file("$project.buildDir/$imageName")
project.file("$buildDir/$imageName")
}

@Internal
File getImageZipFromName() {
project.file("$project.buildDir/${imageName}.zip")
project.file("$buildDir/${imageName}.zip")
}

private File getBuildDir() {
return project.layout.buildDirectory.asFile.get()
}
}
4 changes: 2 additions & 2 deletions src/main/groovy/org/beryx/jlink/data/JPackageData.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ class JPackageData {

@OutputDirectory
File getImageOutputDir() {
this.@imageOutputDir ?: project.file("$project.buildDir/$outputDir")
this.@imageOutputDir ?: project.layout.buildDirectory.dir(outputDir).get().asFile
}

@OutputDirectory
File getInstallerOutputDir() {
this.@installerOutputDir ?: project.file("$project.buildDir/$outputDir")
this.@installerOutputDir ?: project.layout.buildDirectory.dir(outputDir).get().asFile
}

@Internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class JlinkPluginExtension {
JlinkPluginExtension(Project project) {
this.project = project
jlinkBasePath = project.objects.property(String)
jlinkBasePath.set(project.provider{"$project.buildDir/jlinkbase" as String})
jlinkBasePath.set(project.layout.buildDirectory.dir('jlinkbase').map { it -> it as String})

imageName = project.objects.property(String)
imageName.set('')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,18 @@ class PrepareModulesDirTaskImpl extends BaseTaskImpl<PrepareModulesDirTaskData>
}

project.copy {
from project.jar.archiveFile
into td.jlinkJarsDir
from (project.jar.archivePath)
}

adjustModuleDescriptors(depMgr)

def mainModuleJar = new File(td.jlinkJarsDir, project.jar.archivePath.name)
def targetPath = "$td.jlinkJarsDir/${td.moduleName}.jar"
}

@CompileDynamic
private void adjustModuleDescriptors(DependencyManager depMgr) {
def nonModularModules = depMgr.nonModularJars.collect { Util.getModuleName(it) }
def adjuster = new ModuleInfoAdjuster(td.mergedModuleName, nonModularModules)
def jarMap = (depMgr.modularJars + project.jar.archivePath).collectEntries { [it.name, it] }
def jarMap = (depMgr.modularJars + Util.getArchiveFile(project)).collectEntries { [it.name, it] }
td.jlinkJarsDir.listFiles().each { File jar ->
if(jarMap.keySet().contains(jar.name)) {
def adjustedDescriptors = adjuster.getAdjustedDescriptors(jarMap[jar.name])
Expand Down
2 changes: 1 addition & 1 deletion src/main/groovy/org/beryx/jlink/util/JdkUtil.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class JdkUtil {

JdkDownloadOptions(Project project, String targetPlatform, String downloadUrl) {
this.project = project
this.downloadDir = "$project.buildDir/jdks/$targetPlatform"
this.downloadDir = "${project.layout.buildDirectory.get()}/jdks/$targetPlatform"
this.archiveName = "jdk"
def urlPath = new URL(downloadUrl).path
if(urlPath.endsWith(".tar.gz")) archiveExtension = "tar.gz"
Expand Down

0 comments on commit c93aa9b

Please sign in to comment.