Package org.robovm.compiler.config
Class Resource
java.lang.Object
org.robovm.compiler.config.Resource
public class Resource extends Object
Specifies resources needed by the application the compiler produces. A
resource can be specified using a single
File:
<resource>path/to/the/resource.txt</resource>If the path specifies a directory the directory including its contents (except for the default excludes, see below) will be copied. If the path specifies a file, that file will be copied.
A resource be also be specified with a base directory, a target path and include and exclude filters (similar to Maven's <resource> element):
<resource>
<targetPath>data</targetPath>
<directory>resources</directory>
<includes>
<include>**/*</include>
</includes>
<excludes>
<exclude>**/*.bak</exclude>
</excludes>
<flatten>false</flatten>
<ignoreDefaultExcludes>false</ignoreDefaultExcludes>
<skipPngCrush>false</skipPngCrush>
</resource>
Each element represents a property in this class. Please see the
documentation for each property's getter method for more information.
The current Target may transform and rename a resource while being
copied (e.g. running pngcrush or converting xib files to
nib files).
Default excludes
(The same as those used by ANT 1.9)
Miscellaneous typical temporary files:
- **/*~
- **/#*#
- **/.#*
- **/%*%
- **/._*
- **/CVS
- **/CVS/**
- **/.cvsignore
- **/SCCS
- **/SCCS/**
- **/vssver.scc
- **/.svn
- **/.svn/**
- **/.git
- **/.git/**
- **/.gitattributes
- **/.gitignore
- **/.gitmodules
- **/.hg
- **/.hg/**
- **/.hgignore
- **/.hgsub
- **/.hgsubstate
- **/.hgtags
- **/.bzr
- **/.bzr/**
- **/.bzrignore
- **/.DS_Store
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceResource.WalkerInterface used bywalk(Walker, File)to walk the paths matched by aResource. -
Constructor Summary
Constructors Modifier Constructor Description protectedResource()Resource(File path)Creates a new simpleResourcewhich will copy the specified file or directory.Resource(File directory, String targetPath)Creates a newResourcewhich will copy all files in the specified base directory to the specified target path in the application directory. -
Method Summary
Modifier and Type Method Description booleanequals(Object obj)Resourceexclude(String... patterns)Adds exclude patterns.Resourceflatten(boolean b)Sets theflattenproperty and returnsthis.FilegetDirectory()Returns the base directory containing the files and directories copied by theResource.List<String>getExcludes()Returns a list of Ant-style patterns (using **, *, ? as wildcards) matching files which will be excluded when copying thisResource.List<String>getIncludes()Returns a list of Ant-style patterns (using **, *, ? as wildcards) matching files which will be included when copying thisResource.FilegetPath()StringgetTargetPath()Returns the target path relative to the application directory (i.e.inthashCode()ResourceignoreDefaultExcludes(boolean b)Sets theignoreDefaultExcludesproperty and returnsthis.Resourceinclude(String... patterns)Adds include patterns.booleanisFlatten()Returnstrueif the files matched by thisResourceshould be copied directly into the application directory without preserving the directory structure of the source directory.booleanisIgnoreDefaultExcludes()booleanisSkipPngCrush()Returnstrueifpngcrushshould not be called for PNG files matching thisResourcewhen targeting iOS.ResourceskipPngCrush(boolean b)Sets theskipPngCrushproperty and returnsthis.StringtoString()voidwalk(Resource.Walker walker)voidwalk(Resource.Walker walker, File destDir)
-
Constructor Details
-
Resource
protected Resource() -
Resource
Creates a new simpleResourcewhich will copy the specified file or directory.- Parameters:
path- theFilewhich will be copied.
-
Resource
Creates a newResourcewhich will copy all files in the specified base directory to the specified target path in the application directory.- Parameters:
directory- the base directory.targetPath- the target path.
-
-
Method Details
-
getPath
- Returns:
- the path.
-
getTargetPath
Returns the target path relative to the application directory (i.e. app bundle directory for iOS apps) where paths matching thisResourcewill be copied. If not specified paths will be copied directly to the application directory.- Returns:
- the target path or
nullif not specified.
-
getDirectory
Returns the base directory containing the files and directories copied by theResource.- Returns:
- the base directory.
-
getIncludes
Returns a list of Ant-style patterns (using **, *, ? as wildcards) matching files which will be included when copying thisResource.- Returns:
- the include patterns.
- See Also:
AntPathMatcher
-
include
Adds include patterns.- Returns:
this- See Also:
getIncludes()
-
getExcludes
Returns a list of Ant-style patterns (using **, *, ? as wildcards) matching files which will be excluded when copying thisResource.- Returns:
- the exclude patterns.
- See Also:
AntPathMatcher
-
exclude
Adds exclude patterns.- Returns:
this- See Also:
getExcludes()
-
isFlatten
public boolean isFlatten()Returnstrueif the files matched by thisResourceshould be copied directly into the application directory without preserving the directory structure of the source directory. The default isfalse.- Returns:
trueif the directory structure should be flattened.
-
flatten
Sets theflattenproperty and returnsthis.- Parameters:
b- the new value.- Returns:
this- See Also:
isFlatten()
-
isIgnoreDefaultExcludes
public boolean isIgnoreDefaultExcludes()Returnstrueif the default excludes should be ignored and copied for thisResource. The default isfalse, i.e. don't copy files matching the default excludes.- Returns:
trueif default excludes should be ignored.
-
ignoreDefaultExcludes
Sets theignoreDefaultExcludesproperty and returnsthis.- Parameters:
b- the new value.- Returns:
this- See Also:
isIgnoreDefaultExcludes()
-
isSkipPngCrush
public boolean isSkipPngCrush()Returnstrueifpngcrushshould not be called for PNG files matching thisResourcewhen targeting iOS. The default isfalse, i.e.pngcrushWILL be called for PNG files.- Returns:
trueifpngcrushshould not be called.
-
skipPngCrush
Sets theskipPngCrushproperty and returnsthis.- Parameters:
b- the new value.- Returns:
this- See Also:
isSkipPngCrush()
-
walk
- Throws:
IOException
-
walk
- Throws:
IOException
-
hashCode
public int hashCode() -
equals
-
toString
-