Skip to content

Commit e324d63

Browse files
committed
Merge pull request #128 from JuliaLang/precompile
0.4 precompilation functions
2 parents 5cfb06a + 6644ba5 commit e324d63

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ Currently, the `@compat` macro supports the following syntaxes:
8080

8181
* `Timer(timeout::Real, repeat::Real=0.0)` and `Timer(cb::Function, timeout::Real, repeat::Real=0.0)` allow julia 0.4-style Timers to be constructed and used.
8282

83+
* `__precompile(iscompiled::Bool)__` and `include_dependency(path::AbstractString)` allow
84+
Julia 0.4 precompilation information to be provided (with no effect in earlier versions).
85+
(However, to enable precompiling in 0.4, it is better to explicitly put `VERSION >= v"0.4.0-dev+6521" && __precompile__()` before your `module` statement, so that Julia knows to precompile before anything in your module is evaluated.)
86+
8387
## Renamed functions
8488

8589
* `itrunc`, `iround`, `iceil`, `ifloor` are now accessed via `trunc(T, x)`, etc. [#9133](https://github.com/JuliaLang/julia/pull/9133)

src/Compat.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,4 +533,14 @@ if VERSION < v"0.4.0-dev+5697"
533533
export Mmap
534534
end
535535

536+
if VERSION < v"0.4.0-dev+6521"
537+
__precompile__(::Bool) = nothing
538+
export __precompile__
539+
end
540+
541+
if VERSION < v"0.4.0-dev+6506"
542+
include_dependency(::AbstractString) = nothing
543+
export include_dependency
544+
end
545+
536546
end # module

test/runtests.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,3 +409,6 @@ Compat.@irrational mathconst_one 1.0 big(1.)
409409
@compat utf8(Mmap.mmap(@__FILE__(),Vector{Uint8},11,1)) == "sing Compat"
410410

411411
@test base64encode("hello world") == "aGVsbG8gd29ybGQ="
412+
413+
@test nothing === __precompile__(false) # tests should never be precompiled
414+
@test nothing === include_dependency("foo")

0 commit comments

Comments
 (0)