Skip to content

Commit 15eabe2

Browse files
committed
feat: Prepare 1.3.3 release
1 parent 0a2afee commit 15eabe2

File tree

5 files changed

+24
-21
lines changed

5 files changed

+24
-21
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ To use the plugin, just apply the plugin in your `build.gradle`:
2222

2323
```groovy
2424
plugins {
25-
id 'nl.fabianm.kotlin.plugin.generated' version '1.3.2'
25+
id 'nl.fabianm.kotlin.plugin.generated' version '1.3.3'
2626
}
2727
```
2828

@@ -31,8 +31,8 @@ version you are using:
3131

3232
| **Kotlin** | **Plugin** |
3333
|:----------:|:----------:|
34-
| 1.2.* | 1.0 |
35-
| 1.3.* | 1.3.2 |
34+
| 1.2.* | 1.0 |
35+
| 1.3.* | 1.3.3 |
3636

3737
You can optionally configure the plugin as shown below:
3838

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616

1717
plugins {
1818
kotlin("jvm") version "1.3.31" apply false
19-
id("org.jlleitschuh.gradle.ktlint") version "7.4.0" apply false
19+
id("org.jlleitschuh.gradle.ktlint") version "8.2.0" apply false
2020
id("com.github.johnrengelman.shadow") version "5.0.0" apply false
2121
}
2222

2323
allprojects {
2424
group = "nl.fabianm.kotlin.plugin.generated"
25-
version = "1.3.2"
25+
version = "1.3.3"
2626

2727
extra["junitJupiterVersion"] = "5.4.2"
2828
extra["junitPlatformVersion"] = "1.4.2"

plugin-gradle/src/main/kotlin/nl/fabianm/kotlin/plugin/generated/gradle/GeneratedSubplugin.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class GeneratedKotlinGradleSubplugin : KotlinGradleSubplugin<AbstractCompile> {
5050
companion object {
5151
private const val GENERATED_ARTIFACT_NAME = "plugin-gradle"
5252
private const val GENERATED_GROUP_ID = "nl.fabianm.kotlin.plugin.generated"
53-
private const val GENERATED_VERSION = "1.3.2"
53+
private const val GENERATED_VERSION = "1.3.3"
5454
private const val GENERATED_COMPILER_PLUGIN_ID = "nl.fabianm.kotlin.plugin.generated"
5555
private val ANNOTATION_ARG_NAME = "annotation"
5656
private val VISIBLE_ARG_NAME = "visible"

plugin-idea/src/main/kotlin/nl/fabianm/kotlin/plugin/generated/idea/GeneratedGradleImportHandler.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,19 @@ import org.jetbrains.plugins.gradle.model.data.GradleSourceSetData
2424

2525
class GeneratedGradleImportHandler : GradleProjectImportHandler {
2626
override fun importBySourceSet(facet: KotlinFacet, sourceSetNode: DataNode<GradleSourceSetData>) {
27-
GeneratedImportHandler.modifyCompilerArguments(facet, PLUGIN_GRADLE_JAR)
27+
GeneratedImportHandler.modifyCompilerArguments(facet, PLUGIN_GRADLE_JAR, PLUGIN_GRADLE_TITLE)
2828
}
2929

3030
override fun importByModule(facet: KotlinFacet, moduleNode: DataNode<ModuleData>) {
31-
GeneratedImportHandler.modifyCompilerArguments(facet, PLUGIN_GRADLE_JAR)
31+
GeneratedImportHandler.modifyCompilerArguments(facet, PLUGIN_GRADLE_JAR, PLUGIN_GRADLE_TITLE)
3232
}
3333

34-
private val PLUGIN_GRADLE_JAR = "plugin-gradle"
34+
companion object {
35+
private val PLUGIN_GRADLE_JAR = "plugin-gradle"
36+
37+
/**
38+
* The implementation title to search for.
39+
*/
40+
private val PLUGIN_GRADLE_TITLE = "nl.fabianm.kotlin.plugin.generated.gradle"
41+
}
3542
}

plugin-idea/src/main/kotlin/nl/fabianm/kotlin/plugin/generated/idea/GeneratedImportHandler.kt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ internal object GeneratedImportHandler {
3232
private val PLUGIN_JPS_JAR: String?
3333
get() = PathManager.getJarPathForClass(GeneratedCommandLineProcessor::class.java)
3434

35-
/**
36-
* The implementation title to search for.
37-
*/
38-
private val PLUGIN_IMPLEMENTATION_TITLE = "nl.fabianm.kotlin.plugin.generated"
39-
4035
/**
4136
* The [Logger] instance for this class.
4237
*/
@@ -48,19 +43,20 @@ internal object GeneratedImportHandler {
4843
*
4944
* @param facet The facet to modify.
5045
* @param buildSystemPluginJar The name of the jar file to remove rom the classpath.
46+
* @param implementationTitle The implementation title to validate.
5147
*/
52-
fun modifyCompilerArguments(facet: KotlinFacet, buildSystemPluginJar: String) {
48+
fun modifyCompilerArguments(facet: KotlinFacet, buildSystemPluginJar: String, implementationTitle: String) {
5349
logger.info("Probing for Gradle plugin")
5450

5551
val facetSettings = facet.configuration.settings
5652
val commonArguments = facetSettings.compilerArguments ?: CommonCompilerArguments.DummyImpl()
57-
val regex = ".*\\${File.separator}?$buildSystemPluginJar-.*\\.jar".toRegex()
53+
val regex = "(.*\\${File.separator})?$buildSystemPluginJar-.*\\.jar".toRegex()
5854

5955
// Remove the incompatible compiler plugin from the classpath if found
6056
var isEnabled = false
6157
val oldPluginClasspaths = (commonArguments.pluginClasspaths ?: emptyArray()).filterTo(mutableListOf()) {
62-
val match = regex.matches(it) && validateJar(it)
63-
logger.debug("$it [$match]")
58+
val match = regex.matches(it) && validateJar(it, implementationTitle)
59+
logger.info("$it [match=$match]")
6460
if (match) {
6561
isEnabled = true
6662
}
@@ -83,12 +79,12 @@ internal object GeneratedImportHandler {
8379
* We need to perform this rather ugly check, because the artifact id of the Gradle plugin is not unique and rather
8480
* general (`plugin-gradle`). We therefore check whether the manifest contains references to this project.
8581
*/
86-
private fun validateJar(path: String): Boolean {
82+
private fun validateJar(path: String, implementationTitle: String): Boolean {
8783
return try {
8884
val jar = JarInputStream(FileInputStream(path))
8985
val manifest = jar.manifest
90-
manifest.mainAttributes.getValue("Implementation-Title").trim().equals(PLUGIN_IMPLEMENTATION_TITLE, ignoreCase = true)
91-
} catch (_: Exception) {
86+
manifest.mainAttributes.getValue("Implementation-Title").trim().equals(implementationTitle, ignoreCase = true)
87+
} catch (e: Exception) {
9288
false
9389
}
9490
}

0 commit comments

Comments
 (0)