Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

This repository contains the source code for BrowserStack's Gradle plugin.

**Compatibility:** Android Gradle Plugin (AGP) 9.x, Gradle 9.1+. The plugin uses the `androidComponents.onVariants()` API required by AGP 9. For AGP 2.x–6.x, use plugin version 3.1.6 or earlier.


## PURPOSE

Expand Down
27 changes: 14 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

plugins {
id 'java-gradle-plugin'
id 'com.gradle.plugin-publish' version '0.11.0'
id 'com.gradle.plugin-publish' version '2.1.0'
id 'maven-publish'
}

version '3.1.6'
group 'com.browserstack'

pluginBundle {
gradlePlugin {
website = 'https://www.browserstack.com'
vcsUrl = 'https://github.com/browserstack/browserstack-gradle-plugin'

Expand All @@ -17,31 +17,32 @@ pluginBundle {
id = 'com.browserstack.gradle'
displayName = 'BrowserStack\'s Gradle Plugin'
description = 'Runs Espresso tests on BrowserStack'
tags = ['espresso', 'test', 'browserstack', 'app', 'automate',
'app-automate', 'appautomate', 'app-live', 'applive']
version = '3.1.6'
group = 'com.browserstack'
tags.set(['espresso', 'test', 'browserstack', 'app', 'automate',
'app-automate', 'appautomate', 'app-live', 'applive'])
implementationClass = 'com.browserstack.gradle.BrowserStackPlugin'
}
browserstackSDKPlugin {
id = 'com.browserstack.gradle-sdk'
displayName = 'BrowserStack SDK Gradle Solution'
description = 'Cross browser testing for Gradle based projects with BrowserStack SDK'
tags = ['test', 'browserstack']
version = '3.1.6'
group = 'com.browserstack'
tags.set(['test', 'browserstack'])
implementationClass = 'com.browserstack.gradle.BrowserStackSDKPlugin'
}
}
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

repositories {
maven { url 'https://maven.google.com' }
// google()
jcenter()
mavenCentral()
}

dependencies {
// https://mvnrepository.com/artifact/com.android.tools.build/gradle
implementation group: 'com.android.tools.build', name: 'gradle', version: '2.3.0'
implementation group: 'com.android.tools.build', name: 'gradle', version: '9.0.1'
implementation group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
compileOnly group: 'org.jetbrains', name: 'annotations', version: '26.0.2'
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
50 changes: 32 additions & 18 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 22 additions & 18 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
import java.nio.file.Path;
import java.util.Map;

/**
* Gradle task that uploads the debug APK to BrowserStack App Automate and prints the test URL.
*/
public class AppAutomateUploadTask extends BrowserStackTask {

private void displayTestURL(String app_url) {
String app_hashed_id = app_url.substring(5);
System.out.println("Start testing at " + Constants.APP_AUTOMATE_HOST + "/#app_hashed_id=" + app_hashed_id);
}

/** Ensures username and accessKey are set (from extension or env). */
public void verifyParams() throws Exception {
String username = this.getUsername();
String accessKey = this.getAccessKey();
Expand All @@ -21,6 +25,7 @@ public void verifyParams() throws Exception {
}
}

/** Uploads the debug APK to App Automate and prints the session URL. */
@TaskAction
void upload() throws Exception {
verifyParams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
import java.util.Map;
import java.nio.file.Path;

/**
* Gradle task that uploads the debug APK to BrowserStack App Live and prints the test URL.
*/
public class AppLiveUploadTask extends BrowserStackTask {

private void displayTestURL(String app_url) {
String app_hashed_id = app_url.substring(5);
System.out.println("Start testing at " + Constants.APP_LIVE_HOST + "/#app_hashed_id=" + app_hashed_id);
}

/** Ensures username and accessKey are set (from extension or env). */
public void verifyParams() throws Exception {
String username = this.getUsername();
String accessKey = this.getAccessKey();
Expand All @@ -20,6 +24,7 @@ public void verifyParams() throws Exception {
}
}

/** Uploads the debug APK to App Live and prints the session URL. */
@TaskAction
void uploadAndExecuteTest() throws Exception {
verifyParams();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

import java.util.HashMap;

// This class is for getting browserstack configuration from gradle file.
/**
* Gradle extension for BrowserStack credentials and options.
* Configure via the {@code browserStackConfig { ... }} block in build.gradle.
* Username and accessKey default to BROWSERSTACK_USERNAME and BROWSERSTACK_ACCESS_KEY env vars.
*/
public class BrowserStackConfigExtension {

private String username = System.getenv("BROWSERSTACK_USERNAME");
Expand All @@ -11,9 +15,7 @@ public class BrowserStackConfigExtension {
private String configFilePath;
private String customId;

/**
* Enables debugging with more verbose logs
*/
/** When true, enables debugging with more verbose logs. */
private boolean isDebug = false;

public String getUsername() {
Expand Down
Loading