private static List<ManifestIdentifier> findLibraries(Path resDirectory) throws IOException {
    List<ManifestIdentifier> libraryBaseDirs = new ArrayList<>();

    if (resDirectory != null) {
      Path baseDir = resDirectory.getParent();
      final Properties properties = getProperties(baseDir.resolve("project.properties"));
      Properties overrideProperties = getProperties(baseDir.resolve("test-project.properties"));
      properties.putAll(overrideProperties);

      int libRef = 1;
      String lib;
      while ((lib = properties.getProperty("android.library.reference." + libRef)) != null) {
        Path libraryDir = baseDir.resolve(lib);
        if (Files.isDirectory(libraryDir)) {
          // Ignore directories without any files
          Path[] libraryBaseDirFiles = Fs.listFiles(libraryDir);
          if (libraryBaseDirFiles != null && libraryBaseDirFiles.length > 0) {
            List<ManifestIdentifier> libraries =
                findLibraries(libraryDir.resolve(Config.DEFAULT_RES_FOLDER));
            libraryBaseDirs.add(
                new ManifestIdentifier(
                    null,
                    libraryDir.resolve(Config.DEFAULT_MANIFEST_NAME),
                    libraryDir.resolve(Config.DEFAULT_RES_FOLDER),
                    libraryDir.resolve(Config.DEFAULT_ASSET_FOLDER),
                    libraries));
          }
        }

        libRef++;
      }
    }
    return libraryBaseDirs;
  }
private static List<ManifestIdentifier> findLibraries(Path resDirectory) throws IOException {
    List<ManifestIdentifier> libraryBaseDirs = new ArrayList<>();

    if (resDirectory != null) {
      Path baseDir = resDirectory.getParent();
      final Properties properties = getProperties(baseDir.resolve("project.properties"));
      Properties overrideProperties = getProperties(baseDir.resolve("test-project.properties"));
      properties.putAll(overrideProperties);

      int libRef = 1;
      String lib;
      while ((lib = properties.getProperty("android.library.reference." + libRef)) != null) {
        Path libraryDir = baseDir.resolve(lib);
        if (Files.isDirectory(libraryDir)) {
          
          Path[] libraryBaseDirFiles = Fs.listFiles(libraryDir);
          if (libraryBaseDirFiles != null && libraryBaseDirFiles.length > 0) {
            List<ManifestIdentifier> libraries =
                findLibraries(libraryDir.resolve(Config.DEFAULT_RES_FOLDER));
            libraryBaseDirs.add(
                new ManifestIdentifier(
                    null,
                    libraryDir.resolve(Config.DEFAULT_MANIFEST_NAME),
                    libraryDir.resolve(Config.DEFAULT_RES_FOLDER),
                    libraryDir.resolve(Config.DEFAULT_ASSET_FOLDER),
                    libraries));
          }
        }

        libRef++;
      }
    }
    return libraryBaseDirs;
  }
private static List < ManifestIdentifier > findLibraries ( Path resDirectory ) throws IOException { List < ManifestIdentifier > libraryBaseDirs = new ArrayList <> ( ) ; if ( resDirectory != null ) { Path baseDir = resDirectory . getParent ( ) ; final Properties properties = getProperties ( baseDir . resolve ( "project.properties" ) ) ; Properties overrideProperties = getProperties ( baseDir . resolve ( "test-project.properties" ) ) ; properties . putAll ( overrideProperties ) ; int libRef = 1 ; String lib ; while ( ( lib = properties . getProperty ( "android.library.reference." + libRef ) ) != null ) { Path libraryDir = baseDir . resolve ( lib ) ; if ( Files . isDirectory ( libraryDir ) ) { // Ignore directories without any files Path [ ] libraryBaseDirFiles = Fs . listFiles ( libraryDir ) ; if ( libraryBaseDirFiles != null && libraryBaseDirFiles . length > 0 ) { List < ManifestIdentifier > libraries = findLibraries ( libraryDir . resolve ( Config . DEFAULT_RES_FOLDER ) ) ; libraryBaseDirs . add ( new ManifestIdentifier ( null , libraryDir . resolve ( Config . DEFAULT_MANIFEST_NAME ) , libraryDir . resolve ( Config . DEFAULT_RES_FOLDER ) , libraryDir . resolve ( Config . DEFAULT_ASSET_FOLDER ) , libraries ) ) ; } } libRef ++ ; } } return libraryBaseDirs ; }
Find valid library AndroidManifest files referenced from an already loaded AndroidManifest's
`project.properties` file, recursively.
Find valid library AndroidManifest files referenced from an already loaded AndroidManifest s project . properties file recursively .