Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include the juvix version in the build directory path #3069

Merged
merged 3 commits into from
Sep 30, 2024
Merged
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
2 changes: 1 addition & 1 deletion src/Juvix/Compiler/Pipeline/Package/Base.hs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ instance FromJSON RawPackage where

resolveBuildDir :: BuildDir -> SomeBase Dir
resolveBuildDir = \case
DefaultBuildDir -> Rel (relBuildDir)
DefaultBuildDir -> Rel relBuildDir
CustomBuildDir d -> d

resolveAbsBuildDir :: Path Abs Dir -> BuildDir -> Path Abs Dir
Expand Down
3 changes: 2 additions & 1 deletion src/Juvix/Extra/Paths/Base.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module Juvix.Extra.Paths.Base where

import Data.FileEmbed qualified as FE
import Juvix.Extra.Version
import Juvix.Prelude.Base
import Juvix.Prelude.Path
import Language.Haskell.TH.Syntax
Expand Down Expand Up @@ -60,7 +61,7 @@ packageFilePath :: Path Rel File
packageFilePath = $(mkRelFile "Package.juvix")

relBuildDir :: Path Rel Dir
relBuildDir = $(mkRelDir ".juvix-build")
relBuildDir = $(mkRelDir ".juvix-build") <//> versionDir

relStdlibDir :: Path Rel Dir
relStdlibDir = $(mkRelDir "stdlib")
Expand Down
2 changes: 1 addition & 1 deletion tests/positive/Dependencies/.libs/Extra/Package.juvix
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ package : Package :=
defaultPackage@?{
name := "extra";
version := mkVersion 1 0 0;
dependencies := [path ".juvix-build/stdlib"; path "../Base"]
dependencies := [defaultStdlib; path "../Base"]
};
51 changes: 27 additions & 24 deletions tests/smoke/Commands/compile-dependencies-package-juvix.smoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ tests:
defaultPackage@?{name := "HelloWorld";
version := mkVersion 0 0 1;
dependencies :=
[path ".juvix-build/stdlib";
[defaultStdlib;
git "dep1" "$temp/dep" "$dep1hash"];
main := just "HelloWorld.juvix"};
EOF
Expand Down Expand Up @@ -104,7 +104,7 @@ tests:
defaultPackage@?{name := "HelloWorld";
version := mkVersion 0 0 1;
dependencies :=
[path ".juvix-build/stdlib";
[defaultStdlib;
git "dep1" "$temp/dep" "$dep1hash"];
main := just "HelloWorld.juvix"};
EOF
Expand Down Expand Up @@ -172,7 +172,7 @@ tests:
defaultPackage@?{name := "HelloWorld";
version := mkVersion 0 0 1;
dependencies :=
[path ".juvix-build/stdlib";
[defaultStdlib;
git "dep1" "$temp/dep" "$dep1hash"];
main := just "HelloWorld.juvix"};
EOF
Expand Down Expand Up @@ -217,7 +217,7 @@ tests:
defaultPackage@?{name := "HelloWorld";
version := mkVersion 0 0 1;
dependencies :=
[path ".juvix-build/stdlib";
[defaultStdlib;
git "dep1" "$temp/dep" "$dep1hash"];
main := just "HelloWorld.juvix"};
EOF
Expand Down Expand Up @@ -277,7 +277,7 @@ tests:
defaultPackage@?{name := "Dep1";
version := mkVersion 0 1 0;
dependencies :=
[path ".juvix-build/stdlib/";
[defaultStdlib;
git "dep2" "$temp/dep2" "main"]};
EOF

Expand All @@ -300,32 +300,33 @@ tests:
defaultPackage@?{name := "HelloWorld";
version := mkVersion 0 0 1;
dependencies :=
[path ".juvix-build/stdlib/";
[defaultStdlib;
git "dep1" "$temp/dep1" "main"];
main := just "HelloWorld.juvix"};
EOF

checksum=$(sha256sum Package.juvix | cut -d " " -f 1)
version=$(juvix --numeric-version)

cat <<-EOF > juvix.lock.yaml
version: 2
checksum: $checksum
dependencies:
- path: .juvix-build/stdlib/
- path: .juvix-build/$version/stdlib/
dependencies: []
- git:
url: $temp/dep1
ref: $dep1hash
name: dep1
dependencies:
- path: .juvix-build/stdlib/
- path: .juvix-build/$version/stdlib/
dependencies: []
- git:
url: $temp/dep2
ref: $dep2hash
name: dep2
dependencies:
- path: .juvix-build/stdlib/
- path: .juvix-build/$version/stdlib/
dependencies: []
EOF

Expand Down Expand Up @@ -414,7 +415,7 @@ tests:
defaultPackage@?{name := "HelloWorld";
version := mkVersion 0 0 1;
dependencies :=
[path ".juvix-build/stdlib";
[defaultStdlib;
git "dep1" "$temp/dep" "main"];
main := just "HelloWorld.juvix"};
EOF
Expand Down Expand Up @@ -507,7 +508,7 @@ tests:
defaultPackage@?{name := "HelloWorld";
version := mkVersion 0 0 1;
dependencies :=
[path ".juvix-build/stdlib";
[defaultStdlib;
git "dep1" "$temp/dep" "$dep1hash1"];
main := just "HelloWorld.juvix"};
EOF
Expand Down Expand Up @@ -538,7 +539,7 @@ tests:
defaultPackage@?{name := "HelloWorld";
version := mkVersion 0 0 1;
dependencies :=
[path ".juvix-build/stdlib";
[defaultStdlib;
git "dep1" "$temp/dep" "$dep1hash2"];
main := just "HelloWorld.juvix"};
EOF
Expand All @@ -561,6 +562,8 @@ tests:
temp=$(mktemp -d)
trap 'rm -rf -- "$temp"' EXIT

version=$(juvix --numeric-version)

# create dependency2
mkdir $temp/dep2
cd $temp/dep2
Expand Down Expand Up @@ -611,20 +614,20 @@ tests:
defaultPackage@?{name := "Dep1";
version := mkVersion 0 1 0;
dependencies :=
[path ".juvix-build/stdlib/";
[defaultStdlib;
git "dep2" "$temp/dep2" "main"]};
EOF

cat <<-EOF > juvix.lock.yaml
dependencies:
- path: .juvix-build/stdlib/
- path: .juvix-build/$version/stdlib/
dependencies: []
- git:
url: $temp/dep2
ref: $dep2hash
name: dep2
dependencies:
- path: .juvix-build/stdlib/
- path: .juvix-build/$version/stdlib/
dependencies: []
EOF

Expand All @@ -647,7 +650,7 @@ tests:
defaultPackage@?{name := "HelloWorld";
version := mkVersion 0 0 1;
dependencies :=
[path ".juvix-build/stdlib/";
[defaultStdlib;
git "dep1" "$temp/dep1" "$dep1hash"];
main := just "HelloWorld.juvix"};
EOF
Expand Down Expand Up @@ -721,7 +724,7 @@ tests:
defaultPackage@?{name := "HelloWorld";
version := mkVersion 0 0 1;
dependencies :=
[path ".juvix-build/stdlib";
[defaultStdlib;
git "dep1" "$temp/dep" "$dep1hash1"];
main := just "HelloWorld.juvix"};
EOF
Expand Down Expand Up @@ -757,7 +760,7 @@ tests:
defaultPackage@?{name := "HelloWorld";
version := mkVersion 0 0 1;
dependencies :=
[path ".juvix-build/stdlib";
[defaultStdlib;
git "dep1" "$temp/dep" "$dep1hash2"];
main := just "HelloWorld.juvix"};
EOF
Expand Down Expand Up @@ -806,7 +809,7 @@ tests:
defaultPackage@?{name := "HelloWorld";
version := mkVersion 0 0 1;
dependencies :=
[path ".juvix-build/stdlib";
[defaultStdlib;
git "dep1" "$temp/dep" "invalid-ref"];
main := just "HelloWorld.juvix"};
EOF
Expand Down Expand Up @@ -851,7 +854,7 @@ tests:
defaultPackage@?{name := "HelloWorld";
version := mkVersion 0 0 1;
dependencies :=
[path ".juvix-build/stdlib";
[defaultStdlib;
git "dep1" "$temp/dep" "main"];
main := just "HelloWorld.juvix"};
EOF
Expand Down Expand Up @@ -896,7 +899,7 @@ tests:
defaultPackage@?{name := "HelloWorld";
version := mkVersion 0 0 1;
dependencies :=
[path ".juvix-build/stdlib";
[defaultStdlib;
git "dep1" "$temp/dep" "main"];
main := just "HelloWorld.juvix"};
EOF
Expand Down Expand Up @@ -966,7 +969,7 @@ tests:
defaultPackage@?{name := "HelloWorld";
version := mkVersion 0 0 1;
dependencies :=
[path ".juvix-build/stdlib";
[defaultStdlib;
git "dep1" "$temp/dep" "$dep1hash"];
main := just "HelloWorld.juvix"};
EOF
Expand Down Expand Up @@ -1017,7 +1020,7 @@ tests:
defaultPackage@?{name := "HelloWorld";
version := mkVersion 0 0 1;
dependencies :=
[path ".juvix-build/stdlib";
[defaultStdlib;
git "dep1" "$temp/dep1" "main";
git "dep1" "$temp/dep2" "main"];
main := just "HelloWorld.juvix"};
Expand Down Expand Up @@ -1080,7 +1083,7 @@ tests:
defaultPackage@?{name := "HelloWorld";
version := mkVersion 0 0 1;
dependencies :=
[path ".juvix-build/stdlib";
[defaultStdlib;
git "dep1" "$temp/dep" "$dep1hash"];
main := just "HelloWorld.juvix"};
EOF
Expand Down
Loading
Loading