Skip to content

Commit a35c1d0

Browse files
committed
Reduce uses of deprecated APIs
Fixes compatibility with gradle 9
1 parent dada390 commit a35c1d0

7 files changed

Lines changed: 21 additions & 21 deletions

File tree

src/main/java/io/github/fvarrui/javapackager/gradle/CreateTarball.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ else if (Platform.linux.equals(platform)) {
6969
copySpec.include(appFolder.getName() + "/" + executable.getName());
7070
copySpec.include(appFolder.getName() + "/" + jreDirectoryName + "/bin/*");
7171
copySpec.include(appFolder.getName() + "/scripts/*");
72-
copySpec.setFileMode(0755);
72+
copySpec.filePermissions(p -> p.unix("755"));
7373
});
7474

7575
}
@@ -93,7 +93,7 @@ else if (Platform.mac.equals(platform)) {
9393
copySpec.include(appFile.getName() + "/Contents/MacOS/universalJavaApplicationStub");
9494
copySpec.include(appFile.getName() + "/Contents/PlugIns/" + jreDirectoryName + "/Contents/Home/bin/*");
9595
copySpec.include(appFile.getName() + "/Contents/Resources/scripts/*");
96-
copySpec.setFileMode(0755);
96+
copySpec.filePermissions(p -> p.unix("755"));
9797
});
9898

9999
}

src/main/java/io/github/fvarrui/javapackager/gradle/CreateZipball.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ else if (Platform.linux.equals(platform)) {
6565
copySpec.include(appFolder.getName() + "/" + executable.getName());
6666
copySpec.include(appFolder.getName() + "/" + jreDirectoryName + "/bin/*");
6767
copySpec.include(appFolder.getName() + "/scripts/*");
68-
copySpec.setFileMode(0755);
68+
copySpec.filePermissions(p -> p.unix("755"));
6969
});
7070

7171
}
@@ -88,7 +88,7 @@ else if (Platform.mac.equals(platform)) {
8888
copySpec.include(appFile.getName() + "/Contents/MacOS/universalJavaApplicationStub");
8989
copySpec.include(appFile.getName() + "/Contents/PlugIns/" + jreDirectoryName + "/Contents/Home/bin/*");
9090
copySpec.include(appFile.getName() + "/Contents/Resources/scripts/*");
91-
copySpec.setFileMode(0755);
91+
copySpec.filePermissions(p -> p.unix("755"));
9292
});
9393

9494
}

src/main/java/io/github/fvarrui/javapackager/gradle/GradleContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public File getRootDir() {
4444

4545
@Override
4646
public File getBuildDir() {
47-
return project.getBuildDir();
47+
return project.getLayout().getBuildDirectory().getAsFile().get();
4848
}
4949

5050
@Override

src/main/java/io/github/fvarrui/javapackager/gradle/PackagePluginExtension.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public PackagePluginExtension(Project project) {
5353
this.vmArgs = new ArrayList<>();
5454
this.appArgs = new ArrayList<>();
5555
this.winConfig = new WindowsConfig();
56-
this.outputDirectory = project.getBuildDir();
56+
this.outputDirectory = project.getLayout().getBuildDirectory().getAsFile().get();
5757
this.scripts = new Scripts();
5858
this.forceInstaller = false;
5959
this.arch = Arch.getDefault();

src/main/java/io/github/fvarrui/javapackager/maven/PackageMojo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package io.github.fvarrui.javapackager.maven;
22

3+
import static org.apache.commons.lang3.ObjectUtils.getIfNull;
34
import static org.apache.commons.lang3.StringUtils.defaultIfBlank;
4-
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
55
import static org.twdata.maven.mojoexecutor.MojoExecutor.executionEnvironment;
66

77
import java.io.File;
@@ -352,7 +352,7 @@ public void execute() throws MojoExecutionException {
352352
.additionalModulePaths(additionalModulePaths)
353353
.additionalResources(additionalResources)
354354
.administratorRequired(administratorRequired)
355-
.arch(defaultIfNull(arch, Arch.getDefault()))
355+
.arch(getIfNull(arch, Arch.getDefault()))
356356
.assetsDir(assetsDir)
357357
.bundleJre(bundleJre)
358358
.classpath(classpath)

src/main/java/io/github/fvarrui/javapackager/model/LinuxConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public String toString() {
9494
*/
9595
public void setDefaults(Packager packager) {
9696
this.setCategories((categories == null || categories.isEmpty()) ? Collections.singletonList("Utility") : categories);
97-
this.setInstallationPath(ObjectUtils.defaultIfNull(installationPath, "/opt"));
97+
this.setInstallationPath(ObjectUtils.getIfNull(installationPath, "/opt"));
9898
}
9999

100100
}

src/main/java/io/github/fvarrui/javapackager/model/MacConfig.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.github.fvarrui.javapackager.model;
22

3-
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
3+
import static org.apache.commons.lang3.ObjectUtils.getIfNull;
44

55
import java.io.File;
66
import java.io.Serializable;
@@ -305,16 +305,16 @@ public String toString() {
305305
* @param packager Packager
306306
*/
307307
public void setDefaults(Packager packager) {
308-
this.setWindowX(defaultIfNull(this.getWindowX(), 10));
309-
this.setWindowY(defaultIfNull(this.getWindowY(), 60));
310-
this.setWindowWidth(defaultIfNull(this.getWindowWidth(), 540));
311-
this.setWindowHeight(defaultIfNull(this.getWindowHeight(), 360));
312-
this.setIconSize(defaultIfNull(this.getIconSize(), 128));
313-
this.setTextSize(defaultIfNull(this.getTextSize(), 16));
314-
this.setIconX(defaultIfNull(this.getIconX(), 52));
315-
this.setIconY(defaultIfNull(this.getIconY(), 116));
316-
this.setAppsLinkIconX(defaultIfNull(this.getAppsLinkIconX(), 360));
317-
this.setAppsLinkIconY(defaultIfNull(this.getAppsLinkIconY(), 116));
318-
this.setAppId(defaultIfNull(this.getAppId(), packager.getMainClass()));
308+
this.setWindowX(getIfNull(this.getWindowX(), 10));
309+
this.setWindowY(getIfNull(this.getWindowY(), 60));
310+
this.setWindowWidth(getIfNull(this.getWindowWidth(), 540));
311+
this.setWindowHeight(getIfNull(this.getWindowHeight(), 360));
312+
this.setIconSize(getIfNull(this.getIconSize(), 128));
313+
this.setTextSize(getIfNull(this.getTextSize(), 16));
314+
this.setIconX(getIfNull(this.getIconX(), 52));
315+
this.setIconY(getIfNull(this.getIconY(), 116));
316+
this.setAppsLinkIconX(getIfNull(this.getAppsLinkIconX(), 360));
317+
this.setAppsLinkIconY(getIfNull(this.getAppsLinkIconY(), 116));
318+
this.setAppId(getIfNull(this.getAppId(), packager.getMainClass()));
319319
}
320320
}

0 commit comments

Comments
 (0)