-
Notifications
You must be signed in to change notification settings - Fork 33
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
Conversation
class DependencyJSONGenerator( | ||
val ctx: ProtocolGenerator.GenerationContext, | ||
) { | ||
fun writePackageJSON(dependencies: List<SymbolDependency>) { | ||
ctx.delegator.useFileWriter(DEPENDENCY_JSON_NAME) { writer -> | ||
ctx.delegator.useFileWriter("Dependencies.json") { writer -> |
There was a problem hiding this comment.
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 } |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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, | ||
} | ||
|
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.)
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
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.