Skip to content

Commit 4252d06

Browse files
committed
debug: Add debugging output and file system checks for CI
- Export Module.getUri() method to TypeScript - Add detailed debug logging in product detection test - Add file system verification step in CI workflow to diagnose why only 1 product is found instead of 2
1 parent d3f599c commit 4252d06

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ jobs:
3030
- name: Install rust dependencies
3131
run: cargo install cargo-udeps
3232

33+
- name: Debug - Check mock directory structure
34+
run: |
35+
echo "=== Checking harmony-project-1 structure ==="
36+
ls -laR mock/harmony-project-1/entry/src/
37+
echo ""
38+
echo "=== Checking if directories exist ==="
39+
[ -d "mock/harmony-project-1/entry/src/main" ] && echo "✓ main directory exists" || echo "✗ main directory missing"
40+
[ -d "mock/harmony-project-1/entry/src/ohosTest" ] && echo "✓ ohosTest directory exists" || echo "✗ ohosTest directory missing"
41+
[ -f "mock/harmony-project-1/entry/src/main/module.json5" ] && echo "✓ main/module.json5 exists" || echo "✗ main/module.json5 missing"
42+
[ -f "mock/harmony-project-1/entry/src/ohosTest/module.json5" ] && echo "✓ ohosTest/module.json5 exists" || echo "✗ ohosTest/module.json5 missing"
43+
3344
- name: Build
3445
run: pnpm build
3546

src/module.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ impl Module {
5353
*
5454
* @returns The module uri.
5555
*/
56+
#[napi]
5657
pub fn get_uri(&self) -> String {
5758
path_clean::clean(&self.uri.to_string())
5859
}

test/index.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,25 @@ describe.sequential('sample', (it) => {
5858

5959
it.sequential('should find all products', () => {
6060
const project1Products = Product.findAll(project1Module1)
61+
62+
// Debug: 输出找到的 products 信息
63+
console.log(`\n=== Product Detection Debug ===`)
64+
console.log(`Found ${project1Products.length} products`)
65+
project1Products.forEach((p, i) => {
66+
console.log(` Product ${i}: directory=${p.getDirectoryName()}, target=${p.getTargetName()}`)
67+
console.log(` uri=${p.getUri()}`)
68+
})
69+
70+
// Debug: 输出 module 信息
71+
if (typeof project1Module1.getUri === 'function') {
72+
console.log(`Module URI: ${project1Module1.getUri()}`)
73+
} else {
74+
console.log(`Module build profile path: ${project1Module1.getBuildProfilePath()}`)
75+
}
76+
const buildProfile = project1Module1.getParsedBuildProfileContent()
77+
console.log(`Targets in build profile:`, buildProfile.targets)
78+
console.log(`=== End Debug ===\n`)
79+
6180
expect(project1Products.length).toBeGreaterThanOrEqual(2)
6281
project1Product1 = project1Products[0]
6382
project1Product2 = project1Products[1]

0 commit comments

Comments
 (0)