|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.android.sdklib.repository.local.LocalSdk
public class LocalSdk
This class keeps information on the current locally installed SDK. It tries to lazily load information as much as possible.
Packages are accessed by their type and a main query attribute, depending on the package type. There are different versions ofgetPkgInfo(com.android.sdklib.repository.descriptors.IPkgDesc)
which depend on the
query attribute.
Type | Query parameter | Getter |
---|---|---|
Tools | Unique instance | getPkgInfo(PkgType.PKG_TOOLS) => LocalPkgInfo |
Platform-Tools | Unique instance | getPkgInfo(PkgType.PKG_PLATFORM_TOOLS) => LocalPkgInfo |
Docs | Unique instance | getPkgInfo(PkgType.PKG_DOCS) => LocalPkgInfo |
Build-Tools | FullRevision |
getLatestBuildTool() => BuildToolInfo , or getBuildTool(FullRevision) => BuildToolInfo , or getPkgInfo(PkgType.PKG_BUILD_TOOLS, FullRevision) => LocalPkgInfo , or getPkgsInfos(PkgType.PKG_BUILD_TOOLS) => LocalPkgInfo [] |
Extras | String vendor/path | getExtra(String) => LocalExtraPkgInfo , or getPkgInfo(PkgType.PKG_EXTRAS, String) => LocalPkgInfo , or getPkgsInfos(PkgType.PKG_EXTRAS) => LocalPkgInfo [] |
Sources | AndroidVersion |
getPkgInfo(PkgType.PKG_SOURCES, AndroidVersion) => LocalPkgInfo , or getPkgsInfos(PkgType.PKG_SOURCES) => LocalPkgInfo [] |
Samples | AndroidVersion |
getPkgInfo(PkgType.PKG_SAMPLES, AndroidVersion) => LocalPkgInfo , or getPkgsInfos(PkgType.PKG_SAMPLES) => LocalPkgInfo [] |
Platforms | AndroidVersion |
getPkgInfo(PkgType.PKG_PLATFORMS, AndroidVersion) => LocalPkgInfo , or getPkgInfo(PkgType.PKG_ADDONS, String) => LocalPkgInfo , or getPkgsInfos(PkgType.PKG_PLATFORMS) => LocalPkgInfo [], or getTargetFromHashString(String) => IAndroidTarget |
Add-ons | AndroidVersion x String vendor/path |
getPkgInfo(PkgType.PKG_ADDONS, String) => LocalPkgInfo , or getPkgsInfos(PkgType.PKG_ADDONS) => LocalPkgInfo [], or getTargetFromHashString(String) => IAndroidTarget |
System images | AndroidVersion x String ABI |
getPkgsInfos(PkgType.PKG_SYS_IMAGES) => LocalPkgInfo [] |
getPkgsInfos
returns a copy of its data array, which objects are
not altered after creation, so its value is not influenced by the internal state after
it returns.
Implementation Background:
LocalSdk
parses sdk on disk,
and RemoteSdk
wraps the downloaded manifest.
Constructor Summary | |
---|---|
|
LocalSdk()
Creates an initial LocalSdk instance with an unknown location. |
|
LocalSdk(java.io.File sdkRoot)
Creates an initial LocalSdk instance for a known SDK location. |
protected |
LocalSdk(IFileOp fileOp)
Creates an initial LocalSdk instance with an unknown location. |
Method Summary | |
---|---|
void |
clearLocalPkg(java.util.EnumSet<PkgType> filters)
Clear the tracked visited folders & the cached LocalPkgInfo for the
given filter types. |
BuildToolInfo |
getBuildTool(FullRevision revision)
Returns the BuildToolInfo for the given revision. |
LocalExtraPkgInfo |
getExtra(java.lang.String vendor,
java.lang.String path)
Retrieves information on an extra package identified by its String vendor/path. |
IFileOp |
getFileOp()
|
BuildToolInfo |
getLatestBuildTool()
Returns the highest build-tool revision known, or null if there are are no build-tools. |
java.io.File |
getLocation()
Location of the SDK. |
java.lang.String |
getPath()
Deprecated. |
LocalPkgInfo |
getPkgInfo(IPkgDesc descriptor)
Retrieves information on a package identified by an IPkgDesc . |
LocalPkgInfo |
getPkgInfo(PkgType filter)
For unique local packages. |
LocalPkgInfo |
getPkgInfo(PkgType filter,
AndroidVersion version)
Retrieves information on a package identified by an AndroidVersion . |
LocalPkgInfo |
getPkgInfo(PkgType filter,
FullRevision revision)
Retrieves information on a package identified by its FullRevision . |
LocalPkgInfo |
getPkgInfo(PkgType filter,
java.lang.String path)
Retrieves information on a package identified by its String path. |
LocalPkgInfo |
getPkgInfo(PkgType filter,
java.lang.String vendor,
java.lang.String path)
Retrieves information on a package identified by both vendor and path strings. |
LocalPkgInfo[] |
getPkgsInfos(java.util.EnumSet<PkgType> filters)
Retrieve all the info about the requested package types. |
LocalPkgInfo[] |
getPkgsInfos(PkgType filter)
Retrieve all the info about the requested package type. |
IAndroidTarget |
getTargetFromHashString(java.lang.String hash)
Returns a target from a hash that was generated by IAndroidTarget.hashString() . |
IAndroidTarget[] |
getTargets()
Returns the targets (platforms & addons) that are available in the SDK. |
boolean |
hasChanged(java.util.EnumSet<PkgType> filters)
Check the tracked visited folders to see if anything has changed for the requested filter types. |
void |
setLocation(java.io.File sdkRoot)
Sets or changes the SDK root location. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LocalSdk()
public LocalSdk(@NonNull java.io.File sdkRoot)
sdkRoot
- The location of the SDK root folder.protected LocalSdk(@NonNull IFileOp fileOp)
FileOp
being used.
fileOp
- The alternate FileOp
to use for all file-based interactions.Method Detail |
---|
@NonNull public IFileOp getFileOp()
public void setLocation(@NonNull java.io.File sdkRoot)
sdkRoot
- The location of the SDK root folder.@Nullable public java.io.File getLocation()
@Deprecated @Nullable public java.lang.String getPath()
public void clearLocalPkg(@NonNull java.util.EnumSet<PkgType> filters)
LocalPkgInfo
for the
given filter types.
filters
- A set of PkgType constants or PkgType.PKG_ALL
to clear everything.public boolean hasChanged(@NonNull java.util.EnumSet<PkgType> filters)
filters
- A set of PkgType constants or PkgType.PKG_ALL
to clear everything.@Nullable public LocalPkgInfo getPkgInfo(@NonNull IPkgDesc descriptor)
IPkgDesc
.
descriptor
- IPkgDesc
describing a package.
@Nullable public LocalPkgInfo getPkgInfo(@NonNull PkgType filter, @NonNull AndroidVersion version)
AndroidVersion
.
Note: don't use this for PkgType.PKG_SYS_IMAGE
since there can be more than
one ABI and this method only returns a single package per filter type.
filter
- PkgType.PKG_PLATFORM
, PkgType.PKG_SAMPLE
or PkgType.PKG_SOURCE
.version
- The AndroidVersion
specific for this package type.
@Nullable public LocalPkgInfo getPkgInfo(@NonNull PkgType filter, @NonNull FullRevision revision)
FullRevision
.
Note that PkgType.PKG_TOOLS
and PkgType.PKG_PLATFORM_TOOLS
are unique in a local SDK so you'll want to use getPkgInfo(PkgType)
to retrieve them instead.
filter
- PkgType.PKG_BUILD_TOOLS
.revision
- The FullRevision
uniquely identifying this package.
@Nullable public LocalPkgInfo getPkgInfo(@NonNull PkgType filter, @NonNull java.lang.String path)
String
path.
For add-ons and platforms, the path is the target hash string
(see AndroidTargetHash
for helpers methods to generate this string.)
filter
- PkgType.PKG_ADDON
, PkgType.PKG_PLATFORM
.path
- The vendor/path uniquely identifying this package.
@Nullable public LocalPkgInfo getPkgInfo(@NonNull PkgType filter, @NonNull java.lang.String vendor, @NonNull java.lang.String path)
AndroidTargetHash
for helpers methods to generate this string.)
filter
- PkgType.PKG_EXTRA
, PkgType.PKG_ADDON
.vendor
- The vendor id of the extra package.path
- The path uniquely identifying this package for its vendor.
@Nullable public LocalExtraPkgInfo getExtra(@NonNull java.lang.String vendor, @NonNull java.lang.String path)
String
vendor/path.
vendor
- The vendor id of the extra package.path
- The path uniquely identifying this package for its vendor.
@Nullable public LocalPkgInfo getPkgInfo(@NonNull PkgType filter)
filter
- PkgType.PKG_TOOLS
or PkgType.PKG_PLATFORM_TOOLS
or PkgType.PKG_DOC
.
@NonNull public LocalPkgInfo[] getPkgsInfos(@NonNull PkgType filter)
PkgType.PKG_TOOLS
, PkgType.PKG_PLATFORM_TOOLS
and
PkgType.PKG_DOC
but since there can only be one package of these types, it is
more efficient to use getPkgInfo(PkgType)
to query them.
filter
- One of PkgType
constants.
@NonNull public LocalPkgInfo[] getPkgsInfos(@NonNull java.util.EnumSet<PkgType> filters)
PkgType.PKG_ALL
argument to load all the known package types.
Note: you can use this with PkgType.PKG_TOOLS
, PkgType.PKG_PLATFORM_TOOLS
and
PkgType.PKG_DOC
but since there can only be one package of these types, it is
more efficient to use getPkgInfo(PkgType)
to query them.
filters
- One or more of PkgType.PKG_ADDON
, PkgType.PKG_PLATFORM
,
PkgType.PKG_BUILD_TOOLS
, PkgType.PKG_EXTRA
,
PkgType.PKG_SOURCE
, PkgType.PKG_SYS_IMAGE
@Nullable public BuildToolInfo getBuildTool(@Nullable FullRevision revision)
BuildToolInfo
for the given revision.
revision
- The requested revision.
BuildToolInfo
. Can be null if revision
is null or is
not part of the known set returned by getPkgsInfos(PkgType.PKG_BUILD_TOOLS)
.@Nullable public BuildToolInfo getLatestBuildTool()
@NonNull public IAndroidTarget[] getTargets()
clearLocalPkg(java.util.EnumSet)
is called to clear platforms
and/or add-ons.
The array can be empty but not null.
@Nullable public IAndroidTarget getTargetFromHashString(@Nullable java.lang.String hash)
IAndroidTarget.hashString()
.
hash
- the IAndroidTarget
hash string.
IAndroidTarget
or null.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |