2828import org .gradle .api .tasks .Input ;
2929import org .gradle .api .tasks .InputDirectory ;
3030import org .gradle .api .tasks .InputFiles ;
31+ import org .gradle .api .tasks .Internal ;
3132import org .gradle .api .tasks .Nested ;
3233import org .gradle .api .tasks .Optional ;
3334import org .gradle .api .tasks .OutputDirectory ;
@@ -106,6 +107,9 @@ abstract public class Jpackage extends DefaultTask {
106107 @ OutputDirectory
107108 abstract public DirectoryProperty getDestination ();
108109
110+ @ Internal
111+ abstract public DirectoryProperty getTempDirectory ();
112+
109113 @ Inject
110114 abstract protected FileOperations getFiles ();
111115
@@ -114,6 +118,7 @@ abstract public class Jpackage extends DefaultTask {
114118
115119 @ TaskAction
116120 public void runJpackage () throws Exception {
121+ getFiles ().delete (getTempDirectory ());
117122 getFiles ().delete (getDestination ());
118123
119124 String os = getOperatingSystem ().get ();
@@ -123,9 +128,8 @@ public void runJpackage() throws Exception {
123128
124129 validateHostSystem (arch , hostArch , os , hostOs );
125130
126- Directory tmpDir = getDestination ().dir ("tmp" ).get ();
127- Directory resourcesDir = tmpDir .dir ("jpackage-resources" );
128- Directory appImageParent = tmpDir .dir ("app-image" );
131+ Directory resourcesDir = getTempDirectory ().get ().dir ("jpackage-resources" );
132+ Directory appImageParent = getTempDirectory ().get ().dir ("app-image" );
129133 //noinspection ResultOfMethodCallIgnored
130134 resourcesDir .getAsFile ().mkdirs ();
131135
@@ -205,8 +209,6 @@ public void runJpackage() throws Exception {
205209 })
206210 );
207211
208- getFiles ().delete (tmpDir );
209-
210212 generateChecksums ();
211213 }
212214
0 commit comments