Search in sources :

Example 1 with PubSpecLockParser

use of com.synopsys.integration.detectable.detectables.dart.pubspec.PubSpecLockParser in project synopsys-detect by blackducksoftware.

the class DetectableFactory method createDartPubSpecLockDetectable.

public DartPubSpecLockDetectable createDartPubSpecLockDetectable(DetectableEnvironment environment) {
    PubSpecLockParser pubSpecLockParser = new PubSpecLockParser();
    PubSpecYamlNameVersionParser pubSpecYamlNameVersionParser = new PubSpecYamlNameVersionParser();
    PubSpecExtractor pubSpecExtractor = new PubSpecExtractor(pubSpecLockParser, pubSpecYamlNameVersionParser);
    return new DartPubSpecLockDetectable(environment, fileFinder, pubSpecExtractor);
}
Also used : PubSpecYamlNameVersionParser(com.synopsys.integration.detectable.detectables.dart.PubSpecYamlNameVersionParser) PubSpecExtractor(com.synopsys.integration.detectable.detectables.dart.pubspec.PubSpecExtractor) PubSpecLockParser(com.synopsys.integration.detectable.detectables.dart.pubspec.PubSpecLockParser) DartPubSpecLockDetectable(com.synopsys.integration.detectable.detectables.dart.pubspec.DartPubSpecLockDetectable)

Example 2 with PubSpecLockParser

use of com.synopsys.integration.detectable.detectables.dart.pubspec.PubSpecLockParser in project synopsys-detect by blackducksoftware.

the class PubSpecLockParserTest method test.

@Test
public void test() {
    List<String> pubSpecLockLines = Arrays.asList("# Generated by pub", "# See https://dart.dev/tools/pub/glossary#lockfile", "packages:", "  async:", "    dependency: transitive", "    description:", "      name: async", "    source: hosted", "    version: \"2.6.1\"", "  boolean_selector:", "    dependency: transitive", "    description:", "      name: boolean_selector", "      url: \"https://pub.dartlang.org\"", "    version: \"2.1.0\"", "  characters:", "    description:", "      name: characters", "    version: \"1.1.0\"");
    PubSpecLockParser pubSpecLockParser = new PubSpecLockParser();
    DependencyGraph dependencyGraph = pubSpecLockParser.parse(pubSpecLockLines);
    NameVersionGraphAssert graphAssert = new NameVersionGraphAssert(Forge.DART, dependencyGraph);
    graphAssert.hasRootSize(3);
    graphAssert.hasRootDependency("async", "2.6.1");
    graphAssert.hasRootDependency("boolean_selector", "2.1.0");
    graphAssert.hasRootDependency("characters", "1.1.0");
}
Also used : PubSpecLockParser(com.synopsys.integration.detectable.detectables.dart.pubspec.PubSpecLockParser) NameVersionGraphAssert(com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert) DependencyGraph(com.synopsys.integration.bdio.graph.DependencyGraph) Test(org.junit.jupiter.api.Test)

Aggregations

PubSpecLockParser (com.synopsys.integration.detectable.detectables.dart.pubspec.PubSpecLockParser)2 DependencyGraph (com.synopsys.integration.bdio.graph.DependencyGraph)1 PubSpecYamlNameVersionParser (com.synopsys.integration.detectable.detectables.dart.PubSpecYamlNameVersionParser)1 DartPubSpecLockDetectable (com.synopsys.integration.detectable.detectables.dart.pubspec.DartPubSpecLockDetectable)1 PubSpecExtractor (com.synopsys.integration.detectable.detectables.dart.pubspec.PubSpecExtractor)1 NameVersionGraphAssert (com.synopsys.integration.detectable.util.graph.NameVersionGraphAssert)1 Test (org.junit.jupiter.api.Test)1