Search in sources :

Example 1 with YarnLockEntryParseResult

use of com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntryParseResult in project synopsys-detect by blackducksoftware.

the class YarnLockParser method parseYarnLock.

public YarnLock parseYarnLock(List<String> yarnLockFileAsList) {
    List<YarnLockEntry> entries = new ArrayList<>();
    int lineIndex = 0;
    while (lineIndex < yarnLockFileAsList.size()) {
        YarnLockEntryParseResult entryParseResult = yarnLockEntryParser.parseNextEntry(yarnLockFileAsList, lineIndex);
        if (entryParseResult.getYarnLockEntry().isPresent()) {
            YarnLockEntry entry = entryParseResult.getYarnLockEntry().get();
            if (entry.isMetadataEntry()) {
                yarnLockFileFormatVersion = entry.getVersion();
            } else {
                entries.add(entry);
            }
        }
        lineIndex = entryParseResult.getLastParsedLineIndex();
        lineIndex++;
    }
    return new YarnLock(yarnLockFileFormatVersion, isYarn1Project(yarnLockFileFormatVersion), entries);
}
Also used : YarnLockEntryParseResult(com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntryParseResult) YarnLockEntry(com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntry) ArrayList(java.util.ArrayList)

Aggregations

YarnLockEntry (com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntry)1 YarnLockEntryParseResult (com.synopsys.integration.detectable.detectables.yarn.parse.entry.YarnLockEntryParseResult)1 ArrayList (java.util.ArrayList)1