public Map search()

in fxcop-agent/src/jetbrains/buildServer/fxcop/agent/FxCopSearcher.java [44:78]


  public Map<String, String> search() {
    //TODO: introduce .net properties searcher in open api and use it here
    if (!myBuildAgentConfiguration.getSystemInfo().isWindows()) return Collections.emptyMap();

    AgentParametersSupplier dotNetParametersSupplier = myExtensionHolder.getExtension(AgentParametersSupplier.class, FxCopConstants.DOTNET_SUPPLIER_NAME);

    if (dotNetParametersSupplier == null){
      LOG.warn("Failed to find dotNet's parameter supplier. Will not be able to detect FxCop from Visual Studio or MsBuild");
    }

    for (FxCopSearch search : mySearches) {
      for (File fxCopExe : search.getHintPaths(myBuildAgentConfiguration, dotNetParametersSupplier)) {
        if (!fxCopExe.exists()) {
          continue;
        }

        final PEVersion fileVersion = PEUtil.getFileVersion(fxCopExe);
        if (fileVersion == null) {
          LOG.warn(String.format("Unable to get FxCop version located at \"%s\"", fxCopExe));
          continue;
        }

        final String fxcopRoot = FileUtil.getCanonicalFile(fxCopExe).getParent();
        final String version = fileVersion.toString();

        LOG.info(String.format("Found FxCop %s in \"%s\"", version, fxcopRoot));
        final Map<String, String> systemProperties = new HashMap<>();
        systemProperties.put(FxCopConstants.FXCOP_ROOT_NAME, fxcopRoot);
        systemProperties.put(FxCopConstants.FXCOPCMD_FILE_VERSION_NAME, fileVersion.toString());

        return systemProperties;
      }
    }
    return Collections.emptyMap();
  }