Configuration
To use this plugin you must add it to your project and then configure it to your environment.
Adding the Plugin
The plugin jar must be made available to your Gradle script.
If using com.preemptive.dasho
, com.preemptive.dashoJar
, or com.preemptive.dashoCustom
, add the following to your build script:
buildscript {
repositories {
flatDir dirs: "{DashO's Installation Directory}/gradle"
}
dependencies {
classpath "com.preemptive:dasho:3.0.+"
}
}
If using DashO's com.android.application
or com.android.library
you will also need the core Android plugin in the mix (See Version Compatibility):
buildscript {
repositories {
flatDir dirs: "{DashO's Installation Directory}/gradle"
jcenter()
}
dependencies {
classpath "com.preemptive:dasho:3.0.+" //This must be before the Android tools
classpath "com.android.tools.build:gradle:3.0.0"
}
}
Note: Use forward slashes when replacing
{DashO's Installation Directory}
with the actual path (E.G."C:/Program Files/..."
instead of"C:\Program Files\..."
).
Configuring the Plugin
Configuration for DashO's tasks is done via the dashOConfig
closure. This closure takes six properties:
dashOHome
- The name of the directory where DashO is installed. This setting is optional. This information may also be provided via an environment variable namedDASHO_HOME
.doxFilename
- The name of the DashO configuration (.dox
) file. This setting is optional. It defaults to "project.dox" or a name based on the flavor of an Android build.disabledForBuildVariants
- Used only by DashO'scom.android.application
andcom.android.library
plugins, this optional setting allows obfuscation to be skipped for specific build variants. It can include the names of build types (e.g.debug
), product flavors (e.g.free
), or a combination of both (e.g.freeDebug
). This setting is only available in versions 3.0.2 and later of this plugin. Note: Any existing configuration ofminifyEnabled
is ignored and replaced based on these configured values.disabledForBuildTypes
- Equivalent todisabledForBuildVariants
, but available in version 3.0.1 and earlier. Deprecated.includeAsInputs
- The names of support libraries which should be included as inputs and not support libraries. This optional setting is a list of.jar
files. The files listed here must already be part of the Gradle compile classpath or an error will occur. If used with an Android project,.aar
files can also be listed. When specifying an.aar
file the plugin will pass the correspondingclasses.jar
file to DashO. See the Android Configuration section for more details.dexExcluded
- Used only by DashO'scom.android.application
plugin. DashO'scom.android.application
plugin will detect 3rd party libraries which were included as inputs to DashO and will exclude the original jars from dex. This optional setting overrides the plugin's detection and supplies the list of 3rd party libraries (.jar
or.aar
) to be excluded from dex. Use the--info
option, when running Gradle, to print out the detected exclusions.Note: If configuring both
dexExcluded
andincludeAsInputs
, you should include the entries fromincludeAsInputs
in thedexExcluded
setting. Since version 3.0.1, theincludeAsInputs
anddexExcluded
configuration utilizes the names of the inputs provided by the Transform API. If custom transforms do not pass along that name, the DashO plugin may not be able to properly identify the resources. The build cache may also prevent the lookups. You may need to disable caching.maxHeap
- Allows setting the max heap size to use when running DashO. Valid units areG
,M
,K
, andB
for gibibytes, mebibytes, kibibytes, and bytes respectively. If no unit is specified, mebibytes is assumed. This setting is only available in versions 1.7 and later of this plugin. If you are using an older version, see the OutOfMemory troubleshooting solution.transformName
- Allows configuration of the name for the obfuscation transform used with the Android Gradle integration which can help in rare situations where other (third-party) plugins expect a specific name. This setting is optional and only available in versions 2.2.1 and later of this plugin.skipManifestProcessing
- Tells the plugin to skip processing theAndroidManifest.xml
when used with the Android Gradle Integration. This setting can help if you have complex manifest merges in your android build. This setting is optional and only available in versions 2.3.1 and later of this plugin.Note: If setting
skipManifestProcessing
totrue
you must also configure the DashO project to not rename the classes listed inAndroidManifest.xml
.verbose
- Tells the plugin to run DashO with the--verbose
and--printStackTraces
arguments. This setting is optional and only available in versions 2.3.4 and later of this plugin.
Example
dashOConfig {
dashOHome = '{DashO's Installation Directory}'
doxFilename = 'project.dox'
disabledForBuildVariants = ['debug']
includeAsInputs = ['support-2.3.aar', 'myLibrary.jar']
dexExcluded = ['support-2.3.aar', 'myLibrary.jar', 'myOtherLibrary.jar']
maxHeap = '512M'
transformName = 'PreEmptiveProtectionDashO'
skipManifestProcessing = false
verbose = true
}
The plugins will pass the inputs and outputs as User Properties
to DashO, your project file should use ${gradleInput}
and ${gradleOutput}
as the input and output locations. They will also pass the required support jars in ${gradleSupport}
. See the DashO User's Guide for information concerning User Properties.
If you use the DashO Android wizard, it will set up these properties automatically. The configured output type needs to match the plugin you are using:
com.preemptive.dasho
- Your output in DashO must be configured to be a merged directory.
Note: With this plugin, the contents of DashO's output directory will be deleted before DashO runs.
com.preemptive.dashoJar
- Your output in DashO must configured to be a jar.com.preemptive.dashoCustom
- Your output in DashO must match the Task Type being used.com.android.application
orcom.android.library
- Please see Android Configuration.
Note: The DashO Gradle Plugin will use the same version of Java as configured for Gradle when running DashO. This can be configured with the org.gradle.java.home setting.