diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-expected-output-app.yml b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/expected-output-lockfile-v1.yml similarity index 97% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-expected-output-app.yml rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/expected-output-lockfile-v1.yml index 8ce635e09e03..9bc985411fac 100644 --- a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-expected-output-app.yml +++ b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/expected-output-lockfile-v1.yml @@ -1,6 +1,6 @@ --- project: - id: "SwiftPM::src/funTest/assets/projects/synthetic/spm-app/Package.resolved:" + id: "SwiftPM::src/funTest/assets/projects/synthetic/lockfile-v1/Package.resolved:" definition_file_path: "" declared_licenses: [] declared_licenses_processed: {} diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-expected-output-lib-no-lockfile.yml b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/expected-output-project-without-lockfile.yml similarity index 71% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-expected-output-lib-no-lockfile.yml rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/expected-output-project-without-lockfile.yml index 48a2167c20de..5860b95e0b7b 100644 --- a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-expected-output-lib-no-lockfile.yml +++ b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/expected-output-project-without-lockfile.yml @@ -1,7 +1,7 @@ --- project: - id: "SwiftPM::src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Package.swift:" - definition_file_path: "plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Package.swift" + id: "SwiftPM::src/funTest/assets/projects/synthetic/project-without-lockfile/Package.swift:" + definition_file_path: "plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Package.swift" declared_licenses: [] declared_licenses_processed: {} vcs: @@ -20,8 +20,8 @@ packages: [] issues: - timestamp: "1970-01-01T00:00:00Z" source: "SwiftPM" - message: "SwiftPM failed to resolve dependencies for path 'src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Package.swift':\ - \ IllegalArgumentException: No lockfile found in 'src/funTest/assets/projects/synthetic/spm-lib-no-lockfile'.\ + message: "SwiftPM failed to resolve dependencies for path 'src/funTest/assets/projects/synthetic/project-without-lockfile/Package.swift':\ + \ IllegalArgumentException: No lockfile found in 'src/funTest/assets/projects/synthetic/project-without-lockfile'.\ \ This potentially results in unstable versions of dependencies. To support this,\ \ enable the 'allowDynamicVersions' option in 'config.yml'." severity: "ERROR" diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-expected-output-lib.yml b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/expected-output-project.yml similarity index 99% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-expected-output-lib.yml rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/expected-output-project.yml index ce4cac326d85..ea950226be87 100644 --- a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-expected-output-lib.yml +++ b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/expected-output-project.yml @@ -1,6 +1,6 @@ --- project: - id: "SwiftPM::src/funTest/assets/projects/synthetic/spm-lib/Package.swift:" + id: "SwiftPM::src/funTest/assets/projects/synthetic/project-with-lockfile/Package.swift:" definition_file_path: "" declared_licenses: [] declared_licenses_processed: {} diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-app/.gitignore b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/lockfile-v1/.gitignore similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-app/.gitignore rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/lockfile-v1/.gitignore diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-app/Package.resolved b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/lockfile-v1/Package.resolved similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-app/Package.resolved rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/lockfile-v1/Package.resolved diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/.gitignore b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/.gitignore similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/.gitignore rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/.gitignore diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Package.resolved b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Package.resolved similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Package.resolved rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Package.resolved diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Package.swift b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Package.swift similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Package.swift rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Package.swift diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Sources/CBase32/main.swift b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Sources/CBase32/main.swift similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Sources/CBase32/main.swift rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Sources/CBase32/main.swift diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Sources/CBcrypt/main.swift b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Sources/CBcrypt/main.swift similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Sources/CBcrypt/main.swift rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Sources/CBcrypt/main.swift diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Sources/COperatingSystem/main.swift b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Sources/COperatingSystem/main.swift similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Sources/COperatingSystem/main.swift rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Sources/COperatingSystem/main.swift diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Sources/CURLParser/main.swift b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Sources/CURLParser/main.swift similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Sources/CURLParser/main.swift rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Sources/CURLParser/main.swift diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Sources/Development/main.swift b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Sources/Development/main.swift similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Sources/Development/main.swift rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Sources/Development/main.swift diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Sources/Vapor/main.swift b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Sources/Vapor/main.swift similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Sources/Vapor/main.swift rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Sources/Vapor/main.swift diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Sources/XCTVapor/main.swift b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Sources/XCTVapor/main.swift similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Sources/XCTVapor/main.swift rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Sources/XCTVapor/main.swift diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Tests/AsyncTests/README.md b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Tests/AsyncTests/README.md similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Tests/AsyncTests/README.md rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Tests/AsyncTests/README.md diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Tests/VaporTests/README.md b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Tests/VaporTests/README.md similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib-no-lockfile/Tests/VaporTests/README.md rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-with-lockfile/Tests/VaporTests/README.md diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Package.swift b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Package.swift similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Package.swift rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Package.swift diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Sources/CBase32/main.swift b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Sources/CBase32/main.swift similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Sources/CBase32/main.swift rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Sources/CBase32/main.swift diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Sources/CBcrypt/main.swift b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Sources/CBcrypt/main.swift similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Sources/CBcrypt/main.swift rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Sources/CBcrypt/main.swift diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Sources/COperatingSystem/main.swift b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Sources/COperatingSystem/main.swift similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Sources/COperatingSystem/main.swift rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Sources/COperatingSystem/main.swift diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Sources/CURLParser/main.swift b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Sources/CURLParser/main.swift similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Sources/CURLParser/main.swift rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Sources/CURLParser/main.swift diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Sources/Development/main.swift b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Sources/Development/main.swift similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Sources/Development/main.swift rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Sources/Development/main.swift diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Sources/Vapor/main.swift b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Sources/Vapor/main.swift similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Sources/Vapor/main.swift rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Sources/Vapor/main.swift diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Sources/XCTVapor/main.swift b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Sources/XCTVapor/main.swift similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Sources/XCTVapor/main.swift rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Sources/XCTVapor/main.swift diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Tests/AsyncTests/README.md b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Tests/AsyncTests/README.md similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Tests/AsyncTests/README.md rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Tests/AsyncTests/README.md diff --git a/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Tests/VaporTests/README.md b/plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Tests/VaporTests/README.md similarity index 100% rename from plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/spm-lib/Tests/VaporTests/README.md rename to plugins/package-managers/swiftpm/src/funTest/assets/projects/synthetic/project-without-lockfile/Tests/VaporTests/README.md diff --git a/plugins/package-managers/swiftpm/src/funTest/kotlin/SwiftPmFunTest.kt b/plugins/package-managers/swiftpm/src/funTest/kotlin/SwiftPmFunTest.kt index f839aa9e6c77..76f958704ae7 100644 --- a/plugins/package-managers/swiftpm/src/funTest/kotlin/SwiftPmFunTest.kt +++ b/plugins/package-managers/swiftpm/src/funTest/kotlin/SwiftPmFunTest.kt @@ -31,10 +31,10 @@ import org.ossreviewtoolkit.utils.test.getAssetFile import org.ossreviewtoolkit.utils.test.matchExpectedResult class SwiftPmFunTest : WordSpec({ - "Parsing 'Package.resolved' dependencies" should { + "Analyzing a lockfile with file format version 1" should { "return the correct result" { - val definitionFile = getAssetFile("projects/synthetic/spm-app/Package.resolved") - val expectedResultFile = getAssetFile("projects/synthetic/spm-expected-output-app.yml") + val definitionFile = getAssetFile("projects/synthetic/lockfile-v1/Package.resolved") + val expectedResultFile = getAssetFile("projects/synthetic/expected-output-lockfile-v1.yml") val result = create(PROJECT_TYPE).resolveSingleProject(definitionFile) @@ -42,19 +42,23 @@ class SwiftPmFunTest : WordSpec({ } } - "Parsing 'Package.swift' dependencies" should { + "Analyzing a definition file with a sibling lockfile" should { "return the correct result" { - val definitionFile = getAssetFile("projects/synthetic/spm-lib/Package.swift") - val expectedResultFile = getAssetFile("projects/synthetic/spm-expected-output-lib.yml") + val definitionFile = getAssetFile("projects/synthetic/project-with-lockfile/Package.swift") + val expectedResultFile = getAssetFile("projects/synthetic/expected-output-project.yml") val result = create(PROJECT_TYPE).resolveSingleProject(definitionFile, resolveScopes = true) result.toYaml() should matchExpectedResult(expectedResultFile, definitionFile) } + } - "show an error if 'allowDynamicVersions' is disabled" { - val definitionFile = getAssetFile("projects/synthetic/spm-lib-no-lockfile/Package.swift") - val expectedResultFile = getAssetFile("projects/synthetic/spm-expected-output-lib-no-lockfile.yml") + "Analyzing a definition file without a lockfile" should { + "return an issue if 'allowDynamicVersions' is disabled" { + val definitionFile = getAssetFile("projects/synthetic/project-without-lockfile/Package.swift") + val expectedResultFile = getAssetFile( + "projects/synthetic/expected-output-project-without-lockfile.yml" + ) val result = create(PROJECT_TYPE, AnalyzerConfiguration(allowDynamicVersions = false)) .resolveSingleProject(definitionFile, resolveScopes = true)