Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ plugins {
alias(libs.plugins.shadow)
alias(libs.plugins.spotless)
alias(libs.plugins.nexusPublish)
alias(libs.plugins.protobuf)
}

val buildInfo = project.extensions.getByType<BuildInfo>()
Expand Down Expand Up @@ -77,10 +78,13 @@ dependencies {
implementation(libs.kotlinxSerializationJson)
implementation(libs.jspecify) // used by jtreesitter
implementation(libs.jtreesitter)
implementation(libs.protobuf)
// stdlib files are included from a one-off configuration then bundled into shadow jar (see
// shadowJar spec).
// declare a regular dependency for testing only.
testRuntimeOnly(libs.pklStdlib)
// Add pkl stdlib as runtime dependency for development/debug commands
runtimeOnly(libs.pklStdlib)
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation(libs.assertJ)
testImplementation(libs.junitJupiter)
Expand All @@ -96,6 +100,11 @@ dependencies {
val configurePklCliExecutable by
tasks.registering { doLast { pklCli.singleFile.setExecutable(true) } }

protobuf {
protoc { artifact = "com.google.protobuf:protoc:${libs.versions.protobuf.get()}" }
generateProtoTasks { all().forEach { it.builtins { create("kotlin") } } }
}

tasks.jar {
manifest {
attributes("Main-Class" to "org.pkl.lsp.cli.Main", "Enable-Native-Access" to "ALL-UNNAMED")
Expand Down
6 changes: 5 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ ktfmt = "0.53"
lsp4j = "0.23.1"
nexusPublishPlugin = "2.0.0"
pkl = "0.29.0"
protobuf = "4.28.3"
protobufPlugin = "0.9.4"
shadowPlugin = "8.1.1"
spotless = "6.25.0"
treeSitterRepo = "v0.25.3" # git tag name
Expand All @@ -36,10 +38,12 @@ junitEngine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", vers
kotlinxSerializationJson = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinx" }
lsp4j = { group = "org.eclipse.lsp4j", name = "org.eclipse.lsp4j", version.ref = "lsp4j" }
pklStdlib = { group = "org.pkl-lang", name = "pkl-stdlib", version.ref = "pkl" }
protobuf = { group = "com.google.protobuf", name = "protobuf-kotlin", version.ref = "protobuf" }

[plugins]
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadowPlugin" }
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexusPublishPlugin" }
nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexusPublishPlugin" }
protobuf = { id = "com.google.protobuf", version.ref = "protobufPlugin" }
131 changes: 131 additions & 0 deletions pkl-pantrysnapshot/basePklProject.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
//===----------------------------------------------------------------------===//
// 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.
// 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.
//===----------------------------------------------------------------------===//
module basePklProject
//^^^^^^^^^^^^^^^^^^^^^ definition pkl . . . `basePklProject.pkl`/

amends "pkl:Project"

import "pkl:reflect"

local myModule = reflect.Module(module)
// ^^^^^^^^ definition local myModule_22
// ^^^^^^^ reference pkl . pkl 0.29.0 `pkl.reflect`/
// ^^^^^^ reference pkl . pkl 0.29.0 `pkl.reflect`/Module().

local packageName: String =
// ^^^^^^^^^^^ definition local packageName_24
// ^^^^^^ reference pkl . pkl 0.29.0 `pkl.base`/String#
findRootModule(myModule)
// ^^^^^^^^^^^^^^ reference local findRootModule_29
// ^^^^^^^^ reference local myModule_22
.relativePathTo(module)
// ^^^^^^^^^^^^^^ reference pkl . pkl 0.29.0 `pkl.base`/Module#relativePathTo().
.last
// ^^^^ reference pkl . pkl 0.29.0 `pkl.base`/List#last.

local function findRootModule(mod: reflect.Module): Module =
// ^^^^^^^^^^^^^^ definition local findRootModule_29
// ^^^ definition local mod_29
// ^^^^^^ reference pkl . pkl 0.29.0 `pkl.reflect`/Module#
// ^^^^^^ reference pkl . pkl 0.29.0 `pkl.base`/Module#
let (supermodule = mod.supermodule)
// ^^^^^^^^^^^ definition local supermodule_30
// ^^^ reference local mod_29
// ^^^^^^^^^^^ reference pkl . pkl 0.29.0 `pkl.reflect`/Module#supermodule.
if (supermodule == null || !supermodule.isAmend) mod.reflectee
// ^^^^^^^^^^^ reference local supermodule_30
// ^^^^^^^^^^^ reference local supermodule_30
// ^^^^^^^ reference pkl . pkl 0.29.0 `pkl.reflect`/Module#isAmend.
// ^^^ reference local mod_29
// ^^^^^^^^^ reference pkl . pkl 0.29.0 `pkl.reflect`/Module#reflectee.
else findRootModule(supermodule)
// ^^^^^^^^^^^^^^ reference local findRootModule_29
// ^^^^^^^^^^^ reference local supermodule_30

const local allTests = import*("**/tests/**.pkl").keys.filter((it) -> !it.contains("tests/fixtures/"))
// ^^^^^^^^ definition local allTests_34
// ^^^^ reference pkl . pkl 0.29.0 `pkl.base`/Mapping#keys.
// ^^^^^^ reference pkl . pkl 0.29.0 `pkl.base`/Set#filter().
// ^^ definition local it_34
// ^^ reference local it_34
// ^^^^^^^^ reference pkl . pkl 0.29.0 `pkl.base`/String#contains().

package {
//^^^^^^^ definition pkl . . . `basePklProject.pkl`/package.
name = packageName
// ^^^^ definition pkl . . . `basePklProject.pkl`/name.
// ^^^^^^^^^^^ reference local packageName_24
apiTests = tests // api tests are shared with module tests
// ^^^^^^^^ definition pkl . . . `basePklProject.pkl`/apiTests.
// ^^^^^ reference pkl . . . `basePklProject.pkl`/tests.
baseUri = "package://pkg.pkl-lang.org/pkl-pantry/\(name)"
// ^^^^^^^ definition pkl . . . `basePklProject.pkl`/baseUri.
// ^^^^ reference pkl . . . `basePklProject.pkl`/name.
packageZipUrl = "https://github.com/apple/pkl-pantry/releases/download/\(name)@\(version)/\(name)@\(version).zip"
// ^^^^^^^^^^^^^ definition pkl . . . `basePklProject.pkl`/packageZipUrl.
// ^^^^ reference pkl . . . `basePklProject.pkl`/name.
// ^^^^^^^ reference pkl . pkl 0.29.0 `pkl.Project`/Package#version.
// ^^^^ reference pkl . . . `basePklProject.pkl`/name.
// ^^^^^^^ reference pkl . pkl 0.29.0 `pkl.Project`/Package#version.
license = "Apache-2.0"
// ^^^^^^^ definition pkl . . . `basePklProject.pkl`/license.
authors {
// ^^^^^^^ definition pkl . . . `basePklProject.pkl`/authors.
"The Pkl Authors <[email protected]>"
}
exclude {
// ^^^^^^^ definition pkl . . . `basePklProject.pkl`/exclude.
"examples/**"
"tests/**"
}
description = myModule.docComment
// ^^^^^^^^^^^ definition pkl . . . `basePklProject.pkl`/description.
// ^^^^^^^^ reference local myModule_22
// ^^^^^^^^^^ reference pkl . pkl 0.29.0 `pkl.reflect`/Declaration#docComment.
issueTracker = "https://github.com/apple/pkl-pantry/issues"
// ^^^^^^^^^^^^ definition pkl . . . `basePklProject.pkl`/issueTracker.
sourceCode = "https://github.com/apple/pkl-pantry/tree/\(name)@\(version)/packages/\(name)"
// ^^^^^^^^^^ definition pkl . . . `basePklProject.pkl`/sourceCode.
// ^^^^ reference pkl . . . `basePklProject.pkl`/name.
// ^^^^^^^ reference pkl . pkl 0.29.0 `pkl.Project`/Package#version.
// ^^^^ reference pkl . . . `basePklProject.pkl`/name.
sourceCodeUrlScheme = "https://github.com/apple/pkl-pantry/blob/\(name)@\(version)/packages/\(name)%{path}#L%{line}-%{endLine}"
// ^^^^^^^^^^^^^^^^^^^ definition pkl . . . `basePklProject.pkl`/sourceCodeUrlScheme.
// ^^^^ reference pkl . . . `basePklProject.pkl`/name.
// ^^^^^^^ reference pkl . pkl 0.29.0 `pkl.Project`/Package#version.
// ^^^^ reference pkl . . . `basePklProject.pkl`/name.
}

tests {
//^^^^^ definition pkl . . . `basePklProject.pkl`/tests.
for (test in allTests) {
// ^^^^ definition local test_56
// ^^^^^^^^ reference local allTests_34
when (test.split("/").first == package.name) {
// ^^^^ reference local test_56
// ^^^^^ reference pkl . pkl 0.29.0 `pkl.base`/String#split().
// ^^^^^ reference pkl . pkl 0.29.0 `pkl.base`/List#first.
// ^^^^^^^ reference pkl . . . `basePklProject.pkl`/package.
// ^^^^ reference pkl . pkl 0.29.0 `pkl.Project`/Package#name.
test.replaceFirst(package.name, ".")
// ^^^^ reference local test_56
// ^^^^^^^^^^^^ reference pkl . pkl 0.29.0 `pkl.base`/String#replaceFirst().
// ^^^^^^^ reference pkl . . . `basePklProject.pkl`/package.
// ^^^^ reference pkl . pkl 0.29.0 `pkl.Project`/Package#name.
}
}
}

Loading