Skip to content
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

put chainrules core in a requires block, rm it from deps #107

Merged
merged 2 commits into from
Jun 19, 2023
Merged
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
14 changes: 7 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@ uuid = "621f4979-c628-5d54-868e-fcf4e3e8185c"
version = "1.3.1"

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

[weakdeps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"

[extensions]
AbstractFFTsChainRulesCoreExt = "ChainRulesCore"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"

[compat]
ChainRulesCore = "1"
julia = "^1.0"

[extensions]
AbstractFFTsChainRulesCoreExt = "ChainRulesCore"

[extras]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
ChainRulesTestUtils = "cdddcdb0-9152-4a09-a978-84456f9df70a"
Expand All @@ -25,3 +22,6 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[targets]
test = ["ChainRulesCore", "ChainRulesTestUtils", "Random", "Test", "Unitful"]

[weakdeps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
12 changes: 10 additions & 2 deletions src/AbstractFFTs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ export fft, ifft, bfft, fft!, ifft!, bfft!,

include("definitions.jl")

if !isdefined(Base, :get_extension)
include("../ext/AbstractFFTsChainRulesCoreExt.jl")
@static if !isdefined(Base, :get_extension)
import Requires
end

@static if !isdefined(Base, :get_extension)
function __init__()
Requires.@require ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" begin
include("../ext/AbstractFFTsChainRulesCoreExt.jl")
end
end
end

end # module
14 changes: 13 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

using AbstractFFTs
using AbstractFFTs: Plan
using ChainRulesTestUtils

using LinearAlgebra
using Random
Expand Down Expand Up @@ -241,6 +240,19 @@ end
end

@testset "ChainRules" begin

if isdefined(Base, :get_extension)
CRCEXT = Base.get_extension(AbstractFFTs, :AbstractFFTsChainRulesCoreExt)
@test isnothing(CRCEXT)
end

using ChainRulesTestUtils

if isdefined(Base, :get_extension)
CRCEXT = Base.get_extension(AbstractFFTs, :AbstractFFTsChainRulesCoreExt)
@test !isnothing(CRCEXT)
end

@testset "shift functions" begin
for x in (randn(3), randn(3, 4), randn(3, 4, 5))
for dims in ((), 1, 2, (1,2), 1:2)
Expand Down