Class BuildToolInfo


  • public class BuildToolInfo
    extends java.lang.Object
    Information on a specific build-tool folder.

    For unit tests, see: - sdklib/src/test/.../LocalSdkTest - sdklib/src/test/.../SdkManagerTest - sdklib/src/test/.../BuildToolInfoTest

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  BuildToolInfo.PathId  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static BuildToolInfo fromLocalPackage​(com.android.repository.api.LocalPackage localPackage)
      Creates a BuildToolInfo from a LocalPackage.
      static BuildToolInfo fromStandardDirectoryLayout​(com.android.repository.Revision revision, java.nio.file.Path path)
      Creates a BuildToolInfo from a directory which follows the standard layout convention.
      java.nio.file.Path getLocation()
      Returns the build-tool revision-specific folder.
      java.lang.String getPath​(BuildToolInfo.PathId pathId)
      Returns the path of a build-tool component.
      com.android.repository.Revision getRevision()
      Returns the revision.
      boolean isValid​(com.android.utils.ILogger log)
      Checks whether the build-tool is valid by verifying that the expected binaries are actually present.
      static BuildToolInfo modifiedLayout​(com.android.repository.Revision revision, java.nio.file.Path mainPath, java.nio.file.Path aapt, java.nio.file.Path aidl, java.nio.file.Path llmvRsCc, java.nio.file.Path androidRs, java.nio.file.Path androidRsClang, java.nio.file.Path bccCompat, java.nio.file.Path ldArm, java.nio.file.Path ldArm64, java.nio.file.Path ldX86, java.nio.file.Path ldX86_64, java.nio.file.Path ldMips, java.nio.file.Path lld, java.nio.file.Path zipAlign, java.nio.file.Path aapt2)
      Creates a full BuildToolInfo from the specified paths.
      static BuildToolInfo partial​(com.android.repository.Revision revision, java.nio.file.Path location, java.util.Map<BuildToolInfo.PathId,​java.nio.file.Path> paths)
      Creates a new BuildToolInfo where only some tools are present.
      java.lang.String toString()
      Returns a debug representation suitable for unit-tests.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • fromStandardDirectoryLayout

        @NonNull
        public static BuildToolInfo fromStandardDirectoryLayout​(@NonNull
                                                                com.android.repository.Revision revision,
                                                                @NonNull
                                                                java.nio.file.Path path)
        Creates a BuildToolInfo from a directory which follows the standard layout convention.
      • fromLocalPackage

        @NonNull
        public static BuildToolInfo fromLocalPackage​(@NonNull
                                                     com.android.repository.api.LocalPackage localPackage)
        Creates a BuildToolInfo from a LocalPackage.
      • modifiedLayout

        @NonNull
        public static BuildToolInfo modifiedLayout​(@NonNull
                                                   com.android.repository.Revision revision,
                                                   @NonNull
                                                   java.nio.file.Path mainPath,
                                                   @NonNull
                                                   java.nio.file.Path aapt,
                                                   @NonNull
                                                   java.nio.file.Path aidl,
                                                   @NonNull
                                                   java.nio.file.Path llmvRsCc,
                                                   @NonNull
                                                   java.nio.file.Path androidRs,
                                                   @NonNull
                                                   java.nio.file.Path androidRsClang,
                                                   @Nullable
                                                   java.nio.file.Path bccCompat,
                                                   @Nullable
                                                   java.nio.file.Path ldArm,
                                                   @Nullable
                                                   java.nio.file.Path ldArm64,
                                                   @Nullable
                                                   java.nio.file.Path ldX86,
                                                   @Nullable
                                                   java.nio.file.Path ldX86_64,
                                                   @Nullable
                                                   java.nio.file.Path ldMips,
                                                   @Nullable
                                                   java.nio.file.Path lld,
                                                   @NonNull
                                                   java.nio.file.Path zipAlign,
                                                   @Nullable
                                                   java.nio.file.Path aapt2)
        Creates a full BuildToolInfo from the specified paths.

        The Nullable paths can only be null if corresponding tools were not present in the specified version of build tools.

      • partial

        @NonNull
        public static BuildToolInfo partial​(@NonNull
                                            com.android.repository.Revision revision,
                                            @NonNull
                                            java.nio.file.Path location,
                                            @NonNull
                                            java.util.Map<BuildToolInfo.PathId,​java.nio.file.Path> paths)
        Creates a new BuildToolInfo where only some tools are present.

        This may be the case when paths are managed by an external build system.

      • getRevision

        @NonNull
        public com.android.repository.Revision getRevision()
        Returns the revision.
      • getLocation

        @NonNull
        public java.nio.file.Path getLocation()
        Returns the build-tool revision-specific folder.

        For compatibility reasons, use getPath(PathId) if you need the path to a specific tool.

      • getPath

        public java.lang.String getPath​(BuildToolInfo.PathId pathId)
        Returns the path of a build-tool component.
        Parameters:
        pathId - the id representing the path to return.
        Returns:
        The absolute path for that tool, with a / separator if it's a folder. Null if the path-id is unknown.
      • isValid

        public boolean isValid​(@Nullable
                               com.android.utils.ILogger log)
        Checks whether the build-tool is valid by verifying that the expected binaries are actually present. This checks that all known paths point to a valid file or directory.
        Parameters:
        log - An optional logger. If non-null, errors will be printed there.
        Returns:
        True if the build-tool folder contains all the expected tools.
      • toString

        public java.lang.String toString()
        Returns a debug representation suitable for unit-tests. Note that unit-tests need to clean up the paths to avoid inconsistent results.
        Overrides:
        toString in class java.lang.Object