-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle shared dependencies being required by server dependencies (#80)
* Create test projects and packages to test the fix * Tests * Local CI run * Re-encode files * Create test snapshots * Packaged projects: Use LF encoding * Fix server-to-shared tests(?) * Activate the dependency using it's origin realm rather than it's request realm * Modify resolution behavior When activating a dependency, always use the origin realm (i.e. inherited realm from state) instead of it's declared realm * rustfmt fixes * Update snap files to accept full lockfiles --------- Co-authored-by: magnalite <jonny@uplift.games>
- Loading branch information
Showing
22 changed files
with
235 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/snapshots/libwally__resolution__tests__server_to_shared_and_shared_to_shared.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
source: src/resolution.rs | ||
expression: resolve | ||
|
||
--- | ||
activated: | ||
- biff/root@1.0.0 | ||
- biff/server@1.0.0 | ||
- biff/shared@1.0.0 | ||
metadata: | ||
biff/root@1.0.0: | ||
realm: shared | ||
origin_realm: shared | ||
source_registry: DefaultRegistry | ||
biff/server@1.0.0: | ||
realm: server | ||
origin_realm: server | ||
source_registry: DefaultRegistry | ||
biff/shared@1.0.0: | ||
realm: shared | ||
origin_realm: shared | ||
source_registry: DefaultRegistry | ||
shared_dependencies: | ||
biff/root@1.0.0: | ||
Shared: biff/shared@1.0.0 | ||
biff/server@1.0.0: | ||
Shared: biff/shared@1.0.0 | ||
server_dependencies: | ||
biff/root@1.0.0: | ||
Server: biff/server@1.0.0 | ||
dev_dependencies: {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "cross-realm-dependency", | ||
"tree": { | ||
"$path": "src" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
local sdos = require(script.Parent.sdos) | ||
|
||
return function() | ||
print("howdy") | ||
sdos() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[package] | ||
name = "biff/cross-realm-dependency" | ||
version = "0.1.0" | ||
license = "MIT" | ||
realm = "shared" | ||
registry = "test-registries/primary-registry" | ||
|
||
[place] | ||
shared-packages = "game.ReplicatedStorage.Packages" | ||
|
||
[server-dependencies] | ||
sdos = "biff/server-depends-on-shared@0.1.0" |
6 changes: 6 additions & 0 deletions
6
test-projects/cross-realm-explicit-dependency/default.project.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "cross-realm-explicit-dependency", | ||
"tree": { | ||
"$path": "src" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
local Minimal = require(script.Parent.Minimal) | ||
local sdos = require(script.Parent.sdos) | ||
|
||
return function() | ||
print(Minimal) | ||
sdos() | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "biff/cross-realm-explicit-dependency" | ||
version = "0.1.0" | ||
license = "MIT" | ||
realm = "shared" | ||
registry = "test-registries/primary-registry" | ||
|
||
[place] | ||
shared-packages = "game.ReplicatedStorage.Packages" | ||
|
||
[dependencies] | ||
Minimal = "biff/minimal-shared@0.1.0" | ||
|
||
[server-dependencies] | ||
sdos = "biff/server-depends-on-shared@0.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "minimal-shared", | ||
"tree": { | ||
"$path": "src" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
return "hey" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[package] | ||
name = "biff/minimal-shared" | ||
version = "0.1.0" | ||
license = "MIT" | ||
realm = "shared" | ||
registry = "test-registries/primary-registry" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "server-depends-on-shared", | ||
"tree": { | ||
"$path": "src" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
local Minimal = require(script.Parent.Minimal) | ||
|
||
return function() | ||
print(Minimal) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "biff/server-depends-on-shared" | ||
version = "0.1.0" | ||
license = "MIT" | ||
realm = "server" | ||
registry = "test-registries/primary-registry" | ||
|
||
[dependencies] | ||
Minimal = "biff/minimal-shared@0.1.0" |
Binary file added
BIN
+604 Bytes
test-registries/primary-registry/contents/biff/minimal-shared/0.1.0.zip
Binary file not shown.
Binary file added
BIN
+700 Bytes
test-registries/primary-registry/contents/biff/server-depends-on-shared/0.1.0.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"package":{"name":"biff/minimal-shared","version":"0.1.0","registry":"https://github.com/UpliftGames/wally-test-index","realm":"shared","description":null,"license":"MIT","authors":[],"include":[],"exclude":[]},"place":{"shared-packages":null,"server-packages":null},"dependencies":{},"server-dependencies":{},"dev-dependencies":{}} |
1 change: 1 addition & 0 deletions
1
test-registries/primary-registry/index/biff/server-depends-on-shared
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"package":{"name":"biff/server-depends-on-shared","version":"0.1.0","registry":"https://github.com/UpliftGames/wally-test-index","realm":"server","description":null,"license":"MIT","authors":[],"include":[],"exclude":[]},"place":{"shared-packages":null,"server-packages":null},"dependencies":{"Minimal":"biff/minimal-shared@>=0.1.0, <0.2.0"},"server-dependencies":{},"dev-dependencies":{}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
tests/integration/snapshots/integration__install__cross_realm_dependency.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
source: tests/integration/install.rs | ||
expression: result | ||
|
||
--- | ||
ServerPackages: | ||
_Index: | ||
biff_minimal-shared@0.1.0: | ||
minimal-shared: | ||
default.project.json: "{\n \"name\": \"minimal-shared\",\n \"tree\": {\n \"$path\": \"src\"\n }\n}" | ||
src: | ||
init.lua: "return \"hey\"" | ||
wally.toml: "[package]\nname = \"biff/minimal-shared\"\nversion = \"0.1.0\"\nlicense = \"MIT\"\nrealm = \"shared\"\nregistry = \"test-registries/primary-registry\"\n" | ||
biff_server-depends-on-shared@0.1.0: | ||
Minimal.lua: "return require(script.Parent.Parent[\"biff_minimal-shared@0.1.0\"][\"minimal-shared\"])\n" | ||
server-depends-on-shared: | ||
default.project.json: "{\n \"name\": \"server-depends-on-shared\",\n \"tree\": {\n \"$path\": \"src\"\n }\n}" | ||
src: | ||
init.lua: "local Minimal = require(script.Parent.Minimal)\n\nreturn function()\n\tprint(Minimal)\nend" | ||
wally.toml: "[package]\nname = \"biff/server-depends-on-shared\"\nversion = \"0.1.0\"\nlicense = \"MIT\"\nrealm = \"server\"\nregistry = \"test-registries/primary-registry\"\n\n[dependencies]\nMinimal = \"biff/minimal-shared@0.1.0\"\n" | ||
sdos.lua: "return require(script.Parent._Index[\"biff_server-depends-on-shared@0.1.0\"][\"server-depends-on-shared\"])\n" | ||
default.project.json: "{\n\t\"name\": \"cross-realm-dependency\",\n\t\"tree\": {\n\t\t\"$path\": \"src\"\n\t}\n}" | ||
src: | ||
init.lua: "local sdos = require(script.Parent.sdos)\n\nreturn function()\n\tprint(\"howdy\")\n\tsdos()\nend\n" | ||
wally.lock: "# This file is automatically @generated by Wally.\n# It is not intended for manual editing.\nregistry = \"test\"\n\n[[package]]\nname = \"biff/cross-realm-dependency\"\nversion = \"0.1.0\"\ndependencies = [[\"sdos\", \"biff/server-depends-on-shared@0.1.0\"]]\n\n[[package]]\nname = \"biff/minimal-shared\"\nversion = \"0.1.0\"\ndependencies = []\n\n[[package]]\nname = \"biff/server-depends-on-shared\"\nversion = \"0.1.0\"\ndependencies = [[\"Minimal\", \"biff/minimal-shared@0.1.0\"]]\n" | ||
wally.toml: "[package]\nname = \"biff/cross-realm-dependency\"\nversion = \"0.1.0\"\nlicense = \"MIT\"\nrealm = \"shared\"\nregistry = \"test-registries/primary-registry\"\n\n[place]\nshared-packages = \"game.ReplicatedStorage.Packages\"\n\n[server-dependencies]\nsdos = \"biff/server-depends-on-shared@0.1.0\"\n" | ||
|
30 changes: 30 additions & 0 deletions
30
tests/integration/snapshots/integration__install__cross_realm_explicit_dependency.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
source: tests/integration/install.rs | ||
expression: result | ||
|
||
--- | ||
Packages: | ||
Minimal.lua: "return require(script.Parent._Index[\"biff_minimal-shared@0.1.0\"][\"minimal-shared\"])\n" | ||
_Index: | ||
biff_minimal-shared@0.1.0: | ||
minimal-shared: | ||
default.project.json: "{\n \"name\": \"minimal-shared\",\n \"tree\": {\n \"$path\": \"src\"\n }\n}" | ||
src: | ||
init.lua: "return \"hey\"" | ||
wally.toml: "[package]\nname = \"biff/minimal-shared\"\nversion = \"0.1.0\"\nlicense = \"MIT\"\nrealm = \"shared\"\nregistry = \"test-registries/primary-registry\"\n" | ||
ServerPackages: | ||
_Index: | ||
biff_server-depends-on-shared@0.1.0: | ||
Minimal.lua: "return require(game.ReplicatedStorage.Packages._Index[\"biff_minimal-shared@0.1.0\"][\"minimal-shared\"])\n" | ||
server-depends-on-shared: | ||
default.project.json: "{\n \"name\": \"server-depends-on-shared\",\n \"tree\": {\n \"$path\": \"src\"\n }\n}" | ||
src: | ||
init.lua: "local Minimal = require(script.Parent.Minimal)\n\nreturn function()\n\tprint(Minimal)\nend" | ||
wally.toml: "[package]\nname = \"biff/server-depends-on-shared\"\nversion = \"0.1.0\"\nlicense = \"MIT\"\nrealm = \"server\"\nregistry = \"test-registries/primary-registry\"\n\n[dependencies]\nMinimal = \"biff/minimal-shared@0.1.0\"\n" | ||
sdos.lua: "return require(script.Parent._Index[\"biff_server-depends-on-shared@0.1.0\"][\"server-depends-on-shared\"])\n" | ||
default.project.json: "{\n\t\"name\": \"cross-realm-explicit-dependency\",\n\t\"tree\": {\n\t\t\"$path\": \"src\"\n\t}\n}" | ||
src: | ||
init.lua: "local Minimal = require(script.Parent.Minimal)\nlocal sdos = require(script.Parent.sdos)\n\nreturn function()\n\tprint(Minimal)\n\tsdos()\nend" | ||
wally.lock: "# This file is automatically @generated by Wally.\n# It is not intended for manual editing.\nregistry = \"test\"\n\n[[package]]\nname = \"biff/cross-realm-explicit-dependency\"\nversion = \"0.1.0\"\ndependencies = [[\"Minimal\", \"biff/minimal-shared@0.1.0\"], [\"sdos\", \"biff/server-depends-on-shared@0.1.0\"]]\n\n[[package]]\nname = \"biff/minimal-shared\"\nversion = \"0.1.0\"\ndependencies = []\n\n[[package]]\nname = \"biff/server-depends-on-shared\"\nversion = \"0.1.0\"\ndependencies = [[\"Minimal\", \"biff/minimal-shared@0.1.0\"]]\n" | ||
wally.toml: "[package]\nname = \"biff/cross-realm-explicit-dependency\"\nversion = \"0.1.0\"\nlicense = \"MIT\"\nrealm = \"shared\"\nregistry = \"test-registries/primary-registry\"\n\n[place]\nshared-packages = \"game.ReplicatedStorage.Packages\"\n\n[dependencies]\nMinimal = \"biff/minimal-shared@0.1.0\"\n\n[server-dependencies]\nsdos = \"biff/server-depends-on-shared@0.1.0\"\n" | ||
|