Skip to content

Commit

Permalink
[Build] Force UTF-8 where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
Schaka committed Oct 14, 2024
1 parent c8db7f8 commit 52448b8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ jobs:
- name: Build JVM OCI image
run: gradle jib -Djib.serialize=true # https://github.com/GoogleContainerTools/jib/issues/4301
env:
LC_ALL: "C.UTF-8"
USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
Expand All @@ -84,6 +85,7 @@ jobs:
- name: Build Native OCI Image
run: gradle bootBuildImage --publishImage --imagePlatform linux/amd64
env:
LC_ALL: "C.UTF-8"
USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
Expand Down
24 changes: 21 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import net.nemerosa.versioning.VersioningExtension
import org.gradle.plugins.ide.idea.model.IdeaModel
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_22
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.resolve.compatibility
import org.springframework.boot.gradle.dsl.SpringBootExtension
import org.springframework.boot.gradle.tasks.aot.ProcessAot
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
Expand Down Expand Up @@ -133,13 +134,19 @@ extra {
tasks.withType<BootRun> {
jvmArgs(
arrayOf(
"-Dspring.config.additional-location=optional:file:/config/application.yaml,optional:file:/workspace/application.yaml"
"-Dspring.config.additional-location=optional:file:/config/application.yaml,optional:file:/workspace/application.yaml",
"-Dsun.jnu.encoding=UTF-8",
"-Dfile.encoding=UTF-8"
)
)
}

tasks.withType<ProcessAot> {
args("-Dspring.config.additional-location=optional:file:/config/application.yaml,optional:file:/workspace/application.yaml")
args(
"-Dspring.config.additional-location=optional:file:/config/application.yaml,optional:file:/workspace/application.yaml",
"-Dsun.jnu.encoding=UTF-8",
"-Dfile.encoding=UTF-8"
)
}

tasks.withType<BootBuildImage> {
Expand All @@ -162,8 +169,14 @@ tasks.withType<BootBuildImage> {
"BP_HEALTH_CHECKER_ENABLED" to "true",
"BP_JVM_CDS_ENABLED" to "true",
"BP_JVM_VERSION" to "23",
"JAVA_TOOL_OPTIONS" to """
--Dsun.jnu.encoding=UTF-8
-Dfile.encoding=UTF-8
""".trimIndent(),
"BP_NATIVE_IMAGE_BUILD_ARGUMENTS" to """
-march=compatibility
-Dsun.jnu.encoding=UTF-8
-Dfile.encoding=UTF-8
""".trimIndent()
)
}
Expand Down Expand Up @@ -196,7 +209,12 @@ jib {
}
}
container {
jvmFlags = listOf("-Dspring.config.additional-location=optional:file:/config/application.yaml", "-Xms256m")
jvmFlags = listOf(
"-Dspring.config.additional-location=optional:file:/config/application.yaml",
"-Dsun.jnu.encoding=UTF-8",
"-Dfile.encoding=UTF-8",
"-Xms256m",
)
mainClass = "com.github.schaka.janitorr.JanitorrApplicationKt"
ports = listOf("8978")
format = ImageFormat.Docker // OCI not yet supported
Expand Down

0 comments on commit 52448b8

Please sign in to comment.