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

Adding generics does not work #1587

Closed
GianfrancoMS opened this issue Feb 10, 2020 · 3 comments
Closed

Adding generics does not work #1587

GianfrancoMS opened this issue Feb 10, 2020 · 3 comments

Comments

@GianfrancoMS
Copy link
Contributor

In the build.gradle of sample/common , I tried to enable generics, but it did not work.

  // Configure iOS.
  def sdkName = System.getenv("SDK_NAME")
  if (sdkName != null && sdkName.startsWith("iphoneos")) {
    iosArm64("ios")
  } else {
    iosX64("ios")
  }

  sourceSets.iosMain.dependencies {
    implementation "com.squareup.sqldelight:native-driver:${versions.sqldelight}"
  }

  cocoapods {
    summary = "Common core for SQLDelight sample."
    homepage = "https://github.com/cashapp/sqldelight/tree/master/sample/common"
  }

  //Modify framework created by the Cocoapods plugin
  targets.ios.binaries.framework("common") {
    freeCompilerArgs += ["-Xobjc-generics"]
  }

In the issues of the Kotlin Native's repository, it is mentioned that you have to modify the framework that the Cocoapods plugin creates internally; however, it appears that it does not work since Any still spears in XCode and AppCode.

@AlecKazakova
Copy link
Collaborator

cc @kpgalligan

@vanniktech
Copy link
Contributor

This groovy script does work for me:

kotlin {
  targets.ios.binaries
    .findAll { it instanceof org.jetbrains.kotlin.gradle.plugin.mpp.Framework }
    .every {
      it.setFreeCompilerArgs(it.getFreeCompilerArgs() + "-Xobjc-generics")
    }
}

@GianfrancoMS
Copy link
Contributor Author

@vanniktech It worked, thanks.

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

No branches or pull requests

3 participants