@@ -39,14 +39,32 @@ version = "2.6.1"
3939
4040repositories {
4141 mavenCentral()
42+ ivy {
43+ url = uri(" https://github.com/PowerShell/PSScriptAnalyzer/releases/download/" )
44+ patternLayout {
45+ artifact(" [revision]/[module].[revision].[ext]" )
46+ }
47+ content {
48+ includeGroup(" PSScriptAnalyzer" )
49+ }
50+ metadataSources {
51+ artifact()
52+ }
53+ }
4254}
4355
56+ val psScriptAnalyzer: Configuration by configurations.creating
57+
4458dependencies {
4559 implementation(libs.bundles.junixsocket)
4660
4761 implementation(libs.lsp4j)
4862 testImplementation(" org.jetbrains.kotlin:kotlin-test-junit" )
4963 testImplementation(libs.junit)
64+
65+ libs.psScriptAnalyzer.get().apply {
66+ psScriptAnalyzer(group = this .group!! , name = this .name, version = this .version, ext = " nupkg" )
67+ }
5068}
5169
5270configurations {
@@ -158,29 +176,21 @@ tasks {
158176
159177 val downloads = layout.buildDirectory.get().dir(" download" )
160178
161- val psScriptAnalyzerVersion: String by project
162- val psScriptAnalyzerSha256Hash: String by project
163- val psScriptAnalyzerFileName = " PSScriptAnalyzer.$psScriptAnalyzerVersion .nupkg"
164- val psScriptAnalyzerOutFile = downloads.file(psScriptAnalyzerFileName)
165-
166179 val psesVersion: String by project
167180 val psesSha256Hash: String by project
168181
169- val getPsScriptAnalyzer = getDependencyTask(
170- " PSScriptAnalyzer" ,
171- psScriptAnalyzerVersion,
172- psScriptAnalyzerSha256Hash,
173- URI (
174- " https://github.com/PowerShell/PSScriptAnalyzer/releases/download/" +
175- " $psScriptAnalyzerVersion /$psScriptAnalyzerFileName "
176- ),
177- psScriptAnalyzerOutFile
178- ) {
179- // NuGet stuff:
180- exclude(" _manifest/**" , " _rels/**" , " package/**" , " [Content_Types].xml" , " *.nuspec" )
182+ fun PrepareSandboxTask.unpackPsScriptAnalyzer (outDir : String ) {
183+ dependsOn(psScriptAnalyzer)
184+
185+ from(zipTree(psScriptAnalyzer.singleFile)) {
186+ into(" $outDir /PSScriptAnalyzer" )
181187
182- // Compatibility profiles, see https://github.com/PowerShell/PSScriptAnalyzer/issues/1148
183- exclude(" compatibility_profiles/**" )
188+ // NuGet stuff:
189+ exclude(" _manifest/**" , " _rels/**" , " package/**" , " [Content_Types].xml" , " *.nuspec" )
190+
191+ // Compatibility profiles, see https://github.com/PowerShell/PSScriptAnalyzer/issues/1148
192+ exclude(" compatibility_profiles/**" )
193+ }
184194 }
185195
186196 val getPowerShellEditorServices = getDependencyTask(
@@ -200,11 +210,14 @@ tasks {
200210 }
201211
202212 val getAllDependencies by registering {
203- dependsOn(getPsScriptAnalyzer, getPowerShellEditorServices)
213+ dependsOn(getPowerShellEditorServices)
204214 }
205215
206216 withType<PrepareSandboxTask > {
207217 dependsOn(getAllDependencies)
218+ val outDir = " ${intellij.pluginName.get()} /lib/LanguageHost/modules"
219+ unpackPsScriptAnalyzer(outDir)
220+
208221 from(" ${project.rootDir} /language_host" ) {
209222 into(" ${intellij.pluginName.get()} /lib/" )
210223 }
0 commit comments