1
+ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
2
+ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3
+
4
+ buildscript {
5
+ val kotlinVersion = " 2.0.20"
6
+ repositories {
7
+ mavenCentral()
8
+ }
9
+ dependencies {
10
+ classpath(" org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion " )
11
+ }
12
+ }
13
+
14
+ plugins {
15
+ id(" java" )
16
+ id(" org.jetbrains.intellij.platform" ) version " 2.1.0"
17
+ id(" org.jetbrains.kotlin.jvm" ) version " 2.0.20"
18
+ }
19
+
20
+ java {
21
+ sourceCompatibility = JavaVersion .VERSION_11
22
+ targetCompatibility = JavaVersion .VERSION_11
23
+ }
24
+
25
+ val pluginVersion = " 1.0.23"
26
+
27
+ intellijPlatform {
28
+ buildSearchableOptions = true
29
+ instrumentCode = true
30
+ projectName = project.name
31
+ pluginConfiguration {
32
+ id = " com.suusan2go.kotlin-fill-class"
33
+ version = pluginVersion
34
+ name = " kotlin-fill-class"
35
+ ideaVersion {
36
+ sinceBuild = " 242.21829.142"
37
+ untilBuild = null
38
+ }
39
+ }
40
+ publishing {
41
+ token = System .getenv(" TOKEN" )
42
+ }
43
+ }
44
+
45
+ group = " com.github.suusan2go.kotlin-fill-class"
46
+ version = pluginVersion
47
+
48
+ repositories {
49
+ mavenCentral()
50
+ maven(" https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-ide-plugin-dependencies" )
51
+ intellijPlatform {
52
+ defaultRepositories()
53
+
54
+ }
55
+ }
56
+
57
+ val ktlint by configurations.creating
58
+
59
+ dependencies {
60
+ intellijPlatform {
61
+ intellijIdeaCommunity(" 2024.2.4" )
62
+ bundledPlugin(" com.intellij.java" )
63
+ bundledPlugin(" org.jetbrains.kotlin" )
64
+ instrumentationTools()
65
+ }
66
+ implementation(" org.jetbrains.kotlin:kotlin-stdlib-jdk8" )
67
+ // compileOnly("org.jetbrains.kotlin:high-level-api-for-ide::2.0.20-ij242-38") {
68
+ // exclude(group = "org.jetbrains.kotlin", module = "analysis-api")
69
+ // }
70
+ // compileOnly("org.jetbrains.kotlin:high-level-api-fir-for-ide::2.0.20-ij242-38") {
71
+ // exclude(group = "org.jetbrains.kotlin", module = "analysis-api-fir")
72
+ // }
73
+ // compileOnly("org.jetbrains.kotlin:high-level-api-fe10-for-ide:2.0.20-ij242-38") {
74
+ // exclude(group = "org.jetbrains.kotlin", module = "analysis-api-fe10")
75
+ // }
76
+ // Lorem : An extremely useful Lorem Ipsum generator for Java!
77
+ implementation(" com.thedeanda:lorem:2.1" )
78
+
79
+ testImplementation(" junit:junit:4.13.1" )
80
+ testImplementation(" io.mockk:mockk:1.13.4" )
81
+ ktlint(" com.pinterest:ktlint:0.42.1" ) {
82
+ attributes {
83
+ attribute(Bundling .BUNDLING_ATTRIBUTE , getObjects().named(Bundling .EXTERNAL ))
84
+ }
85
+ }
86
+
87
+ }
88
+
89
+ tasks.named<KotlinCompile >(" compileKotlin" ) {
90
+ compilerOptions.jvmTarget = JvmTarget .JVM_11
91
+ }
92
+
93
+ tasks.named<KotlinCompile >(" compileTestKotlin" ) {
94
+ compilerOptions.jvmTarget = JvmTarget .JVM_11
95
+ }
96
+
97
+ val ktlintTask = tasks.register<JavaExec >(" ktlint" ) {
98
+ group = " verification"
99
+ description = " Check Kotlin code style."
100
+ classpath = ktlint
101
+ mainClass.set(" com.pinterest.ktlint.Main" )
102
+ args = listOf (" src/**/*.kt" )
103
+ // to generate report in checkstyle format prepend following args:
104
+ // "--reporter=plain", "--reporter=checkstyle,output=${buildDir}/ktlint.xml"
105
+ // to add a baseline to check against prepend following args:
106
+ // "--baseline=ktlint-baseline.xml"
107
+ // see https://github.com/pinterest/ktlint#usage for more
108
+ }
109
+ tasks.check {
110
+ dependsOn.add(ktlintTask)
111
+ }
112
+
113
+ tasks.register<JavaExec >(" ktlintFormat" ) {
114
+ group = " formatting"
115
+ description = " Fix Kotlin code style deviations."
116
+ classpath = ktlint
117
+ mainClass.set(" com.pinterest.ktlint.Main" )
118
+ args = listOf (" -F" , " src/**/*.kt" )
119
+ }
120
+
121
+ val runK2 by intellijPlatformTesting.runIde.creating {
122
+ task {
123
+ systemProperty(" idea.kotlin.plugin.use.k2" , true )
124
+ }
125
+ }
126
+
127
+ kotlin {
128
+ compilerOptions {
129
+ freeCompilerArgs.add(" -Xcontext-receivers" )
130
+ }
131
+ compilerOptions {
132
+ apiVersion = org.jetbrains.kotlin.gradle.dsl.KotlinVersion .KOTLIN_2_0
133
+ }
134
+ }
0 commit comments