Skip to content

Commit

Permalink
Migrated to kotlin gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
jezzsantos committed Oct 14, 2024
1 parent f57a6ab commit 36d81c6
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 164 deletions.
6 changes: 6 additions & 0 deletions .idea/kotlinc.xml

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

134 changes: 0 additions & 134 deletions build.gradle

This file was deleted.

157 changes: 157 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.date
import org.jetbrains.intellij.platform.gradle.TestFrameworkType

plugins {

id("java")
alias(libs.plugins.kotlin)
id("org.jetbrains.intellij.platform")
alias(libs.plugins.changelog)
alias(libs.plugins.jvmwrapper)
}

group = providers.gradleProperty("thisPluginGroup").get()
version = providers.gradleProperty("thisPluginVersion").get()

// Set the JVM language level used to build the project.
kotlin {
jvmToolchain(17)
}

repositories {
maven { setUrl("https://cache-redirector.jetbrains.com/maven-central") }

intellijPlatform {
defaultRepositories()
jetbrainsRuntime()
}
}

dependencies {
implementation("com.google.code.gson:gson:2.10")
//noinspection GradlePackageUpdate
implementation("com.microsoft.azure:applicationinsights-core:2.6.4") // HACK: we need to stay on this older version of AppInsights for as long as possible

intellijPlatform {
val platformVer: String = providers.gradleProperty("platformVersion").get()
rider(platformVer)
jetbrainsRuntime()
pluginVerifier()
zipSigner()
instrumentationTools()

testFramework(TestFrameworkType.Bundled)
}
}

intellijPlatform {
instrumentCode = true
pluginConfiguration {
val plugInVer: String = providers.gradleProperty("thisPluginVersion").get()
version = plugInVer
ideaVersion {
sinceBuild = providers.gradleProperty("pluginSinceBuild")
untilBuild = providers.gradleProperty("pluginUntilBuild")
}
}
pluginVerification {
ides {
recommended()
}
}
}

changelog {
val plugInVer: String = providers.gradleProperty("thisPluginVersion").get()
version.set(plugInVer)
path.set(file("CHANGELOG.md").canonicalPath)
header.set(provider { "[${version.get()}] - ${date("yyyy-MM-dd")}" })
headerParserRegex.set("""(\d+\.\d+\.\d+[\-\w]*)""".toRegex())
introduction.set(
"""
All notable changes to this project are documented in this file.
> The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
""".trimIndent()
)
itemPrefix.set("-")
keepUnreleasedSection.set(true)
unreleasedTerm.set("[Unreleased]")
groups.set(listOf("Notes", "Added", "Changed", "Deprecated", "Removed", "Fixed", "Security"))
lineSeparator.set("\n")
combinePreReleases.set(true)
}

tasks {

wrapper {
val gradleVer: String = providers.gradleProperty("gradleVersion").get()
gradleVersion = gradleVer
}

publishPlugin {
dependsOn("patchChangelog")
val plugInVer: String = providers.gradleProperty("thisPluginVersion").get()
val items: String = if (plugInVer.split("-").size > 1)
plugInVer.split("-")[1]
else
"default"
token.set(System.getenv("ORG_GRADLE_PROJECT_intellijPublishToken"))
channels.set(listOf(items))
}

patchPluginXml {
val plugInVer: String = providers.gradleProperty("thisPluginVersion").get()
val versionExists = changelog.has(plugInVer)
if (versionExists) {
changeNotes.set(provider {
changelog.renderItem(
changelog
.get(plugInVer)
.withHeader(false)
.withEmptySections(false),
Changelog.OutputType.HTML
)
}
)
} else {
changeNotes.set(provider {
changelog.renderItem(
changelog
.getUnreleased()
.withHeader(false)
.withEmptySections(false),
Changelog.OutputType.HTML
)
}
)
}
}

test {
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter:5.9.0")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.0")
testImplementation("org.mockito:mockito-core:4.8.0")
testImplementation("org.testng:testng:7.7.0")
testRuntimeOnly("org.junit.support:testng-engine:1.0.4")
}

systemProperty("LOCAL_ENV_RUN", "true") //For use with 'BaseTestWithSolution' and TestNG
useJUnitPlatform()
minHeapSize = "512m"
maxHeapSize = "1024m"
testLogging {
showStandardStreams = true
exceptionFormat = TestExceptionFormat.FULL
}
}

runIde {
autoReload = false
maxHeapSize = "2G"
}
}

5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ intellijPluginVersion=2.1.0
# Gradle Releases -> https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin.html#requirements
gradleVersion=8.10.2
# Other properties -> https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-gradle-properties.html
org.jetbrains.intellij.platform.downloadSources=false
org.jetbrains.intellij.platform.downloadSources=false
# Kotlin 1.4 will bundle the stdlib dependency by default, causing problems with the version bundled with the IDE
# https://blog.jetbrains.com/kotlin/2020/07/kotlin-1-4-rc-released/#stdlib-default
kotlin.stdlib.default.dependency=false
12 changes: 12 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[versions]
kotlin = "1.9.25" # https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#kotlin-standard-library
changelog = "2.2.1"
jvmwrapper = "0.14.0"

[libraries]
kotlin = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" }

[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
jvmwrapper = { id = "me.filippov.gradle.jvm.wrapper", version.ref = "jvmwrapper" }
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://cache-redirector.jetbrains.com/services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
20 changes: 0 additions & 20 deletions settings.gradle

This file was deleted.

25 changes: 25 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
pluginManagement {
val intellijPluginVersion: String by settings

plugins {
id("org.jetbrains.intellij.platform").version(intellijPluginVersion) // so that we can read the version from gradle.properties
}

repositories {
maven { setUrl("https://cache-redirector.jetbrains.com/plugins.gradle.org") }

}

resolutionStrategy {
eachPlugin {
// Gradle has to map a plugin dependency to Maven coordinates - '{groupId}:{artifactId}:{version}'. It tries
// to do use '{plugin.id}:{plugin.id}.gradle.plugin:version'.
// This doesn't work for rdgen, so we provide some help
if (requested.id.id == "com.jetbrains.rdgen") {
useModule("com.jetbrains.rd:rd-gen:${requested.version}")
}
}
}
}

rootProject.name = "automate"
Loading

0 comments on commit 36d81c6

Please sign in to comment.