Skip to content

Commit 14ae192

Browse files
authored
feat: Move the C bindings into a standalone repository (#1)
1 parent 713d542 commit 14ae192

18 files changed

+2309
-18
lines changed

.cargo/config.toml

-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,3 @@ rustflags = [
77
rustflags = [
88
"-C", "link-arg=-Wl,-install_name,@rpath/libaccesskit.dylib",
99
]
10-
11-
[profile.release]
12-
panic = "abort"
13-
debug = true

.clang-format

+200
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: Google
4+
AccessModifierOffset: -1
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveMacros: None
7+
AlignConsecutiveAssignments: None
8+
AlignConsecutiveBitFields: None
9+
AlignConsecutiveDeclarations: None
10+
AlignEscapedNewlines: Left
11+
AlignOperands: Align
12+
AlignTrailingComments: true
13+
AllowAllArgumentsOnNextLine: true
14+
AllowAllConstructorInitializersOnNextLine: true
15+
AllowAllParametersOfDeclarationOnNextLine: true
16+
AllowShortEnumsOnASingleLine: true
17+
AllowShortBlocksOnASingleLine: Never
18+
AllowShortCaseLabelsOnASingleLine: false
19+
AllowShortFunctionsOnASingleLine: All
20+
AllowShortLambdasOnASingleLine: All
21+
AllowShortIfStatementsOnASingleLine: WithoutElse
22+
AllowShortLoopsOnASingleLine: true
23+
AlwaysBreakAfterDefinitionReturnType: None
24+
AlwaysBreakAfterReturnType: None
25+
AlwaysBreakBeforeMultilineStrings: true
26+
AlwaysBreakTemplateDeclarations: Yes
27+
AttributeMacros:
28+
- __capability
29+
BinPackArguments: true
30+
BinPackParameters: true
31+
BraceWrapping:
32+
AfterCaseLabel: false
33+
AfterClass: false
34+
AfterControlStatement: Never
35+
AfterEnum: false
36+
AfterFunction: false
37+
AfterNamespace: false
38+
AfterObjCDeclaration: false
39+
AfterStruct: false
40+
AfterUnion: false
41+
AfterExternBlock: false
42+
BeforeCatch: false
43+
BeforeElse: false
44+
BeforeLambdaBody: false
45+
BeforeWhile: false
46+
IndentBraces: false
47+
SplitEmptyFunction: true
48+
SplitEmptyRecord: true
49+
SplitEmptyNamespace: true
50+
BreakBeforeBinaryOperators: None
51+
BreakBeforeConceptDeclarations: true
52+
BreakBeforeBraces: Attach
53+
BreakBeforeInheritanceComma: false
54+
BreakInheritanceList: BeforeColon
55+
BreakBeforeTernaryOperators: true
56+
BreakConstructorInitializersBeforeComma: false
57+
BreakConstructorInitializers: BeforeColon
58+
BreakAfterJavaFieldAnnotations: false
59+
BreakStringLiterals: true
60+
ColumnLimit: 80
61+
CommentPragmas: '^ IWYU pragma:'
62+
CompactNamespaces: false
63+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
64+
ConstructorInitializerIndentWidth: 4
65+
ContinuationIndentWidth: 4
66+
Cpp11BracedListStyle: true
67+
DeriveLineEnding: true
68+
DerivePointerAlignment: true
69+
DisableFormat: false
70+
EmptyLineBeforeAccessModifier: LogicalBlock
71+
ExperimentalAutoDetectBinPacking: false
72+
FixNamespaceComments: true
73+
ForEachMacros:
74+
- foreach
75+
- Q_FOREACH
76+
- BOOST_FOREACH
77+
StatementAttributeLikeMacros:
78+
- Q_EMIT
79+
IncludeBlocks: Regroup
80+
IncludeCategories:
81+
- Regex: '^<ext/.*\.h>'
82+
Priority: 2
83+
SortPriority: 0
84+
CaseSensitive: false
85+
- Regex: '^<.*\.h>'
86+
Priority: 1
87+
SortPriority: 0
88+
CaseSensitive: false
89+
- Regex: '^<.*'
90+
Priority: 2
91+
SortPriority: 0
92+
CaseSensitive: false
93+
- Regex: '.*'
94+
Priority: 3
95+
SortPriority: 0
96+
CaseSensitive: false
97+
IncludeIsMainRegex: '([-_](test|unittest))?$'
98+
IncludeIsMainSourceRegex: ''
99+
IndentCaseLabels: true
100+
IndentCaseBlocks: false
101+
IndentGotoLabels: true
102+
IndentPPDirectives: None
103+
IndentExternBlock: AfterExternBlock
104+
IndentRequires: false
105+
IndentWidth: 2
106+
IndentWrappedFunctionNames: false
107+
InsertTrailingCommas: None
108+
JavaScriptQuotes: Leave
109+
JavaScriptWrapImports: true
110+
KeepEmptyLinesAtTheStartOfBlocks: false
111+
MacroBlockBegin: ''
112+
MacroBlockEnd: ''
113+
MaxEmptyLinesToKeep: 1
114+
NamespaceIndentation: None
115+
ObjCBinPackProtocolList: Never
116+
ObjCBlockIndentWidth: 2
117+
ObjCBreakBeforeNestedBlockParam: true
118+
ObjCSpaceAfterProperty: false
119+
ObjCSpaceBeforeProtocolList: true
120+
PenaltyBreakAssignment: 2
121+
PenaltyBreakBeforeFirstCallParameter: 1
122+
PenaltyBreakComment: 300
123+
PenaltyBreakFirstLessLess: 120
124+
PenaltyBreakString: 1000
125+
PenaltyBreakTemplateDeclaration: 10
126+
PenaltyExcessCharacter: 1000000
127+
PenaltyReturnTypeOnItsOwnLine: 200
128+
PenaltyIndentedWhitespace: 0
129+
PointerAlignment: Left
130+
RawStringFormats:
131+
- Language: Cpp
132+
Delimiters:
133+
- cc
134+
- CC
135+
- cpp
136+
- Cpp
137+
- CPP
138+
- 'c++'
139+
- 'C++'
140+
CanonicalDelimiter: ''
141+
BasedOnStyle: google
142+
- Language: TextProto
143+
Delimiters:
144+
- pb
145+
- PB
146+
- proto
147+
- PROTO
148+
EnclosingFunctions:
149+
- EqualsProto
150+
- EquivToProto
151+
- PARSE_PARTIAL_TEXT_PROTO
152+
- PARSE_TEST_PROTO
153+
- PARSE_TEXT_PROTO
154+
- ParseTextOrDie
155+
- ParseTextProtoOrDie
156+
- ParseTestProto
157+
- ParsePartialTestProto
158+
CanonicalDelimiter: ''
159+
BasedOnStyle: google
160+
ReflowComments: true
161+
SortIncludes: true
162+
SortJavaStaticImport: Before
163+
SortUsingDeclarations: true
164+
SpaceAfterCStyleCast: false
165+
SpaceAfterLogicalNot: false
166+
SpaceAfterTemplateKeyword: true
167+
SpaceBeforeAssignmentOperators: true
168+
SpaceBeforeCaseColon: false
169+
SpaceBeforeCpp11BracedList: false
170+
SpaceBeforeCtorInitializerColon: true
171+
SpaceBeforeInheritanceColon: true
172+
SpaceBeforeParens: ControlStatements
173+
SpaceAroundPointerQualifiers: Default
174+
SpaceBeforeRangeBasedForLoopColon: true
175+
SpaceInEmptyBlock: false
176+
SpaceInEmptyParentheses: false
177+
SpacesBeforeTrailingComments: 2
178+
SpacesInAngles: false
179+
SpacesInConditionalStatement: false
180+
SpacesInContainerLiterals: true
181+
SpacesInCStyleCastParentheses: false
182+
SpacesInParentheses: false
183+
SpacesInSquareBrackets: false
184+
SpaceBeforeSquareBrackets: false
185+
BitFieldColonSpacing: Both
186+
Standard: Auto
187+
StatementMacros:
188+
- Q_UNUSED
189+
- QT_REQUIRE_VERSION
190+
TabWidth: 8
191+
UseCRLF: false
192+
UseTab: Never
193+
WhitespaceSensitiveMacros:
194+
- STRINGIZE
195+
- PP_STRINGIZE
196+
- BOOST_PP_STRINGIZE
197+
- NS_SWIFT_NAME
198+
- CF_SWIFT_NAME
199+
...
200+

.github/workflows/ci.yml

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
pull_request:
6+
7+
name: CI
8+
9+
jobs:
10+
fmt:
11+
runs-on: ubuntu-latest
12+
name: Check formatting
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: install stable toolchain
17+
uses: dtolnay/rust-toolchain@master
18+
with:
19+
toolchain: stable
20+
components: rustfmt
21+
22+
- name: cargo fmt
23+
run: cargo fmt -- --check
24+
25+
- name: clang-format
26+
uses: jidicula/[email protected]
27+
with:
28+
clang-format-version: 15
29+
30+
cargo-deny:
31+
runs-on: ubuntu-22.04
32+
steps:
33+
- uses: actions/checkout@v3
34+
- uses: EmbarkStudios/cargo-deny-action@v1
35+
36+
clippy:
37+
runs-on: ${{ matrix.os }}
38+
strategy:
39+
matrix:
40+
os: [macOS-latest, windows-2019, ubuntu-latest]
41+
name: cargo clippy
42+
steps:
43+
- uses: actions/checkout@v4
44+
45+
- name: install stable toolchain
46+
uses: dtolnay/rust-toolchain@stable
47+
with:
48+
components: clippy
49+
50+
- name: restore cache
51+
uses: Swatinem/rust-cache@v2
52+
53+
- name: cargo clippy
54+
run: cargo clippy --all-targets -- -D warnings
55+
56+
find-msrv:
57+
runs-on: ubuntu-latest
58+
outputs:
59+
version: ${{ steps.step2.outputs.version }}
60+
steps:
61+
- uses: actions/checkout@v4
62+
- id: step2
63+
run: echo "version=`cat Cargo.toml | sed -n 's/rust-version = "\(.*\)"/\1/p'`" >> "$GITHUB_OUTPUT"
64+
65+
test:
66+
runs-on: ${{ matrix.os }}
67+
needs: find-msrv
68+
strategy:
69+
matrix:
70+
os: [macOS-latest, windows-2019, ubuntu-latest]
71+
name: cargo test
72+
steps:
73+
- uses: actions/checkout@v4
74+
75+
- name: install stable toolchain
76+
uses: dtolnay/rust-toolchain@master
77+
with:
78+
toolchain: ${{ needs.find-msrv.outputs.version }}
79+
80+
- name: restore cache
81+
uses: Swatinem/rust-cache@v2
82+
83+
- name: cargo test
84+
run: cargo test
85+
86+
check-c-header:
87+
runs-on: ubuntu-latest
88+
name: Check committed C header
89+
steps:
90+
- uses: actions/checkout@v4
91+
92+
- name: install nightly toolchain
93+
uses: dtolnay/rust-toolchain@nightly
94+
95+
- uses: dtolnay/install@master
96+
with:
97+
crate: cbindgen
98+
- run: cmake -S . -B build -DACCESSKIT_BUILD_HEADERS=ON -DACCESSKIT_BUILD_LIBRARIES=OFF
99+
- run: cmake --build build
100+
- run: cmp build/accesskit.h include/accesskit.h

0 commit comments

Comments
 (0)