private void analyzePodfileLockDependencies ( Dependency podfileLock , Engine engine ) throws AnalysisException { engine . removeDependency ( podfileLock ) ; final String contents ; try { contents = FileUtils . readFileToString ( podfileLock . getActualFile ( ) , Charset . defaultCharset ( ) ) ; } catch ( IOException e ) { throw new AnalysisException ( "Problem occurred while reading dependency file." , e ) ; } final Matcher matcher = PODFILE_LOCK_DEPENDENCY_PATTERN . matcher ( contents ) ; while ( matcher . find ( ) ) { final String name = matcher . group ( 1 ) ; final String version = matcher . group ( 2 ) ; final Dependency dependency = new Dependency ( podfileLock . getActualFile ( ) , true ) ; dependency . setEcosystem ( DEPENDENCY_ECOSYSTEM ) ; dependency . setName ( name ) ; dependency . setVersion ( version ) ; final String packagePath = String . format ( "%s:%s" , name , version ) ; dependency . setPackagePath ( packagePath ) ; dependency . setDisplayFileName ( packagePath ) ; dependency . setSha1sum ( Checksum . getSHA1Checksum ( packagePath ) ) ; dependency . setSha256sum ( Checksum . getSHA256Checksum ( packagePath ) ) ; dependency . setMd5sum ( Checksum . getMD5Checksum ( packagePath ) ) ; dependency . addEvidence ( EvidenceType . VENDOR , PODFILE_LOCK , "name" , name , Confidence . HIGHEST ) ; dependency . addEvidence ( EvidenceType . PRODUCT , PODFILE_LOCK , "name" , name , Confidence . HIGHEST ) ; dependency . addEvidence ( EvidenceType . VERSION , PODFILE_LOCK , "version" , version , Confidence . HIGHEST ) ; engine . addDependency ( dependency ) ; } }
Analyzes the podfile . lock file to extract evidence for the dependency .