Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin v1.5.31, XCFramework: targetConfigs fields not found from iOS #59

Closed
eirikvaa opened this issue Oct 5, 2021 · 7 comments · Fixed by #61
Closed

Kotlin v1.5.31, XCFramework: targetConfigs fields not found from iOS #59

eirikvaa opened this issue Oct 5, 2021 · 7 comments · Fixed by #61

Comments

@eirikvaa
Copy link

eirikvaa commented Oct 5, 2021

First of all, thanks so much for an awesome library!

I have a KMM project that was upgraded to Kotlin v1.5.31 recently. With that release came support for generating an XCFramework that can be consumed from the iOS app, which is awesome since it lets you bundle up different app variants like one for the simulator and one for physical devices.

Previously I would use BuildKonfig and its targetConfigs option to create fields for different platforms, ios among them. This worked fine on Kotlin v1.5.10. After upgrading to v1.5.31, the fields in the defaultConfigs are found, but not the ones in targetConfigs.

  • Kotlin: 1.5.31
  • Gradle: 7.0.2
  • BuildKonfig: 0.10.2
@eirikvaa
Copy link
Author

eirikvaa commented Oct 5, 2021

I'll see if I can create a reproducible project tomorrow.

@yshrsmz
Copy link
Owner

yshrsmz commented Oct 5, 2021

I'm going to look into this tomorrow(or next weekend), but at first glance it must be related to #38 .

For now BuildKonfig cannot detect which is non-root shared sourceset, and simply ignores it.

This is something I really want to support. Any suggestion (and of course repro) is appreciated.

@eirikvaa
Copy link
Author

eirikvaa commented Oct 5, 2021

Thanks for coming back to me so quickly, appreciate it :) I'll see about that repro when I have time.

@yshrsmz
Copy link
Owner

yshrsmz commented Oct 13, 2021

As a temporary workaround, you can define variables in defaultConfigs and use targetConfigs to override values

defaultConfigs {
  buildConfigField 'STRING', 'constantForIos', ''
}

targetConfigs {
  iosArm64 {
    buildConfigField 'STRING', 'constantForIos', 'same value'
  }
  iosX64 {
    buildConfigField 'STRING', 'constantForIos', 'same value'
  }
}

I've been tackling this since last weekend, but it seems to need more time.

@eirikvaa
Copy link
Author

@yshrsmz Oh, very nice, I'll test this out for sure :)

@yshrsmz
Copy link
Owner

yshrsmz commented Oct 19, 2021

Hi, I've released v0.11.0 with (experimental) HMPP support.
Please let me know if you find anything strange.

https://github.com/yshrsmz/BuildKonfig/releases/tag/v0.11.0

@eirikvaa
Copy link
Author

Awesome work, thank you! I tested it a bit last week and it seems to work great :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants