Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
918beb2
Add list-registry-test.
floitsch May 30, 2025
03bc065
Fix.
floitsch May 30, 2025
e25a496
Sort packages.
floitsch May 30, 2025
0632231
Merge branch 'master' into floitsch/pkg.20
floitsch Jun 2, 2025
b8c9674
Merge branch 'master' into floitsch/pkg.20
floitsch Jun 14, 2025
0118aa0
merge master.
floitsch Jun 14, 2025
5d55fa1
A few more renames from toit.pkg to 'toit pkg'.
floitsch Jun 14, 2025
8355910
Merge branch 'floitsch/pkg.10-merge_toit.go-pkg' into floitsch/pkg.20
floitsch Jun 14, 2025
7ba8a79
Add another pkg test.
floitsch Jun 14, 2025
512c993
Add search test.
floitsch Jun 15, 2025
e8cbe47
Replace '\' by '/' in normalized gold output.
floitsch Jun 15, 2025
d4e739d
Merge branch 'floitsch/pkg.30' into floitsch/pkg.40
floitsch Jun 15, 2025
2d7c67c
WIP.
floitsch Jun 15, 2025
bb9fa73
WIP.
floitsch Jun 15, 2025
6498f58
Update gold.
floitsch Jun 15, 2025
1d8cdc4
Merge branch 'floitsch/pkg.30' into floitsch/pkg.40
floitsch Jun 15, 2025
fbc998a
Merge branch 'floitsch/pkg.40' into floitsch/pkg.50
floitsch Jun 15, 2025
2111f80
Merge branch 'master' into floitsch/pkg.10-merge_toit.go-pkg
floitsch Jun 17, 2025
54c05af
Merge branch 'floitsch/pkg.10-merge_toit.go-pkg' into floitsch/pkg.20
floitsch Jun 17, 2025
b213811
Merge branch 'floitsch/pkg.20' into floitsch/pkg.30
floitsch Jun 17, 2025
519a024
Merge branch 'floitsch/pkg.30' into floitsch/pkg.40
floitsch Jun 17, 2025
1ebcc39
Merge branch 'floitsch/pkg.40' into floitsch/pkg.50
floitsch Jun 17, 2025
71d46a3
Update gold.
floitsch Jun 18, 2025
4d73d33
Merge branch 'floitsch/pkg.30' into floitsch/pkg.40
floitsch Jun 18, 2025
3e92c4d
Merge branch 'floitsch/pkg.40' into floitsch/pkg.50
floitsch Jun 18, 2025
79b185e
Update gold.
floitsch Jun 18, 2025
af8a9a2
Better normalization.
floitsch Jun 18, 2025
de5d5b7
Merge branch 'floitsch/pkg.30' into floitsch/pkg.40
floitsch Jun 18, 2025
1a93e79
Merge branch 'floitsch/pkg.40' into floitsch/pkg.50
floitsch Jun 18, 2025
cb6bc2b
Better normalize.
floitsch Jun 21, 2025
93a458e
Merge branch 'floitsch/pkg.30' into floitsch/pkg.40
floitsch Jun 21, 2025
5ee9e9b
Merge branch 'floitsch/pkg.40' into floitsch/pkg.50
floitsch Jun 21, 2025
08dbdbb
Make more robust.
floitsch Jun 21, 2025
0ded73c
Merge branch 'floitsch/pkg.30' into floitsch/pkg.40
floitsch Jun 21, 2025
bd51e9a
Merge branch 'floitsch/pkg.40' into floitsch/pkg.50
floitsch Jun 21, 2025
2aac1ed
Fix search, so it includes name.
floitsch Jun 21, 2025
85de177
More normalization.
floitsch Jun 22, 2025
f02f673
Merge branch 'floitsch/pkg.30' into floitsch/pkg.40
floitsch Jun 22, 2025
3ca975e
Merge branch 'floitsch/pkg.40' into floitsch/pkg.50
floitsch Jun 22, 2025
8133bd5
Update test.
floitsch Jun 22, 2025
d276040
Escape package paths.
floitsch Jun 28, 2025
da6facc
Add info output when installing a package.
floitsch Jun 28, 2025
440a445
Test is passing now.
floitsch Jun 28, 2025
f8e3da0
Merge branch 'floitsch/pkg.50' into floitsch/pkg.60
floitsch Jun 28, 2025
40fc324
Remove go code.
floitsch Jul 22, 2025
b8b8704
Merge branch 'floitsch/pkg.40' into floitsch/pkg.50
floitsch Jul 22, 2025
264da78
Merge branch 'floitsch/pkg.50' into floitsch/pkg.60
floitsch Jul 22, 2025
234a6de
Write README.md
floitsch Jul 22, 2025
ccbd12f
Merge branch 'floitsch/pkg.50' into floitsch/pkg.60
floitsch Jul 22, 2025
63543de
fix.
floitsch Jul 22, 2025
102dc9b
Merge branch 'floitsch/pkg.50' into floitsch/pkg.60
floitsch Jul 22, 2025
18e9090
Merge branch 'master' into floitsch/pkg.20
floitsch Jul 24, 2025
24e0a89
Merge branch 'floitsch/pkg.20' into floitsch/pkg.30
floitsch Jul 24, 2025
6b264d7
Merge branch 'floitsch/pkg.30' into floitsch/pkg.40
floitsch Jul 24, 2025
6437c19
Merge branch 'floitsch/pkg.40' into floitsch/pkg.50
floitsch Jul 24, 2025
faf7639
Merge branch 'floitsch/pkg.50' into floitsch/pkg.60
floitsch Jul 24, 2025
9acaed6
Also replace '\r' in actual.
floitsch Aug 4, 2025
e152f68
Merge branch 'floitsch/pkg.10' into floitsch/pkg.20
floitsch Aug 4, 2025
0c1e0f9
Merge branch 'floitsch/pkg.20' into floitsch/pkg.30
floitsch Aug 4, 2025
2f28be3
Merge branch 'floitsch/pkg.30' into floitsch/pkg.40
floitsch Aug 4, 2025
b83092d
Merge branch 'floitsch/pkg.40' into floitsch/pkg.50
floitsch Aug 4, 2025
947ee3b
Merge branch 'floitsch/pkg.50' into floitsch/pkg.60
floitsch Aug 4, 2025
fc00fa9
Merge branch 'master' into floitsch/pkg.10.gold-tester-win
floitsch Sep 27, 2025
3ee0bee
Merge branch 'floitsch/pkg.10.gold-tester-win' into floitsch/pkg.20.l…
floitsch Sep 27, 2025
834dc65
Merge branch 'floitsch/pkg.20.list-registry' into floitsch/pkg.30.bad…
floitsch Sep 27, 2025
707b51d
Merge branch 'floitsch/pkg.30.bad-registry' into floitsch/pkg.40.search
floitsch Sep 27, 2025
8bc8576
Merge branch 'floitsch/pkg.40.search' into floitsch/pkg.50.git-pkg
floitsch Sep 27, 2025
9ac4355
Merge branch 'floitsch/pkg.50.git-pkg' into floitsch/pkg.60.install-in
floitsch Sep 27, 2025
29b3726
Merge branch 'master' into floitsch/pkg.10.gold-tester-win
floitsch Oct 29, 2025
73d6646
Merge branch 'floitsch/pkg.10.gold-tester-win' into floitsch/pkg.20.l…
floitsch Oct 29, 2025
a8cbb63
Merge branch 'floitsch/pkg.20.list-registry' into floitsch/pkg.30.bad…
floitsch Oct 29, 2025
47d92ec
Merge branch 'floitsch/pkg.30.bad-registry' into floitsch/pkg.40.search
floitsch Oct 29, 2025
8d3d5af
Merge branch 'floitsch/pkg.40.search' into floitsch/pkg.50.git-pkg
floitsch Oct 29, 2025
9486994
Merge branch 'floitsch/pkg.50.git-pkg' into floitsch/pkg.60.install-in
floitsch Oct 29, 2025
abd1e43
Update pkg.
floitsch Oct 29, 2025
ff4dea1
Merge branch 'floitsch/pkg.10.gold-tester-win' into floitsch/pkg.20.l…
floitsch Oct 29, 2025
80ee0ca
Merge branch 'floitsch/pkg.20.list-registry' into floitsch/pkg.30.bad…
floitsch Oct 29, 2025
797462c
Merge branch 'floitsch/pkg.30.bad-registry' into floitsch/pkg.40.search
floitsch Oct 29, 2025
69b4268
Merge branch 'floitsch/pkg.40.search' into floitsch/pkg.50.git-pkg
floitsch Oct 29, 2025
52c8ef4
Merge branch 'floitsch/pkg.50.git-pkg' into floitsch/pkg.60.install-in
floitsch Oct 29, 2025
af4d81a
Update pkg.
floitsch Oct 29, 2025
c9bd7fd
Merge branch 'floitsch/pkg.10.gold-tester-win' into floitsch/pkg.20.l…
floitsch Oct 29, 2025
44249eb
Merge branch 'master' into floitsch/pkg.10.gold-tester-win
floitsch Nov 15, 2025
55d5940
Merge branch 'floitsch/pkg.10.gold-tester-win' into floitsch/pkg.20.l…
floitsch Nov 15, 2025
2927dd5
Merge branch 'floitsch/pkg.20.list-registry' into floitsch/pkg.30.bad…
floitsch Nov 15, 2025
0769f38
Merge branch 'floitsch/pkg.30.bad-registry' into floitsch/pkg.40.search
floitsch Nov 15, 2025
1c0a45f
Merge branch 'floitsch/pkg.40.search' into floitsch/pkg.50.git-pkg
floitsch Nov 15, 2025
72da4a0
Merge branch 'floitsch/pkg.50.git-pkg' into floitsch/pkg.60.install-in
floitsch Nov 15, 2025
6fabcb2
Remove bad code.
floitsch Nov 15, 2025
2e68f2c
Merge branch 'floitsch/pkg.20.list-registry' into floitsch/pkg.30.bad…
floitsch Nov 15, 2025
8481bd3
Merge branch 'floitsch/pkg.30.bad-registry' into floitsch/pkg.40.search
floitsch Nov 15, 2025
c937418
Merge branch 'floitsch/pkg.40.search' into floitsch/pkg.50.git-pkg
floitsch Nov 15, 2025
dbeac51
Merge branch 'floitsch/pkg.50.git-pkg' into floitsch/pkg.60.install-in
floitsch Nov 15, 2025
cab1afd
Merge branch 'master' into floitsch/pkg.10.gold-tester-win
floitsch Dec 12, 2025
a7ce21d
Merge branch 'floitsch/pkg.10.gold-tester-win' into floitsch/pkg.20.l…
floitsch Dec 12, 2025
a9a512b
Feedback.
floitsch Dec 12, 2025
d3e1303
Merge branch 'master' into floitsch/pkg.20.list-registry
floitsch Dec 12, 2025
f2537d3
Merge branch 'floitsch/pkg.20.list-registry' into floitsch/pkg.30.bad…
floitsch Dec 12, 2025
81b9986
Feedback.
floitsch Dec 12, 2025
12a5bc1
Merge branch 'master' into floitsch/pkg.30.bad-registry
floitsch Dec 12, 2025
9a7ecd1
Merge branch 'floitsch/pkg.30.bad-registry' into floitsch/pkg.40.search
floitsch Dec 12, 2025
610b50b
Merge branch 'master' into floitsch/pkg.40.search
floitsch Dec 12, 2025
c2955d1
Merge branch 'floitsch/pkg.40.search' into floitsch/pkg.50.git-pkg
floitsch Dec 12, 2025
ba31501
Merge branch 'master' into floitsch/pkg.50.git-pkg
floitsch Dec 12, 2025
bac7e55
Merge branch 'floitsch/pkg.50.git-pkg' into floitsch/pkg.60.install-in
floitsch Dec 12, 2025
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
1 change: 1 addition & 0 deletions tests/pkg/assets/git-pkg/gold/install.gold
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ OK
==================
OK
[pkg, install, pkg1]
Package '[email protected]' installed with prefix 'pkg1'.
==================
== package.lock
prefixes:
Expand Down
1 change: 1 addition & 0 deletions tests/pkg/assets/git-pkg2/gold/00-install.gold
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ OK
==================
OK
[pkg, install, pkg1]
Package '[email protected]' installed with prefix 'pkg1'.
==================
== package.lock
prefixes:
Expand Down
4 changes: 4 additions & 0 deletions tests/pkg/assets/git-pkg2/gold/10-git package search.gold
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ OK
==================
OK
[pkg, install, foo]
Package '[email protected]' installed with prefix 'foo'.
==================
OK
[pkg, install, bar]
Package '[email protected]' installed with prefix 'bar'.
==================
// Execution should succeed now
==================
Expand Down Expand Up @@ -58,9 +60,11 @@ Exit Code: 1
==================
OK
[pkg, install, --prefix=pre1, foo]
Package '[email protected]' installed with prefix 'foo'.
==================
OK
[pkg, install, --prefix=pre2, bar]
Package '[email protected]' installed with prefix 'bar'.
==================
// Execution should succeed now
==================
Expand Down
44 changes: 44 additions & 0 deletions tests/pkg/assets/install-in-package/gold/00-test.gold
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
OK
[pkg, init]
==================
OK
[pkg, registry, add, --local, test-reg, registry]
==================
OK
[pkg, install, foo]
Package '[email protected]' installed with prefix 'foo'.
==================
OK
[pkg, install, bar]
Package '[email protected]' installed with prefix 'bar'.
==================
== package.lock
sdk: ^0.1.30
prefixes:
bar: http_//localhost_<[*PORT*]>/pkg/bar-2
foo: http_//localhost_<[*PORT*]>/pkg/foo-1
packages:
http_//localhost_<[*PORT*]>/pkg/bar-2:
prefixes:
foo: http_//localhost_<[*PORT*]>/pkg/foo-1
sub: http_//localhost_<[*PORT*]>/pkg/sub-3
url: http://localhost:<[*PORT*]>/pkg/bar
version: 2.0.1
hash: <[*HASH*]>
http_//localhost_<[*PORT*]>/pkg/foo-1:
url: http://localhost:<[*PORT*]>/pkg/foo
version: 1.2.3
hash: <[*HASH*]>
http_//localhost_<[*PORT*]>/pkg/sub-3:
url: http://localhost:<[*PORT*]>/pkg/sub
version: 3.1.4
hash: <[*HASH*]>
==================
== package.yaml
dependencies:
foo:
url: http://localhost:<[*PORT*]>/pkg/foo
version: ^1.2.3
bar:
url: http://localhost:<[*PORT*]>/pkg/bar
version: ^2.0.1
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
OK
[pkg, install, --local, --prefix=pkg1, pkg2]
Package 'pkg2' installed with prefix 'pkg1'.
4 changes: 4 additions & 0 deletions tests/pkg/assets/install1/gold/install.gold
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Exit Code: 1
==================
OK
[pkg, install, --local, pkg]
Package 'pkg' installed with prefix 'pkg'.
==================
exec main.toit
hello from pkg
Expand All @@ -21,6 +22,7 @@ Exit Code: 0
==================
OK
[pkg, install, --local, --prefix=prepkg, pkg2]
Package 'pkg2' installed with prefix 'prepkg'.
==================
exec main2.toit
hello from pkg2
Expand All @@ -30,11 +32,13 @@ Exit Code: 0
==================
OK
[pkg, install, --local, pkg]
Package 'pkg' installed with prefix 'pkg'.
==================
// Installing a package where the directory name is not the package name.
==================
OK
[pkg, install, --local, pkg3]
Package 'pkg3' installed with prefix 'pkg3_modified'.
==================
exec main3.toit
hello from pkg3_modified
Expand Down
3 changes: 3 additions & 0 deletions tests/pkg/gold-tester.toit
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ class GoldTester:
else if command == "package.lock":
lock-content := file.read-contents "$working-dir_/package.lock"
outputs.add "== package.lock\n$lock-content.to-string"
else if command == "package.yaml":
yaml-content := file.read-contents "$working-dir_/package.yaml"
outputs.add "== package.yaml\n$yaml-content.to-string"
else if command == "pkg":
test-ui := TestUi --quiet=false
cli := Cli "pkg" --ui=test-ui
Expand Down
18 changes: 18 additions & 0 deletions tests/pkg/install-in-package-gold-test.toit
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (C) 2025 Toit contributors.
// Use of this source code is governed by a Zero-Clause BSD license that can
// be found in the tests/LICENSE file.

import .gold-tester

main args:
with-gold-tester --with-git-pkg-registry args: test it

test tester/GoldTester:
tester.gold "00-test" [
["pkg", "init"], // So we don't accidentally use a /tmp/package.yaml.
["pkg", "registry", "add", "--local", "test-reg", "registry"],
["pkg", "install", "foo"],
["pkg", "install", "bar"],
["package.lock"],
["package.yaml"]
]
6 changes: 5 additions & 1 deletion tools/pkg/commands/install.toit
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,12 @@ class InstallCommand extends PkgProjectCommand:
if not prefix: prefix = remote-package.name

if project.specification.has-package prefix:
error "Project already has a package with name '$prefix'."
error "Project already has a package with prefix '$prefix'."

project.install-remote prefix remote-package --registries=registries
id := "$remote-package.name@$remote-package.version"
name := remote-package.name
ui.emit --info "Package '$id' installed with prefix '$name'."

execute-local:
specification-name := "$package/$Specification.FILE-NAME"
Expand All @@ -88,6 +91,7 @@ class InstallCommand extends PkgProjectCommand:
if not prefix: prefix = specification.name

project.install-local prefix package --registries=registries
ui.emit --info "Package '$package' installed with prefix '$prefix'."

static CLI-COMMAND ::=
cli.Command "install"
Expand Down
Loading