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

Fix issue with internal classes in SDK #306

Conversation

jplewa
Copy link
Member

@jplewa jplewa commented Aug 30, 2023

Task

Resolves: #41

Description

I changed three constructors in abstract classes from internal to protected (all resources in our provider SDKs inherit from these classes, so the constructors have to be available to them). I also changed the opts method in resources from this:

  public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
    val builder = CustomResourceOptionsBuilder()
    block(builder)
    this.opts = builder.build()
  }

to this:

  public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
    this.opts = com.pulumi.kotlin.options.opts(block)
  }

I also had to change the modifier of the underlying javaResource in resources to protected, because otherwise there were problems in subclasses, but that caused issues with the Alias class, so I added another property (underLyingJavaResource) that's exposed only as internal (it's also used in tests).

@jplewa jplewa self-assigned this Aug 30, 2023
@jplewa jplewa requested a review from a team as a code owner August 30, 2023 14:50
@jplewa jplewa requested review from myhau and ddzikon August 30, 2023 14:50
@jplewa jplewa force-pushed the 41-extract-sdk-package-to-a-separate-module-and-release-as-a-separate-library branch 3 times, most recently from dd65275 to 2f05d3e Compare August 30, 2023 21:50
@jplewa jplewa force-pushed the 41-extract-sdk-package-to-a-separate-module-and-release-as-a-separate-library branch from 2f05d3e to df4cf4e Compare August 30, 2023 21:51
@jplewa jplewa changed the title fix issue with internal classes in SDK Fix issue with internal classes in SDK Aug 30, 2023
@myhau
Copy link
Member

myhau commented Aug 30, 2023

...
also changed the opts method in resources from this:

  public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
    val builder = CustomResourceOptionsBuilder()
    block(builder)
    this.opts = builder.build()
  }

...

Is this done to prevent making the build method public?

@jplewa
Copy link
Member Author

jplewa commented Aug 30, 2023

...
also changed the opts method in resources from this:

  public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
    val builder = CustomResourceOptionsBuilder()
    block(builder)
    this.opts = builder.build()
  }

...

Is this done to prevent making the build method public?

Yes

@jplewa jplewa requested a review from myhau August 31, 2023 08:44
@jplewa jplewa merged commit 75c484a into main Aug 31, 2023
@jplewa jplewa deleted the 41-extract-sdk-package-to-a-separate-module-and-release-as-a-separate-library branch August 31, 2023 12:26
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 this pull request may close these issues.

Extract sdk package to a separate module and release as a separate library
2 participants