From 840b7791a7d5adff00beb97a2bc894aecffc5c74 Mon Sep 17 00:00:00 2001 From: d-monnet Date: Fri, 3 Nov 2023 12:20:43 -0400 Subject: [PATCH] Makes TikzPictures.jl a requirement for using export_performance_profile_tikz --- Project.toml | 4 ++-- src/BenchmarkProfiles.jl | 5 ++++- src/requires.jl | 4 ++++ src/tikz_export.jl | 6 +----- test/runtests.jl | 8 ++++---- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Project.toml b/Project.toml index 7bbeea7..c46bcb7 100644 --- a/Project.toml +++ b/Project.toml @@ -17,14 +17,14 @@ LaTeXStrings = "^1.3" NaNMath = "0.3, 1" Requires = "1" Tables = "1.11" -TikzPictures = "3.5" julia = "^1.6" [extras] PGFPlotsX = "8314cec4-20b6-5062-9cdb-752b83310925" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +TikzPictures = "37f6aa50-8035-52d0-81c2-5a1d08754b2d" UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228" [targets] -test = ["PGFPlotsX", "Plots", "Test", "UnicodePlots"] +test = ["PGFPlotsX", "Plots", "Test", "TikzPictures", "UnicodePlots"] diff --git a/src/BenchmarkProfiles.jl b/src/BenchmarkProfiles.jl index a95d7ab..8f26454 100644 --- a/src/BenchmarkProfiles.jl +++ b/src/BenchmarkProfiles.jl @@ -29,9 +29,12 @@ for backend ∈ bp_backends end end +@eval begin + export_performance_profile_tikz(args...;kwargs...) = error("Please load TikzPictures.jl package to access this function.") +end + include("performance_profiles.jl") include("data_profiles.jl") -include("tikz_export.jl") """ Replace each number by 2^{number} in a string. diff --git a/src/requires.jl b/src/requires.jl index ea1627a..490aaca 100644 --- a/src/requires.jl +++ b/src/requires.jl @@ -181,4 +181,8 @@ function __init__() return profile end end + + @require TikzPictures = "37f6aa50-8035-52d0-81c2-5a1d08754b2d" begin + include("tikz_export.jl") + end end diff --git a/src/tikz_export.jl b/src/tikz_export.jl index a1ff5a7..134621e 100644 --- a/src/tikz_export.jl +++ b/src/tikz_export.jl @@ -1,11 +1,7 @@ -using TikzPictures - -export export_performance_profile_tikz - """ function export_performance_profile_tikz(T, filename; kwargs...) -Export tikz figure of the performance profiles given by `T` in `filename`. +Export tikz-generated figure of the performance profiles given by `T` in `filename`. ## Arguments diff --git a/test/runtests.jl b/test/runtests.jl index 4de1937..4b5a5d4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -77,16 +77,16 @@ if !Sys.isfreebsd() # GR_jll not available, so Plots won't install @testset "tikz export" begin T = 10 * rand(25, 3) filename = "tikz_fig" - export_performance_profile_tikz(T, filename) + BenchmarkProfiles.export_performance_profile_tikz(T, filename) @test isfile(filename * ".tikz") rm(filename * ".tikz") - export_performance_profile_tikz(T, filename, file_type = TEX) + BenchmarkProfiles.export_performance_profile_tikz(T, filename, file_type = TEX) @test isfile(filename * ".tex") rm(filename * ".tex") - export_performance_profile_tikz(T, filename, file_type = SVG) + BenchmarkProfiles.export_performance_profile_tikz(T, filename, file_type = SVG) @test isfile(filename * ".svg") rm(filename * ".svg") - export_performance_profile_tikz(T, filename, file_type = PDF) + BenchmarkProfiles.export_performance_profile_tikz(T, filename, file_type = PDF) @test isfile(filename * ".pdf") rm(filename * ".pdf") end