mirror of
https://github.com/apple/pkl.git
synced 2026-05-25 16:19:20 +02:00
Reformat Kotlin code (#1560)
ktfmt has much improved how it formats Kotlin code. Unfortunately, this means that whenever we touch a single line in a Kotlin file, we get a _lot_ more changes thanks to ratcheting now picking up this file for formatting. This PR just reformats every single Kotlin file so we don't have to deal with this churn in future PRs that touch Kotlin code.
This commit is contained in:
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* Copyright © 2024-2026 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import java.nio.file.Files
|
||||
import kotlin.io.path.isDirectory
|
||||
import kotlin.io.path.isRegularFile
|
||||
import kotlin.io.path.useDirectoryEntries
|
||||
import org.junit.platform.commons.annotation.Testable
|
||||
import org.junit.platform.engine.*
|
||||
import org.junit.platform.engine.TestDescriptor.Type
|
||||
@@ -16,23 +35,18 @@ import org.pkl.core.Loggers
|
||||
import org.pkl.core.SecurityManagers
|
||||
import org.pkl.core.StackFrameTransformers
|
||||
import org.pkl.core.evaluatorSettings.TraceMode
|
||||
import org.pkl.core.http.HttpClient
|
||||
import org.pkl.core.module.ModuleKeyFactories
|
||||
import org.pkl.core.repl.ReplRequest
|
||||
import org.pkl.core.repl.ReplResponse
|
||||
import org.pkl.core.repl.ReplServer
|
||||
import org.pkl.core.resource.ResourceReaders
|
||||
import org.pkl.core.util.IoUtils
|
||||
import org.pkl.core.http.HttpClient
|
||||
import org.pkl.parser.Parser
|
||||
import org.pkl.parser.ParserError
|
||||
import org.pkl.parser.syntax.ClassProperty
|
||||
import org.pkl.core.resource.ResourceReaders
|
||||
import java.nio.file.Files
|
||||
import kotlin.io.path.isDirectory
|
||||
import kotlin.io.path.isRegularFile
|
||||
import kotlin.io.path.useDirectoryEntries
|
||||
|
||||
@Testable
|
||||
class DocSnippetTests
|
||||
@Testable class DocSnippetTests
|
||||
|
||||
class DocSnippetTestsEngine : HierarchicalTestEngine<DocSnippetTestsEngine.ExecutionContext>() {
|
||||
private val projectDir = rootProjectDir.resolve("docs")
|
||||
@@ -41,7 +55,8 @@ class DocSnippetTestsEngine : HierarchicalTestEngine<DocSnippetTestsEngine.Execu
|
||||
private companion object {
|
||||
val headingRegex = Regex("""(?u)^\s*(=++)\s*(.+)""")
|
||||
val collapsibleBlockRegex = Regex("""(?u)^\s*\[%collapsible""")
|
||||
val codeBlockRegex = Regex("""(?u)^\s*\[source(?:%(tested|parsed)(%error)?)?(?:,\{?([a-zA-Z-_]+)}?)?""")
|
||||
val codeBlockRegex =
|
||||
Regex("""(?u)^\s*\[source(?:%(tested|parsed)(%error)?)?(?:,\{?([a-zA-Z-_]+)}?)?""")
|
||||
val codeBlockNameRegex = Regex("""(?u)^\s*\.(.+)""")
|
||||
val codeBlockDelimiterRegex = Regex("""(?u)^\s*----""")
|
||||
val graphicsRegex = Regex("\\[small]#.+#")
|
||||
@@ -51,7 +66,7 @@ class DocSnippetTestsEngine : HierarchicalTestEngine<DocSnippetTestsEngine.Execu
|
||||
|
||||
override fun discover(
|
||||
discoveryRequest: EngineDiscoveryRequest,
|
||||
uniqueId: UniqueId
|
||||
uniqueId: UniqueId,
|
||||
): TestDescriptor {
|
||||
val packageSelectors = discoveryRequest.getSelectorsByType(PackageSelector::class.java)
|
||||
val classSelectors = discoveryRequest.getSelectorsByType(ClassSelector::class.java)
|
||||
@@ -62,12 +77,14 @@ class DocSnippetTestsEngine : HierarchicalTestEngine<DocSnippetTestsEngine.Execu
|
||||
val packageName = testClass.`package`.name
|
||||
val className = testClass.name
|
||||
|
||||
if (methodSelectors.isEmpty()
|
||||
&& (packageSelectors.isEmpty() || packageSelectors.any { it.packageName == packageName })
|
||||
&& (classSelectors.isEmpty() || classSelectors.any { it.className == className })
|
||||
if (
|
||||
methodSelectors.isEmpty() &&
|
||||
(packageSelectors.isEmpty() || packageSelectors.any { it.packageName == packageName }) &&
|
||||
(classSelectors.isEmpty() || classSelectors.any { it.className == className })
|
||||
) {
|
||||
|
||||
val rootDescriptor = Descriptor.Path(uniqueId, docsDir.fileName.toString(), ClassSource.from(testClass), docsDir)
|
||||
val rootDescriptor =
|
||||
Descriptor.Path(uniqueId, docsDir.fileName.toString(), ClassSource.from(testClass), docsDir)
|
||||
doDiscover(rootDescriptor, uniqueIdSelectors)
|
||||
return rootDescriptor
|
||||
}
|
||||
@@ -77,19 +94,17 @@ class DocSnippetTestsEngine : HierarchicalTestEngine<DocSnippetTestsEngine.Execu
|
||||
}
|
||||
|
||||
override fun createExecutionContext(request: ExecutionRequest): ExecutionContext {
|
||||
val replServer = ReplServer(
|
||||
val replServer =
|
||||
ReplServer(
|
||||
SecurityManagers.defaultManager,
|
||||
HttpClient.dummyClient(),
|
||||
Loggers.stdErr(),
|
||||
listOf(
|
||||
ModuleKeyFactories.standardLibrary,
|
||||
ModuleKeyFactories.classPath(DocSnippetTests::class.java.classLoader),
|
||||
ModuleKeyFactories.file
|
||||
),
|
||||
listOf(
|
||||
ResourceReaders.environmentVariable(),
|
||||
ResourceReaders.externalProperty()
|
||||
ModuleKeyFactories.file,
|
||||
),
|
||||
listOf(ResourceReaders.environmentVariable(), ResourceReaders.externalProperty()),
|
||||
System.getenv(),
|
||||
emptyMap(),
|
||||
null,
|
||||
@@ -104,9 +119,9 @@ class DocSnippetTestsEngine : HierarchicalTestEngine<DocSnippetTestsEngine.Execu
|
||||
}
|
||||
|
||||
private fun doDiscover(rootDescriptor: TestDescriptor, selectors: List<UniqueIdSelector>) {
|
||||
fun isMatch(other: UniqueId) = selectors.isEmpty() || selectors.any {
|
||||
it.uniqueId.hasPrefix(other) || other.hasPrefix(it.uniqueId)
|
||||
}
|
||||
fun isMatch(other: UniqueId) =
|
||||
selectors.isEmpty() ||
|
||||
selectors.any { it.uniqueId.hasPrefix(other) || other.hasPrefix(it.uniqueId) }
|
||||
|
||||
docsDir.useDirectoryEntries { docsDirEntries ->
|
||||
for (docsDirEntry in docsDirEntries) {
|
||||
@@ -116,11 +131,12 @@ class DocSnippetTestsEngine : HierarchicalTestEngine<DocSnippetTestsEngine.Execu
|
||||
val docsDirEntryId = rootDescriptor.uniqueId.append("dir", docsDirEntryName)
|
||||
if (!isMatch(docsDirEntryId)) continue
|
||||
|
||||
val docsDirEntryDescriptor = Descriptor.Path(
|
||||
val docsDirEntryDescriptor =
|
||||
Descriptor.Path(
|
||||
docsDirEntryId,
|
||||
docsDirEntryName,
|
||||
DirectorySource.from(docsDirEntry.toFile()),
|
||||
docsDirEntry
|
||||
docsDirEntry,
|
||||
)
|
||||
rootDescriptor.addChild(docsDirEntryDescriptor)
|
||||
|
||||
@@ -131,16 +147,19 @@ class DocSnippetTestsEngine : HierarchicalTestEngine<DocSnippetTestsEngine.Execu
|
||||
for (pagesDirEntry in pagesDirEntries) {
|
||||
val pagesDirEntryName = pagesDirEntry.fileName.toString()
|
||||
val pagesDirEntryId = docsDirEntryId.append("file", pagesDirEntryName)
|
||||
if (!pagesDirEntry.isRegularFile() ||
|
||||
if (
|
||||
!pagesDirEntry.isRegularFile() ||
|
||||
!pagesDirEntryName.endsWith(".adoc") ||
|
||||
!isMatch(pagesDirEntryId)
|
||||
) continue
|
||||
)
|
||||
continue
|
||||
|
||||
val pagesDirEntryDescriptor = Descriptor.Path(
|
||||
val pagesDirEntryDescriptor =
|
||||
Descriptor.Path(
|
||||
pagesDirEntryId,
|
||||
pagesDirEntryName,
|
||||
FileSource.from(pagesDirEntry.toFile()),
|
||||
pagesDirEntry
|
||||
pagesDirEntry,
|
||||
)
|
||||
docsDirEntryDescriptor.addChild(pagesDirEntryDescriptor)
|
||||
|
||||
@@ -174,16 +193,14 @@ class DocSnippetTestsEngine : HierarchicalTestEngine<DocSnippetTestsEngine.Execu
|
||||
}
|
||||
|
||||
val parent = sections.firstOrNull() ?: docDescriptor
|
||||
val normalizedTitle = title
|
||||
.replace("<code>", "")
|
||||
.replace("</code>", "")
|
||||
.replace(graphicsRegex, "")
|
||||
.trim()
|
||||
val childSection = Descriptor.Section(
|
||||
val normalizedTitle =
|
||||
title.replace("<code>", "").replace("</code>", "").replace(graphicsRegex, "").trim()
|
||||
val childSection =
|
||||
Descriptor.Section(
|
||||
parent.uniqueId.append("section", normalizedTitle),
|
||||
normalizedTitle,
|
||||
FileSource.from(docDescriptor.path.toFile(), FilePosition.from(lineNum)),
|
||||
newLevel
|
||||
newLevel,
|
||||
)
|
||||
|
||||
sections.addFirst(childSection)
|
||||
@@ -217,7 +234,8 @@ class DocSnippetTestsEngine : HierarchicalTestEngine<DocSnippetTestsEngine.Execu
|
||||
codeBlockNum += 1
|
||||
val (testMode, error, language) = codeBlockMatch.destructured
|
||||
if (testMode.isNotEmpty()) {
|
||||
val blockName = codeBlockNameRegex.find(prevLine)?.groupValues?.get(1) ?: "snippet$codeBlockNum"
|
||||
val blockName =
|
||||
codeBlockNameRegex.find(prevLine)?.groupValues?.get(1) ?: "snippet$codeBlockNum"
|
||||
while (linesIterator.hasNext()) {
|
||||
advance()
|
||||
val startDelimiterMatch = codeBlockDelimiterRegex.find(line)
|
||||
@@ -236,10 +254,13 @@ class DocSnippetTestsEngine : HierarchicalTestEngine<DocSnippetTestsEngine.Execu
|
||||
snippetId,
|
||||
blockName,
|
||||
language,
|
||||
FileSource.from(docDescriptor.path.toFile(), FilePosition.from(jumpToLineNum)),
|
||||
FileSource.from(
|
||||
docDescriptor.path.toFile(),
|
||||
FilePosition.from(jumpToLineNum),
|
||||
),
|
||||
builder.toString(),
|
||||
testMode == "parsed",
|
||||
error.isNotEmpty()
|
||||
error.isNotEmpty(),
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -261,28 +282,21 @@ class DocSnippetTestsEngine : HierarchicalTestEngine<DocSnippetTestsEngine.Execu
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class Descriptor(
|
||||
uniqueId: UniqueId,
|
||||
displayName: String,
|
||||
source: TestSource
|
||||
) : AbstractTestDescriptor(uniqueId, displayName, source), Node<ExecutionContext> {
|
||||
private sealed class Descriptor(uniqueId: UniqueId, displayName: String, source: TestSource) :
|
||||
AbstractTestDescriptor(uniqueId, displayName, source), Node<ExecutionContext> {
|
||||
|
||||
class Path(
|
||||
uniqueId: UniqueId,
|
||||
displayName: String,
|
||||
source: TestSource,
|
||||
val path: java.nio.file.Path
|
||||
val path: java.nio.file.Path,
|
||||
) : Descriptor(uniqueId, displayName, source) {
|
||||
|
||||
override fun getType() = Type.CONTAINER
|
||||
}
|
||||
|
||||
class Section(
|
||||
uniqueId: UniqueId,
|
||||
displayName: String,
|
||||
source: TestSource,
|
||||
val level: Int
|
||||
) : Descriptor(uniqueId, displayName, source) {
|
||||
class Section(uniqueId: UniqueId, displayName: String, source: TestSource, val level: Int) :
|
||||
Descriptor(uniqueId, displayName, source) {
|
||||
|
||||
override fun getType() = Type.CONTAINER
|
||||
|
||||
@@ -299,7 +313,7 @@ class DocSnippetTestsEngine : HierarchicalTestEngine<DocSnippetTestsEngine.Execu
|
||||
source: TestSource,
|
||||
private val code: String,
|
||||
private val parseOnly: Boolean,
|
||||
private val expectError: Boolean
|
||||
private val expectError: Boolean,
|
||||
) : Descriptor(uniqueId, displayName, source) {
|
||||
|
||||
override fun getType() = Type.TEST
|
||||
@@ -312,7 +326,10 @@ class DocSnippetTestsEngine : HierarchicalTestEngine<DocSnippetTestsEngine.Execu
|
||||
}
|
||||
}
|
||||
|
||||
override fun execute(context: ExecutionContext, executor: DynamicTestExecutor): ExecutionContext {
|
||||
override fun execute(
|
||||
context: ExecutionContext,
|
||||
executor: DynamicTestExecutor,
|
||||
): ExecutionContext {
|
||||
if (parseOnly) {
|
||||
try {
|
||||
parsed
|
||||
@@ -328,12 +345,7 @@ class DocSnippetTestsEngine : HierarchicalTestEngine<DocSnippetTestsEngine.Execu
|
||||
}
|
||||
|
||||
context.replServer.handleRequest(
|
||||
ReplRequest.Eval(
|
||||
"snippet",
|
||||
code,
|
||||
!expectError,
|
||||
!expectError
|
||||
)
|
||||
ReplRequest.Eval("snippet", code, !expectError, !expectError)
|
||||
)
|
||||
|
||||
val properties = parsed.children()?.filterIsInstance<ClassProperty>() ?: emptyList()
|
||||
@@ -342,21 +354,21 @@ class DocSnippetTestsEngine : HierarchicalTestEngine<DocSnippetTestsEngine.Execu
|
||||
|
||||
// force each property
|
||||
for (prop in properties) {
|
||||
responses.addAll(context.replServer.handleRequest(
|
||||
ReplRequest.Eval(
|
||||
"snippet",
|
||||
prop.name.value,
|
||||
false,
|
||||
true
|
||||
responses.addAll(
|
||||
context.replServer.handleRequest(
|
||||
ReplRequest.Eval("snippet", prop.name.value, false, true)
|
||||
)
|
||||
)
|
||||
))
|
||||
}
|
||||
if (expectError) {
|
||||
if (responses.dropLast(1).any { it !is ReplResponse.EvalSuccess } ||
|
||||
responses.last() !is ReplResponse.EvalError) {
|
||||
if (
|
||||
responses.dropLast(1).any { it !is ReplResponse.EvalSuccess } ||
|
||||
responses.last() !is ReplResponse.EvalError
|
||||
) {
|
||||
throw AssertionError(
|
||||
"Expected %error snippet to fail at the end, but got the following REPL responses:\n\n" +
|
||||
responses.joinToString("\n\n") { it.message })
|
||||
responses.joinToString("\n\n") { it.message }
|
||||
)
|
||||
}
|
||||
|
||||
return context
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1549,8 +1549,9 @@ class JavaCodeGeneratorTest {
|
||||
|
||||
// not worthwhile to add spring & spring boot dependency just so that this test can compile
|
||||
// their annotations
|
||||
val javaCodeWithoutSpringAnnotations =
|
||||
javaCode.deleteLines { it.contains("ConfigurationProperties") }
|
||||
val javaCodeWithoutSpringAnnotations = javaCode.deleteLines {
|
||||
it.contains("ConfigurationProperties")
|
||||
}
|
||||
assertThat(javaCodeWithoutSpringAnnotations).compilesSuccessfully()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
+3
-2
@@ -1464,8 +1464,9 @@ class KotlinCodeGeneratorTest {
|
||||
|
||||
// not worthwhile to add spring & spring boot dependency just so that this test can compile
|
||||
// their annotations
|
||||
val kotlinCodeWithoutSpringAnnotations =
|
||||
kotlinCode.deleteLines { it.contains("ConfigurationProperties") }
|
||||
val kotlinCodeWithoutSpringAnnotations = kotlinCode.deleteLines {
|
||||
it.contains("ConfigurationProperties")
|
||||
}
|
||||
assertThat(kotlinCodeWithoutSpringAnnotations).compilesSuccessfully()
|
||||
}
|
||||
|
||||
|
||||
@@ -192,8 +192,7 @@ data class CliBaseOptions(
|
||||
// sort modules to make cli output independent of source module order
|
||||
.sorted()
|
||||
|
||||
val normalizedSettingsModule: URI? =
|
||||
settings?.let { uri ->
|
||||
val normalizedSettingsModule: URI? = settings?.let { uri ->
|
||||
if (uri.isAbsolute) uri else IoUtils.resolve(normalizedWorkingDir.toUri(), uri)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -69,8 +69,7 @@ internal class MainPageGenerator(
|
||||
private fun HtmlBlockTag.renderPackages() {
|
||||
if (packagesData.isEmpty()) return
|
||||
|
||||
val sortedPackages =
|
||||
packagesData.sortedWith { pkg1, pkg2 ->
|
||||
val sortedPackages = packagesData.sortedWith { pkg1, pkg2 ->
|
||||
when {
|
||||
pkg1.ref.pkg == "pkl" -> -1 // always sort the stdlib first
|
||||
else -> pkg1.ref.pkg.compareTo(pkg2.ref.pkg)
|
||||
|
||||
@@ -723,11 +723,13 @@ internal abstract class PageGenerator<out S>(
|
||||
?.let { markdownRenderer.render(markdownParser.parse(it)).trim().ifEmpty { null } }
|
||||
}
|
||||
|
||||
private val deprecatedAnnotation: PObject? =
|
||||
annotations.find { it.classInfo == PClassInfo.Deprecated }
|
||||
private val deprecatedAnnotation: PObject? = annotations.find {
|
||||
it.classInfo == PClassInfo.Deprecated
|
||||
}
|
||||
|
||||
private val alsoKnownAsAnnotation: PObject? =
|
||||
annotations.find { it.classInfo == PClassInfo.AlsoKnownAs }
|
||||
private val alsoKnownAsAnnotation: PObject? = annotations.find {
|
||||
it.classInfo == PClassInfo.AlsoKnownAs
|
||||
}
|
||||
|
||||
val isDeprecatedMember: Boolean = deprecatedAnnotation != null
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2025-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2026 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.
|
||||
@@ -36,11 +36,11 @@ internal fun AutoCloseable.closeQuietly() {
|
||||
}
|
||||
}
|
||||
|
||||
internal val threadLocalBufferPacker: ThreadLocal<MessageBufferPacker> =
|
||||
ThreadLocal.withInitial { MessagePack.newDefaultBufferPacker() }
|
||||
internal val threadLocalBufferPacker: ThreadLocal<MessageBufferPacker> = ThreadLocal.withInitial {
|
||||
MessagePack.newDefaultBufferPacker()
|
||||
}
|
||||
|
||||
private val threadLocalEncoder: ThreadLocal<(Message) -> ByteArray> =
|
||||
ThreadLocal.withInitial {
|
||||
private val threadLocalEncoder: ThreadLocal<(Message) -> ByteArray> = ThreadLocal.withInitial {
|
||||
val packer = threadLocalBufferPacker.get()
|
||||
val encoder = ServerMessagePackEncoder(packer);
|
||||
{ message: Message ->
|
||||
|
||||
Reference in New Issue
Block a user