Skip to content

Multiple Swift targets, single dynamic library #715

@mortenbekditlevsen

Description

@mortenbekditlevsen

I am not certain about whether this is an actual issue, or perhaps just my expectations being wrong:

I have two targets in Swift, TargetA and TargetB. TargetA depends on TargetB.
I have a dynamic library product that builds a single dynamic library based on TargetA. I have called that library product 'TargetA' so that the correct library is loaded at runtime.

My first issue is:
The generated java code contains
static final String LIB_NAME = "TargetA";
and
static final String LIB_NAME = "TargetB";
for types in the two targets respectively.

For types in TargetB, I would also like the library name to be 'TargetA', so they both load from the same dynamic library.

I have tried setting

  "nativeLibraryName": "TargetA",

in the swift-java.config files without effect.

Am I supposed to be able to override the LIB_NAME in the generated java code?

The second issue is:
When calling the JExtract tool for TargetA, it correctly adds '--depends-on' for TargetB.
I would assume that API in TargetA that uses types from TargetB could now be exposed to java, but it appears that they are stripped - just like when there were no dependency on TargetB.

Is this supposed to work like I expect, or am I misunderstanding the role of '--depends-on'?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions