-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for "glue packages" to code loading
This allows packages to define "glue packages" which are modules that are automatically loaded when a set of other packages are loaded into the Julia session.
- Loading branch information
1 parent
726bbd7
commit aee0af8
Showing
16 changed files
with
458 additions
and
26 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,3 @@ | ||
name = "GlueDep" | ||
uuid = "fa069be4-f60b-4d4c-8b95-f8008775090c" | ||
version = "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,5 @@ | ||
module GlueDep | ||
|
||
struct GlueDepStruct end | ||
|
||
end # module GlueDep |
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,3 @@ | ||
name = "GlueDep2" | ||
uuid = "55982ee5-2ad5-4c40-8cfe-5e9e1b01500d" | ||
version = "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,5 @@ | ||
module GlueDep2 | ||
|
||
greet() = print("Hello World!") | ||
|
||
end # module GlueDep2 |
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,25 @@ | ||
# This file is machine-generated - editing it directly is not advised | ||
|
||
julia_version = "1.10.0-DEV" | ||
manifest_format = "2.0" | ||
project_hash = "7cbe1857ecc6692a8cc8be428a5ad5073531ff98" | ||
|
||
[[deps.GlueDep]] | ||
path = "../GlueDep.jl" | ||
uuid = "fa069be4-f60b-4d4c-8b95-f8008775090c" | ||
version = "0.1.0" | ||
|
||
[[deps.GlueDep2]] | ||
path = "../GlueDep2" | ||
uuid = "55982ee5-2ad5-4c40-8cfe-5e9e1b01500d" | ||
version = "0.1.0" | ||
|
||
[[deps.HasGluePkgs]] | ||
gluedeps = ["GlueDep", "GlueDep2"] | ||
path = "../HasGluePkgs.jl" | ||
uuid = "4d3288b3-3afc-4bb6-85f3-489fffe514c8" | ||
version = "0.1.0" | ||
|
||
[deps.HasGluePkgs.gluepkgs] | ||
GluePkg = "GlueDep" | ||
GluePkgFolder = ["GlueDep", "GlueDep2"] |
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,8 @@ | ||
name = "HasDepWithGluePkgs" | ||
uuid = "d4ef3d4a-8e22-4710-85d8-c6cf2eb9efca" | ||
version = "0.1.0" | ||
|
||
[deps] | ||
GlueDep = "fa069be4-f60b-4d4c-8b95-f8008775090c" | ||
GlueDep2 = "55982ee5-2ad5-4c40-8cfe-5e9e1b01500d" | ||
HasGluePkgs = "4d3288b3-3afc-4bb6-85f3-489fffe514c8" |
13 changes: 13 additions & 0 deletions
13
test/project/GluePkgs/HasDepWithGluePkgs.jl/src/HasDepWithGluePkgs.jl
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,13 @@ | ||
module HasDepWithGluePkgs | ||
|
||
using HasGluePkgs: HasGluePkgs, HasGluePkgsStruct | ||
using GlueDep: GlueDepStruct | ||
# Loading GlueDep makes the glue module "GluePkg" load | ||
|
||
function do_something() | ||
HasGluePkgs.foo(HasGluePkgsStruct()) == 1 || error() | ||
HasGluePkgs.foo(GlueDepStruct()) == 2 || error() | ||
return true | ||
end | ||
|
||
end # module |
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 @@ | ||
# This file is machine-generated - editing it directly is not advised | ||
|
||
julia_version = "1.10.0-DEV" | ||
manifest_format = "2.0" | ||
project_hash = "c87947f1f1f070eea848950c304d668a112dec3d" | ||
|
||
[deps] |
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,11 @@ | ||
name = "HasGluePkgs" | ||
uuid = "4d3288b3-3afc-4bb6-85f3-489fffe514c8" | ||
version = "0.1.0" | ||
|
||
[gluedeps] | ||
GlueDep = "fa069be4-f60b-4d4c-8b95-f8008775090c" | ||
GlueDep2 = "55982ee5-2ad5-4c40-8cfe-5e9e1b01500d" | ||
|
||
[gluepkgs] | ||
GluePkg = "GlueDep" | ||
GluePkgFolder = ["GlueDep", "GlueDep2"] |
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,11 @@ | ||
module GluePkg | ||
|
||
using HasGluePkgs, GlueDep | ||
|
||
HasGluePkgs.foo(::GlueDep.GlueDepStruct) = 2 | ||
|
||
function __init__() | ||
HasGluePkgs.glue_loaded = true | ||
end | ||
|
||
end |
9 changes: 9 additions & 0 deletions
9
test/project/GluePkgs/HasGluePkgs.jl/glue/GluePkgFolder/GluePkgFolder.jl
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 @@ | ||
module GluePkgFolder | ||
|
||
using GlueDep, GlueDep2, HasGluePkgs | ||
|
||
function __init__() | ||
HasGluePkgs.glue_folder_loaded = true | ||
end | ||
|
||
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,10 @@ | ||
module HasGluePkgs | ||
|
||
struct HasGluePkgsStruct end | ||
|
||
foo(::HasGluePkgsStruct) = 1 | ||
|
||
glue_loaded = false | ||
glue_folder_loaded = false | ||
|
||
end # module |