Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to work with 221.* and convert gradle scripts to kts #58

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ jobs:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "build.gradle" }}
- v1-dependencies-{{ checksum "build.gradle.kts" }}
- v1-dependencies-
- run: ./gradlew dependencies
- save_cache:
paths:
- ~/.gradle
key: v1-dependencies-{{ checksum "build.gradle" }}
key: v1-dependencies-{{ checksum "build.gradle.kts" }}
lint:
docker:
- image: circleci/openjdk:11-jdk
Expand All @@ -25,9 +25,9 @@ jobs:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "build.gradle" }}
- v1-dependencies-{{ checksum "build.gradle.kts" }}
- v1-dependencies-
- run: ./gradlew ktlint
- run: ./gradlew ktlintCheck
test:
docker:
- image: circleci/openjdk:11-jdk
Expand All @@ -36,7 +36,7 @@ jobs:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "build.gradle" }}
- v1-dependencies-{{ checksum "build.gradle.kts" }}
- v1-dependencies-
- run: ./gradlew test

Expand Down
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## [1.0.11]
### Added
- Add support for 213* / 2021.3 version of IDEA #56
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
[![jetBrains](https://img.shields.io/jetbrains/plugin/d/10942-kotlin-fill-class.svg)](https://plugins.jetbrains.com/plugin/10942-kotlin-fill-class)

# kotlin-fill-class plugin
<!-- Plugin description -->
Intellij plugin that provide intention action for empty constructor or function to fill property with default value.
Inspired by Go [fillstruct](https://github.com/davidrjenni/reftools/tree/master/cmd/fillstruct)
<!-- Plugin description end -->

## Usage
This plugin add intention action for invalid constructor or function expression.
![kotlin fill class demo](https://user-images.githubusercontent.com/8841470/59397528-e61a4380-8dc7-11e9-9684-d82d225316fe.gif)


### Configure settings
You can configure the plugin settings by `Edit inspection profile setting`
![Edit inspection profile setting](https://user-images.githubusercontent.com/1121855/107631811-f4a9b400-6ca8-11eb-9ea8-1b0b56f0fda9.png)
Expand Down
84 changes: 0 additions & 84 deletions build.gradle

This file was deleted.

108 changes: 108 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import org.jetbrains.changelog.markdownToHTML
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jlleitschuh.gradle.ktlint.KtlintExtension

fun properties(key: String) = project.findProperty(key).toString()

plugins {
id("java")
id("org.jetbrains.kotlin.jvm") version "1.6.10"
id("org.jetbrains.intellij") version "1.4.0"
id("org.jetbrains.changelog") version "1.3.1"
id("org.jlleitschuh.gradle.ktlint") version "10.2.1"
}

group = properties("pluginGroup")
version = properties("pluginVersion")

repositories {
mavenCentral()
}

intellij {
pluginName.set(properties("pluginName"))
version.set(properties("platformVersion"))
type.set(properties("platformType"))
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
}

changelog {
version.set(properties("pluginVersion"))
groups.set(emptyList())
}

configure<KtlintExtension> {
filter {
include("src/**/*.kt")
}
}

dependencies {
testImplementation(group = "junit", name = "junit", version = "4.13.1")
}

tasks {
// Set the JVM compatibility versions
properties("javaVersion").let {
withType<JavaCompile> {
sourceCompatibility = it
targetCompatibility = it
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = it
}
}

wrapper {
gradleVersion = properties("gradleVersion")
}

patchPluginXml {
version.set(properties("pluginVersion"))
sinceBuild.set(properties("pluginSinceBuild"))
untilBuild.set(properties("pluginUntilBuild"))

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
pluginDescription.set(
projectDir.resolve("README.md").readText().lines().run {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
subList(indexOf(start) + 1, indexOf(end))
}.joinToString("\n")
.run { markdownToHTML(this) }
.plus(
"<a target=\"_blank\" href=\"https://user-images.githubusercontent.com/8841470/59397528-e61a4380-8dc7-11e9-9684-d82d225316fe.gif\">" +
"<img src=\"https://user-images.githubusercontent.com/8841470/59397528-e61a4380-8dc7-11e9-9684-d82d225316fe.gif\" alt=\"fill-class\" style=\"max-width:100%;\">" +
"</a></p>"
)
)

// Get the latest available change notes from the changelog file
changeNotes.set(
provider {
changelog.run {
getOrNull(properties("pluginVersion")) ?: getLatest()
}.toHTML()
}
)
}

// Configure UI tests plugin
// Read more: https://github.com/JetBrains/intellij-ui-test-robot
runIdeForUiTests {
systemProperty("robot-server.port", "8082")
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
systemProperty("jb.consents.confirmation.enabled", "false")
}

publishPlugin {
dependsOn("patchChangelog")
token.set(System.getenv("TOKEN"))
channels.set(listOf(properties("pluginVersion").split('-').getOrElse(1) { "default" }.split('.').first()))
}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not opposed to adding these things, but can you make PRs into two or three separated PRs?

  • just converting Kotlin DSL
  • other improvements (change note, description). To be honest, generating change note from the changelog.md looks useful, but I'm not that interested in generating descriptions from README.

15 changes: 15 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
pluginGroup = com.github.suusan2go.kotlin-fill-class
pluginName = kotlin-fill-class
pluginVersion = 1.0.12
pluginSinceBuild = 191.8026.42
pluginUntilBuild = 221.*
platformType = IC
platformVersion = 2021.1.3
platformPlugins = com.intellij.java, org.jetbrains.kotlin
javaVersion = 11
gradleVersion = 7.4

# Opt-out flag for bundling Kotlin standard library.
# See https://plugins.jetbrains.com/docs/intellij/kotlin.html#kotlin-standard-library for details.
# suppress inspection "UnusedProperty"
kotlin.stdlib.default.dependency = false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 2 additions & 3 deletions settings.gradle → settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/*
* This file was generated by the Gradle 'init' task.
* This file was generated by the Gradle "init" task.
*
* The settings file is used to specify which projects to include in your build.
*
* Detailed information about configuring a multi-project build in Gradle can be found
* in the user guide at https://docs.gradle.org/4.8.1/userguide/multi_project_builds.html
*/

rootProject.name = 'kotlin-fill-class'

rootProject.name = "kotlin-fill-class"
Loading