mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 11:45:45 +03:00
pkl: init at 0.28.2
This commit is contained in:
parent
0169a2ffe8
commit
90da7eb1bc
5 changed files with 1687 additions and 0 deletions
1495
pkgs/by-name/pk/pkl/deps.json
generated
Normal file
1495
pkgs/by-name/pk/pkl/deps.json
generated
Normal file
File diff suppressed because it is too large
Load diff
12
pkgs/by-name/pk/pkl/disable_bad_tests.patch
Normal file
12
pkgs/by-name/pk/pkl/disable_bad_tests.patch
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
diff --git i/pkl-cli/src/test/kotlin/org/pkl/cli/CliEvaluatorTest.kt w/pkl-cli/src/test/kotlin/org/pkl/cli/CliEvaluatorTest.kt
|
||||||
|
index df88c423..ae1db500 100644
|
||||||
|
--- i/pkl-cli/src/test/kotlin/org/pkl/cli/CliEvaluatorTest.kt
|
||||||
|
+++ w/pkl-cli/src/test/kotlin/org/pkl/cli/CliEvaluatorTest.kt
|
||||||
|
@@ -1497,6 +1497,7 @@ result = someLib.x
|
||||||
|
assertThat(output).isEqualTo("result = 1\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
+ @Disabled
|
||||||
|
@Test
|
||||||
|
fun `eval file with non-ASCII name`() {
|
||||||
|
val tempDirUri = tempDir.toUri()
|
65
pkgs/by-name/pk/pkl/disable_gradle_codegen_tests.patch
Normal file
65
pkgs/by-name/pk/pkl/disable_gradle_codegen_tests.patch
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
diff --git a/pkl-gradle/src/test/kotlin/org/pkl/gradle/JavaCodeGeneratorsTest.kt b/pkl-gradle/src/test/kotlin/org/pkl/gradle/JavaCodeGeneratorsTest.kt
|
||||||
|
index 68a5b533..84fe66df 100644
|
||||||
|
--- a/pkl-gradle/src/test/kotlin/org/pkl/gradle/JavaCodeGeneratorsTest.kt
|
||||||
|
+++ b/pkl-gradle/src/test/kotlin/org/pkl/gradle/JavaCodeGeneratorsTest.kt
|
||||||
|
@@ -18,9 +18,11 @@ package org.pkl.gradle
|
||||||
|
import kotlin.io.path.listDirectoryEntries
|
||||||
|
import kotlin.io.path.readText
|
||||||
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
|
+import org.junit.jupiter.api.Disabled;
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
class JavaCodeGeneratorsTest : AbstractTest() {
|
||||||
|
+ @Disabled("runTask doesn't use the MITM cache")
|
||||||
|
@Test
|
||||||
|
fun `generate code`() {
|
||||||
|
writeBuildFile()
|
||||||
|
@@ -68,6 +70,7 @@ class JavaCodeGeneratorsTest : AbstractTest() {
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
+ @Disabled("runTask doesn't use the MITM cache")
|
||||||
|
@Test
|
||||||
|
fun `compile generated code`() {
|
||||||
|
writeBuildFile()
|
||||||
|
@@ -84,6 +87,7 @@ class JavaCodeGeneratorsTest : AbstractTest() {
|
||||||
|
assertThat(addressClassFile).exists()
|
||||||
|
}
|
||||||
|
|
||||||
|
+ @Disabled("runTask doesn't use the MITM cache")
|
||||||
|
@Test
|
||||||
|
fun `no source modules`() {
|
||||||
|
writeFile(
|
||||||
|
diff --git a/pkl-gradle/src/test/kotlin/org/pkl/gradle/KotlinCodeGeneratorsTest.kt b/pkl-gradle/src/test/kotlin/org/pkl/gradle/KotlinCodeGeneratorsTest.kt
|
||||||
|
index 2b9ffc88..99b91893 100644
|
||||||
|
--- a/pkl-gradle/src/test/kotlin/org/pkl/gradle/KotlinCodeGeneratorsTest.kt
|
||||||
|
+++ b/pkl-gradle/src/test/kotlin/org/pkl/gradle/KotlinCodeGeneratorsTest.kt
|
||||||
|
@@ -18,9 +18,11 @@ package org.pkl.gradle
|
||||||
|
import kotlin.io.path.listDirectoryEntries
|
||||||
|
import kotlin.io.path.readText
|
||||||
|
import org.assertj.core.api.Assertions.assertThat
|
||||||
|
+import org.junit.jupiter.api.Disabled;
|
||||||
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
class KotlinCodeGeneratorsTest : AbstractTest() {
|
||||||
|
+ @Disabled("runTask doesn't use the MITM cache")
|
||||||
|
@Test
|
||||||
|
fun `generate code`() {
|
||||||
|
writeBuildFile()
|
||||||
|
@@ -69,6 +71,7 @@ class KotlinCodeGeneratorsTest : AbstractTest() {
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
+ @Disabled("runTask doesn't use the MITM cache")
|
||||||
|
@Test
|
||||||
|
fun `compile generated code`() {
|
||||||
|
writeBuildFile()
|
||||||
|
@@ -84,6 +87,7 @@ class KotlinCodeGeneratorsTest : AbstractTest() {
|
||||||
|
assertThat(addressClassFile).exists()
|
||||||
|
}
|
||||||
|
|
||||||
|
+ @Disabled("runTask doesn't use the MITM cache")
|
||||||
|
@Test
|
||||||
|
fun `no source modules`() {
|
||||||
|
writeFile(
|
||||||
|
|
14
pkgs/by-name/pk/pkl/fix_kotlin_classpath.patch
Normal file
14
pkgs/by-name/pk/pkl/fix_kotlin_classpath.patch
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
diff --git a/pkl-gradle/pkl-gradle.gradle.kts b/pkl-gradle/pkl-gradle.gradle.kts
|
||||||
|
index 08f0e8ca..a16c7073 100644
|
||||||
|
--- a/pkl-gradle/pkl-gradle.gradle.kts
|
||||||
|
+++ b/pkl-gradle/pkl-gradle.gradle.kts
|
||||||
|
@@ -58,7 +58,7 @@ sourceSets {
|
||||||
|
// if `compileClasspath` is filtered, causing "unresolved reference" errors in IntelliJ.
|
||||||
|
// As a workaround, don't perform filtering for IntelliJ (import).
|
||||||
|
if (System.getProperty("idea.sync.active") == null) {
|
||||||
|
- compileClasspath = compileClasspath.filter { !(it.path.contains("dists")) }
|
||||||
|
+ compileClasspath = compileClasspath.filter { !(it.path.contains("@gradle@") || it.path.contains("generated-gradle-jars/gradle-api-")) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
101
pkgs/by-name/pk/pkl/package.nix
Normal file
101
pkgs/by-name/pk/pkl/package.nix
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
{
|
||||||
|
stdenv,
|
||||||
|
lib,
|
||||||
|
fetchFromGitHub,
|
||||||
|
gradle,
|
||||||
|
temurin-bin-21,
|
||||||
|
kotlin,
|
||||||
|
nix-update-script,
|
||||||
|
replaceVars,
|
||||||
|
makeWrapper,
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
jdk = temurin-bin-21;
|
||||||
|
gradleOverlay = gradle.override { java = jdk; };
|
||||||
|
kotlinOverlay = kotlin.override { jre = jdk; };
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
|
pname = "pkl";
|
||||||
|
version = "0.28.2";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "apple";
|
||||||
|
repo = "pkl";
|
||||||
|
tag = finalAttrs.version;
|
||||||
|
hash = "sha256-ay3V3EWqZHncLH6UR4JOCChkweNcilDeskXzaeAFTR8=";
|
||||||
|
leaveDotGit = true;
|
||||||
|
postFetch = ''
|
||||||
|
pushd $out
|
||||||
|
git rev-parse HEAD | tr -d '\n' > .commit-hash
|
||||||
|
rm -rf .git
|
||||||
|
popd
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
(replaceVars ./fix_kotlin_classpath.patch { gradle = gradle.unwrapped; })
|
||||||
|
./disable_gradle_codegen_tests.patch
|
||||||
|
./disable_bad_tests.patch
|
||||||
|
];
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
gradleOverlay
|
||||||
|
jdk
|
||||||
|
kotlinOverlay
|
||||||
|
makeWrapper
|
||||||
|
];
|
||||||
|
|
||||||
|
mitmCache = gradle.fetchDeps {
|
||||||
|
inherit (finalAttrs) pname;
|
||||||
|
data = ./deps.json;
|
||||||
|
};
|
||||||
|
|
||||||
|
doCheck = !(stdenv.hostPlatform.isDarwin);
|
||||||
|
|
||||||
|
gradleFlags = [
|
||||||
|
"-x"
|
||||||
|
"spotlessCheck"
|
||||||
|
"-DreleaseBuild=true"
|
||||||
|
"-Dorg.gradle.java.home=${jdk}"
|
||||||
|
"-Porg.gradle.java.installations.auto-download=false"
|
||||||
|
"-Porg.gradle.java.installations.auto-detect=false"
|
||||||
|
];
|
||||||
|
|
||||||
|
preBuild = ''
|
||||||
|
gradleFlagsArray+=(-DcommitId=$(cat .commit-hash))
|
||||||
|
'';
|
||||||
|
|
||||||
|
JAVA_TOOL_OPTIONS = "-Dfile.encoding=utf-8";
|
||||||
|
__darwinAllowLocalNetworking = true;
|
||||||
|
|
||||||
|
preCheck = ''
|
||||||
|
export LANG=C.UTF-8
|
||||||
|
export LC_ALL=C.UTF-8
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p "$out/bin" "$out/opt/pkl"
|
||||||
|
cp ./pkl-cli/build/executable/jpkl "$out/opt/pkl/jpkl.jar"
|
||||||
|
|
||||||
|
makeWrapper ${lib.getExe jdk} $out/bin/pkl --add-flags "-jar $out/opt/pkl/jpkl.jar"
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru.updateScript = nix-update-script { };
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Configuration-as-code language with rich validation and tooling";
|
||||||
|
homepage = "https://pkl-lang.org";
|
||||||
|
license = lib.licenses.asl20;
|
||||||
|
platforms = lib.platforms.all;
|
||||||
|
maintainers = with lib.maintainers; [ hugolgst ];
|
||||||
|
mainProgram = "pkl";
|
||||||
|
sourceProvenance = with lib.sourceTypes; [
|
||||||
|
fromSource
|
||||||
|
binaryBytecode # mitm cache
|
||||||
|
];
|
||||||
|
};
|
||||||
|
})
|
Loading…
Add table
Add a link
Reference in a new issue