Skip to content

Add the repository url to the generated License - #48

Open
yutailang0119 wants to merge 1 commit into
maiyama18:mainfrom
yutailang0119:feature/license-repository-url
Open

Add the repository url to the generated License#48
yutailang0119 wants to merge 1 commit into
maiyama18:mainfrom
yutailang0119:feature/license-repository-url

Conversation

@yutailang0119

@yutailang0119 yutailang0119 commented Aug 18, 2026

Copy link
Copy Markdown

Adds License.url so consumers can link to a dependency's repository without maintaining their own name-to-url map.

PackagePlugin.Package.origin already carries the url for every dependency resolved from source control, but the generator discarded it. It is now filled from PackageOrigin.repository(url:_:_:), and left nil for .root, .local and .registry.

Typed URL? so it can be handed straight to Link or openURL. PackageOrigin reports a String, so the generated code wraps it in URL(string:) — that returns URL?, which matches the property and needs no force unwrap. This adds import Foundation to the generated file.

This is source-breaking for code that constructs a License. The generated file is compiled into the consuming target, so its memberwise initializer is reachable from user code, and adding a property makes existing calls fail with missing argument for parameter 'url' in call. The only such call site in this repository is the LicenseDetailScreen preview, updated here. If you would rather keep it non-breaking, I can emit an explicit initializer with url defaulted to nil instead — say the word.

One thing worth knowing: urls are emitted exactly as declared, so the .git suffix is inconsistent across a real graph (firebase-ios-sdk without it, leveldb.git with it). I left them verbatim rather than normalizing.

Also folded in a one-word README fix — the snippet was missing Sendable, which the generator has been emitting for a while.

@yutailang0119
yutailang0119 force-pushed the feature/license-repository-url branch from 48cdaf2 to 8f61fe2 Compare August 18, 2026 15:27
@yutailang0119
yutailang0119 marked this pull request as ready for review August 18, 2026 15:46
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.

1 participant