diff --git a/audit_test.go b/audit_test.go index 6c196e8d3..f2bebfb26 100644 --- a/audit_test.go +++ b/audit_test.go @@ -30,6 +30,7 @@ import ( "github.com/jfrog/jfrog-cli-core/v2/common/format" "github.com/jfrog/jfrog-cli-core/v2/common/progressbar" + "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" coreTests "github.com/jfrog/jfrog-cli-core/v2/utils/tests" "github.com/jfrog/jfrog-cli-security/sca/bom/buildinfo" @@ -573,12 +574,22 @@ func testXrayAuditPip(t *testing.T, outFormat format.OutputFormat, requirementsF func TestXrayAuditCocoapods(t *testing.T) { securityIntegrationTestUtils.InitAuditCocoapodsTest(t, scangraph.CocoapodsScanMinXrayVersion) - output := testXrayAuditCocoapods(t, format.Json) + output := testXrayAuditCocoapods(t, format.Json, "cocoapods-project") validations.VerifyJsonResults(t, output, validations.ValidationParams{Total: &validations.TotalCount{Vulnerabilities: 1}}) } -func testXrayAuditCocoapods(t *testing.T, format format.OutputFormat) string { - _, cleanUp := securityTestUtils.CreateTestProjectEnvAndChdir(t, filepath.Join(filepath.FromSlash(securityTests.GetTestResourcesPath()), "projects", "package-managers", "cocoapods")) +func TestXrayAuditCocoapodsNoLockFile(t *testing.T) { + securityIntegrationTestUtils.InitAuditCocoapodsTest(t, scangraph.CocoapodsScanMinXrayVersion) + if coreutils.IsWindows() { + t.Skip("Skipping: CocoaPods auto-install (pod install) requires macOS/Linux with Xcode.") + return + } + output := testXrayAuditCocoapods(t, format.SimpleJson, "cocoapods-no-lock-file") + validations.VerifySimpleJsonResults(t, output, validations.ValidationParams{Total: &validations.TotalCount{Vulnerabilities: 1}}) +} + +func testXrayAuditCocoapods(t *testing.T, format format.OutputFormat, projectName string) string { + _, cleanUp := securityTestUtils.CreateTestProjectEnvAndChdir(t, filepath.Join(filepath.FromSlash(securityTests.GetTestResourcesPath()), "projects", "package-managers", "cocoapods", projectName)) defer cleanUp() cleanUpHome := securityIntegrationTestUtils.UseTestHomeWithDefaultXrayConfig(t) defer cleanUpHome() diff --git a/cli/docs/flags.go b/cli/docs/flags.go index efbe3eb93..d9a1e40a5 100644 --- a/cli/docs/flags.go +++ b/cli/docs/flags.go @@ -311,7 +311,7 @@ var flagsMap = map[string]components.Flag{ WorkingDirs: components.NewStringFlag(WorkingDirs, "A comma-separated(,) list of relative working directories, to determine the audit targets locations. If flag isn't provided, a recursive scan is triggered from the root directory of the project."), OutputDir: components.NewStringFlag(OutputDir, "Target directory to save partial results to.", components.SetHiddenStrFlag()), UploadRepoPath: components.NewStringFlag(UploadRepoPath, "Artifactory repository name or path to upload the cyclonedx file to. If no name or path are provided, a local generic repository will be created which will automatically be indexed by Xray.", components.WithStrDefaultValue("import-cdx-scan-results")), - SkipAutoInstall: components.NewBoolFlag(SkipAutoInstall, "Set to true to skip auto-install of dependencies in un-built modules. Currently supported for Yarn and NPM only.", components.SetHiddenBoolFlag()), + SkipAutoInstall: components.NewBoolFlag(SkipAutoInstall, "Set to true to skip auto-install of dependencies in un-built modules. Currently supported only for some package managers.", components.SetHiddenBoolFlag()), AllowPartialResults: components.NewBoolFlag(AllowPartialResults, "Set to true to allow partial results and continuance of the scan in case of certain errors.", components.SetHiddenBoolFlag()), ExclusionsAudit: components.NewStringFlag( Exclusions, diff --git a/sca/bom/buildinfo/technologies/cocoapods/cocoapods.go b/sca/bom/buildinfo/technologies/cocoapods/cocoapods.go index 12c5e6a54..a5ca1ab13 100644 --- a/sca/bom/buildinfo/technologies/cocoapods/cocoapods.go +++ b/sca/bom/buildinfo/technologies/cocoapods/cocoapods.go @@ -2,12 +2,13 @@ package cocoapods import ( "fmt" - "golang.org/x/exp/slices" "os" "path/filepath" "regexp" "strings" + "golang.org/x/exp/slices" + "github.com/jfrog/gofrog/datastructures" "github.com/jfrog/jfrog-cli-core/v2/utils/coreutils" "github.com/jfrog/jfrog-cli-security/sca/bom/buildinfo/technologies" @@ -22,6 +23,9 @@ import ( // dependencies. const ( VersionForMainModule = "0.0.0" + + descriptorFileName = "Podfile" + lockFileName = "Podfile.lock" ) var ( @@ -34,7 +38,7 @@ func GetTechDependencyLocation(directDependencyName, directDependencyVersion str var podPositions []*sarif.Location for _, descriptorPath := range descriptorPaths { descriptorPath = filepath.Clean(descriptorPath) - if !strings.HasSuffix(descriptorPath, "Podfile") { + if !strings.HasSuffix(descriptorPath, descriptorFileName) { log.Logger.Warn("Cannot support other files besides Podfile: %s", descriptorPath) continue } @@ -92,7 +96,7 @@ func parsePodLine(line, directDependencyName, directDependencyVersion, descripto func FixTechDependency(dependencyName, dependencyVersion, fixVersion string, descriptorPaths ...string) error { for _, descriptorPath := range descriptorPaths { descriptorPath = filepath.Clean(descriptorPath) - if !strings.HasSuffix(descriptorPath, "Podfile") { + if !strings.HasSuffix(descriptorPath, descriptorFileName) { log.Logger.Warn("Cannot support other files besides Podfile: %s", descriptorPath) continue } @@ -180,11 +184,11 @@ func extractPodsSection(filePath string) (string, error) { } func GetDependenciesData(currentDir string) (string, error) { - _, err := os.Stat(filepath.Join(currentDir, "Podfile.lock")) + _, err := os.Stat(filepath.Join(currentDir, lockFileName)) if err != nil { return "", err } - result, err := extractPodsSection(filepath.Join(currentDir, "Podfile.lock")) + result, err := extractPodsSection(filepath.Join(currentDir, lockFileName)) if err != nil { return "", err } @@ -199,11 +203,21 @@ func BuildDependencyTree(params technologies.BuildInfoBomGeneratorParams) (depen packageName := filepath.Base(currentDir) packageInfo := fmt.Sprintf("%s:%s", packageName, VersionForMainModule) - _, _, err = getPodVersionAndExecPath() + _, podExecPath, err := getPodVersionAndExecPath() if err != nil { err = fmt.Errorf("failed while retrieving pod path: %s", err.Error()) return } + // Check if lock file exists, if not run 'pod install' + lockFilePath := filepath.Join(currentDir, lockFileName) + if _, err := os.Stat(lockFilePath); os.IsNotExist(err) { + if params.SkipAutoInstall { + return nil, nil, fmt.Errorf("the Podfile.lock file was not found and skip auto install is enabled") + } + if _, err = runPodCmd(podExecPath, currentDir, []string{"install"}); err != nil { + return nil, nil, fmt.Errorf("failed to run 'pod install': %w", err) + } + } // Calculate pod dependencies data, err := GetDependenciesData(currentDir) if err != nil { diff --git a/sca/bom/buildinfo/technologies/cocoapods/cocoapods_test.go b/sca/bom/buildinfo/technologies/cocoapods/cocoapods_test.go index d495f69f4..6aefe8a3c 100644 --- a/sca/bom/buildinfo/technologies/cocoapods/cocoapods_test.go +++ b/sca/bom/buildinfo/technologies/cocoapods/cocoapods_test.go @@ -20,7 +20,7 @@ import ( func TestBuildCocoapodsDependencyList(t *testing.T) { // Create and change directory to test workspace - _, cleanUp := technologies.CreateTestWorkspace(t, filepath.Join("projects", "package-managers", "cocoapods")) + _, cleanUp := technologies.CreateTestWorkspace(t, filepath.Join("projects", "package-managers", "cocoapods", "cocoapods-project")) defer cleanUp() // Run getModulesDependencyTrees @@ -62,7 +62,7 @@ func TestBuildCocoapodsDependencyList(t *testing.T) { } func TestGetTechDependencyLocation(t *testing.T) { - _, cleanUp := technologies.CreateTestWorkspace(t, filepath.Join("projects", "package-managers", "cocoapods")) + _, cleanUp := technologies.CreateTestWorkspace(t, filepath.Join("projects", "package-managers", "cocoapods", "cocoapods-project")) defer cleanUp() currentDir, err := coreutils.GetWorkingDirectory() assert.NoError(t, err) @@ -93,7 +93,7 @@ func TestPodLineParseFoundOnlyDependencyName(t *testing.T) { } func TestFixTechDependencySingleLocation(t *testing.T) { - _, cleanUp := technologies.CreateTestWorkspace(t, filepath.Join("projects", "package-managers", "cocoapods")) + _, cleanUp := technologies.CreateTestWorkspace(t, filepath.Join("projects", "package-managers", "cocoapods", "cocoapods-project")) defer cleanUp() currentDir, err := coreutils.GetWorkingDirectory() assert.NoError(t, err) @@ -105,7 +105,7 @@ func TestFixTechDependencySingleLocation(t *testing.T) { } func TestFixTechDependencyMultipleLocations(t *testing.T) { - _, cleanUp := technologies.CreateTestWorkspace(t, filepath.Join("projects", "package-managers", "cocoapods")) + _, cleanUp := technologies.CreateTestWorkspace(t, filepath.Join("projects", "package-managers", "cocoapods", "cocoapods-project")) defer cleanUp() currentDir, err := coreutils.GetWorkingDirectory() assert.NoError(t, err) @@ -118,7 +118,7 @@ func TestFixTechDependencyMultipleLocations(t *testing.T) { } func TestFixTechDependencyNoLocations(t *testing.T) { - _, cleanUp := technologies.CreateTestWorkspace(t, filepath.Join("projects", "package-managers", "cocoapods")) + _, cleanUp := technologies.CreateTestWorkspace(t, filepath.Join("projects", "package-managers", "cocoapods", "cocoapods-project")) defer cleanUp() currentDir, err := coreutils.GetWorkingDirectory() assert.NoError(t, err) diff --git a/sca/bom/buildinfo/technologies/cocoapods/podcommand.go b/sca/bom/buildinfo/technologies/cocoapods/podcommand.go index a11ed68c8..9f0a57f45 100644 --- a/sca/bom/buildinfo/technologies/cocoapods/podcommand.go +++ b/sca/bom/buildinfo/technologies/cocoapods/podcommand.go @@ -22,15 +22,23 @@ type PodCommand struct { executablePath string } -func getPodVersionAndExecPath() (*version.Version, string, error) { +func getPodExecPath() (string, error) { podExecPath, err := exec.LookPath("pod") if err != nil { - return nil, "", fmt.Errorf("could not find the 'pod' executable in the system PATH %w", err) + return "", fmt.Errorf("could not find the 'pod' executable in the system PATH %w", err) + } + return podExecPath, nil +} + +func getPodVersionAndExecPath() (*version.Version, string, error) { + podExecPath, err := getPodExecPath() + if err != nil { + return nil, "", err } log.Debug("Using pod executable:", podExecPath) versionData, err := runPodCmd(podExecPath, "", []string{"--version"}) if err != nil { - return nil, "", err + return nil, "", fmt.Errorf("failed to get pod version: %w", err) } return version.NewVersion(strings.TrimSpace(string(versionData))), podExecPath, nil } diff --git a/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Podfile b/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Podfile new file mode 100644 index 000000000..dc6d9aca2 --- /dev/null +++ b/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Podfile @@ -0,0 +1,9 @@ +platform :ios, '9.0' + +target 'Test' do + use_frameworks! +pod 'GoogleSignIn', '~> 6.2.4' +pod 'AppAuth', '~> 1.7.5' +pod 'nanopb', '~> 0.3.0' + +end \ No newline at end of file diff --git a/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Test.xcodeproj/project.pbxproj b/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Test.xcodeproj/project.pbxproj new file mode 100644 index 000000000..e848a3bcc --- /dev/null +++ b/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Test.xcodeproj/project.pbxproj @@ -0,0 +1,311 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + A10000000000000000000002 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A10000000000000000000001 /* AppDelegate.swift */; }; + A10000000000000000000004 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A10000000000000000000003 /* LaunchScreen.storyboard */; }; + F51413AF8754363C12A3E256 /* Pods_Test.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CC3B301B576613215FD6C43 /* Pods_Test.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 3CC3B301B576613215FD6C43 /* Pods_Test.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Test.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 47D034BAC64B6AEE5A00F461 /* Pods-Test.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Test.debug.xcconfig"; path = "Target Support Files/Pods-Test/Pods-Test.debug.xcconfig"; sourceTree = ""; }; + A10000000000000000000001 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + A10000000000000000000003 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; + A10000000000000000000005 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + A10000000000000000000006 /* Test.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Test.app; sourceTree = BUILT_PRODUCTS_DIR; }; + CE57013AB51B58F18AC16E73 /* Pods-Test.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Test.release.xcconfig"; path = "Target Support Files/Pods-Test/Pods-Test.release.xcconfig"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + A10000000000000000000020 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + F51413AF8754363C12A3E256 /* Pods_Test.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 964F89CB559E387E0CBAC86B /* Frameworks */ = { + isa = PBXGroup; + children = ( + 3CC3B301B576613215FD6C43 /* Pods_Test.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + A10000000000000000000030 = { + isa = PBXGroup; + children = ( + A10000000000000000000031 /* Test */, + A10000000000000000000032 /* Products */, + C6686A7500ABCD32985A289C /* Pods */, + 964F89CB559E387E0CBAC86B /* Frameworks */, + ); + sourceTree = ""; + }; + A10000000000000000000031 /* Test */ = { + isa = PBXGroup; + children = ( + A10000000000000000000001 /* AppDelegate.swift */, + A10000000000000000000005 /* Info.plist */, + A10000000000000000000033 /* Base.lproj */, + ); + path = Test; + sourceTree = ""; + }; + A10000000000000000000032 /* Products */ = { + isa = PBXGroup; + children = ( + A10000000000000000000006 /* Test.app */, + ); + name = Products; + sourceTree = ""; + }; + A10000000000000000000033 /* Base.lproj */ = { + isa = PBXGroup; + children = ( + A10000000000000000000003 /* LaunchScreen.storyboard */, + ); + path = Base.lproj; + sourceTree = ""; + }; + C6686A7500ABCD32985A289C /* Pods */ = { + isa = PBXGroup; + children = ( + 47D034BAC64B6AEE5A00F461 /* Pods-Test.debug.xcconfig */, + CE57013AB51B58F18AC16E73 /* Pods-Test.release.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + A10000000000000000000040 /* Test */ = { + isa = PBXNativeTarget; + buildConfigurationList = A10000000000000000000050 /* Build configuration list for PBXNativeTarget "Test" */; + buildPhases = ( + B5391DB07AAEF4AD50CE4F29 /* [CP] Check Pods Manifest.lock */, + A10000000000000000000021 /* Sources */, + A10000000000000000000020 /* Frameworks */, + A10000000000000000000022 /* Resources */, + 6D104EA4B5AA9D4569E1F218 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Test; + productName = Test; + productReference = A10000000000000000000006 /* Test.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + A10000000000000000000041 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1500; + LastUpgradeCheck = 1500; + TargetAttributes = { + A10000000000000000000040 = { + CreatedOnToolsVersion = 15.0; + }; + }; + }; + buildConfigurationList = A10000000000000000000051 /* Build configuration list for PBXProject "Test" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = A10000000000000000000030; + productRefGroup = A10000000000000000000032 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + A10000000000000000000040 /* Test */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + A10000000000000000000022 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A10000000000000000000004 /* LaunchScreen.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 6D104EA4B5AA9D4569E1F218 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Test/Pods-Test-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Test/Pods-Test-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Test/Pods-Test-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; + B5391DB07AAEF4AD50CE4F29 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Test-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + A10000000000000000000021 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A10000000000000000000002 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + A10000000000000000000060 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + A10000000000000000000061 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + A10000000000000000000062 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 47D034BAC64B6AEE5A00F461 /* Pods-Test.debug.xcconfig */; + buildSettings = { + CURRENT_PROJECT_VERSION = 1; + INFOPLIST_FILE = Test/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.Test; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + A10000000000000000000063 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CE57013AB51B58F18AC16E73 /* Pods-Test.release.xcconfig */; + buildSettings = { + CURRENT_PROJECT_VERSION = 1; + INFOPLIST_FILE = Test/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.Test; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A10000000000000000000050 /* Build configuration list for PBXNativeTarget "Test" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A10000000000000000000062 /* Debug */, + A10000000000000000000063 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A10000000000000000000051 /* Build configuration list for PBXProject "Test" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A10000000000000000000060 /* Debug */, + A10000000000000000000061 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = A10000000000000000000041 /* Project object */; +} diff --git a/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Test.xcworkspace/contents.xcworkspacedata b/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Test.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..1451589a8 --- /dev/null +++ b/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Test.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Test/AppDelegate.swift b/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Test/AppDelegate.swift new file mode 100644 index 000000000..c87962629 --- /dev/null +++ b/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Test/AppDelegate.swift @@ -0,0 +1,16 @@ +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + var window: UIWindow? + + func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + window = UIWindow(frame: UIScreen.main.bounds) + window?.rootViewController = UIViewController() + window?.makeKeyAndVisible() + return true + } +} diff --git a/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Test/Base.lproj/LaunchScreen.storyboard b/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Test/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 000000000..5ee718d3f --- /dev/null +++ b/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Test/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Test/Info.plist b/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Test/Info.plist new file mode 100644 index 000000000..44cf433e6 --- /dev/null +++ b/tests/testdata/projects/package-managers/cocoapods/cocoapods-no-lock-file/Test/Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + + diff --git a/tests/testdata/projects/package-managers/cocoapods/Podfile b/tests/testdata/projects/package-managers/cocoapods/cocoapods-project/Podfile similarity index 100% rename from tests/testdata/projects/package-managers/cocoapods/Podfile rename to tests/testdata/projects/package-managers/cocoapods/cocoapods-project/Podfile diff --git a/tests/testdata/projects/package-managers/cocoapods/Podfile.lock b/tests/testdata/projects/package-managers/cocoapods/cocoapods-project/Podfile.lock similarity index 100% rename from tests/testdata/projects/package-managers/cocoapods/Podfile.lock rename to tests/testdata/projects/package-managers/cocoapods/cocoapods-project/Podfile.lock