@@ -10,7 +10,7 @@ plugins {
1010}
1111
1212group = " dev.openfga.intellijplugin"
13- version = " 0.1.5 "
13+ version = " 0.1.6 "
1414sourceSets[" main" ].java.srcDirs(" src/main/java" , " src/generated/java" )
1515
1616repositories {
@@ -118,8 +118,8 @@ tasks {
118118 }
119119
120120 patchPluginXml {
121- sinceBuild.set(" 233 " )
122- untilBuild.set(" 251.* " )
121+ sinceBuild.set(providers.gradleProperty( " plugin.sinceBuild " ) )
122+ untilBuild.set(providers.gradleProperty( " plugin.untilBuild " ) )
123123 }
124124
125125 signPlugin {
@@ -131,5 +131,82 @@ tasks {
131131 publishPlugin {
132132 token.set(System .getenv(" PUBLISH_TOKEN" ))
133133 }
134+
135+ register(" generateIdeVersionsList" ) {
136+ group = " verification"
137+ description = " Generate IDE versions list for plugin verifier"
138+
139+ val outputFile = layout.buildDirectory.file(" verifier-plugin/intellij-platform-plugin-verifier-action-ide-versions-file.txt" )
140+ outputs.file(outputFile)
141+
142+ val sinceBuildValue = providers.gradleProperty(" plugin.sinceBuild" )
143+ val untilBuildValue = providers.gradleProperty(" plugin.untilBuild" )
144+ // Enable incremental builds / caching
145+ inputs.property(" plugin.sinceBuild" , sinceBuildValue)
146+ inputs.property(" plugin.untilBuild" , untilBuildValue)
147+
148+ doLast {
149+ val BASE_YEAR = 2000
150+
151+ fun buildNumberToVersion (buildNumber : Int ): String? {
152+ val buildStr = buildNumber.toString()
153+ if (buildStr.length < 3 ) return null
154+
155+ val year = BASE_YEAR + buildStr.substring(0 , 2 ).toInt()
156+ val version = buildStr.last().toString().toInt()
157+
158+ if (version > 3 ) return null
159+
160+ return " $year .$version "
161+ }
162+
163+ fun generateOptimizedVersions (since : Int , until : Int ): List <String > {
164+ val sinceYear = BASE_YEAR + since.toString().substring(0 , 2 ).toInt()
165+ val untilYear = BASE_YEAR + until.toString().substring(0 , 2 ).toInt()
166+
167+ val versions = mutableSetOf<String >()
168+
169+ // Always include the exact since version
170+ buildNumberToVersion(since)?.let { versions.add(it) }
171+
172+ // For intermediary years, only include the latest version (.3)
173+ // We do this to reduce the number of versions while still covering all major releases
174+ // Otherwise, we would run out of space on default GitHub Actions runners
175+ for (year in (sinceYear + 1 ) until untilYear) {
176+ val yearCode = year - BASE_YEAR
177+ val latestBuildNumber = yearCode * 10 + 3 // Always .3 for intermediary years
178+ buildNumberToVersion(latestBuildNumber)?.let { versions.add(it) }
179+ }
180+
181+ // Always include the exact until version (if different from since)
182+ if (until != since) {
183+ buildNumberToVersion(until)?.let { versions.add(it) }
184+ }
185+
186+ return versions.sorted()
187+ }
188+
189+ val sinceVersion = sinceBuildValue.get().replace(" .*" , " " ).toInt()
190+ val untilVersion = untilBuildValue.get().replace(" .*" , " " ).toInt()
191+
192+ println (" Optimizing versions from build $sinceVersion to $untilVersion " )
193+
194+ val versions = generateOptimizedVersions(sinceVersion, untilVersion)
195+
196+ val ideVersions = buildList {
197+ versions.forEach { version ->
198+ add(" ideaIC:$version " )
199+ add(" ideaIU:$version " )
200+ }
201+ }.sorted()
202+
203+ outputFile.get().asFile.parentFile.mkdirs()
204+ outputFile.get().asFile.writeText(ideVersions.joinToString(" \n " ))
205+
206+ println (" Generated optimized ${ideVersions.size} IDE versions (reduced from potential ${(untilVersion - sinceVersion + 1 ) * 2 } )" )
207+ println (" Versions: ${versions.joinToString(" , " )} " )
208+ println (" Output: ${outputFile.get().asFile} " )
209+ }
210+ }
134211}
135212
0 commit comments