Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
Draft
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
36,337 changes: 31,257 additions & 5,080 deletions build-tools/protocol.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.android.tools.build:gradle:7.3.1'
}
}

Expand Down
39 changes: 20 additions & 19 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
# Project-wide Gradle settings.

# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.

# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# Project-wide Gradle settings
VERSION_NAME=1.6.0-SNAPSHOT
GROUP=com.facebook.stetho

# Android build settings
android.useAndroidX=true
android.enableJetifier=true

# Java 17 compatibility for tests - Allow reflection access
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m \
--add-opens=java.base/java.lang=ALL-UNNAMED \
--add-opens=java.base/java.lang.reflect=ALL-UNNAMED \
--add-opens=java.base/java.io=ALL-UNNAMED \
--add-opens=java.base/java.util=ALL-UNNAMED \
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED \
--add-opens=java.base/sun.reflect=ALL-UNNAMED \
--add-opens=java.base/jdk.internal.loader=ALL-UNNAMED \
--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED \
--add-opens=java.base/jdk.internal.reflect=ALL-UNNAMED \
--add-opens=java.base/jdk.internal.math=ALL-UNNAMED \
--add-opens=java.base/jdk.internal.module=ALL-UNNAMED \
--add-opens=java.base/jdk.internal.util.jar=ALL-UNNAMED

VERSION_NAME=1.6.1-SNAPSHOT
GROUP=com.facebook.stetho
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Mar 08 22:57:34 PST 2021
#Updated for Java 17 compatibility
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
145 changes: 65 additions & 80 deletions release.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'signing'

def isReleaseBuild() {
Expand All @@ -17,51 +17,6 @@ def getMavenRepositoryPassword() {
return hasProperty('repositoryPassword') ? property('repositoryPassword') : ""
}

def configureStethoPom(def pom) {
pom.whenConfigured {
applyOptionalDeps it, getOptionalDeps()
}
pom.project {
name POM_NAME
artifactId POM_ARTIFACT_ID
packaging POM_PACKAGING
description 'Stetho Debugging Platform for Android'
url 'https://github.com/facebook/stetho'

scm {
url 'https://github.com/facebook/stetho.git'
connection 'scm:git:https://github.com/facebook/stetho.git'
developerConnection 'scm:git:git@github.com:facebook/stetho.git'
}

licenses {
license {
name 'MIT License'
url 'https://github.com/facebook/stetho/blob/master/LICENSE'
distribution 'repo'
}
}

developers {
developer {
id 'facebook'
name 'Facebook'
}
}
}
}

// Hack to modify the resulting pom's dependencies to use
// <optional>true</optional> where appropriate.
def applyOptionalDeps(def pom, def optionalDeps) {
pom.dependencies.each { dep ->
def artifactLabel = dep.groupId + ':' + dep.artifactId
if (optionalDeps.contains(artifactLabel)) {
dep.optional = true
}
}
}

def getOptionalDeps() {
if (hasProperty('POM_OPTIONAL_DEPS')) {
return property('POM_OPTIONAL_DEPS').split(',') as Set
Expand All @@ -80,60 +35,90 @@ afterEvaluate { project ->
}

task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
classifier = 'javadoc'
archiveClassifier = 'javadoc'
from androidJavadoc.destinationDir
}

task androidSourcesJar(type: Jar) {
classifier = 'sources'
archiveClassifier = 'sources'
from android.sourceSets.main.java.srcDirs
}

android.libraryVariants.all { variant ->
def name = variant.name.capitalize()
task "jar${name}"(type: Jar, dependsOn: variant.javaCompile) {
from variant.javaCompile.destinationDir
task "jar${name}"(type: Jar, dependsOn: variant.javaCompileProvider) {
from variant.javaCompileProvider.get().destinationDirectory
}
}

artifacts {
archives androidJavadocJar
archives androidSourcesJar
}

version = VERSION_NAME
group = GROUP

signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}

uploadArchives {
configuration = configurations.archives
repositories.mavenDeployer {
beforeDeployment {
MavenDeployment deployment -> signing.signPom(deployment)
}

repository(url: getMavenRepositoryUrl()) {
authentication(
userName: getMavenRepositoryUsername(),
password: getMavenRepositoryPassword())

publishing {
publications {
release(MavenPublication) {
from components.release

artifact androidJavadocJar
artifact androidSourcesJar

groupId = GROUP
artifactId = POM_ARTIFACT_ID
version = VERSION_NAME

pom {
name = POM_NAME
description = 'Stetho Debugging Platform for Android'
url = 'https://github.com/facebook/stetho'
packaging = POM_PACKAGING

scm {
url = 'https://github.com/facebook/stetho.git'
connection = 'scm:git:https://github.com/facebook/stetho.git'
developerConnection = 'scm:git:git@github.com:facebook/stetho.git'
}

licenses {
license {
name = 'MIT License'
url = 'https://github.com/facebook/stetho/blob/master/LICENSE'
distribution = 'repo'
}
}

developers {
developer {
id = 'facebook'
name = 'Facebook'
}
}

withXml {
def optionalDeps = getOptionalDeps()
asNode().dependencies.'*'.findAll {
def artifactLabel = it.groupId.text() + ':' + it.artifactId.text()
optionalDeps.contains(artifactLabel)
}.each {
it.appendNode('optional', true)
}
}
}
}

configureStethoPom pom
}
}

task installArchives(type: Upload) {
configuration = configurations.archives
repositories {
mavenDeployer {
repository url: "file://${System.properties['user.home']}/.m2/repository"
configureStethoPom pom
maven {
url = getMavenRepositoryUrl()
credentials {
username = getMavenRepositoryUsername()
password = getMavenRepositoryPassword()
}
}
}
}

signing {
required { isReleaseBuild() && gradle.taskGraph.hasTask("publish") }
sign publishing.publications.release
}
}
31 changes: 25 additions & 6 deletions stetho-okhttp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,43 @@ android {
// more targeted fashion...
warning 'InvalidPackage'
}

testOptions {
unitTests {
includeAndroidResources = true
all {
jvmArgs(
'--add-opens=java.base/java.lang=ALL-UNNAMED',
'--add-opens=java.base/java.lang.reflect=ALL-UNNAMED',
'--add-opens=java.base/java.io=ALL-UNNAMED',
'--add-opens=java.base/java.util=ALL-UNNAMED',
'--add-opens=java.base/sun.nio.ch=ALL-UNNAMED',
'--add-opens=java.base/sun.net.www.protocol.http=ALL-UNNAMED'
)
systemProperty 'robolectric.enabledSdks', '30'
systemProperty 'robolectric.offline', 'true'
}
}
}
}

dependencies {
implementation project(':stetho')
implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'com.squareup.okhttp:okhttp:2.7.2'

testImplementation 'junit:junit:4.12'
testImplementation('org.robolectric:robolectric:2.4') {
testImplementation 'junit:junit:4.13.2'
testImplementation('org.robolectric:robolectric:4.9.2') {
exclude module: 'commons-logging'
exclude module: 'httpclient'
}
testImplementation 'org.powermock:powermock-api-mockito:1.6.6'
testImplementation 'org.powermock:powermock-module-junit4:1.6.6'
testImplementation 'org.mockito:mockito-core:3.12.4'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.9'
testImplementation 'org.powermock:powermock-module-junit4:2.0.9'

// Needed for Robolectric and PowerMock to be combined in a single test.
testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.6'
testImplementation 'org.powermock:powermock-classloading-xstream:1.6.6'
testImplementation 'org.powermock:powermock-module-junit4-rule:2.0.9'
testImplementation 'org.powermock:powermock-classloading-xstream:2.0.9'

testImplementation 'com.squareup.okhttp:mockwebserver:2.7.2'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
import java.util.zip.GZIPOutputStream;

import static org.junit.Assert.*;
import static org.mockito.Matchers.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.mock;

@Config(emulateSdk = Build.VERSION_CODES.JELLY_BEAN)
@Config(sdk = Build.VERSION_CODES.JELLY_BEAN)
@RunWith(RobolectricTestRunner.class)
@PowerMockIgnore({ "org.mockito.*", "org.robolectric.*", "android.*", "javax.net.ssl.*" })
@PrepareForTest(NetworkEventReporterImpl.class)
Expand Down
2 changes: 2 additions & 0 deletions stetho-okhttp/src/test/resources/robolectric.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sdk=30

39 changes: 23 additions & 16 deletions stetho-okhttp3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

lintOptions {
Expand All @@ -17,26 +17,33 @@ android {
// more targeted fashion...
warning 'InvalidPackage'
}

testOptions {
unitTests {
includeAndroidResources = true
returnDefaultValues = true
}
}
}

dependencies {
implementation project(':stetho')
implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'com.squareup.okhttp3:okhttp:3.4.2'

testImplementation 'junit:junit:4.12'
testImplementation('org.robolectric:robolectric:2.4') {
exclude module: 'commons-logging'
exclude module: 'httpclient'
}
testImplementation 'org.powermock:powermock-api-mockito:1.6.6'
testImplementation 'org.powermock:powermock-module-junit4:1.6.6'

// Needed for Robolectric and PowerMock to be combined in a single test.
testImplementation 'org.powermock:powermock-module-junit4-rule:1.6.6'
testImplementation 'org.powermock:powermock-classloading-xstream:1.6.6'

testImplementation 'com.squareup.okhttp3:mockwebserver:3.4.2'
// Updated OkHttp3 to a stable, well-tested version compatible with the codebase
implementation 'com.squareup.okhttp3:okhttp:3.14.9'

// Modern testing dependencies
testImplementation 'junit:junit:4.13.2'

// Robolectric 4.x - compatible with modern Android and Java
testImplementation 'org.robolectric:robolectric:4.9.2'

// Mockito 3.x - modern mocking framework (no PowerMock needed)
testImplementation 'org.mockito:mockito-core:3.12.4'
testImplementation 'org.mockito:mockito-inline:3.12.4'

// MockWebServer for OkHttp testing
testImplementation 'com.squareup.okhttp3:mockwebserver:3.14.9'
}

apply from: rootProject.file('release.gradle')
Loading