Run spotless formatting (#958)

When we updated spotless's Java and Kotlin formatter, we changed the underlying
formatting rules.
However, due to spotless ratcheting, these formatting changes don't get applied unless a file
gets touched in a commit.

To avoid future PRs introducing lines of change that aren't related to the intention of the PR,
this is a one-time format of all files.
This commit is contained in:
Daniel Chao
2025-02-17 07:36:43 -08:00
committed by GitHub
parent d270829ed3
commit 28b128f86f
79 changed files with 679 additions and 682 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ import org.pkl.core.packages.PackageUri
class CliPackageDownloader(
baseOptions: CliBaseOptions,
private val packageUris: List<PackageUri>,
private val noTransitive: Boolean
private val noTransitive: Boolean,
) : CliCommand(baseOptions) {
override fun doRun() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,7 +32,7 @@ class CliProjectPackager(
private val outputPath: String,
private val skipPublishCheck: Boolean,
private val consoleWriter: Writer = System.out.writer(),
private val errWriter: Writer = System.err.writer()
private val errWriter: Writer = System.err.writer(),
) : CliProjectCommand(baseOptions, projectDirs) {
private fun runApiTests(project: Project) {
@@ -85,7 +85,7 @@ class CliProjectPackager(
securityManager,
httpClient,
skipPublishCheck,
consoleWriter
consoleWriter,
)
.createPackages()
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ class CliProjectResolver(
baseOptions: CliBaseOptions,
projectDirs: List<Path>,
private val consoleWriter: Writer = System.out.writer(),
private val errWriter: Writer = System.err.writer()
private val errWriter: Writer = System.err.writer(),
) : CliProjectCommand(baseOptions, projectDirs) {
override fun doRun() {
for (projectFile in normalizedProjectFiles) {
@@ -38,10 +38,10 @@ class CliProjectResolver(
allowedModules,
allowedResources,
SecurityManagers.defaultTrustLevels,
rootDir
rootDir,
),
httpClient,
moduleCacheDir
moduleCacheDir,
)
val dependencies = ProjectDependenciesResolver(project, packageResolver, errWriter).resolve()
val depsFile =

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,13 +34,13 @@ internal class CliRepl(private val options: CliEvaluatorOptions) : CliCommand(op
allowedModules,
allowedResources,
SecurityManagers.defaultTrustLevels,
rootDir
rootDir,
),
httpClient,
Loggers.stdErr(),
listOf(
ModuleKeyFactories.standardLibrary,
ModuleKeyFactories.modulePath(modulePathResolver)
ModuleKeyFactories.modulePath(modulePathResolver),
) +
ModuleKeyFactories.fromServiceProviders() +
listOf(
@@ -48,7 +48,7 @@ internal class CliRepl(private val options: CliEvaluatorOptions) : CliCommand(op
ModuleKeyFactories.http,
ModuleKeyFactories.pkg,
ModuleKeyFactories.projectpackage,
ModuleKeyFactories.genericUrl
ModuleKeyFactories.genericUrl,
),
listOf(
ResourceReaders.environmentVariable(),
@@ -58,7 +58,7 @@ internal class CliRepl(private val options: CliEvaluatorOptions) : CliCommand(op
ResourceReaders.http(),
ResourceReaders.https(),
ResourceReaders.pkg(),
ResourceReaders.projectpackage()
ResourceReaders.projectpackage(),
),
environmentVariables,
externalProperties,

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ constructor(
private val options: CliBaseOptions,
private val testOptions: CliTestOptions,
private val consoleWriter: Writer = System.out.writer(),
private val errWriter: Writer = System.err.writer()
private val errWriter: Writer = System.err.writer(),
) : CliCommand(options) {
override fun doRun() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@ internal class Repl(workingDir: Path, private val server: ReplServer) {
option(Option.DISABLE_EVENT_EXPANSION, true)
variable(
org.jline.reader.LineReader.HISTORY_FILE,
(IoUtils.getPklHomeDir().resolve("repl-history"))
(IoUtils.getPklHomeDir().resolve("repl-history")),
)
}
.build()

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -65,7 +65,7 @@ class CliImportAnalyzerTest {
val analyzer =
CliImportAnalyzer(
CliImportAnalyzerOptions(baseOptions, outputFormat = OutputFormat.JSON.toString()),
StringBuilderWriter(sb)
StringBuilderWriter(sb),
)
analyzer.run()
assertThat(sb.toString())

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -115,7 +115,7 @@ class CliProjectPackagerTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
tempDir.writeFile(
"PklProject",
@@ -130,7 +130,7 @@ class CliProjectPackagerTest {
apiTests { "myTest.pkl" }
}
"""
.trimIndent()
.trimIndent(),
)
val buffer = StringWriter()
val packager =
@@ -140,7 +140,7 @@ class CliProjectPackagerTest {
CliTestOptions(),
".out/%{name}@%{version}",
skipPublishCheck = true,
consoleWriter = buffer
consoleWriter = buffer,
)
val err = assertThrows<CliException> { packager.run() }
assertThat(err).hasMessageContaining("because its API tests are failing")
@@ -187,7 +187,7 @@ class CliProjectPackagerTest {
CliTestOptions(),
".out/%{name}@%{version}",
skipPublishCheck = true,
consoleWriter = buffer
consoleWriter = buffer,
)
packager.run()
}
@@ -286,7 +286,7 @@ class CliProjectPackagerTest {
CliTestOptions(),
".out",
skipPublishCheck = true,
consoleWriter = buffer
consoleWriter = buffer,
)
packager.run()
}
@@ -301,7 +301,7 @@ class CliProjectPackagerTest {
name: String
"""
.trimIndent()
.trimIndent(),
)
val fooTxt =
@@ -312,7 +312,7 @@ class CliProjectPackagerTest {
bar
baz
"""
.trimIndent()
.trimIndent(),
)
tempDir
@@ -337,7 +337,7 @@ class CliProjectPackagerTest {
CliTestOptions(),
".out/%{name}@%{version}",
skipPublishCheck = true,
consoleWriter = StringWriter()
consoleWriter = StringWriter(),
)
packager.run()
val expectedMetadata = tempDir.resolve(".out/mypackage@1.0.0/mypackage@1.0.0")
@@ -411,7 +411,7 @@ class CliProjectPackagerTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
CliProjectPackager(
CliBaseOptions(workingDir = tempDir),
@@ -419,7 +419,7 @@ class CliProjectPackagerTest {
CliTestOptions(),
".out/%{name}@%{version}",
skipPublishCheck = true,
consoleWriter = StringWriter()
consoleWriter = StringWriter(),
)
.run()
val expectedArchive = tempDir.resolve(".out/mypackage@1.0.0/mypackage@1.0.0.zip")
@@ -432,7 +432,7 @@ class CliProjectPackagerTest {
"/input",
"/input/foo",
"/input/foo/bar.txt",
"/main.pkl"
"/main.pkl",
)
)
}
@@ -460,7 +460,7 @@ class CliProjectPackagerTest {
["project2"] = import("../project2/PklProject")
}
"""
.trimIndent()
.trimIndent(),
)
projectDir.writeFile(
"PklProject.deps.json",
@@ -483,7 +483,7 @@ class CliProjectPackagerTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
project2Dir.writeFile(
@@ -498,7 +498,7 @@ class CliProjectPackagerTest {
packageZipUrl = "https://foo.com/project2.zip"
}
"""
.trimIndent()
.trimIndent(),
)
project2Dir.writeFile(
"PklProject.deps.json",
@@ -508,7 +508,7 @@ class CliProjectPackagerTest {
"resolvedDependencies": {}
}
"""
.trimIndent()
.trimIndent(),
)
CliProjectPackager(
@@ -517,7 +517,7 @@ class CliProjectPackagerTest {
CliTestOptions(),
".out/%{name}@%{version}",
skipPublishCheck = true,
consoleWriter = StringWriter()
consoleWriter = StringWriter(),
)
.run()
val expectedMetadata = tempDir.resolve(".out/mypackage@1.0.0/mypackage@1.0.0")
@@ -598,7 +598,7 @@ class CliProjectPackagerTest {
["project2"] = import("../project2/PklProject")
}
"""
.trimIndent()
.trimIndent(),
)
projectDir.writeFile(
"PklProject.deps.json",
@@ -621,7 +621,7 @@ class CliProjectPackagerTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
project2Dir.writeFile(
@@ -636,7 +636,7 @@ class CliProjectPackagerTest {
packageZipUrl = "https://foo.com/project2.zip"
}
"""
.trimIndent()
.trimIndent(),
)
project2Dir.writeFile(
"PklProject.deps.json",
@@ -646,7 +646,7 @@ class CliProjectPackagerTest {
"resolvedDependencies": {}
}
"""
.trimIndent()
.trimIndent(),
)
assertThatCode {
CliProjectPackager(
@@ -655,7 +655,7 @@ class CliProjectPackagerTest {
CliTestOptions(),
".out/%{name}@%{version}",
skipPublishCheck = true,
consoleWriter = StringWriter()
consoleWriter = StringWriter(),
)
.run()
}
@@ -671,7 +671,7 @@ class CliProjectPackagerTest {
res = foo
"""
.trimIndent()
.trimIndent(),
)
tempDir.writeFile(
"PklProject",
@@ -685,7 +685,7 @@ class CliProjectPackagerTest {
packageZipUrl = "https://foo.com"
}
"""
.trimIndent()
.trimIndent(),
)
val e =
assertThrows<CliException> {
@@ -695,7 +695,7 @@ class CliProjectPackagerTest {
CliTestOptions(),
".out/%{name}@%{version}",
skipPublishCheck = true,
consoleWriter = StringWriter()
consoleWriter = StringWriter(),
)
.run()
}
@@ -725,7 +725,7 @@ class CliProjectPackagerTest {
res = foo
"""
.trimIndent()
.trimIndent(),
)
tempDir.writeFile(
"PklProject",
@@ -739,7 +739,7 @@ class CliProjectPackagerTest {
packageZipUrl = "https://foo.com"
}
"""
.trimIndent()
.trimIndent(),
)
val e =
assertThrows<CliException> {
@@ -749,7 +749,7 @@ class CliProjectPackagerTest {
CliTestOptions(),
".out/%{name}@%{version}",
skipPublishCheck = true,
consoleWriter = StringWriter()
consoleWriter = StringWriter(),
)
.run()
}
@@ -771,7 +771,7 @@ class CliProjectPackagerTest {
"""
res = read("$tempDir/foo.pkl")
"""
.trimIndent()
.trimIndent(),
)
tempDir.writeFile(
"PklProject",
@@ -785,7 +785,7 @@ class CliProjectPackagerTest {
packageZipUrl = "https://foo.com"
}
"""
.trimIndent()
.trimIndent(),
)
val e =
assertThrows<CliException> {
@@ -795,7 +795,7 @@ class CliProjectPackagerTest {
CliTestOptions(),
".out/%{name}@%{version}",
skipPublishCheck = true,
consoleWriter = StringWriter()
consoleWriter = StringWriter(),
)
.run()
}
@@ -816,7 +816,7 @@ class CliProjectPackagerTest {
"""
import "baz.pkl"
"""
.trimIndent()
.trimIndent(),
)
tempDir.writeFile(
"PklProject",
@@ -830,7 +830,7 @@ class CliProjectPackagerTest {
packageZipUrl = "https://foo.com"
}
"""
.trimIndent()
.trimIndent(),
)
CliProjectPackager(
CliBaseOptions(workingDir = tempDir),
@@ -838,7 +838,7 @@ class CliProjectPackagerTest {
CliTestOptions(),
".out/%{name}@%{version}",
skipPublishCheck = true,
consoleWriter = StringWriter()
consoleWriter = StringWriter(),
)
.run()
}
@@ -858,7 +858,7 @@ class CliProjectPackagerTest {
packageZipUrl = "https://foo.com"
}
"""
.trimIndent()
.trimIndent(),
)
tempDir.writeFile("project2/main2.pkl", "res = 2")
tempDir.writeFile(
@@ -873,7 +873,7 @@ class CliProjectPackagerTest {
packageZipUrl = "https://foo.com"
}
"""
.trimIndent()
.trimIndent(),
)
val out = StringWriter()
CliProjectPackager(
@@ -882,7 +882,7 @@ class CliProjectPackagerTest {
CliTestOptions(),
".out/%{name}@%{version}",
skipPublishCheck = true,
consoleWriter = out
consoleWriter = out,
)
.run()
val sep = File.separatorChar
@@ -923,7 +923,7 @@ class CliProjectPackagerTest {
packageZipUrl = "https://foo.com"
}
"""
.trimIndent()
.trimIndent(),
)
val e =
assertThrows<CliException> {
@@ -931,13 +931,13 @@ class CliProjectPackagerTest {
CliBaseOptions(
workingDir = tempDir,
caCertificates = listOf(FileTestUtils.selfSignedCertificate),
testPort = packageServer.port
testPort = packageServer.port,
),
listOf(tempDir.resolve("project")),
CliTestOptions(),
".out/%{name}@%{version}",
skipPublishCheck = false,
consoleWriter = StringWriter()
consoleWriter = StringWriter(),
)
.run()
}
@@ -968,20 +968,20 @@ class CliProjectPackagerTest {
packageZipUrl = "https://foo.com"
}
"""
.trimIndent()
.trimIndent(),
)
val out = StringWriter()
CliProjectPackager(
CliBaseOptions(
workingDir = tempDir,
caCertificates = listOf(FileTestUtils.selfSignedCertificate),
testPort = packageServer.port
testPort = packageServer.port,
),
listOf(tempDir.resolve("project")),
CliTestOptions(),
".out/%{name}@%{version}",
skipPublishCheck = false,
consoleWriter = out
consoleWriter = out,
)
.run()
val sep = File.separatorChar
@@ -1025,7 +1025,7 @@ class CliProjectPackagerTest {
CliTestOptions(),
".out/%{name}@%{version}",
skipPublishCheck = true,
consoleWriter = StringWriter()
consoleWriter = StringWriter(),
)
packager.run()
val expectedMetadata = tempDir.resolve(".out/mypackage@1.0.0/mypackage@1.0.0")

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,7 +47,7 @@ class CliProjectResolverTest {
CliBaseOptions(workingDir = tempDir, noCache = true),
emptyList(),
consoleWriter = StringWriter(),
errWriter = StringWriter()
errWriter = StringWriter(),
)
val err = assertThrows<CliException> { packager.run() }
assertThat(err).hasMessageStartingWith("No project visible to the working directory.")
@@ -60,7 +60,7 @@ class CliProjectResolverTest {
CliBaseOptions(noCache = true),
listOf(tempDir),
consoleWriter = StringWriter(),
errWriter = StringWriter()
errWriter = StringWriter(),
)
val err = assertThrows<CliException> { packager.run() }
assertThat(err).hasMessageStartingWith("Directory $tempDir does not contain a PklProject file.")
@@ -79,18 +79,18 @@ class CliProjectResolverTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
CliProjectResolver(
CliBaseOptions(
workingDir = tempDir,
caCertificates = listOf(FileTestUtils.selfSignedCertificate),
testPort = packageServer.port,
noCache = true
noCache = true,
),
listOf(tempDir),
consoleWriter = StringWriter(),
errWriter = StringWriter()
errWriter = StringWriter(),
)
.run()
val expectedOutput = tempDir.resolve("PklProject.deps.json")
@@ -134,18 +134,18 @@ class CliProjectResolverTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
CliProjectResolver(
CliBaseOptions(
workingDir = tempDir,
caCertificates = listOf(FileTestUtils.selfSignedCertificate),
testPort = packageServer.port,
noCache = true
noCache = true,
),
emptyList(),
consoleWriter = StringWriter(),
errWriter = StringWriter()
errWriter = StringWriter(),
)
.run()
val expectedOutput = tempDir.resolve("PklProject.deps.json")
@@ -191,7 +191,7 @@ class CliProjectResolverTest {
["project2"] = import("../project2/PklProject")
}
"""
.trimIndent()
.trimIndent(),
)
projectDir.writeFile(
"../project2/PklProject",
@@ -212,7 +212,7 @@ class CliProjectResolverTest {
["project3"] = import("../project3/PklProject")
}
"""
.trimIndent()
.trimIndent(),
)
projectDir.writeFile(
@@ -233,17 +233,17 @@ class CliProjectResolverTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
CliProjectResolver(
CliBaseOptions(
caCertificates = listOf(FileTestUtils.selfSignedCertificate),
testPort = packageServer.port,
noCache = true
noCache = true,
),
listOf(projectDir),
consoleWriter = StringWriter(),
errWriter = StringWriter()
errWriter = StringWriter(),
)
.run()
val expectedOutput = projectDir.resolve("PklProject.deps.json")
@@ -299,7 +299,7 @@ class CliProjectResolverTest {
["fruit"] = import("../fruit/PklProject")
}
"""
.trimIndent()
.trimIndent(),
)
projectDir.writeFile(
"../fruit/PklProject",
@@ -313,7 +313,7 @@ class CliProjectResolverTest {
packageZipUrl = "https://foo.com/fruit.zip"
}
"""
.trimIndent()
.trimIndent(),
)
val consoleOut = StringWriter()
val errOut = StringWriter()
@@ -321,11 +321,11 @@ class CliProjectResolverTest {
CliBaseOptions(
caCertificates = listOf(FileTestUtils.selfSignedCertificate),
testPort = packageServer.port,
noCache = true
noCache = true,
),
listOf(projectDir),
consoleWriter = consoleOut,
errWriter = errOut
errWriter = errOut,
)
.run()
val expectedOutput = projectDir.resolve("PklProject.deps.json")
@@ -373,7 +373,7 @@ class CliProjectResolverTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
tempDir.writeFile(
@@ -387,7 +387,7 @@ class CliProjectResolverTest {
}
}
"""
.trimIndent()
.trimIndent(),
)
val consoleOut = StringWriter()
@@ -396,11 +396,11 @@ class CliProjectResolverTest {
CliBaseOptions(
caCertificates = listOf(FileTestUtils.selfSignedCertificate),
testPort = packageServer.port,
noCache = true
noCache = true,
),
listOf(tempDir.resolve("project1"), tempDir.resolve("project2")),
consoleWriter = consoleOut,
errWriter = errOut
errWriter = errOut,
)
.run()
val sep = File.separatorChar