Skip to content

Commit

Permalink
Get rid of confusing macro name
Browse files Browse the repository at this point in the history
  • Loading branch information
rikhuijzer committed Apr 30, 2022
1 parent 656a6c1 commit e1a099d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "PrecompileSignatures"
uuid = "91cefc8d-f054-46dc-8f8c-26e11d7c5411"
authors = ["Rik Huijzer <[email protected]>"]
version = "2.0.0"
version = "3.0.0"

[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,22 @@ pkg> activate Foo
(Foo) pkg> add PrecompileSignatures
```

Next, add `@precompile_module(Foo)` somewhere after your module's logic.
Next, add `@precompile_signatures(Foo)` somewhere after your module's logic.
For example:

```julia
module Foo

using PrecompileSignatures: @precompile_module
using PrecompileSignatures: @precompile_signatures

[...]

# Include generated `precompile` directives for this module.
@precompile_module(Foo)
# Generate and run `precompile` directives.
@precompile_signatures(Foo)

end # module
```

This will generate extra `precompile` directives during the precompilation phase and `include` the generated file.

## How does this package work?

This package finds precompile directives by searching for concrete types in method signatures.
Expand Down
14 changes: 7 additions & 7 deletions src/PrecompileSignatures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module PrecompileSignatures

using Documenter.Utilities: submodules

export precompile_directives, write_directives, @precompile_module
export precompile_directives, write_directives, @precompile_signatures

function _is_macro(f::Function)
text = sprint(show, MIME"text/plain"(), f)
Expand Down Expand Up @@ -241,8 +241,8 @@ function _precompile_type(@nospecialize(argt::Type))
return ret
end

"This function is called from within `@precompile_module`."
function _precompile_module(M::Module, config::Config=Config())
"This function is called from within `@precompile_signatures`."
function _precompile_signatures(M::Module, config::Config=Config())
types = precompilables(M, config)
for type in types
_precompile_type(type)
Expand All @@ -251,15 +251,15 @@ function _precompile_module(M::Module, config::Config=Config())
end

"""
@precompile_module(M)
@precompile_signatures(M)
Precompile the concrete signatures in module `M`.
"""
macro precompile_module(M::Symbol)
macro precompile_signatures(M::Symbol)
esc(quote
if ccall(:jl_generating_output, Cint, ()) == 1
try
$PrecompileSignatures._precompile_module($M)
$PrecompileSignatures._precompile_signatures($M)
catch e
msg = "Generating and including the `precompile` directives failed"
@warn msg exception=(e, catch_backtrace())
Expand All @@ -274,6 +274,6 @@ end
_test_precompiled(x::Int) = 3

# Include generated `precompile` directives for this module.
@precompile_module(PrecompileSignatures)
@precompile_signatures(PrecompileSignatures)

end # module

2 comments on commit e1a099d

@rikhuijzer
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

The name @precompile_module sounded nice but makes no sense actually from a wider context. Therefore, the name is now @precompile_signatures; which covers what it does much better

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/59426

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v3.0.0 -m "<description of version>" e1a099d4a61dbe80a282afd35eb6678b4f13cd0f
git push origin v3.0.0

Please sign in to comment.