Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,9 @@ let package = Package(
.executable(name: "MHCStudyDefinitionExporterCLI", targets: ["MHCStudyDefinitionExporterCLI"])
],
dependencies: [
.package(url: "https://github.com/StanfordSpezi/SpeziStudy.git", .upToNextMinor(from: "0.1.19")),
.package(url: "https://github.com/StanfordSpezi/SpeziFoundation.git", from: "2.4.0"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.6.2"),
// not used directly but we need to fix it below 0.9.0 for the time being
.package(url: "https://github.com/apple/FHIRModels.git", .upToNextMinor(from: "0.8.0"))
.package(url: "https://github.com/StanfordSpezi/SpeziStudy.git", revision: "e11803b1897930da7c374085606814e82622bdf3"),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

TODO to add a tagged version here.

.package(url: "https://github.com/StanfordSpezi/SpeziFoundation.git", from: "2.7.7"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.6.2")
Comment on lines +30 to +32

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Does Swift Package Manager allow a package that is itself published/tagged for versioned consumption to depend on another package via .revision(...), or are revision-based requirements only supported in the root package?

💡 Result:

Yes—any package’s manifest can express a revision-based dependency, not only the root package. In SwiftPM, a dependency requirement can be a Git revision via .revision(_:) (or by using package(url:revision:)). This is encoded in the package’s Package.Dependency.Requirement API and is used when resolving remote dependencies, regardless of whether that manifest belongs to the root package or a dependency in the graph. [1][2][3] Important nuance: if your published/tagged package uses commit-based requirements (including .revision), it cannot be depended upon by packages that use version-based dependency requirements (so you may need to avoid commit-based requirements when you intend others to use version constraints against your package). [1][2] Example from the manifest API: dependencies: [ .package(url: "https://example.com/example-package.git", revision: "<40-char-commit-hash>") ] [1][3]

Citations:


Avoid pinning SpeziStudy with .revision(...) if you’re tagging a coordinated release—prefer the released tag/exact version instead.

SwiftPM allows revision-based dependency requirements in any package manifest, so this won’t inherently prevent versioned consumers from resolving your package. Still, pinning SpeziStudy to a specific commit (as in Package.swift:30-32) removes downstream flexibility to use SpeziStudy version constraints for coordinated updates; using a released tag/exact version is safer for release hygiene.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Package.swift` around lines 30 - 32, The Package.swift currently pins
SpeziStudy using a specific commit via .package(..., revision: "e11803b...")
which prevents downstream coordinated version resolution; update the SpeziStudy
dependency declaration (the .package entry for "SpeziStudy") to reference a
released version instead (use a semantic version requirement such as from:
"X.Y.Z" or .exact("X.Y.Z") / .upToNextMajor(from: "X.Y.Z") matching your
coordinated release) so SwiftPM can resolve versions correctly for consumers.

],
targets: [
.target(
Expand All @@ -54,8 +52,7 @@ let package = Package(
.copy("Resources/article"),
.copy("Resources/questionnaire"),
.copy("Resources/hhdExplainer")
],
swiftSettings: [.defaultIsolation(MainActor.self)]
]
),
.executableTarget(
name: "MHCStudyDefinitionExporterCLI",
Expand All @@ -64,8 +61,7 @@ let package = Package(
"MHCStudyDefinitionExporter",
.product(name: "SpeziStudyDefinition", package: "SpeziStudy"),
.product(name: "ArgumentParser", package: "swift-argument-parser")
],
swiftSettings: [.defaultIsolation(MainActor.self)]
]
),
.testTarget(
name: "MHCStudyDefinitionExporterTests",
Expand Down
12 changes: 6 additions & 6 deletions Sources/MHCStudyDefinitionExporter/Study.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Foundation
import MHCStudyDefinition
import SpeziHealthKit
import enum SpeziHealthKitBulkExport.ExportSessionStartDate
import SpeziLocalization
import SpeziScheduler
import SpeziStudyDefinition

Expand All @@ -38,17 +39,16 @@ extension StudyBundle.FileReference {


let mhcStudyDefinition = StudyDefinition(
studyRevision: 40,
studyRevision: 41,
metadata: .init(
id: .mhcStudy,
title: "My Heart Counts",
shortTitle: "MHC",
title: [.enUS: "My Heart Counts"],
shortTitle: [.enUS: "MHC"],
icon: .systemSymbol("cube.transparent"),
explanationText: "",
shortExplanationText: "Improve your cardiovascular health",
explanationText: [:],
shortExplanationText: [.enUS: "Improve your cardiovascular health"],
studyDependency: nil,
participationCriterion: .ageAtLeast(18) && (.isFromRegion(.unitedStates) || .isFromRegion(.unitedKingdom)),
enrollmentConditions: .none,
consentFileRef: .init(category: .consent, filename: "Consent", fileExtension: "md")
),
components: [
Expand Down
Loading