@@ -77,25 +77,7 @@ val assemblePlugin by tasks.registering(Jar::class) {
77
77
val copyPlugin by tasks.creating(Sync ::class .java) {
78
78
dependsOn(assemblePlugin)
79
79
80
- val userHome = System .getProperty(" user.home" ).let { Path .of(it) }
81
- val toolboxCachesDir = when {
82
- SystemInfoRt .isWindows -> System .getenv(" LOCALAPPDATA" )?.let { Path .of(it) } ? : (userHome / " AppData" / " Local" )
83
- // currently this is the location that TBA uses on Linux
84
- SystemInfoRt .isLinux -> System .getenv(" XDG_DATA_HOME" )?.let { Path .of(it) } ? : (userHome / " .local" / " share" )
85
- SystemInfoRt .isMac -> userHome / " Library" / " Caches"
86
- else -> error(" Unknown os" )
87
- } / " JetBrains" / " Toolbox"
88
-
89
- val pluginsDir = when {
90
- SystemInfoRt .isWindows -> toolboxCachesDir / " cache"
91
- SystemInfoRt .isLinux || SystemInfoRt .isMac -> toolboxCachesDir
92
- else -> error(" Unknown os" )
93
- } / " plugins"
94
-
95
- val targetDir = pluginsDir / pluginId
96
-
97
80
from(assemblePlugin.get().outputs.files)
98
-
99
81
from(" src/main/resources" ) {
100
82
include(" extension.json" )
101
83
include(" dependencies.json" )
@@ -117,7 +99,32 @@ val copyPlugin by tasks.creating(Sync::class.java) {
117
99
},
118
100
)
119
101
120
- into(targetDir)
102
+ into(getPluginInstallDir())
103
+ }
104
+
105
+ tasks.register(" cleanAll" , Delete ::class .java) {
106
+ dependsOn(tasks.clean)
107
+ delete(getPluginInstallDir())
108
+ delete()
109
+ }
110
+
111
+ private fun getPluginInstallDir (): Path {
112
+ val userHome = System .getProperty(" user.home" ).let { Path .of(it) }
113
+ val toolboxCachesDir = when {
114
+ SystemInfoRt .isWindows -> System .getenv(" LOCALAPPDATA" )?.let { Path .of(it) } ? : (userHome / " AppData" / " Local" )
115
+ // currently this is the location that TBA uses on Linux
116
+ SystemInfoRt .isLinux -> System .getenv(" XDG_DATA_HOME" )?.let { Path .of(it) } ? : (userHome / " .local" / " share" )
117
+ SystemInfoRt .isMac -> userHome / " Library" / " Caches"
118
+ else -> error(" Unknown os" )
119
+ } / " JetBrains" / " Toolbox"
120
+
121
+ val pluginsDir = when {
122
+ SystemInfoRt .isWindows -> toolboxCachesDir / " cache"
123
+ SystemInfoRt .isLinux || SystemInfoRt .isMac -> toolboxCachesDir
124
+ else -> error(" Unknown os" )
125
+ } / " plugins"
126
+
127
+ return pluginsDir / pluginId
121
128
}
122
129
123
130
val pluginZip by tasks.creating(Zip ::class ) {
0 commit comments