Skip to content

Commit

Permalink
jetbrains: Add ktlint to generator project (#896)
Browse files Browse the repository at this point in the history
## Problem
Code style is not consistent

## Solution
Add ktlint to project

## License

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
  • Loading branch information
rli authored Oct 29, 2024
1 parent b750b1a commit afa6392
Show file tree
Hide file tree
Showing 8 changed files with 240 additions and 159 deletions.
12 changes: 12 additions & 0 deletions telemetry/jetbrains/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 160
tab_width = 4
ij_continuation_indent_size = 4

[*.{kt,kts}]
ktlint_code_style = ktlint_official
8 changes: 5 additions & 3 deletions telemetry/jetbrains/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ plugins {
`maven-publish`
signing
alias(libs.plugins.nexus.publishing)
alias(libs.plugins.jlleitschuh.ktlint)
}

java {
Expand Down Expand Up @@ -146,9 +147,10 @@ publishing {
gradlePlugin { setAutomatedPublishing(false) }

signing {
if (project.hasProperty("signing.keyId")
&& project.hasProperty("signing.password")
&& project.hasProperty("signing.secretKeyRingFile")) {
if (project.hasProperty("signing.keyId") &&
project.hasProperty("signing.password") &&
project.hasProperty("signing.secretKeyRingFile")
) {
sign(publishing.publications["mavenJava"])
}
}
Expand Down
2 changes: 2 additions & 0 deletions telemetry/jetbrains/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[versions]
assertJ = "3.26.3"
jackson = "2.17.2"
jlleitschuh-ktlint = "12.1.1"
# deprecated; should move to json-skema
jsonSchema = "1.14.4"
junit4 = "4.13.2"
Expand All @@ -16,5 +17,6 @@ json-schema = { module = "com.github.erosb:everit-json-schema", version.ref = "j
junit4 = { module = "junit:junit", version.ref = "junit4" }

[plugins]
jlleitschuh-ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "jlleitschuh-ktlint" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
nexus-publishing = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus" }
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
package software.aws.toolkits.telemetry.generator

object ResourceLoader {
private const val schemaPath = "/telemetrySchema.json"
private const val SCHEMA_PATH = "/telemetrySchema.json"

val SCHEMA_FILE = this.javaClass.getResourceAsStream(SCHEMA_PATH).use { it.bufferedReader().readText() }

val SCHEMA_FILE = this.javaClass.getResourceAsStream(schemaPath).use { it.bufferedReader().readText() }
// TODO add a manifest or something
val DEFINITIONS_FILES = listOf("/definitions/commonDefinitions.json").map {
this.javaClass.getResourceAsStream(it).use {
it.bufferedReader().readText()
val DEFINITIONS_FILES =
listOf("/definitions/commonDefinitions.json").map {
this.javaClass.getResourceAsStream(it).use {
it.bufferedReader().readText()
}
}
}
}
Loading

0 comments on commit afa6392

Please sign in to comment.