|
1 | | -import org.jetbrains.changelog.Changelog |
2 | 1 | import org.jetbrains.changelog.markdownToHTML |
3 | 2 | import org.jetbrains.intellij.platform.gradle.TestFrameworkType |
4 | | -import org.jetbrains.intellij.platform.gradle.utils.asPath |
5 | | -import java.nio.charset.Charset |
6 | | -import java.util.Properties |
7 | | -import kotlin.io.path.absolutePathString |
8 | 3 |
|
9 | 4 | fun prop(name: String) = providers.gradleProperty(name).get() |
10 | 5 |
|
11 | | -buildscript { |
12 | | - repositories { |
13 | | - mavenLocal() |
14 | | - mavenCentral() |
15 | | - google() |
16 | | - } |
17 | | - dependencies { |
18 | | - classpath("com.guardsquare:proguard-gradle:7.8.1") |
19 | | - } |
20 | | -} |
21 | | -val envProperties = Properties() |
22 | | -envProperties.load(file(".env").reader(Charset.forName("UTF-8"))) |
23 | | - |
24 | 6 | plugins { |
25 | 7 | id("java") // Java support |
26 | 8 | alias(libs.plugins.kotlin) // Kotlin support |
@@ -104,7 +86,7 @@ intellijPlatform { |
104 | 86 | } |
105 | 87 |
|
106 | 88 | publishing { |
107 | | - token = provider { envProperties["PUBLISH_TOKEN"] as String } |
| 89 | + token = providers.environmentVariable("PUBLISH_TOKEN") |
108 | 90 | // The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3 |
109 | 91 | // Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more: |
110 | 92 | // https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel |
@@ -136,83 +118,6 @@ tasks { |
136 | 118 |
|
137 | 119 | publishPlugin { |
138 | 120 | } |
139 | | - |
140 | | - // https://plugins.jetbrains.com/docs/marketplace/obfuscate-the-plugin.html#proguard |
141 | | - // see https://www.guardsquare.com/manual/setup/gradle |
142 | | - register<proguard.gradle.ProGuardTask>("proguard") { |
143 | | - dependsOn(buildPlugin) |
144 | | - dependsOn(instrumentedJar) |
145 | | - verbose() |
146 | | - |
147 | | - val javaHome = System.getProperty("java.home") |
148 | | - File("$javaHome/jmods/").listFiles().forEach { libraryjars(it.absolutePath) } |
149 | | - |
150 | | - // Use the jar task output as a input jar. This will automatically add the necessary task dependency. |
151 | | - val pluginName = rootProject.name + "-" + prop("pluginVersion") |
152 | | - val inputDir = "build/libs/" |
153 | | - val outputDir = "build/distributions/" |
154 | | - |
155 | | - injars("$inputDir$pluginName-instrumented.jar") |
156 | | - outjars("$outputDir$pluginName-obfuscated.jar") |
157 | | - |
158 | | - libraryjars(configurations.compileClasspath.get()) |
159 | | - |
160 | | - dontshrink() |
161 | | - dontoptimize() |
162 | | -// dontpreverify() |
163 | | -// dontskipnonpubliclibraryclassmembers() |
164 | | - |
165 | | - adaptclassstrings("**.xml") |
166 | | - adaptresourcefilecontents("**.xml") |
167 | | - |
168 | | - // Allow methods with the same signature, except for the return type, |
169 | | - // to get the same obfuscation name. |
170 | | - overloadaggressively() |
171 | | - |
172 | | - // Put all obfuscated classes into the nameless root package. |
173 | | - repackageclasses("") |
174 | | - dontwarn() |
175 | | - |
176 | | - printmapping("$outputDir$pluginName-ProGuard-ChangeLog.txt") |
177 | | - target(prop("pluginVersion")) |
178 | | - |
179 | | - adaptresourcefilenames() |
180 | | - optimizationpasses(9) |
181 | | - allowaccessmodification() |
182 | | -// mergeinterfacesaggressively() |
183 | | - |
184 | | - keepattributes("Exceptions,InnerClasses,Signature,Deprecated,SourceFile,LineNumberTable,*Annotation*,EnclosingMethod") |
185 | | - |
186 | | - keep( |
187 | | - """ |
188 | | - class * implements com.intellij.openapi.components.PersistentStateComponent {*;} |
189 | | - """.trimIndent() |
190 | | - ) |
191 | | - |
192 | | - keepclassmembers( |
193 | | - """ |
194 | | - class * {public static ** INSTANCE;} |
195 | | - """.trimIndent() |
196 | | - ) |
197 | | - keepclassmembers( |
198 | | - """ |
199 | | - enum * { |
200 | | - <fields>; |
201 | | - } |
202 | | - """.trimIndent() |
203 | | - ) |
204 | | - keepclassmembers( |
205 | | - """ |
206 | | - enum * { |
207 | | - public static **[] values(); |
208 | | - public static ** valueOf(java.lang.String); |
209 | | - } |
210 | | - """.trimIndent() |
211 | | - ) |
212 | | - keep("class com.intellij.util.* {*;}") |
213 | | - |
214 | | - println("Output directory: ${layout.projectDirectory.dir(outputDir).asPath.absolutePathString()}:1") |
215 | | - } |
216 | 121 | } |
217 | 122 |
|
218 | 123 | intellijPlatformTesting { |
|
0 commit comments