PreEmptive Protection - DashO Gradle v2.3 User Guide

Configuration

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:2.3.+"
    }
}

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:2.3.+"  //This must be before the Android tools
        classpath "com.android.tools.build:gradle:2.3.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\...").

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 named DASHO_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.
  • disabledForBuildTypes - Used only by DashO's com.android.application and com.android.library plugins, this optional setting allows obfuscation to be skipped for debug and/or release builds. You can also specify the name of a flavor to be skipped. Note: Any existing configuration of minifyEnabled is ignored and replaced based on these configured values.
  • 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 corresponding classes.jar file to DashO.
  • dexExcluded - Used only by DashO's com.android.application plugin. DashO's com.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 and includeAsInputs, you should include the entries from includeAsInputs in the dexExcluded setting. includeAsInputs and dexExcluded may not be able work properly with the new Transform API, introduced in version 1.5.0 of the Android Gradle Plugin, due to limitations in that system. The plugin will not be able to properly identify resources if they have been updated by other transforms. You may need to remove any custom transforms. 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 are G, M, K, and B 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 the AndroidManifest.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 to true you must also configure the DashO project to not rename the classes listed in AndroidManifest.xml.

Example

dashOConfig {
    dashOHome = '{DashO's Installation Directory}'
    doxFilename = 'project.dox'
    disabledForBuildTypes = ['debug']
    includeAsInputs = ['support.aar', 'myLibrary.jar']
    dexExcluded = ['support.aar', 'myLibrary.jar', 'myOtherLibrary.jar']
    maxHeap = '512M'
    transformName = 'PreEmptiveProtectionDashO'
    skipManifestProcessing = false
}

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

If using the com.preemptive.dasho plugin your output in DashO must be configured to be a merged directory.

Note: The contents of DashO's output directory will be deleted before DashO runs.

com.preemptive.dashoJar

If using the com.preemptive.dashoJar plugin, your output in DashO must configured to be a jar.

com.preemptive.dashoCustom

If using the com.preemptive.dashoCustom plugin, your output in DashO must match the task type being used.

PreEmptive Protection - DashO Gradle Version 2.3.2.21+7441f77. Copyright © 2017 PreEmptive Solutions, LLC