Skip to content

Commit

Permalink
print warning for missing resolved version
Browse files Browse the repository at this point in the history
  • Loading branch information
hbmartin committed Mar 18, 2024
1 parent 97a139d commit 058a00a
Show file tree
Hide file tree
Showing 6 changed files with 362 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish Yard HTML to GitHub Pages
on:
push:
tags:
- "*"
- v*
workflow_dispatch:

jobs:
Expand Down
7 changes: 7 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ Style/MultilineIfModifier:
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: consistent_comma

Style/StderrPuts:
Enabled: false

Style/RegexpLiteral:
Enabled: true
EnforcedStyle: slashes

RSpec/ExampleLength:
Enabled: false

Expand Down
5 changes: 4 additions & 1 deletion lib/spm_version_updates/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ def check_for_updates(xcodeproj_path)
resolved_version = resolved_versions[repository_url]
kind = requirement["kind"]

# kind can be major, minor, range, exact, branch, or commit
if resolved_version.nil?
$stderr.puts("Unable to locate the current version for #{name} (#{repository_url}) in #{find_packages_resolved_file(xcodeproj_path)}")
next
end

if kind == "branch"
branch = requirement["branch"]
Expand Down
14 changes: 14 additions & 0 deletions spec/spm_version_updates_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,20 @@ module Danger
]
)
end

it "Does not crash or warn when resolved version is missing from xcodeproj" do
@my_plugin.check_for_updates("#{File.dirname(__FILE__)}/support/fixtures/NoResolvedVersion.xcodeproj")

expect(@dangerfile.status_report[:warnings]).to eq([])
end

it "Does print to stderr when resolved version is missing from xcodeproj" do
expect {
@my_plugin.check_for_updates("#{File.dirname(__FILE__)}/support/fixtures/NoResolvedVersion.xcodeproj")
}.to output(
%r{Unable to locate the current version for kean/Nuke.*}
).to_stderr
end
end
end
end
80 changes: 80 additions & 0 deletions spec/support/fixtures/NoResolvedVersion.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objects = {
/* Begin PBXGroup section */
F1465EF423AA94BF0055F7C3 = {
isa = PBXGroup;
children = (
F1465EFF23AA94BF0055F7C3 /* Demo */,
);
sourceTree = "<group>";
};
F1465EFF23AA94BF0055F7C3 /* Demo */ = {
isa = PBXGroup;
children = ();
path = Demo;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXProject section */
F1465EF523AA94BF0055F7C3 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1420;
LastUpgradeCheck = 1420;
TargetAttributes = {
F1465EFC23AA94BF0055F7C3 = {
CreatedOnToolsVersion = 11.2.1;
};
};
};
buildConfigurationList = F1465EF823AA94BF0055F7C3 /* Build configuration list for PBXProject "Demo" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
es,
"zh-Hans",
fr,
);
mainGroup = F1465EF423AA94BF0055F7C3;
packageReferences = (
11BBD37629C1571400F7A968 /* XCRemoteSwiftPackageReference "Nuke" */,
);
productRefGroup = F1465EFE23AA94BF0055F7C3 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = ();
};
/* End PBXProject section */

/* Begin XCConfigurationList section */
F1465EF823AA94BF0055F7C3 /* Build configuration list for PBXNativeTarget "Demo" */ = {
isa = XCConfigurationList;
buildConfigurations = ();
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
11BBD37629C1571400F7A968 /* XCRemoteSwiftPackageReference "Nuke" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/kean/Nuke";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 12.1.6;
};
};
/* End XCRemoteSwiftPackageReference section */
};
rootObject = F1465EF523AA94BF0055F7C3 /* Project object */;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
{
"pins" : [
{
"identity" : "abseil-cpp-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/abseil-cpp-binary.git",
"state" : {
"revision" : "bfc0b6f81adc06ce5121eb23f628473638d67c5c",
"version" : "1.2022062300.0"
}
},
{
"identity" : "analytics-swift",
"kind" : "remoteSourceControl",
"location" : "[email protected]:hbmartin/analytics-swift.git",
"state" : {
"branch" : "main",
"revision" : "81ed4a83fc87ef074bb71b2b0bced199811dc3bb"
}
},
{
"identity" : "firebase-ios-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk",
"state" : {
"revision" : "8a8ec57a272e0d31480fb0893dda0cf4f769b57e",
"version" : "10.15.0"
}
},
{
"identity" : "googleappmeasurement",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "03b9beee1a61f62d32c521e172e192a1663a5e8b",
"version" : "10.13.0"
}
},
{
"identity" : "googledatatransport",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleDataTransport.git",
"state" : {
"revision" : "aae45a320fd0d11811820335b1eabc8753902a40",
"version" : "9.2.5"
}
},
{
"identity" : "googleutilities",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleUtilities.git",
"state" : {
"revision" : "c38ce365d77b04a9a300c31061c5227589e5597b",
"version" : "7.11.5"
}
},
{
"identity" : "grpc-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/grpc-binary.git",
"state" : {
"revision" : "f1b366129d1125be7db83247e003fc333104b569",
"version" : "1.50.2"
}
},
{
"identity" : "gtm-session-fetcher",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/gtm-session-fetcher.git",
"state" : {
"revision" : "d415594121c9e8a4f9d79cecee0965cf35e74dbd",
"version" : "3.1.1"
}
},
{
"identity" : "interop-ios-for-google-sdks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/interop-ios-for-google-sdks.git",
"state" : {
"revision" : "2d12673670417654f08f5f90fdd62926dc3a2648",
"version" : "100.0.0"
}
},
{
"identity" : "leveldb",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/leveldb.git",
"state" : {
"revision" : "0706abcc6b0bd9cedfbb015ba840e4a780b5159b",
"version" : "1.22.2"
}
},
{
"identity" : "lookingglassui",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ryanlintott/LookingGlassUI",
"state" : {
"revision" : "3257e1b5392a8b39e4620e09cfdb672d2be42855",
"version" : "0.3.1"
}
},
{
"identity" : "maplibre-gl-native-distribution",
"kind" : "remoteSourceControl",
"location" : "https://github.com/maplibre/maplibre-gl-native-distribution",
"state" : {
"revision" : "ffda61e298c1490d4860d5184e80d618aaadc089",
"version" : "5.13.0"
}
},
{
"identity" : "nanopb",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/nanopb.git",
"state" : {
"revision" : "819d0a2173aff699fb8c364b6fb906f7cdb1a692",
"version" : "2.30909.0"
}
},
{
"identity" : "phonenumberkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/marmelroy/PhoneNumberKit.git",
"state" : {
"revision" : "b456f2f9be10c1d183158220b831afd22697dd68",
"version" : "3.7.4"
}
},
{
"identity" : "promises",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/promises.git",
"state" : {
"revision" : "e70e889c0196c76d22759eb50d6a0270ca9f1d9e",
"version" : "2.3.1"
}
},
{
"identity" : "sentry-cocoa",
"kind" : "remoteSourceControl",
"location" : "https://github.com/getsentry/sentry-cocoa.git",
"state" : {
"revision" : "14aa6e47b03b820fd2b338728637570b9e969994",
"version" : "8.12.0"
}
},
{
"identity" : "sovran-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/segmentio/Sovran-Swift.git",
"state" : {
"revision" : "64f3b5150c282a34af4578188dce2fd597e600e3",
"version" : "1.1.0"
}
},
{
"identity" : "swift-algorithms",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-algorithms.git",
"state" : {
"revision" : "bcd4f369ac962bc3e5244c9df778739f8f5bdbf1",
"version" : "1.1.0"
}
},
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser.git",
"state" : {
"revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531",
"version" : "1.2.3"
}
},
{
"identity" : "swift-asn1",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-asn1.git",
"state" : {
"revision" : "3664efa98bd302ec90e5b27ee1c0649fbcc365bc"
}
},
{
"identity" : "swift-case-paths",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-case-paths",
"state" : {
"revision" : "5da6989aae464f324eef5c5b52bdb7974725ab81",
"version" : "1.0.0"
}
},
{
"identity" : "swift-custom-dump",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump",
"state" : {
"revision" : "3efbfba0e4e56c7187cc19137ee16b7c95346b79",
"version" : "1.1.0"
}
},
{
"identity" : "swift-numerics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-numerics.git",
"state" : {
"revision" : "0a5bc04095a675662cf24757cc0640aa2204253b",
"version" : "1.0.2"
}
},
{
"identity" : "swift-protobuf",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-protobuf.git",
"state" : {
"revision" : "cf62cdaea48b77f1a631e5cb3aeda6047c2cba1d",
"version" : "1.23.0"
}
},
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
"state" : {
"revision" : "696b86a6d151578bca7c1a2a3ed419a5f834d40f",
"version" : "1.13.0"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "74203046135342e4a4a627476dd6caf8b28fe11b",
"version" : "509.0.0"
}
},
{
"identity" : "swiftui-navigation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swiftui-navigation",
"state" : {
"revision" : "6eb293c49505d86e9e24232cb6af6be7fff93bd5",
"version" : "1.0.2"
}
},
{
"identity" : "xctest-dynamic-overlay",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "23cbf2294e350076ea4dbd7d5d047c1e76b03631",
"version" : "1.0.2"
}
}
],
"version" : 2
}

0 comments on commit 058a00a

Please sign in to comment.