Skip to content

chore: Remove package scope property #954

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

Merged
merged 3 commits into from
Aug 5, 2025
Merged

chore: Remove package scope property #954

merged 3 commits into from
Aug 5, 2025

Conversation

jbelkins
Copy link
Contributor

@jbelkins jbelkins commented Aug 5, 2025

Description of changes

Removes the DistributionMethod type because it was only needed for Swift Package Registry. Simplified code that used to handle distribution method.

Scope

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

class DependencyJSONGenerator(
val ctx: ProtocolGenerator.GenerationContext,
) {
fun writePackageJSON(dependencies: List<SymbolDependency>) {
ctx.delegator.useFileWriter(DEPENDENCY_JSON_NAME) { writer ->
ctx.delegator.useFileWriter("Dependencies.json") { writer ->
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to store this filename in a var, it's not referenced anywhere else.

it.getProperty("url", String::class.java).getOrNull() != null ||
it.getProperty("scope", String::class.java).getOrNull() != null
}
dependencies.filter { it.getProperty("url", String::class.java).getOrNull() != null }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "scope" property no longer exists since it was only associated with Swift Package Registry.
References to scope on dependencies is removed here & below in this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also removed in the next file.

writer.write("url: \$S,", it)
}
val url = dependency.getProperty("url", String::class.java).get()
writer.write("url: \$S,", url)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the url property is guaranteed to succeed here since the method is only called on dependencies that have already been verified to have url set.

SPR,
GIT,
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DistributionMethod is removed because now everything is presumed distributed by git.

@@ -13,7 +13,7 @@ import software.amazon.smithy.swift.codegen.TestContext
import software.amazon.smithy.swift.codegen.defaultSettings
import software.amazon.smithy.swift.codegen.protocolgeneratormocks.MockHTTPAWSJson11ProtocolGenerator

class ServiceClientJSONManifestGeneratorTests {
class DependencyJSONGeneratorTests {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed this rename in my previous PR.

@@ -10,6 +10,7 @@ import io.kotest.matchers.string.shouldStartWith
import org.junit.jupiter.api.Assertions.assertNotNull
import org.junit.jupiter.api.Test
import software.amazon.smithy.swift.codegen.PackageManifestGenerator
import software.amazon.smithy.swift.codegen.SwiftDependency
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a dependency to the manifest in this test so that more of the manifest can be checked (package & target dependencies.)

@jbelkins jbelkins marked this pull request as ready for review August 5, 2025 22:41
@jbelkins jbelkins merged commit 7eb3b40 into main Aug 5, 2025
33 checks passed
@jbelkins jbelkins deleted the jbe/remove_spr_scope branch August 5, 2025 23:53
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.

2 participants