Skip to content

Unable to use swift-api-digester when aws-crt-swift is a dependency #267

Open
@rozaychen

Description

@rozaychen

Describe the bug

Hi!

I have aws-crt-swift as a dependency of my library (integrated with SPM). I'd like to use swift-api-digester to diagnose breaking API changes. I do this by running swift build and then swift api-digester. These are the commands I run:

swift build --target $module

swift api-digester -swift-only -sdk "$(xcrun --show-sdk-path)" -dump-sdk -module "$module" \
        -o "./api-dump/$module.json" -I .build/debug

The build command succeeds; however, the swift-api-digester fails with this error:

<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/rozayc/Downloads/amplify-swift/.build/checkouts/aws-crt-swift/aws-common-runtime/aws-c-cal/include/aws/cal/cal.h"
        ^
/Users/rozayc/Downloads/amplify-swift/.build/checkouts/aws-crt-swift/aws-common-runtime/aws-c-cal/include/aws/cal/cal.h:8:10: error: 'aws/common/common.h' file not found
#include <aws/common/common.h>
         ^
<unknown>:0: error: could not build Objective-C module 'AwsCCal'
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/rozayc/Downloads/amplify-swift/.build/checkouts/aws-crt-swift/aws-common-runtime/aws-c-auth/include/aws/auth/auth.h"
        ^
Failed to load module: AWSCloudWatchLoggingPlugin

I tried to debug by running swift build then swift api-digester in aws-crt-swift, and I get this error:

rozayc@6c7e67cb160a Downloads % ./generate_api_files.sh 
warning: 'aws-crt-swift': Invalid Exclude '/Users/rozayc/Downloads/aws-crt-swift/aws-common-runtime/aws-c-io/THIRD-PARTY-LICENSES.txt': File not found.
Building for debugging...
[1/1] Write swift-version--58304C5D6DBC2206.txt
Build complete! (0.26s)
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/rozayc/Downloads/aws-crt-swift/aws-common-runtime/aws-c-auth/include/aws/auth/auth.h"
        ^
/Users/rozayc/Downloads/aws-crt-swift/aws-common-runtime/aws-c-auth/include/aws/auth/auth.h:9:10: error: 'aws/auth/exports.h' file not found
#include <aws/auth/exports.h>
         ^
<unknown>:0: error: could not build Objective-C module 'AwsCAuth'
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "/Users/rozayc/Downloads/aws-crt-swift/aws-common-runtime/aws-c-cal/include/aws/cal/cal.h"
        ^
Failed to load module: AwsCommonRuntimeKit

Do you have any recommendations for how I might be able to solve this issue? Thanks!

Expected Behavior

Expected to generate json file in the api-dump folder when running swift api-digester

Current Behavior

Has the failed to load module error

Reproduction Steps

In the aws-crt-swift directory, run
swift build
Then run
swift api-digester -sdk "$(xcrun --show-sdk-path)" -dump-sdk -module "AwsCommonRuntimeKit" -o ./api-dump/AwsCommonRuntimeKit.json -I .build/debug

Possible Solution

No response

Additional Information/Context

No response

aws-crt-swift version used

0.26.0

Compiler and Version used

swift 5.9.0

Operating System and version

macos v14.4.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions