Skip to content

Commit c788adb

Browse files
authored
Fix generation handling of dependencies (#2)
* Fix generation handling of dependencies * patch version bump * generate bindings * Revert "patch version bump" This reverts commit baa82c6.
1 parent 283faca commit c788adb

File tree

8 files changed

+39
-114
lines changed

8 files changed

+39
-114
lines changed

gen/Manifest.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
julia_version = "1.10.2"
44
manifest_format = "2.0"
5-
project_hash = "46342e1b48a16f578d983378fc2b627a4124a3d5"
5+
project_hash = "bd802c34455e572f67caa68a2beb6ffc7761162e"
66

77
[[deps.ArgTools]]
88
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
@@ -82,6 +82,18 @@ git-tree-sha1 = "7e5d6779a1e09a36db2a7b6cff50942a0a7d0fca"
8282
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
8383
version = "1.5.0"
8484

85+
[[deps.LibAwsCal]]
86+
deps = ["CEnum", "LibAwsCommon", "aws_c_cal_jll"]
87+
git-tree-sha1 = "cb38f20d8e187a33770840e2a2eaef8c13ee425d"
88+
uuid = "ef519ef6-af43-41a0-8ac4-eb81328190af"
89+
version = "1.0.0"
90+
91+
[[deps.LibAwsCommon]]
92+
deps = ["CEnum", "aws_c_common_jll"]
93+
git-tree-sha1 = "d8705f05415a487369d5bbfb2ca149c72ffb5609"
94+
uuid = "c6e421ba-b5f8-4792-a1c4-42948de3ed9d"
95+
version = "1.0.0"
96+
8597
[[deps.LibCURL]]
8698
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
8799
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"

gen/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[deps]
22
Clang = "40e3b903-d033-50b4-a0cc-940c62c95e31"
33
JLLPrefixes = "afc68a34-7891-4c5a-9da1-1c62935e7b0d"
4+
LibAwsCal = "ef519ef6-af43-41a0-8ac4-eb81328190af"
5+
LibAwsCommon = "c6e421ba-b5f8-4792-a1c4-42948de3ed9d"
46
aws_c_cal_jll = "70f11efc-bab2-57f1-b0f3-22aad4e67c4b"
57
aws_c_common_jll = "73048d1d-b8c4-5092-a58d-866c5e8d1e50"
68
aws_c_io_jll = "13c41daa-f319-5298-b5eb-5754e0170d52"

gen/generator.jl

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ using Clang.Generators
22
using Clang.JLLEnvs
33
using JLLPrefixes
44
import aws_c_common_jll, aws_c_io_jll, aws_c_cal_jll
5+
using LibAwsCommon
6+
using LibAwsCal
57

68
cd(@__DIR__)
79

@@ -27,6 +29,21 @@ function should_skip_target(target)
2729
return target == "i686-w64-mingw32"
2830
end
2931

32+
const deps_jlls = [aws_c_common_jll, aws_c_cal_jll]
33+
const deps = [LibAwsCommon, LibAwsCal]
34+
const deps_names = sort(collect(Iterators.flatten(names.(deps))))
35+
36+
# clang can emit code for forward declarations of structs defined in our dependencies. we need to skip those, otherwise
37+
# we'll have duplicate struct definitions.
38+
function skip_nodes_in_dependencies!(dag::ExprDAG)
39+
replace!(get_nodes(dag)) do node
40+
if insorted(node.id, deps_names)
41+
return ExprNode(node.id, Generators.Skip(), node.cursor, Expr[], node.adj)
42+
end
43+
return node
44+
end
45+
end
46+
3047
# download toolchains in parallel
3148
Threads.@threads for target in JLLEnvs.JLL_ENV_TRIPLES
3249
if should_skip_target(target)
@@ -44,11 +61,10 @@ for target in JLLEnvs.JLL_ENV_TRIPLES
4461
options["general"]["callback_documentation"] = get_docs
4562

4663
args = get_default_args(target)
47-
inc = JLLEnvs.get_pkg_include_dir(aws_c_common_jll, target)
48-
push!(args, "-isystem$inc")
49-
50-
inc = JLLEnvs.get_pkg_include_dir(aws_c_cal_jll, target)
51-
push!(args, "-isystem$inc")
64+
for dep in deps_jlls
65+
inc = JLLEnvs.get_pkg_include_dir(dep, target)
66+
push!(args, "-isystem$inc")
67+
end
5268

5369
header_dirs = []
5470
inc = JLLEnvs.get_pkg_include_dir(aws_c_io_jll, target)
@@ -68,5 +84,7 @@ for target in JLLEnvs.JLL_ENV_TRIPLES
6884
unique!(headers)
6985

7086
ctx = create_context(headers, args, options)
71-
build!(ctx)
87+
build!(ctx, BUILDSTAGE_NO_PRINTING)
88+
skip_nodes_in_dependencies!(ctx.dag)
89+
build!(ctx, BUILDSTAGE_PRINTING_ONLY)
7290
end

lib/aarch64-linux-gnu.jl

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6717,21 +6717,6 @@ function aws_input_stream_new_tester(alloc, options)
67176717
ccall((:aws_input_stream_new_tester, libaws_c_io), Ptr{aws_input_stream}, (Ptr{aws_allocator}, Ptr{aws_input_stream_tester_options}), alloc, options)
67186718
end
67196719

6720-
"""
6721-
__pthread_mutex_s
6722-
6723-
Documentation not found.
6724-
"""
6725-
struct __pthread_mutex_s
6726-
__lock::Cint
6727-
__count::Cuint
6728-
__owner::Cint
6729-
__nusers::Cuint
6730-
__kind::Cint
6731-
__spins::Cint
6732-
__list::__pthread_list_t
6733-
end
6734-
67356720
"""
67366721
__JL_Ctag_710
67376722

lib/armv7l-linux-gnueabihf.jl

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6717,37 +6717,6 @@ function aws_input_stream_new_tester(alloc, options)
67176717
ccall((:aws_input_stream_new_tester, libaws_c_io), Ptr{aws_input_stream}, (Ptr{aws_allocator}, Ptr{aws_input_stream_tester_options}), alloc, options)
67186718
end
67196719

6720-
"""
6721-
__pthread_mutex_s
6722-
6723-
Documentation not found.
6724-
"""
6725-
struct __pthread_mutex_s
6726-
data::NTuple{24, UInt8}
6727-
end
6728-
6729-
function Base.getproperty(x::Ptr{__pthread_mutex_s}, f::Symbol)
6730-
f === :__lock && return Ptr{Cint}(x + 0)
6731-
f === :__count && return Ptr{Cuint}(x + 4)
6732-
f === :__owner && return Ptr{Cint}(x + 8)
6733-
f === :__kind && return Ptr{Cint}(x + 12)
6734-
f === :__nusers && return Ptr{Cuint}(x + 16)
6735-
f === :__spins && return Ptr{Cint}(x + 20)
6736-
f === :__list && return Ptr{__pthread_slist_t}(x + 20)
6737-
return getfield(x, f)
6738-
end
6739-
6740-
function Base.getproperty(x::__pthread_mutex_s, f::Symbol)
6741-
r = Ref{__pthread_mutex_s}(x)
6742-
ptr = Base.unsafe_convert(Ptr{__pthread_mutex_s}, r)
6743-
fptr = getproperty(ptr, f)
6744-
GC.@preserve r unsafe_load(fptr)
6745-
end
6746-
6747-
function Base.setproperty!(x::Ptr{__pthread_mutex_s}, f::Symbol, v)
6748-
unsafe_store!(getproperty(x, f), v)
6749-
end
6750-
67516720
"""
67526721
__JL_Ctag_709
67536722

lib/i686-linux-gnu.jl

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6756,37 +6756,6 @@ function Base.setproperty!(x::Ptr{__JL_Ctag_685}, f::Symbol, v)
67566756
end
67576757

67586758

6759-
"""
6760-
__pthread_mutex_s
6761-
6762-
Documentation not found.
6763-
"""
6764-
struct __pthread_mutex_s
6765-
data::NTuple{24, UInt8}
6766-
end
6767-
6768-
function Base.getproperty(x::Ptr{__pthread_mutex_s}, f::Symbol)
6769-
f === :__lock && return Ptr{Cint}(x + 0)
6770-
f === :__count && return Ptr{Cuint}(x + 4)
6771-
f === :__owner && return Ptr{Cint}(x + 8)
6772-
f === :__kind && return Ptr{Cint}(x + 12)
6773-
f === :__nusers && return Ptr{Cuint}(x + 16)
6774-
f === :__spins && return Ptr{Cint}(x + 20)
6775-
f === :__list && return Ptr{__pthread_slist_t}(x + 20)
6776-
return getfield(x, f)
6777-
end
6778-
6779-
function Base.getproperty(x::__pthread_mutex_s, f::Symbol)
6780-
r = Ref{__pthread_mutex_s}(x)
6781-
ptr = Base.unsafe_convert(Ptr{__pthread_mutex_s}, r)
6782-
fptr = getproperty(ptr, f)
6783-
GC.@preserve r unsafe_load(fptr)
6784-
end
6785-
6786-
function Base.setproperty!(x::Ptr{__pthread_mutex_s}, f::Symbol, v)
6787-
unsafe_store!(getproperty(x, f), v)
6788-
end
6789-
67906759
"""
67916760
Documentation not found.
67926761
"""

lib/powerpc64le-linux-gnu.jl

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6756,21 +6756,6 @@ function Base.setproperty!(x::Ptr{__JL_Ctag_688}, f::Symbol, v)
67566756
end
67576757

67586758

6759-
"""
6760-
__pthread_mutex_s
6761-
6762-
Documentation not found.
6763-
"""
6764-
struct __pthread_mutex_s
6765-
__lock::Cint
6766-
__count::Cuint
6767-
__owner::Cint
6768-
__nusers::Cuint
6769-
__kind::Cint
6770-
__spins::Cint
6771-
__list::__pthread_list_t
6772-
end
6773-
67746759
"""
67756760
Documentation not found.
67766761
"""

lib/x86_64-linux-gnu.jl

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6756,21 +6756,6 @@ function Base.setproperty!(x::Ptr{__JL_Ctag_705}, f::Symbol, v)
67566756
end
67576757

67586758

6759-
"""
6760-
__pthread_mutex_s
6761-
6762-
Documentation not found.
6763-
"""
6764-
struct __pthread_mutex_s
6765-
__lock::Cint
6766-
__count::Cuint
6767-
__owner::Cint
6768-
__nusers::Cuint
6769-
__kind::Cint
6770-
__spins::Cint
6771-
__list::__pthread_list_t
6772-
end
6773-
67746759
"""
67756760
Documentation not found.
67766761
"""

0 commit comments

Comments
 (0)