### Example Test Method Following Given-When-Then Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/CONTRIBUTING.md Demonstrates a test method adhering to the Given-When-Then structure, with a descriptive name following the M/W convention and clear setup, action, and assertion steps. ```kotlin @Test fun `M forward boolean attribute to handler W addAttribute`( @StringForgery(StringForgeryType.ALPHABETICAL) key : String, @BoolForgery value : Boolean ) { // When testedLogger.addAttribute(key, value) testedLogger.v(fakeMessage) // Then verify(mockLogHandler) .handleLog( Log.VERBOSE, fakeMessage, null, mapOf(key to value), emptySet() ) } ``` -------------------------------- ### Build the Gradle Plugin Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/CONTRIBUTING.md Use this command to build the Gradle Plugin. Ensure you have the necessary build tools installed. ```shell ./gradlew :dd-sdk-android-gradle-plugin:assemble ``` -------------------------------- ### Format Kotlin Code with Ktlint Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/CONTRIBUTING.md Applies the ktlint check and formatter to all Kotlin files. The ktlint client must be installed locally. ```shell # launches the ktlint check and formatter for all Kotlin files (the ktlint client needs to be installed on your machine) ktlint -F "**/*.kt" "**/*.kts" '!'**/build/generated/**' '!'**/build/kspCaches/**' ``` -------------------------------- ### KtLint Formatting Command Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/CONTRIBUTING.md Command to automatically format Kotlin code according to KtLint's default style rules. Ensure KtLint is installed on your machine before running. ```bash ktlint -F "**/*.kt" "**/*.kts" '!**/build/generated/**' '!**/build/kspCaches/**' ``` -------------------------------- ### Set Minimum CMake Version Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/samples/ndk/src/main/cpp/CMakeLists.txt Specifies the minimum CMake version required for the project. Ensure this version is compatible with your NDK and Android Studio setup. ```cmake cmake_minimum_required(VERSION 3.22.1) ``` -------------------------------- ### Configure Datadog Plugin Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/README.md Add this block to your build.gradle file to configure the Datadog plugin. Optional parameters include versionName, serviceName, site, checkProjectDependencies, mappingFilePath, nonDefaultObfuscation, ignoreDatadogCiFileConfig, and additionalSymbolFilesLocations. ```groovy datadog { versionName = "1.3.0" // Optional, by default it is read from your Android plugin configuration's version name serviceName = "my-service" // Optional, by default it is read from your Android plugin configuration's package name site = "US1" // Optional, can be "US1", "EU1" or "US1_FED", etc. (check `DatadogSite` documentation for the full list). Default is "US1" checkProjectDependencies = "warn" // Optional, can be "warn", "fail" or "none". Default is "fail". Will check if Datadog SDK is in the project dependencies. mappingFilePath = "path/to/mapping.txt" // Optional, provides a custom mapping file path. Default is "build/outputs/mapping/{variant}/mapping.txt". nonDefaultObfuscation = false // Optional, to be used if a 3rd-party obfuscation tool is used. Default is false. ignoreDatadogCiFileConfig = false // Optional, ignore configuration provided in `datadog-ci.json` file if found. Default is false. additionalSymbolFilesLocations = ["/path/to/location/obj"] // Optional, additional locations the Gradle plugin will check for `.so` files during `uploadNdkSymbolFiles` task. Default is none. } ``` -------------------------------- ### Run Unit Tests Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/CONTRIBUTING.md Executes the unit tests for the project. This is part of the overall quality check. ```shell # launches the unit tests ./gradlew :dd-sdk-android-gradle-plugin:test ``` -------------------------------- ### Run All Project Tests and Checks Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/CONTRIBUTING.md Triggers all defined tests and static analysis checks for the project. ```shell # launches all the tests described above ./gradlew :dd-sdk-android-gradle-plugin:check ``` -------------------------------- ### Upload Mapping Files Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/README.md Run this Gradle task to upload your mapping files to Datadog. Replace [Variant] with your build variant (e.g., Release). ```bash ./gradlew uploadMappingRelease ``` -------------------------------- ### Apply Datadog Gradle Plugin Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/README.md Add this to your build.gradle file to apply the Datadog plugin. ```groovy plugins { id("com.datadoghq.dd-sdk-android-gradle-plugin") version "x.y.z" } ``` -------------------------------- ### Upload NDK Symbol Files Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/README.md Run this Gradle task to upload your NDK symbol files to Datadog. Replace [Variant] with your build variant (e.g., Release). ```bash ./gradlew uploadNdkSymbolFilesRelease ``` -------------------------------- ### Configure Variant-Specific Settings (Groovy) Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/README.md Set custom configurations per variant using this syntax in your build.gradle file. Variants without specific configurations will use the default settings. ```groovy datadog { site = "US1" // Variants with no configurations will use this as default variants { fr { site = "EU1" mappingFilePath = "path/to/fr/mapping.txt" } } } ``` -------------------------------- ### Configure Variant-Specific Settings (Kotlin) Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/README.md Set custom configurations per variant using this syntax in your build.gradle.kts file. Variants without specific configurations will use the default settings. ```kotlin datadog { site = "US1" // Variants with no configurations will use this as default variants { register("fr") { site = "EU1" mappingFilePath = "path/to/fr/mapping.txt" } } } ``` -------------------------------- ### androidx.work.Data.Builder Mapping Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/dd-sdk-android-gradle-plugin/src/test/resources/mapping.txt This section provides the mapping for the `androidx.work.Data.Builder` class and its methods, including constructors and utility methods. ```APIDOC ## androidx.work.Data$Builder ### Description Provides mapping for the `Data.Builder` class used in WorkManager. ### Methods #### Constructor - **``**: Maps the default constructor. #### `build()` ### Description Maps the `build` method which constructs a `Data` object. ### Method N/A (Method Signature Mapping) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### `putAll(java.util.Map)` ### Description Maps the `putAll` method for adding all entries from a map. ### Method N/A (Method Signature Mapping) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### `put(java.lang.String, java.lang.Object)` ### Description Maps the `put` method for adding a key-value pair. ### Method N/A (Method Signature Mapping) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### `convertPrimitiveBooleanArray(boolean[])` ### Description Maps the utility method for converting primitive boolean arrays. ### Method N/A (Method Signature Mapping) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### `convertPrimitiveByteArray(byte[])` ### Description Maps the utility method for converting primitive byte arrays. ### Method N/A (Method Signature Mapping) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### `convertPrimitiveIntArray(int[])` ### Description Maps the utility method for converting primitive int arrays. ### Method N/A (Method Signature Mapping) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### `convertPrimitiveLongArray(long[])` ### Description Maps the utility method for converting primitive long arrays. ### Method N/A (Method Signature Mapping) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### `convertPrimitiveFloatArray(float[])` ### Description Maps the utility method for converting primitive float arrays. ### Method N/A (Method Signature Mapping) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A #### `convertPrimitiveDoubleArray(double[])` ### Description Maps the utility method for converting primitive double arrays. ### Method N/A (Method Signature Mapping) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Kotlin Class Structure with Folding Regions Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/CONTRIBUTING.md Demonstrates how to organize methods within a Kotlin class using named folding regions for different interfaces and private methods. This convention enhances code readability and maintainability. ```kotlin class Foo :Observable(), Runnable { // region Observable override fun addObserver(o: Observer?) { super.addObserver(o) doSomething() } // endregion // region Runnable override fun run() {} // endregion // region Internal private fun doSomething() {} // endregion } ``` -------------------------------- ### Accessibility Methods Mapping Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/dd-sdk-android-gradle-plugin/src/test/resources/mapping.txt This section details the mapping for accessibility-related methods, showing how original method signatures are transformed. ```APIDOC ## onRequestSendAccessibilityEvent ### Description Maps the original `onRequestSendAccessibilityEvent` method to its obfuscated equivalent. ### Method N/A (Method Signature Mapping) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## performAccessibilityAction ### Description Maps the original `performAccessibilityAction` method to its obfuscated equivalent. ### Method N/A (Method Signature Mapping) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## sendAccessibilityEvent ### Description Maps the original `sendAccessibilityEvent` method to its obfuscated equivalent. ### Method N/A (Method Signature Mapping) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## sendAccessibilityEventUnchecked ### Description Maps the original `sendAccessibilityEventUnchecked` method to its obfuscated equivalent. ### Method N/A (Method Signature Mapping) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Add Shared Native Library Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/samples/ndk/src/main/cpp/CMakeLists.txt Creates a shared native library from C/C++ source files. Gradle automatically packages shared libraries with your APK. The library name is derived from the project name. ```cmake add_library(${CMAKE_PROJECT_NAME} SHARED # List C/C++ source files with relative paths to this CMakeLists.txt. native_code.cpp) ``` -------------------------------- ### Disable SDK Dependency Check for Configuration Cache Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/README.md To enable Gradle configuration cache support from version 1.1.0 onwards, set `checkProjectDependencies` to `none` within the datadog block. ```groovy datadog { ... checkProjectDependencies = "none" ... } ``` -------------------------------- ### Declare Project Name Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/samples/ndk/src/main/cpp/CMakeLists.txt Defines the name of the project. This name can be accessed using ${PROJECT_NAME} or ${CMAKE_PROJECT_NAME} within the CMake scripts. ```cmake project("ndk") ``` -------------------------------- ### Link Target Libraries Source: https://github.com/datadog/dd-sdk-android-gradle-plugin/blob/develop/samples/ndk/src/main/cpp/CMakeLists.txt Specifies libraries that CMake should link to your target library. This includes Android system libraries like 'android' and 'log'. ```cmake target_link_libraries(${CMAKE_PROJECT_NAME} # List libraries link to the target library android log) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.