Skip to content
Open
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
42 changes: 42 additions & 0 deletions tests/pkg/assets/install2/gold/test.gold
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// No package installed yet.
==================
exec main.toit

STDERR---
<[*WORKING-DIR*]>/package.lock:6:10: error: Package 'http://localhost:<[*PORT*]>/pkg/pkg1-1.0.0' not found
url: 'http://localhost:<[*PORT*]>/pkg/pkg1'
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.toit:5:8: error: Package 'pkg1' for prefix 'pkg1' not found
import pkg1
^~~~
main.toit:8:14: error: Unresolved identifier: 'identify'
print pkg1.identify
^~~~~~~~
Compilation failed
Exit Code: 1
==================
// Just 'install' doesn't add the missing dependencies.
==================
OK
[pkg, install]
==================
== package.lock
prefixes:
pkg1: pkg1

packages:
pkg1:
url: 'http://localhost:<[*PORT*]>/pkg/pkg1'
version: 1.0.0
hash: <[*HASH*]>
==================
// With '--recompute' we get the missing dependencies.
==================
OK
[pkg, install, --recompute]
==================
// Should work now.
==================
exec main.toit
pkg1-1.0.0pkg2-2.4.2pkg3-3.1.2
Exit Code: 0
8 changes: 8 additions & 0 deletions tests/pkg/assets/install2/main.toit
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// 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 pkg1

main:
print pkg1.identify
8 changes: 8 additions & 0 deletions tests/pkg/assets/install2/package.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
prefixes:
pkg1: pkg1

packages:
pkg1:
url: 'http://localhost:<[*PORT*]>/pkg/pkg1'
version: 1.0.0
hash: deadbeef1234567890abcdef1234567890abcdef
4 changes: 4 additions & 0 deletions tests/pkg/assets/install2/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dependencies:
pkg1:
url: http://localhost:<[*PORT*]>/pkg/pkg1
version: ^1.0.0
21 changes: 21 additions & 0 deletions tests/pkg/install2-gold-test.toit
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 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 "test" [
["// No package installed yet."],
["exec", "main.toit"],
["// Just 'install' doesn't add the missing dependencies."],
["pkg", "install"],
["package.lock"],
["// With '--recompute' we get the missing dependencies."],
["pkg", "install", "--recompute"],
["// Should work now."],
["exec", "main.toit"],
]
5 changes: 4 additions & 1 deletion tools/pkg/commands/install.toit
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ class InstallCommand extends PkgProjectCommand:

execute:
if not package:
project.install
if recompute:
project.install --recompute=recompute --registries=registries
else:
project.install
else if not local:
execute-remote
else:
Expand Down
7 changes: 6 additions & 1 deletion tools/pkg/project/project.toit
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,12 @@ class Project:
solve_ --update-everything --registries=registries
save

install -> none:
install --recompute/True --registries/Registries -> none:
solve_ --no-update-everything --registries=registries
save
lock-file.install

install --recompute/bool=false -> none:
lock-file.install

clean -> none:
Expand Down
Loading