Skip to content

WIP: Initial prototype of how to exclude code from Base #16415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ endif
@echo "const DOCDIR = \"$(docdir_rel)\"" >> $@
@echo "const LIBDIR = \"$(libdir_rel)\"" >> $@
@echo "const INCLUDEDIR = \"$(includedir_rel)\"" >> $@
ifeq ($(NODATES), 1)
@echo "const NODATES = true" >> $@
else
@echo "const NODATES = false" >> $@
endif

@# This to ensure that we always rebuild this file, but only when it is modified do we touch build_h.jl,
@# ensuring we rebuild the system image as infrequently as possible
Expand Down
22 changes: 22 additions & 0 deletions base/excluded.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

module Excluded

macro exclude(typexpr)
f = typexpr.args[2]
if typexpr.head == :type
return quote
export $f
type $f
$(f)() = throw(ArgumentError("`$($f)` has been excluded in this build"))
end
end
end
end

export Dates
module Dates end
@exclude type Date end
@exclude type DateTime end

end # module
9 changes: 7 additions & 2 deletions base/sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ Array{T}(::Type{T}, m::Integer) = Array{T,1}(Int(m))
Array{T}(::Type{T}, m::Integer,n::Integer) = Array{T,2}(Int(m),Int(n))
Array{T}(::Type{T}, m::Integer,n::Integer,o::Integer) = Array{T,3}(Int(m),Int(n),Int(o))

include("excluded.jl")
using .Excluded

# numeric operations
include("hashing.jl")
include("rounding.jl")
Expand Down Expand Up @@ -323,8 +326,10 @@ include("profile.jl")
importall .Profile

# dates
include("Dates.jl")
import .Dates: Date, DateTime, now
if !NODATES
include("Dates.jl")
import .Dates: Date, DateTime, now
end

# sparse matrices, vectors, and sparse linear algebra
include("sparse.jl")
Expand Down