diff --git a/src/JET.jl b/src/JET.jl index a02515894..3352232f4 100644 --- a/src/JET.jl +++ b/src/JET.jl @@ -6,6 +6,19 @@ const JET_DEV_MODE = Preferences.@load_preference("JET_DEV_MODE", false) const JET_LOADABLE = JET_DEV_MODE || (get(VERSION.prerelease, 1, "") != "DEV") +# exports +# ======= + +export + # jetanalyzer + @report_call, report_call, @test_call, test_call, + report_file, test_file, report_package, test_package, report_text, reportkey, test_text, + watch_file, + # optanalyzer + @report_opt, report_opt, @test_opt, test_opt, + # configurations + LastFrameModule, AnyFrameModule + # Pre-release Julia versions are not supported, and we don't expect JET to even # precompile in pre-release versions. So, instead of having JET fail to precompile, we # simply make JET an empty module so that failure is delayed until the first time JET is @@ -21,6 +34,7 @@ else If you want to load JET on a nightly version, set the `JET_DEV_MODE` Preferences.jl configuration to `true` and reload it. """ + include("JETEmpty.jl") end end # module diff --git a/src/JETBase.jl b/src/JETBase.jl index 1dbebd9a1..26f10984f 100644 --- a/src/JETBase.jl +++ b/src/JETBase.jl @@ -1,16 +1,3 @@ -# exports -# ======= - -export - # jetanalyzer - @report_call, report_call, @test_call, test_call, - report_file, test_file, report_package, test_package, report_text, reportkey, test_text, - watch_file, - # optanalyzer - @report_opt, report_opt, @test_opt, test_opt, - # configurations - LastFrameModule, AnyFrameModule - let README = normpath(dirname(@__DIR__), "README.md") s = read(README, String) s = replace(s, diff --git a/src/JETEmpty.jl b/src/JETEmpty.jl new file mode 100644 index 000000000..4ee1a4481 --- /dev/null +++ b/src/JETEmpty.jl @@ -0,0 +1,37 @@ +# Empty stubs for the exported functions/macros of JET.jl, to provide a more informative +# error message when JET.jl is used with a pre-release version of Julia. + +const err_msg = strip(""" + JET.jl does not guarantee compatibility with pre-release versions of Julia and + is not be loaded on this versions by default. + Julia VERSION = $VERSION + We recommend using a stable version of Julia in order to use JET.jl. + Or to try JET with this pre-release Julia version use Preferences.jl to enable + `JET_DEV_MODE`, and then reload JET. For example create a file named + `LocalPreferences.toml` which contains the line: + JET_DEV_MODE = true + Note that JET.jl may not function properly with a pre-release versions of Julia + even with `JET_DEV_MODE` enabled. + """) + +for exported_func in ( + :report_call, :test_call, + :report_file, :test_file, :report_package, :test_package, :report_text, :reportkey, :test_text, + :watch_file, + # optanalyzer + :report_opt, :test_opt, + # configurations + :LastFrameModule, :AnyFrameModule +) + @eval $exported_func(args...; kws...) = error($err_msg) +end +for exported_macro in ( + :report_call, :test_call, + :report_opt, :test_opt +) + @eval begin + macro $exported_macro(args...) + error($err_msg) + end + end +end