Bright SDK Update Plugin Integration Guide
Introduction
The Bright SDK Update Plugin is designed to automate the process of updating the Bright SDK within your project. By integrating this plugin, developers can effortlessly switch between SDK versions, ensuring they are always working with the latest features and fixes. This plugin also simplifies debugging by allowing easy transitions between different versions of the SDK.
Benefits
- Automated Updates: Automatically fetches and installs the latest version of the Bright SDK, reducing manual overhead.
- Seamless Integration: Simplifies the process of adding the Bright SDK as a dependency in your project’s
build.gradle
file. - Version Management: Allows easy switching between different SDK versions, which is particularly useful for testing and debugging.
- Local Caching: Supports caching of SDK files, minimizing the need for repeated downloads.
Prerequisites
- Java Development Kit (JDK): Version 17 or higher, with backward compatibility for Java 8.
- Gradle: Version 6.7 or later.
- Internet Access: Required for downloading the SDK version information and the SDK itself.
Getting Started
System Requirements
- JDK: Version 17 or higher.
- Gradle: Version 6.7 or later.
- Supported Platforms: Any platform where Java and Gradle can run (e.g., Windows, macOS, Linux).
Installation Instructions
Step-by-Step Integration into the Application
Step 1: Adding the Plugin to Your Project
-
Create a
brightsdk.gradle
File in theapp/
Directory:Add a file named
brightsdk.gradle
in yourapp/
directory with the following content:buildscript { repositories { mavenCentral() } dependencies { classpath 'com.brightdata:bright-sdk-gradle:1+' } } // default values kept for reference ext.brightsdk = [ dir: "libs", version: "latest", ext: "brightsdk", consumerProjects: "app", useLocalCache: false, useMavenLocal: false, ] apply plugin: com.brightdata.BrightSdkPlugin tasks.named("preBuild").configure { dependsOn installBrightSdk }
-
Register plugin in
app/build.gradle
:Add the following lines to your
app/build.gradle
file:apply from: 'brightsdk.gradle'
Step 2: Verifying the Integration
Run your Gradle build process as usual, e.g:
./gradlew build
The installBrightSdk
task will automatically execute before the preBuild
task, ensuring that the latest version of the Bright SDK is used in your project.
Explanation:
brightsdk.gradle
inapp/
Directory: This file contains the configuration and application of the Bright SDK Update Plugin.- Auto-Update Setup: By adding the specified lines in
app/build.gradle
, you ensure that the SDK update runs before thepreBuild
task, which is an early stage in the build process.
Plugin Configuration
Basic Configuration
Modify brightsdk
configuration block values to override defaults:
- version: The SDK version to use (default:
"latest"
). - ext: The file extension for the SDK files (default:
"brightsdk"
). - useMavenLocal: Auto-inject SDK with it's dependencies using MavenLocal (default:
false
).
Using the Plugin
Checking for Bright SDK Updates
The plugin will automatically check for the latest SDK version based on the provided configuration.
Updating Bright SDK
If version is set to "latest", and a newer version is available, the plugin will download and replace the existing SDK files.
Backward Compatibility
The plugin supports backward compatibility with older SDK versions, allowing you to switch between versions as needed.
Documentation
For more detailed information, please refer to the Bright SDK Gradle Plugin Documentation.
Best Practices
- Regular Updates: Run your gradle with
--refresh-dependencies
to keep your plugins up-to-date with the latest features and bugfixes.
FAQ
Common Questions
Here are some common questions and answers about the Bright SDK Update Plugin:
- Q: How do I update the Bright SDK?
A: Simply run theupdateBrightSdk
task before your build. - Q: Can I use this plugin with older versions of the SDK?
A: Yes, the plugin supports backward compatibility with older SDK versions. - Q: What should I do if I encounter issues?
A: Check the plugin documentation and ensure you are using the latest version. If issues persist, contact support.
Support
If you need further assistance, please contact our support team at sdk@brightdata.com.
Conclusion
We hope this guide has helped you integrate the Bright SDK Update Plugin into your project. By following the steps outlined, you can ensure that your project always uses the latest version of the Bright SDK. If you have any questions or need further assistance, please refer to the documentation or contact our support team.