Class PlatformTarget

    • Field Detail

      • PLATFORM_VENDOR

        public static final java.lang.String PLATFORM_VENDOR
        Default vendor for platform targets
        See Also:
        Constant Field Values
    • Constructor Detail

      • PlatformTarget

        public PlatformTarget​(@NonNull
                              com.android.repository.api.LocalPackage p,
                              @NonNull
                              AndroidSdkHandler sdkHandler,
                              @NonNull
                              com.android.repository.api.ProgressIndicator progress)
        Construct a new PlatformTarget based on the given package.
    • Method Detail

      • setSources

        public void setSources​(@Nullable
                               java.nio.file.Path location)
      • getLibsFromJson

        @NonNull
        public static java.util.List<OptionalLibrary> getLibsFromJson​(@NonNull
                                                                      java.nio.file.Path jsonFile)
        Parses OptionalLibrarys from the given json file.
      • getLocation

        @NonNull
        public java.lang.String getLocation()
        Description copied from interface: IAndroidTarget
        Returns the target location, including a trailing file separator.
        Specified by:
        getLocation in interface IAndroidTarget
      • getVendor

        public java.lang.String getVendor()
        Returns the name of the vendor of the target. For platform, this is always PLATFORM_VENDOR
        Specified by:
        getVendor in interface IAndroidTarget
      • getName

        public java.lang.String getName()
        Description copied from interface: IAndroidTarget
        Returns the name of the target.
        Specified by:
        getName in interface IAndroidTarget
      • getFullName

        public java.lang.String getFullName()
        Description copied from interface: IAndroidTarget
        Returns the full name of the target, possibly including vendor name.
        Specified by:
        getFullName in interface IAndroidTarget
      • getVersion

        @NonNull
        public com.android.sdklib.AndroidVersion getVersion()
        Description copied from interface: IAndroidTarget
        Returns the version of the target. This is guaranteed to be non-null.
        Specified by:
        getVersion in interface IAndroidTarget
      • getVersionName

        public java.lang.String getVersionName()
        Description copied from interface: IAndroidTarget
        Returns the platform version as a readable string.
        Specified by:
        getVersionName in interface IAndroidTarget
      • isPlatform

        public boolean isPlatform()
        Description copied from interface: IAndroidTarget
        Returns true if the target is a standard Android platform.
        Specified by:
        isPlatform in interface IAndroidTarget
      • getPath

        @NonNull
        public java.nio.file.Path getPath​(int pathId)
        Description copied from interface: IAndroidTarget
        Returns the path of a platform component.
        Specified by:
        getPath in interface IAndroidTarget
        Parameters:
        pathId - the id representing the path to return. Any of the constants defined in the IAndroidTarget interface can be used.
      • getBuildToolInfo

        @Nullable
        public BuildToolInfo getBuildToolInfo()
        Description copied from interface: IAndroidTarget
        Returns a BuildToolInfo for backward compatibility. If an older SDK is used this will return paths located in the platform-tools, otherwise it'll return paths located in the latest build-tools.
        Specified by:
        getBuildToolInfo in interface IAndroidTarget
        Returns:
        a BuildToolInfo or null if none are available.
      • getOptionalLibraries

        @NonNull
        public java.util.List<OptionalLibrary> getOptionalLibraries()
        Description copied from interface: IAndroidTarget
        Returns a list of optional libraries for this target.

        These libraries are not automatically added to the classpath. Using them requires adding a uses-library entry in the manifest and calling useLibrary in the Gradle build script. Example of such library is org.apache.http.legacy which is not on the classpath by default since 6.0.

        Specified by:
        getOptionalLibraries in interface IAndroidTarget
        Returns:
        a list of libraries.
        See Also:
        OptionalLibrary.getName()
      • getAdditionalLibraries

        @NonNull
        public java.util.List<OptionalLibrary> getAdditionalLibraries()
        Description copied from interface: IAndroidTarget
        Returns the additional libraries for this target.

        These libraries are automatically added to the classpath, but using them requires adding a uses-library entry in the manifest. Example of such library is com.google.android.maps, which is part of the Google APIs add-on.

        Specified by:
        getAdditionalLibraries in interface IAndroidTarget
        Returns:
        a list of libraries.
        See Also:
        OptionalLibrary.getName()
      • getSkins

        @NonNull
        public java.nio.file.Path[] getSkins()
        Description copied from interface: IAndroidTarget
        Returns the available skin folders for this target.

        To get the skin names, use File.getName().
        Skins come either from:

        • a platform (sdk/platforms/N/skins/name)
        • an add-on (sdk/addons/name/skins/name)
        • a tagged system-image (sdk/system-images/platform-N/tag/abi/skins/name.)
        The array can be empty but not null.
        Specified by:
        getSkins in interface IAndroidTarget
      • getLayoutlibApi

        public int getLayoutlibApi()
      • getDefaultSkin

        @Nullable
        public java.nio.file.Path getDefaultSkin()
        Description copied from interface: IAndroidTarget
        Returns the default skin folder for this target.

        To get the skin name, use File.getName().

        Specified by:
        getDefaultSkin in interface IAndroidTarget
      • getPlatformLibraries

        @NonNull
        public java.lang.String[] getPlatformLibraries()
        Returns the list of libraries available for a given platform. For platforms this is always SdkConstants.ANDROID_TEST_RUNNER_LIB.
        Specified by:
        getPlatformLibraries in interface IAndroidTarget
        Returns:
        an array of libraries provided by the platform or null if there is none.
      • getProperty

        @Nullable
        public java.lang.String getProperty​(@NonNull
                                            java.lang.String name)
        Description copied from interface: IAndroidTarget
        Return the value of a given property for this target.
        Specified by:
        getProperty in interface IAndroidTarget
        Returns:
        the property value or null if it was not found.
      • getProperties

        @Nullable
        public java.util.Map<java.lang.String,​java.lang.String> getProperties()
        Description copied from interface: IAndroidTarget
        Returns all the properties associated with this target. This can be null if the target has no properties.
        Specified by:
        getProperties in interface IAndroidTarget
      • getShortClasspathName

        @NonNull
        public java.lang.String getShortClasspathName()
        Description copied from interface: IAndroidTarget
        Returns the name to be displayed when representing all the libraries this target contains.
        Specified by:
        getShortClasspathName in interface IAndroidTarget
      • getClasspathName

        @NonNull
        public java.lang.String getClasspathName()
        Description copied from interface: IAndroidTarget
        Returns the name to be displayed when representing all the libraries this target contains.
        Specified by:
        getClasspathName in interface IAndroidTarget
      • canRunOn

        public boolean canRunOn​(@NonNull
                                IAndroidTarget target)
        Description copied from interface: IAndroidTarget
        Returns whether the given target is compatible with the receiver.

        This means that a project using the receiver's target can run on the given target.
        Example:

         CupcakeTarget.canRunOn(DonutTarget) == true
         
        .
        Specified by:
        canRunOn in interface IAndroidTarget
        Parameters:
        target - the IAndroidTarget to test.
      • hashString

        @NonNull
        public java.lang.String hashString()
        Description copied from interface: IAndroidTarget
        Returns a string able to uniquely identify a target. Typically the target will encode information such as api level, whether it's a platform or add-on, and if it's an add-on vendor and add-on name.

        See AndroidTargetHash for helper methods to manipulate hash strings.

        Specified by:
        hashString in interface IAndroidTarget
      • compareTo

        public int compareTo​(@NonNull
                             IAndroidTarget o)
        Specified by:
        compareTo in interface java.lang.Comparable<IAndroidTarget>
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object