Generates the DependencyInfo by scanning and/or parsing the file.
This is called lazily by getDependencyInfo, and does not take into
account any extra requires/provides added by {@link #addRequire}
or {@link #addProvide}.
543252
private DependencyInfo generateDependencyInfo() {
    Preconditions.checkNotNull(compiler, "Expected setCompiler to be called first: %s", this);
    Preconditions.checkNotNull(
        compiler.getErrorManager(), "Expected compiler to call an error manager: %s", this);

    // If the code is a JsAst, then it was originally JS code, and is compatible with the
    // regex-based parsing of JsFileParser.
    if (ast instanceof JsAst && JsFileParser.isSupported()) {
      // Look at the source code.
      // Note: it's OK to use getName() instead of
      // getPathRelativeToClosureBase() here because we're not using
      // this to generate deps files. (We're only using it for
      // symbol dependencies.)
      try {
        DependencyInfo info =
            new JsFileParser(compiler.getErrorManager())
                .setModuleLoader(compiler.getModuleLoader())
                .setIncludeGoogBase(true)
                .parseFile(getName(), getName(), getCode());
        return new LazyParsedDependencyInfo(info, (JsAst) ast, compiler);
      } catch (IOException e) {
        compiler.getErrorManager().report(CheckLevel.ERROR,
            JSError.make(AbstractCompiler.READ_ERROR, getName(), e.getMessage()));
        return SimpleDependencyInfo.EMPTY;
      }
    } else {
      // Otherwise, just look at the AST.

      DepsFinder finder = new DepsFinder(getPath());
      Node root = getAstRoot(compiler);
      if (root == null) {
        return SimpleDependencyInfo.EMPTY;
      }

      finder.visitTree(root);
      JSDocInfo info = root.getJSDocInfo();

      // TODO(nicksantos|user): This caching behavior is a bit
      // odd, and only works if you assume the exact call flow that
      // clients are currently using.  In that flow, they call
      // getProvides(), then remove the goog.provide calls from the
      // AST, and then call getProvides() again.
      //
      // This won't work for any other call flow, or any sort of incremental
      // compilation scheme. The API needs to be fixed so callers aren't
      // doing weird things like this, and then we should get rid of the
      // multiple-scan strategy.
      return SimpleDependencyInfo.builder("", "")
          .setProvides(finder.provides)
          .setRequires(finder.requires)
          .setTypeRequires(finder.typeRequires)
          .setLoadFlags(finder.loadFlags)
          .setHasExternsAnnotation(info != null && info.isExterns())
          .setHasNoCompileAnnotation(info != null && info.isNoCompile())
          .build();
    }
  }
1164332
private <T> List<Object> getDependencies(T extension) {
    return new ArrayList<>(evaluateAnnotatedClasses(extension, DependsUpon.class));
  }
89932
private void buildDependencyTree()
        throws DependencyTreeBuilderException
    {
        if ( rootNode == null )
        {
            rootNode =
                dependencyTreeBuilder.buildDependencyTree( project, localRepository, artifactFactory,
                                                           artifactMetadataSource, null, artifactCollector );
        }
    }
485358
function getDependencis(file, moduleId) {
    var res = [];

    if (!fs.existsSync(file)) {
        return res;
    }

    var codeAST = amd.getAst(fs.readFileSync(file));
    var info = amd.analyseModule(codeAST);

    var dependencies = info.actualDependencies || [];

    return dependencies.slice(info.factoryAst.params.length).map(function (id) {
        return amd.resolveModuleId(id, moduleId);
    });
}
1320696
public function getDependsInfo()
    {
        $dependsInfo = $this->getCachedValue('dependsInfo');
        if ($dependsInfo === false) {

            $data = $this->dataProvider->getData();

            $dependsInfo = array();

            foreach ($this->getPackageSortOrder() as $packageId => $order) {
                if (!isset($data[$packageId])) {
                    continue;
                }

                $provides = $this->getProvidesForPackage($packageId);
                foreach ($provides as $file => $fileInfo) {
                    if (!isset($dependsInfo[$file])) {
                        $dependsInfo[$file] = array();
                    }
                    if (isset($fileInfo['Depends'])) {
                        $dependsInfo[$file] = array_merge(
                            $dependsInfo[$file],
                            $fileInfo['Depends']
                        );
                    }
                    // TODO: some day we could treat optional-depends
                    // differently
                    if (isset($fileInfo['OptionalDepends'])) {
                        $dependsInfo[$file] = array_merge(
                            $dependsInfo[$file],
                            $fileInfo['OptionalDepends']
                        );
                    }
                }
            }

            $this->setCachedValue('dependsInfo', $dependsInfo);
        }

        return $dependsInfo;
    }
880421
private Map<String, DependencyInfo> parseDepsFiles() throws IOException {
    DepsFileParser depsParser = createDepsFileParser();
    Map<String, DependencyInfo> depsFiles = new LinkedHashMap<>();
    for (SourceFile file : deps) {
      if (!shouldSkipDepsFile(file)) {
        List<DependencyInfo>
            depInfos = depsParser.parseFileReader(
                file.getName(), file.getCodeReader());
        if (depInfos.isEmpty()) {
          reportNoDepsInDepsFile(file.getName());
        } else {
          for (DependencyInfo info : depInfos) {
            depsFiles.put(info.getPathRelativeToClosureBase(), removeRelativePathProvide(info));
          }
        }
      }
    }

    // If a deps file also appears in srcs, our build tools will move it
    // into srcs.  So we need to scan all the src files for addDependency
    // calls as well.
    for (SourceFile src : srcs) {
      if (!shouldSkipDepsFile(src)) {
        List<DependencyInfo> srcInfos =
            depsParser.parseFileReader(src.getName(), src.getCodeReader());
        for (DependencyInfo info : srcInfos) {
          depsFiles.put(info.getPathRelativeToClosureBase(), removeRelativePathProvide(info));
        }
      }
    }

    return depsFiles;
  }
183310
@Requires({
    "sourceDependencyLoader != null",
    "type != null"
  })
  @Ensures({
    "importNames != null",
    "rootLineNumberIterator != null"
  })
  @SuppressWarnings("unchecked")
  protected void fetchSourceDependency() throws IOException {
    String fileName = type.getName().getBinaryName()
        + JavaUtils.SOURCE_DEPENDENCY_EXTENSION;
    InputStream in =
        sourceDependencyLoader.getResourceAsStream(fileName);
    if (in == null) {
      throw new FileNotFoundException();
    }
    ObjectInputStream oin = new ObjectInputStream(in);
    try {
      importNames = (Set<String>) oin.readObject();
      rootLineNumberIterator = ((List<Long>) oin.readObject()).iterator();
    } catch (ClassNotFoundException e) {
      throw new IOException(e);
    }
    oin.close();
  }
24261
private String collectDependenciesWithoutDefinedManager(String rootDirectory, List<DependencyInfo> dependencyInfos){
        String error = null;
        try {
            collectDepDependencies(rootDirectory, dependencyInfos);
            goDependencyManager = GoDependencyManager.DEP;
        } catch (Exception e){
            try {
                collectGoDepDependencies(rootDirectory, dependencyInfos);
                goDependencyManager = GoDependencyManager.GO_DEP;
            } catch (Exception e1){
                try {
                    collectVndrDependencies(rootDirectory, dependencyInfos);
                    goDependencyManager = GoDependencyManager.VNDR;
                } catch (Exception e2) {
                    try {
                        collectGoGradleDependencies(rootDirectory, dependencyInfos);
                        goDependencyManager = GoDependencyManager.GO_GRADLE;
                    } catch (Exception e3) {
                        try {
                            collectGlideDependencies(rootDirectory, dependencyInfos);
                            goDependencyManager = GoDependencyManager.GLIDE;
                        } catch (Exception e4) {
                            try {
                                collectGoVendorDependencies(rootDirectory, dependencyInfos);
                                goDependencyManager = GoDependencyManager.GO_VENDOR;
                            } catch (Exception e5) {
                                try {
                                    collectGoPMDependencies(rootDirectory, dependencyInfos);
                                    goDependencyManager = GoDependencyManager.GOPM;
                                } catch (Exception e6) {
                                    error = "Couldn't collect dependencies - no dependency manager is installed";
                                }
                            }
                        }
                    }
                }
            }
        }
        return error;
    }
375046
public Map<String,String> getDependenciesPath() {
        Map<String,String> dependenciesMap = new HashMap<String,String>();
        for (Dependency dependency : currentDependencies() ) {
            if ( dependency.getArtifact().getFile() != null ) {
                dependenciesMap.put( Notation.generate( dependency ), dependency.getArtifact().getFile().getAbsolutePath() );
            }
        }
        
        return dependenciesMap;
    }
905903
public void addDependency(final Dependency dependency) {
        if(dependency != null && !dependencies.contains(dependency)){
            this.dependencies.add(dependency);
        }
    }
1249899
protected static function initDependencyInjection()
    {
        // Get required dependency container for annotations!
        include_once DOOZR_DOCUMENT_ROOT.'Doozr/Di/Map/Annotation.php';
        include_once DOOZR_DOCUMENT_ROOT.'Doozr/Di/Parser/Annotation.php';
        include_once DOOZR_DOCUMENT_ROOT.'Doozr/Di/Dependency.php';

        $collection = new Doozr_Di_Collection();
        $parser     = new Doozr_Di_Parser_Annotation();
        $dependency = new Doozr_Di_Dependency();

        self::$map = new Doozr_Di_Map_Annotation($collection, $parser, $dependency);

        #self::$container = Doozr_Di_Container::getInstance();
        #self::$container->setFactory(new Doozr_Di_Factory(self::$registry));
    }
952446
private Collection<DependencyInfo> createDependencyInfos(Collection<PhpPackage> phpPackages, Collection<DependencyInfo> dependencyInfos, Collection<String> directDependencies) {
        HashMap<DependencyInfo, Collection<String>> parentToChildMap = new HashMap<>();
        HashMap<String, DependencyInfo> packageDependencyMap = new HashMap<>();
        // collect packages data and create its dependencyInfo
        for (PhpPackage phpPackage : phpPackages) {
            DependencyInfo dependencyInfo = createDependencyInfo(phpPackage);
            if (dependencyInfo != null) {
                parentToChildMap.put(dependencyInfo, phpPackage.getPackageRequire().keySet());
                packageDependencyMap.put(phpPackage.getName(), dependencyInfo);
            } else {
                logger.debug("Didn't succeed to create dependencyInfo for {}", phpPackage.getName());
            }
        }
        if (!packageDependencyMap.isEmpty()) {
            for (String directDependency : directDependencies) {
                // create hierarchy tree
                DependencyInfo dependencyInfo = packageDependencyMap.get(directDependency);
                if (dependencyInfo != null) {
                    collectChildren(dependencyInfo, packageDependencyMap, parentToChildMap);
                    dependencyInfos.add(dependencyInfo);
                } else {
                    logger.debug("Didn't found {} in map {}", directDependency, packageDependencyMap.getClass().getName());
                }
            }
        } else {
            logger.debug("The map {} is empty ", packageDependencyMap.getClass().getName());
        }
        return dependencyInfos;
    }
588879
def addDependencyInfo(self):
        
        logger.debug("Adding dependency info to the AboutDialog")
        self.progressLabel.setText("Retrieving package info...")
        self.editor.clear()

        self._addModuleInfo(mi.PythonModuleInfo())
        self._addModuleInfo(mi.QtModuleInfo())

        modules = ['numpy', 'scipy', 'pandas', 'pyqtgraph']
        for module in modules:
            self._addModuleInfo(module)

        self._addModuleInfo(mi.PillowInfo())
        self._addModuleInfo(mi.H5pyModuleInfo())
        self._addModuleInfo(mi.NetCDF4ModuleInfo())

        self.progressLabel.setText("")
        logger.debug("Finished adding dependency info to the AboutDialog")
490658
public static void addDependency(Dependency depend,
                                   ClassLoader loader)
  {
    for (; loader != null; loader = loader.getParent()) {
      if (loader instanceof EnvironmentClassLoader) {
        ((EnvironmentClassLoader) loader).addDependency(depend);
        return;
      }
    }
  }
1357282
@Override
    public Collection<DependencyInfo> parse(File file) {
        BufferedReader br = null;
        FileReader fr = null;
        Collection<DependencyInfo> dependencyInfos = new LinkedList<>();
        try {
            fr = new FileReader(file.getAbsoluteFile());
            br = new BufferedReader(fr);
            String line = null;
            Package packageInfo = new Package();
            // Create Alpine package - package-version-architecture.apk
            while ((line = br.readLine()) != null) {
                if (!line.isEmpty()) {
                    if (packageInfo.getPackageName() == null || packageInfo.getVersion() == null || packageInfo.getArchitecture() == null) {
                        String[] lineSplit = line.split(Constants.COLON);
                        String dependencyParameter = lineSplit[1].trim();
                        switch (lineSplit[0]) {
                            case PACKAGE:
                                packageInfo.setPackageName(dependencyParameter);
                                break;
                            case VERSION:
                                packageInfo.setVersion(dependencyParameter);
                                break;
                            case ARCHITECTURE:
                                packageInfo.setArchitecture(dependencyParameter);
                                break;
                            default:
                                break;
                        }
                    }
                } else {
                    DependencyInfo dependencyInfo = createDependencyInfo(packageInfo);
                    packageInfo = new Package();
                    dependencyInfos.add(dependencyInfo);
                }
            }
        } catch (Exception e) {
            logger.error(e.getMessage());
            logger.debug("{}", e.getStackTrace());
        } finally {
            closeStream(br, fr);
        }
        return dependencyInfos;
    }
646076
public Set<Deque<Archive>> inverseDependences() throws IOException {
        // create a new dependency finder to do the analysis
        DependencyFinder dependencyFinder = new DependencyFinder(configuration, DEFAULT_FILTER);
        try {
            // parse all archives in unnamed module to get compile-time dependences
            Stream<Archive> archives =
                Stream.concat(configuration.initialArchives().stream(),
                              configuration.classPathArchives().stream());
            if (apiOnly) {
                dependencyFinder.parseExportedAPIs(archives);
            } else {
                dependencyFinder.parse(archives);
            }

            Graph.Builder<Archive> builder = new Graph.Builder<>();
            // include all target nodes
            targets().forEach(builder::addNode);

            // transpose the module graph
            configuration.getModules().values().stream()
                .forEach(m -> {
                    builder.addNode(m);
                    m.descriptor().requires().stream()
                        .map(Requires::name)
                        .map(configuration::findModule)  // must be present
                        .forEach(v -> builder.addEdge(v.get(), m));
                });

            // add the dependences from the analysis
            Map<Archive, Set<Archive>> dependences = dependencyFinder.dependences();
            dependences.entrySet().stream()
                .forEach(e -> {
                    Archive u = e.getKey();
                    builder.addNode(u);
                    e.getValue().forEach(v -> builder.addEdge(v, u));
                });

            // transposed dependence graph.
            Graph<Archive> graph = builder.build();
            trace("targets: %s%n", targets());

            // Traverse from the targets and find all paths
            // rebuild a graph with all nodes that depends on targets
            // targets directly and indirectly
            return targets().stream()
                .map(t -> findPaths(graph, t))
                .flatMap(Set::stream)
                .collect(Collectors.toSet());
        } finally {
            dependencyFinder.shutdown();
        }
    }
561588
protected function getDependencyMapping()
    {
        $constructor = (new ReflectionClass($this->className))
            ->getConstructor();

        $dependencies = [];

        if (!is_null($constructor)) {
            foreach ($constructor->getParameters() as $param) {
                $dependencies[$param->getClass()->getName()] = $param->getName();
            }
        }

        return $dependencies;
    }