Skip to content

Commit ada8378

Browse files
committed
Run cargo fmt + update check C SDK build parameters workflow
1 parent b86abe3 commit ada8378

File tree

2 files changed

+30
-23
lines changed

2 files changed

+30
-23
lines changed

.github/workflows/check_csdk_build_parameters.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ jobs:
3636
matrix:
3737
target: ["nanox", "nanosplus", "stax", "flex"]
3838
steps:
39-
- name: Checkout Rust SDK
40-
uses: actions/checkout@v4
4139
- name: Checkout C BP
4240
uses: actions/checkout@v4
4341
with:
@@ -49,21 +47,16 @@ jobs:
4947
name: c_sdk_build_params_extractor
5048
- name: Run C SDK Build Parameters Extractor
5149
run: |
52-
# to be suppressed when C SDK API_LEVEL_24 is available in dev-tools
53-
git clone https://github.com/LedgerHQ/ledger-secure-sdk.git --branch API_LEVEL_24 --single-branch c_sdk
54-
echo "setting LEDGER_SDK_PATH to $(realpath c_sdk)"
55-
export LEDGER_SDK_PATH=$(realpath c_sdk)
56-
# ####################################### #
5750
chmod +x cbpx
5851
./cbpx --app-path c_boilerplate \
5952
--device ${{ matrix.target }}
6053
# Compare output with matching file
61-
diff -Z c_sdk_build_${{ matrix.target }}.cflags ledger_secure_sdk_sys/c_sdk_build_${{ matrix.target }}.cflags
54+
diff c_sdk_build_${{ matrix.target }}.cflags c_sdk_build_${{ matrix.target }}_ref.cflags
6255
if [ $? -ne 0 ]; then
6356
echo "C SDK build parameters CFLAGS do not match for target ${{ matrix.target }}"
6457
exit 1
6558
fi
66-
diff -Z c_sdk_build_${{ matrix.target }}.defines ledger_secure_sdk_sys/c_sdk_build_${{ matrix.target }}.defines
59+
diff c_sdk_build_${{ matrix.target }}.defines c_sdk_build_${{ matrix.target }}_ref.defines
6760
if [ $? -ne 0 ]; then
6861
echo "C SDK build parameters DEFINES do not match for target ${{ matrix.target }}"
6962
exit 1

ledger_secure_sdk_sys/build.rs

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ impl SDKBuilder<'_> {
160160
let f = File::open(m_path)
161161
.expect("Failed to open c_sdk_build_nanosplus.cflags file");
162162
let reader = BufReader::new(f);
163-
reader.lines().filter_map(|line| line.ok()).collect::<Vec<String>>()
163+
reader
164+
.lines()
165+
.filter_map(|line| line.ok())
166+
.collect::<Vec<String>>()
164167
},
165168
glyphs_folders: Vec::new(),
166169
arm_libs: Default::default(),
@@ -191,10 +194,13 @@ impl SDKBuilder<'_> {
191194
cflags: {
192195
let mut m_path = String::from(env!("CARGO_MANIFEST_DIR"));
193196
m_path.push_str("/c_sdk_build_nanox.cflags");
194-
let f = File::open(m_path)
195-
.expect("Failed to open c_sdk_build_nanox.cflags file");
197+
let f =
198+
File::open(m_path).expect("Failed to open c_sdk_build_nanox.cflags file");
196199
let reader = BufReader::new(f);
197-
reader.lines().filter_map(|line| line.ok()).collect::<Vec<String>>()
200+
reader
201+
.lines()
202+
.filter_map(|line| line.ok())
203+
.collect::<Vec<String>>()
198204
},
199205
glyphs_folders: Vec::new(),
200206
arm_libs: Default::default(),
@@ -211,10 +217,13 @@ impl SDKBuilder<'_> {
211217
cflags: {
212218
let mut m_path = String::from(env!("CARGO_MANIFEST_DIR"));
213219
m_path.push_str("/c_sdk_build_stax.cflags");
214-
let f = File::open(m_path)
215-
.expect("Failed to open c_sdk_build_stax.cflags file");
220+
let f =
221+
File::open(m_path).expect("Failed to open c_sdk_build_stax.cflags file");
216222
let reader = BufReader::new(f);
217-
reader.lines().filter_map(|line| line.ok()).collect::<Vec<String>>()
223+
reader
224+
.lines()
225+
.filter_map(|line| line.ok())
226+
.collect::<Vec<String>>()
218227
},
219228
glyphs_folders: Vec::new(),
220229
arm_libs: Default::default(),
@@ -231,10 +240,13 @@ impl SDKBuilder<'_> {
231240
cflags: {
232241
let mut m_path = String::from(env!("CARGO_MANIFEST_DIR"));
233242
m_path.push_str("/c_sdk_build_flex.cflags");
234-
let f = File::open(m_path)
235-
.expect("Failed to open c_sdk_build_flex.cflags file");
243+
let f =
244+
File::open(m_path).expect("Failed to open c_sdk_build_flex.cflags file");
236245
let reader = BufReader::new(f);
237-
reader.lines().filter_map(|line| line.ok()).collect::<Vec<String>>()
246+
reader
247+
.lines()
248+
.filter_map(|line| line.ok())
249+
.collect::<Vec<String>>()
238250
},
239251
glyphs_folders: Vec::new(),
240252
arm_libs: Default::default(),
@@ -251,10 +263,13 @@ impl SDKBuilder<'_> {
251263
cflags: {
252264
let mut m_path = String::from(env!("CARGO_MANIFEST_DIR"));
253265
m_path.push_str("/c_sdk_build_apex_p.cflags");
254-
let f = File::open(m_path)
255-
.expect("Failed to open c_sdk_build_apex_p.cflags file");
266+
let f =
267+
File::open(m_path).expect("Failed to open c_sdk_build_apex_p.cflags file");
256268
let reader = BufReader::new(f);
257-
reader.lines().filter_map(|line| line.ok()).collect::<Vec<String>>()
269+
reader
270+
.lines()
271+
.filter_map(|line| line.ok())
272+
.collect::<Vec<String>>()
258273
},
259274
glyphs_folders: Vec::new(),
260275
arm_libs: Default::default(),
@@ -388,7 +403,6 @@ impl SDKBuilder<'_> {
388403
.files(&AUX_C_FILES)
389404
.files(str2path(&self.device.c_sdk, &SDK_C_FILES));
390405

391-
392406
let glyphs_path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("glyphs");
393407

394408
command = command

0 commit comments

Comments
 (0)