-
-
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 "package extensions" to code loading (#47695)
* 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. (cherry picked from commit 495a004)
- Loading branch information
1 parent
cfbb86a
commit 93587d7
Showing
16 changed files
with
406 additions
and
23 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 = "ExtDep" | ||
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 ExtDep | ||
|
||
struct ExtDepStruct end | ||
|
||
end # module ExtDep |
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 = "ExtDep2" | ||
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 ExtDep2 | ||
|
||
greet() = print("Hello World!") | ||
|
||
end # module ExtDep2 |
25 changes: 25 additions & 0 deletions
25
test/project/Extensions/HasDepWithExtensions.jl/Manifest.toml
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.ExtDep]] | ||
path = "../ExtDep.jl" | ||
uuid = "fa069be4-f60b-4d4c-8b95-f8008775090c" | ||
version = "0.1.0" | ||
|
||
[[deps.ExtDep2]] | ||
path = "../ExtDep2" | ||
uuid = "55982ee5-2ad5-4c40-8cfe-5e9e1b01500d" | ||
version = "0.1.0" | ||
|
||
[[deps.HasExtensions]] | ||
weakdeps = ["ExtDep", "ExtDep2"] | ||
path = "../HasExtensions.jl" | ||
uuid = "4d3288b3-3afc-4bb6-85f3-489fffe514c8" | ||
version = "0.1.0" | ||
|
||
[deps.HasExtensions.extensions] | ||
Extension = "ExtDep" | ||
ExtensionFolder = ["ExtDep", "ExtDep2"] |
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 = "HasDepWithExtensions" | ||
uuid = "d4ef3d4a-8e22-4710-85d8-c6cf2eb9efca" | ||
version = "0.1.0" | ||
|
||
[deps] | ||
ExtDep = "fa069be4-f60b-4d4c-8b95-f8008775090c" | ||
ExtDep2 = "55982ee5-2ad5-4c40-8cfe-5e9e1b01500d" | ||
HasExtensions = "4d3288b3-3afc-4bb6-85f3-489fffe514c8" |
13 changes: 13 additions & 0 deletions
13
test/project/Extensions/HasDepWithExtensions.jl/src/HasDepWithExtensions.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 HasDepWithExtensions | ||
|
||
using HasExtensions: HasExtensions, HasExtensionsStruct | ||
using ExtDep: ExtDepStruct | ||
# Loading ExtDep makes the extension "Extension" load | ||
|
||
function do_something() | ||
HasExtensions.foo(HasExtensionsStruct()) == 1 || error() | ||
HasExtensions.foo(ExtDepStruct()) == 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 = "HasExtensions" | ||
uuid = "4d3288b3-3afc-4bb6-85f3-489fffe514c8" | ||
version = "0.1.0" | ||
|
||
[weakdeps] | ||
ExtDep = "fa069be4-f60b-4d4c-8b95-f8008775090c" | ||
ExtDep2 = "55982ee5-2ad5-4c40-8cfe-5e9e1b01500d" | ||
|
||
[extensions] | ||
Extension = "ExtDep" | ||
ExtensionFolder = ["ExtDep", "ExtDep2"] |
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 Extension | ||
|
||
using HasExtensions, ExtDep | ||
|
||
HasExtensions.foo(::ExtDep.ExtDepStruct) = 2 | ||
|
||
function __init__() | ||
HasExtensions.ext_loaded = true | ||
end | ||
|
||
const extvar = 1 | ||
|
||
end |
9 changes: 9 additions & 0 deletions
9
test/project/Extensions/HasExtensions.jl/ext/ExtensionFolder/ExtensionFolder.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 ExtensionFolder | ||
|
||
using ExtDep, ExtDep2, HasExtensions | ||
|
||
function __init__() | ||
HasExtensions.ext_folder_loaded = true | ||
end | ||
|
||
end |
10 changes: 10 additions & 0 deletions
10
test/project/Extensions/HasExtensions.jl/src/HasExtensions.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,10 @@ | ||
module HasExtensions | ||
|
||
struct HasExtensionsStruct end | ||
|
||
foo(::HasExtensionsStruct) = 1 | ||
|
||
ext_loaded = false | ||
ext_folder_loaded = false | ||
|
||
end # module |