|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.android.sdklib.internal.project.ProjectProperties
public class ProjectProperties
Class representing project properties for both ADT and Ant-based build.
The class is associated to aProjectProperties.PropertyType that indicate which of the project
property file is represented.
To load an existing file, use load(IAbstractFolder, PropertyType).
The class is meant to be always in sync (or at least not newer) than the file it represents.
Once created, it can only be updated through reload()
The make modification or make new file, use a ProjectPropertiesWorkingCopy instance,
either through create(IAbstractFolder, PropertyType) or through
makeWorkingCopy().
| Nested Class Summary | |
|---|---|
static class |
ProjectProperties.PropertyType
|
| Field Summary | |
|---|---|
protected com.android.io.IAbstractFolder |
mProjectFolder
|
protected java.util.Map<java.lang.String,java.lang.String> |
mProperties
|
protected ProjectProperties.PropertyType |
mType
|
protected static java.util.regex.Pattern |
PATTERN_PROP
|
static java.lang.String |
PROPERTY_BUILD_OUT_DIR
|
static java.lang.String |
PROPERTY_BUILD_SOURCE_DIR
|
static java.lang.String |
PROPERTY_BUILD_TOOLS
The version of the build tools to use to compile |
static java.lang.String |
PROPERTY_KEY_ALIAS
|
static java.lang.String |
PROPERTY_KEY_STORE
|
static java.lang.String |
PROPERTY_LIB_REF
|
static java.lang.String |
PROPERTY_LIBRARY
|
static java.lang.String |
PROPERTY_PACKAGE
|
static java.lang.String |
PROPERTY_PROGUARD_CONFIG
|
static java.lang.String |
PROPERTY_PROJECTS
|
static java.lang.String |
PROPERTY_RS_TARGET
The property name for the renderscript build target |
static java.lang.String |
PROPERTY_RULES_PATH
|
static java.lang.String |
PROPERTY_SDK
|
static java.lang.String |
PROPERTY_SPLIT_BY_ABI
|
static java.lang.String |
PROPERTY_SPLIT_BY_DENSITY
|
static java.lang.String |
PROPERTY_SPLIT_BY_LOCALE
|
static java.lang.String |
PROPERTY_TARGET
The property name for the project target |
static java.lang.String |
PROPERTY_TESTED_PROJECT
|
static java.lang.String |
PROPERTY_VERSIONCODE
|
| Constructor Summary | |
|---|---|
protected |
ProjectProperties(com.android.io.IAbstractFolder projectFolder,
java.util.Map<java.lang.String,java.lang.String> map,
ProjectProperties.PropertyType type)
Private constructor. |
| Method Summary | |
|---|---|
static ProjectPropertiesWorkingCopy |
create(com.android.io.IAbstractFolder projectFolder,
ProjectProperties.PropertyType type)
Creates a new project properties object, with no properties. |
static ProjectPropertiesWorkingCopy |
create(java.lang.String projectFolderOsPath,
ProjectProperties.PropertyType type)
Creates a new project properties object, with no properties. |
static ProjectProperties |
createEmpty(com.android.io.IAbstractFolder projectFolder,
ProjectProperties.PropertyType type)
Creates a new project properties object, with no properties. |
static ProjectProperties |
createEmpty(java.lang.String projectFolderOsPath,
ProjectProperties.PropertyType type)
Creates a new project properties object, with no properties. |
void |
debugPrint()
|
static boolean |
delete(com.android.io.IAbstractFolder projectFolder,
ProjectProperties.PropertyType type)
Deletes a project properties file. |
static boolean |
delete(java.lang.String projectFolderOsPath,
ProjectProperties.PropertyType type)
Deletes a project properties file. |
protected static java.lang.String |
escape(java.lang.String value)
|
com.android.io.IAbstractFile |
getFile()
Returns the location of this property file. |
java.lang.String |
getProperty(java.lang.String name)
Returns the value of a property. |
ProjectProperties.PropertyType |
getType()
Returns the type of the property file. |
java.util.Set<java.lang.String> |
keySet()
Returns a set of the property keys. |
static ProjectProperties |
load(com.android.io.IAbstractFolder projectFolder,
ProjectProperties.PropertyType type)
Loads a project properties file and return a ProjectProperties object
containing the properties. |
static ProjectProperties |
load(java.lang.String projectFolderOsPath,
ProjectProperties.PropertyType type)
Loads a project properties file and return a ProjectProperties object
containing the properties. |
ProjectPropertiesWorkingCopy |
makeWorkingCopy()
Creates and returns a copy of the current properties as a ProjectPropertiesWorkingCopy that can be modified and saved. |
ProjectPropertiesWorkingCopy |
makeWorkingCopy(ProjectProperties.PropertyType type)
Creates and returns a copy of the current properties as a ProjectPropertiesWorkingCopy that can be modified and saved. |
static java.util.Map<java.lang.String,java.lang.String> |
parsePropertyFile(com.android.io.IAbstractFile propFile,
com.android.utils.ILogger log)
Parses a property file (using UTF-8 encoding) and returns a map of the content. |
void |
reload()
Reloads the properties from the underlying file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.util.regex.Pattern PATTERN_PROP
public static final java.lang.String PROPERTY_TARGET
public static final java.lang.String PROPERTY_RS_TARGET
public static final java.lang.String PROPERTY_BUILD_TOOLS
public static final java.lang.String PROPERTY_LIBRARY
public static final java.lang.String PROPERTY_LIB_REF
public static final java.lang.String PROPERTY_PROGUARD_CONFIG
public static final java.lang.String PROPERTY_RULES_PATH
public static final java.lang.String PROPERTY_SDK
public static final java.lang.String PROPERTY_SPLIT_BY_DENSITY
public static final java.lang.String PROPERTY_SPLIT_BY_ABI
public static final java.lang.String PROPERTY_SPLIT_BY_LOCALE
public static final java.lang.String PROPERTY_TESTED_PROJECT
public static final java.lang.String PROPERTY_BUILD_SOURCE_DIR
public static final java.lang.String PROPERTY_BUILD_OUT_DIR
public static final java.lang.String PROPERTY_PACKAGE
public static final java.lang.String PROPERTY_VERSIONCODE
public static final java.lang.String PROPERTY_PROJECTS
public static final java.lang.String PROPERTY_KEY_STORE
public static final java.lang.String PROPERTY_KEY_ALIAS
protected final com.android.io.IAbstractFolder mProjectFolder
protected final java.util.Map<java.lang.String,java.lang.String> mProperties
protected final ProjectProperties.PropertyType mType
| Constructor Detail |
|---|
protected ProjectProperties(@NonNull
com.android.io.IAbstractFolder projectFolder,
@NonNull
java.util.Map<java.lang.String,java.lang.String> map,
@NonNull
ProjectProperties.PropertyType type)
load(String, PropertyType) or create(String, PropertyType)
to instantiate.
| Method Detail |
|---|
public static ProjectProperties load(java.lang.String projectFolderOsPath,
ProjectProperties.PropertyType type)
ProjectProperties object
containing the properties.
projectFolderOsPath - the project folder.type - One the possible ProjectProperties.PropertyTypes.
public static ProjectProperties load(com.android.io.IAbstractFolder projectFolder,
ProjectProperties.PropertyType type)
ProjectProperties object
containing the properties.
projectFolder - the project folder.type - One the possible ProjectProperties.PropertyTypes.
public static boolean delete(com.android.io.IAbstractFolder projectFolder,
ProjectProperties.PropertyType type)
projectFolder - the project folder.type - One the possible ProjectProperties.PropertyTypes.
public static boolean delete(java.lang.String projectFolderOsPath,
ProjectProperties.PropertyType type)
projectFolderOsPath - the project folder.type - One the possible ProjectProperties.PropertyTypes.
public static ProjectPropertiesWorkingCopy create(@NonNull
java.lang.String projectFolderOsPath,
@NonNull
ProjectProperties.PropertyType type)
ProjectPropertiesWorkingCopy.save() is called.
projectFolderOsPath - the project folder.type - the type of property file to createcreateEmpty(String, PropertyType)
public static ProjectPropertiesWorkingCopy create(@NonNull
com.android.io.IAbstractFolder projectFolder,
@NonNull
ProjectProperties.PropertyType type)
ProjectPropertiesWorkingCopy.save() is called.
projectFolder - the project folder.type - the type of property file to createcreateEmpty(IAbstractFolder, PropertyType)
public static ProjectProperties createEmpty(@NonNull
java.lang.String projectFolderOsPath,
@NonNull
ProjectProperties.PropertyType type)
ProjectPropertiesWorkingCopy is created
first with makeWorkingCopy().
projectFolderOsPath - the project folder.type - the type of property file to createcreate(String, PropertyType)
public static ProjectProperties createEmpty(@NonNull
com.android.io.IAbstractFolder projectFolder,
@NonNull
ProjectProperties.PropertyType type)
ProjectPropertiesWorkingCopy is created
first with makeWorkingCopy().
projectFolder - the project folder.type - the type of property file to createcreate(IAbstractFolder, PropertyType)public com.android.io.IAbstractFile getFile()
public ProjectPropertiesWorkingCopy makeWorkingCopy()
ProjectPropertiesWorkingCopy that can be modified and saved.
ProjectPropertiesWorkingCopypublic ProjectPropertiesWorkingCopy makeWorkingCopy(ProjectProperties.PropertyType type)
ProjectPropertiesWorkingCopy that can be modified and saved. This also allows
converting to a new type, by specifying a different ProjectProperties.PropertyType.
type - the ProjectProperties.PropertyType of the prop file to save.
ProjectPropertiesWorkingCopypublic ProjectProperties.PropertyType getType()
ProjectProperties.PropertyTypepublic java.lang.String getProperty(java.lang.String name)
getProperty in interface IPropertySourcename - the name of the property.
public java.util.Set<java.lang.String> keySet()
Map.keySet() this is not a view of the
map keys. Modifying the returned Set will not impact the underlying Map.
public void reload()
public static java.util.Map<java.lang.String,java.lang.String> parsePropertyFile(@NonNull
com.android.io.IAbstractFile propFile,
@Nullable
com.android.utils.ILogger log)
ProjectPropertiesWorkingCopy.save().
Code that writes INI or properties without at least using escape(String) will
certainly not load back correct data. Properties which has well defined semantics.
It's also a mistake to write/read property files using this code and expect it to
work with Java's Properties or external tools (e.g. ant) since there can be
differences in escaping and in character encoding.
propFile - the property file to parselog - the ILogger object receiving warning/error from the parsing.
protected static java.lang.String escape(java.lang.String value)
public void debugPrint()
debugPrint in interface IPropertySource
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||