This is, theoretically, slightly better than addDeploymentTypeBasedDependencies(),
but we don't have any of the has*() methods implemented yet, so it does nothing.
964371
private void addHardcodedRecognitionDependencies(ProjectModel projectModel, Pom modulePom)
    {
        // TODO: Create a mapping from API occurence in the module into use of
        if (hasJpaEntities(projectModel))
            modulePom.getDependencies().add(new SimpleDependency(Dependency.Role.API, ApiDependenciesData.DEP_API_JPA_21));

        if (hasJsf(projectModel))
            modulePom.getDependencies().add(new SimpleDependency(Dependency.Role.API, ApiDependenciesData.DEP_API_JSF));

        if (hasJaxrs(projectModel))
            modulePom.getDependencies().add(new SimpleDependency(Dependency.Role.API, ApiDependenciesData.DEP_API_JAXRS_20));
    }
1284426
private void renderBundleDependenciesLinks(String requestedPath, BundleRendererContext ctx, Writer out,
			boolean debugOn, List<JoinableResourceBundle> dependencies) throws IOException {

		if (dependencies != null && !dependencies.isEmpty()) {
			for (JoinableResourceBundle dependencyBundle : dependencies) {
				if (debugOn) {
					addComment("Start adding dependency '" + dependencyBundle.getId() + "'", out);
				}
				renderBundleLinks(dependencyBundle, requestedPath, ctx, out, debugOn, false);
				if (debugOn) {
					addComment("Finished adding dependency '" + dependencyBundle.getId() + "'", out);
				}
			}
		}
	}
529469
public void addBaseClasses(Class<?>... baseClasses) {

    if (this.baseClassList == null) {
      this.baseClassList = new ArrayList<>();
    }
    this.baseClassList.addAll(Arrays.asList(baseClasses));
  }
31218
private void addDependency(String symbol, Set<String> seen, List<String> list)
      throws ServiceException {
    DependencyInfo dependency = getDependencyInfo(symbol);
    if (dependency == null) {
      if (this.strictRequires) {
        throw new ServiceException("Unknown require of " + symbol);
      }
    } else if (!seen.containsAll(dependency.getProvides())) {
      seen.addAll(dependency.getProvides());
      for (String require : dependency.getRequiredSymbols()) {
        addDependency(require, seen, list);
      }
      list.add(dependency.getPathRelativeToClosureBase());
    }
  }
77015
def add_deps(self, deps):
        
        if isinstance(deps, collections.Mapping):
            # Convert dictionary into list of dependencies.
            deps = [Dependency(node, exts) for node, exts in deps.items()]

        # We want a list
        if not isinstance(deps, (list, tuple)):
            deps = [deps]

        assert all(isinstance(d, Dependency) for d in deps)

        # Add the dependencies to the node
        self._deps.extend(deps)

        if self.is_work:
            # The task in the work should inherit the same dependency.
            for task in self:
                task.add_deps(deps)

        # If we have a FileNode as dependency, add self to its children
        # Node.get_parents will use this list if node.is_isfile.
        for dep in (d for d in deps if d.node.is_file):
            dep.node.add_filechild(self)
1341525
protected void makeProcessDefinitionsConsistentWithPersistedVersions(ParsedDeployment parsedDeployment) {
        for (ProcessDefinitionEntity processDefinition : parsedDeployment.getAllProcessDefinitions()) {
            ProcessDefinitionEntity persistedProcessDefinition =
                    bpmnDeploymentHelper.getPersistedInstanceOfProcessDefinition(processDefinition);

            if (persistedProcessDefinition != null) {
                processDefinition.setId(persistedProcessDefinition.getId());
                processDefinition.setVersion(persistedProcessDefinition.getVersion());
                processDefinition.setSuspensionState(persistedProcessDefinition.getSuspensionState());
            }
        }
    }
725052
function addVendorHelper() {
  if (this.options.zip) {
    if (this.serverless.service.package.individually) {
      return BbPromise.resolve(this.targetFuncs)
        .map(f => {
          if (!get(f, 'package.include')) {
            set(f, ['package', 'include'], []);
          }
          if (!get(f, 'module')) {
            set(f, ['module'], '.');
          }
          f.package.include.push('unzip_requirements.py');
          return f;
        })
        .then(functions => uniqBy(functions, func => func.module))
        .map(f => {
          this.serverless.cli.log(
            `Adding Python requirements helper to ${f.module}...`
          );

          return fse.copyAsync(
            path.resolve(__dirname, '../unzip_requirements.py'),
            path.join(this.servicePath, f.module, 'unzip_requirements.py')
          );
        });
    } else {
      this.serverless.cli.log('Adding Python requirements helper...');

      if (!get(this.serverless.service, 'package.include')) {
        set(this.serverless.service, ['package', 'include'], []);
      }

      this.serverless.service.package.include.push('unzip_requirements.py');

      return fse.copyAsync(
        path.resolve(__dirname, '../unzip_requirements.py'),
        path.join(this.servicePath, 'unzip_requirements.py')
      );
    }
  }
}
631208
private PBXObjectRef addDependency(final Map objects, final PBXObjectRef project, final List mainGroupChildren,
      final String baseDir, final DependencyDef dependency) {
    if (dependency.getFile() != null) {
      final File xcodeDir = new File(dependency.getFile().getAbsolutePath() + ".xcodeproj");
      if (xcodeDir.exists()) {
        final PBXObjectRef xcodePrj = createPBXFileReference("SOURCE_ROOT", baseDir, xcodeDir);
        mainGroupChildren.add(xcodePrj);
        objects.put(xcodePrj.getID(), xcodePrj.getProperties());

        final int proxyType = 2;
        final PBXObjectRef proxy = createPBXContainerItemProxy(xcodePrj, proxyType, dependency.getName());
        objects.put(proxy.getID(), proxy.getProperties());

        final PBXObjectRef referenceProxy = createPBXReferenceProxy(proxy, dependency);
        objects.put(referenceProxy.getID(), referenceProxy.getProperties());

        final PBXObjectRef buildFile = createPBXBuildFile(referenceProxy, Collections.emptyMap());
        objects.put(buildFile.getID(), buildFile.getProperties());

        final List productsChildren = new ArrayList();
        productsChildren.add(referenceProxy);
        final PBXObjectRef products = createPBXGroup("Products", "<group>", productsChildren);
        objects.put(products.getID(), products.getProperties());

        final Map projectReference = new HashMap();
        projectReference.put("ProductGroup", products);
        projectReference.put("ProjectRef", xcodePrj);

        List projectReferences = (List) project.getProperties().get("ProjectReferences");
        if (projectReferences == null) {
          projectReferences = new ArrayList();
          project.getProperties().put("ProjectReferences", projectReferences);
        }
        projectReferences.add(projectReference);
        return buildFile;
      }
    }
    return null;
  }
613284
private void removeDependenciesWithoutSha1(Collection<DependencyInfo> dependencies){
        Collection<DependencyInfo> childDependencies = new ArrayList<>();
        for (Iterator<DependencyInfo> iterator = dependencies.iterator(); iterator.hasNext();){
            DependencyInfo dependencyInfo = iterator.next();
            if (dependencyInfo.getSha1().isEmpty()){
                childDependencies.addAll(dependencyInfo.getChildren());
                iterator.remove();
            }
        }
        dependencies.addAll(childDependencies);
    }
244564
function lookForExternalDependenciesRES( _def, resources, depFile ) {
  if ( !_def ) return;
  try {
    const def = convertExternalDependencyDefinition( _def );
    for ( const dep of Object.keys( def ) ) {
      if ( def[ dep ] === "" ) {
        // `res: { "bob/foo.png": "" }` is equivalent to
        // `res: { "bob/foo.png": "bob/foo.png" }`
        def[ dep ] = dep;
      }
      const
      srcDep = Project.srcOrLibPath( `mod/${dep}` ) ||
        Project.srcOrLibPath( dep );
      if ( !srcDep ) {
        Fatal.fire(
          `Unable to find dependency file "${dep}" nor "mod/${dep}"!`,
          depFile.getAbsoluteFilePath()
        );
      }
      resources[ srcDep ] = Project.wwwPath( def[ dep ] );
    }
  } catch ( ex ) {
    Fatal.fire(
      `Unable to parse RES dependencies: ${JSON.stringify(_def)}!\n${ex}`,
      depFile
    );
  }
}
654113
public void addDependency(Dependency dependency) {
        Dependency newDep = null;
        String classifier = dependency.getArtifact().getClassifier();
        if ( Const.TEST.equals( classifier ) || Const.TEST_JAR.equals( classifier ) ) {
            ArtifactType artifactType = new DefaultArtifactType( Const.TEST_JAR, Const.JAR, Const.TEST_JAR, null );
            
            Artifact artifact = dependency.getArtifact();
            
            artifact = new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(),
                    null, Const.JAR, artifact.getBaseVersion(), artifactType );
            newDep =  new Dependency(artifact, dependency.getScope());
        } else {
            newDep = dependency;
        }
        dependencies.add(newDep);
    }
395945
public void addDependency(String notation, String scope) {
        log.debug("Add dep {} {}", notation, scope);
        
        DefaultArtifact artifact = new DefaultArtifact( notation );
        
        if ( Const.TEST.equals( artifact.getClassifier() ) || Const.TEST_JAR.equals( artifact.getClassifier() ) ) {
            
            ArtifactType artifactType = new DefaultArtifactType( Const.TEST_JAR, Const.JAR, Const.TEST_JAR, null );
            
            artifact = new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(),
                    null, Const.JAR, artifact.getBaseVersion(), artifactType );
        }
        Dependency dependency = new Dependency(artifact, scope);
        addDependency(dependency);
    }
1041538
boolean isEmpty(Map<String, List<List<RepositoryResource>>> installResources) {
        if (installResources == null)
            return true;
        for (List<List<RepositoryResource>> targetList : installResources.values()) {
            for (List<RepositoryResource> mrList : targetList) {
                if (!mrList.isEmpty())
                    return false;
            }
        }
        return true;
    }
1125524
function excludeNodeDevDependencies(servicePath) {
  const exAndIn = {
    include: [],
    exclude: [],
  };

  // the files where we'll write the dependencies into
  const tmpDir = os.tmpdir();
  const randHash = crypto.randomBytes(8).toString('hex');
  const nodeDevDepFile = path.join(tmpDir, `node-dependencies-${randHash}-dev`);
  const nodeProdDepFile = path.join(tmpDir, `node-dependencies-${randHash}-prod`);

  try {
    const packageJsonFilePaths = globby.sync([
      '**/package.json',
      // TODO add glob for node_modules filtering
    ], {
      cwd: servicePath,
      dot: true,
      silent: true,
      follow: true,
      nosort: true,
    });

    // filter out non node_modules file paths
    const packageJsonPaths = _.filter(packageJsonFilePaths, (filePath) => {
      const isNodeModulesDir = !!filePath.match(/node_modules/);
      return !isNodeModulesDir;
    });

    if (_.isEmpty(packageJsonPaths)) {
      return BbPromise.resolve(exAndIn);
    }

    // NOTE: using mapSeries here for a sequential computation (w/o race conditions)
    return BbPromise.mapSeries(packageJsonPaths, (packageJsonPath) => {
      // the path where the package.json file lives
      const fullPath = path.join(servicePath, packageJsonPath);
      const dirWithPackageJson = fullPath.replace(path.join(path.sep, 'package.json'), '');

      // we added a catch which resolves so that npm commands with an exit code of 1
      // (e.g. if the package.json is invalid) won't crash the dev dependency exclusion process
      return BbPromise.map(['dev', 'prod'], (env) => {
        const depFile = env === 'dev' ? nodeDevDepFile : nodeProdDepFile;
        return childProcess.execAsync(
          `npm ls --${env}=true --parseable=true --long=false --silent >> ${depFile}`,
          { cwd: dirWithPackageJson }
        ).catch(() => BbPromise.resolve());
      });
    })
    // NOTE: using mapSeries here for a sequential computation (w/o race conditions)
    .then(() => BbPromise.mapSeries(['dev', 'prod'], (env) => {
      const depFile = env === 'dev' ? nodeDevDepFile : nodeProdDepFile;
      return fs.readFileAsync(depFile)
        .then((fileContent) => _.compact(
          (_.uniq(_.split(fileContent.toString('utf8'), '\n'))),
          elem => elem.length > 0
        )).catch(() => BbPromise.resolve());
    }))
    .then((devAndProDependencies) => {
      const devDependencies = devAndProDependencies[0];
      const prodDependencies = devAndProDependencies[1];

      // NOTE: the order for _.difference is important
      const dependencies = _.difference(devDependencies, prodDependencies);
      const nodeModulesRegex = new RegExp(`${path.join('node_modules', path.sep)}.*`, 'g');

      if (!_.isEmpty(dependencies)) {
        return BbPromise
          .map(dependencies, (item) => item.replace(path.join(servicePath, path.sep), ''))
          .filter((item) => item.length > 0 && item.match(nodeModulesRegex))
          .reduce((globs, item) => {
            const packagePath = path.join(servicePath, item, 'package.json');
            return fs.readFileAsync(packagePath, 'utf-8').then((packageJsonFile) => {
              const lastIndex = item.lastIndexOf(path.sep) + 1;
              const moduleName = item.substr(lastIndex);
              const modulePath = item.substr(0, lastIndex);

              const packageJson = JSON.parse(packageJsonFile);
              const bin = packageJson.bin;

              const baseGlobs = [path.join(item, '**')];

              // NOTE: pkg.bin can be object, string, or undefined
              if (typeof bin === 'object') {
                _.each(_.keys(bin), (executable) => {
                  baseGlobs.push(path.join(modulePath, '.bin', executable));
                });
              // only 1 executable with same name as lib
              } else if (typeof bin === 'string') {
                baseGlobs.push(path.join(modulePath, '.bin', moduleName));
              }

              return globs.concat(baseGlobs);
            });
          }, [])
          .then((globs) => {
            exAndIn.exclude = exAndIn.exclude.concat(globs);
            return exAndIn;
          });
      }

      return exAndIn;
    })
    .then(() => {
      // cleanup
      fs.unlinkSync(nodeDevDepFile);
      fs.unlinkSync(nodeProdDepFile);
      return exAndIn;
    })
    .catch(() => exAndIn);
  } catch (e) {
    // fail silently
  }
}
410017
public void addDiscoveredBda(ArchiveType moduleType, WebSphereBeanDeploymentArchive bda) throws CDIException {
        webSphereCDIDeployment.addBeanDeploymentArchive(bda);
        Set<WebSphereBeanDeploymentArchive> bdaSet = bdasByType.get(moduleType);
        if (bdaSet != null) {
            bdaSet.add(bda);
        } else {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "Ignore this type: {0}, as CDI does not need to add this in the addDiscoveredBda ", moduleType);
            }
        }

        String path = bda.getArchive().getPath();
        if (moduleType == ArchiveType.SHARED_LIB || moduleType == ArchiveType.EAR_LIB) {
            libraryPaths.add(path);
        } else if (moduleType == ArchiveType.RAR_MODULE || moduleType == ArchiveType.EJB_MODULE) {
            modulePaths.add(path);
        }
    }
974978
public List<TypedDependency> typedDependencies(boolean includeExtras) {
    List<TypedDependency> deps = includeExtras ? allTypedDependencies
                                                       : typedDependencies;
    correctDependencies(deps);
    return deps;
  }
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;
    }