Skip to content
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
81 changes: 35 additions & 46 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,49 +1,51 @@
buildscript {
ext {
kotlinVersion = '1.6.10'
androidGradleVersion = '7.1.1'
kotlinVersion = '1.6.21'
androidGradleVersion = '7.0.4'
coroutineVersion = '1.5.2'

// Google libraries
activityVersion = '1.4.0'
appCompatVersion = '1.4.1'
constraintLayoutVersion = '2.1.3'
materialComponentsVersion = '1.5.0'
roomVersion = '2.4.1'
fragmentVersion = '1.4.1'
lifecycleVersion = '2.4.1'
androidXCoreVersion = '2.1.0'
appCompatVersion = '1.3.1'
constraintLayoutVersion = '2.1.1'
materialComponentsVersion = '1.2.1'
roomVersion = '2.4.2'
fragmentVersion = '1.3.6'
lifecycleVersion = '2.4.0'
androidXArchTestVersion = '2.1.0'
paletteKtxVersion = '1.0.0'

// Networking
brotliVersion = '0.1.2'
gsonVersion = '2.9.0'
okhttpVersion = '4.9.3'
gsonVersion = '2.8.5'
okhttpVersion = '4.9.0'
retrofitVersion = '2.9.0'
wireVersion = '4.1.0'
jsonhandleviewVersion = '1.0.0'

// Debug and quality control
binaryCompatibilityValidator = '0.8.0'
detektVersion = '1.19.0'
dokkaVersion = '1.6.10'
ktLintGradleVersion = '10.2.1'
leakcanaryVersion = '2.8.1'
detektVersion = '1.18.1'
dokkaVersion = '1.5.31'
ktLintGradleVersion = '10.0.0'
ktLintVersion = '0.40.0'
leakcanaryVersion = '2.7'

// Testing
androidxTestCoreVersion = '1.4.0'
junitGradlePluignVersion = '1.8.2.0'
junitVersion = '5.8.2'
junit4Version = '4.13.2'
mockkVersion = '1.12.2'
robolectricVersion = '4.7.3'
truthVersion = '1.1.3'
androidxTestCoreVersion = '1.3.0'
junitGradlePluignVersion = '1.7.1.1'
junitVersion = '5.7.0'
vintageJunitVersion = '4.12'
mockkVersion = '1.10.2'
robolectricVersion = '4.4'
truthVersion = '1.1'

// Publishing
nexusStagingPlugin = '0.30.0'
jfrogExtractor = '4.21.0'
}

repositories {
google()
mavenCentral()
gradlePluginPortal()
}

Expand All @@ -54,33 +56,26 @@ buildscript {
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektVersion"
classpath "org.jlleitschuh.gradle:ktlint-gradle:$ktLintGradleVersion"
classpath "org.jetbrains.kotlinx:binary-compatibility-validator:$binaryCompatibilityValidator"
classpath "com.squareup.wire:wire-gradle-plugin:$wireVersion"
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:$nexusStagingPlugin"
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:$jfrogExtractor"
}
}
apply plugin: 'binary-compatibility-validator'
apply plugin: 'io.codearte.nexus-staging'

apiValidation {
ignoredProjects += ["sample"]
ignoredPackages += [
"com.chuckerteam.chucker.internal",
"com.chuckerteam.chucker.databinding"
]
}

allprojects {
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.artifactory'

version = VERSION_NAME
group = GROUP

repositories {
google()
mavenCentral()
jcenter {
content {
includeModule("org.jetbrains.trove4j", "trove4j")
includeModule("org.jetbrains.kotlinx", "kotlinx-html-jvm")
maven {
url "${JFROG_ARTIFACTORY_URL}/${RELEASE_REPO_NAME}"
credentials {
username = "${JFROG_ARTIFACTORY_USERNAME}"
password = "${JFROG_ARTIFACTORY_KEY}"
}
}
}
Expand Down Expand Up @@ -108,9 +103,3 @@ ext {
targetSdkVersion = 31
compileSdkVersion = 31
}

nexusStaging {
username = findProperty("NEXUS_USERNAME")
password = findProperty("NEXUS_PASSWORD")
stagingProfileId = "ea09119de9f4"
}
9 changes: 8 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ org.gradle.jvmargs=-Xmx1536m
org.gradle.parallel=true

android.useAndroidX=true
android.enableJetifier=true

VERSION_NAME=4.0.0-SNAPSHOT
# 4*100*100 + 0*100 + 0 => 40000
Expand All @@ -28,4 +29,10 @@ POM_DESCRIPTION=Android in-app HTTP inspector
POM_URL=https://github.com/ChuckerTeam/chucker
POM_SCM_CONNECTION=scm:git:git://github.com/ChuckerTeam/chucker.git
POM_LICENSE_NAME=The Apache Software License, Version 2.0
POM_LICENSE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENSE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt

JFROG_ARTIFACTORY_URL=
JFROG_ARTIFACTORY_USERNAME=
JFROG_ARTIFACTORY_KEY=
RELEASE_REPO_NAME=
SNAPSHOT_REPO_NAME=
1 change: 1 addition & 0 deletions gradle/kotlin-static-analysis.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apply plugin: 'io.gitlab.arturbosch.detekt'
apply plugin: 'org.jlleitschuh.gradle.ktlint'

ktlint {
version = "$ktLintVersion"
debug = false
verbose = true
android = false
Expand Down
70 changes: 69 additions & 1 deletion library-no-op/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,43 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

def versionName = {
def stdout = new ByteArrayOutputStream()
def errout = new ByteArrayOutputStream()
try {
exec {
commandLine 'git', 'tag', '--points-at', 'HEAD'
standardOutput = stdout
errorOutput = errout
ignoreExitValue = true
}
} catch (Exception ignored) {
return "unknown-SNAPSHOT"
}
def tag = stdout.toString().trim()
if (tag != null && !tag.isEmpty()) {
return tag
}
def branchStream = new ByteArrayOutputStream()
try {
exec {
commandLine 'git', 'rev-parse', '--abbrev-ref', 'HEAD'
standardOutput = branchStream
ignoreExitValue = true
}
} catch (Exception ignored) {
return "unknown-SNAPSHOT"
}
def branch = branchStream.toString().trim().replace('/', '-')
return "${branch}-SNAPSHOT"
}

android {
compileSdkVersion rootProject.compileSdkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
kotlinOptions.freeCompilerArgs += [
'-module-name', "com.github.ChuckerTeam.Chucker.library-no-op",
"-Xexplicit-api=strict"
Expand Down Expand Up @@ -34,5 +67,40 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
}

apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
}

afterEvaluate {
publishing {
publications {
aar(MavenPublication) {
groupId = 'com.meesho.android.chucker'
artifactId = project.name
version = versionName()
from components.release
artifact androidSourcesJar
}
}
}
}

artifactory {
contextUrl = "${JFROG_ARTIFACTORY_URL}"
publish {
repository {
repoKey = versionName().endsWith('SNAPSHOT') ? "${SNAPSHOT_REPO_NAME}" : "${RELEASE_REPO_NAME}"
username = "${JFROG_ARTIFACTORY_USERNAME}"
password = "${JFROG_ARTIFACTORY_KEY}"
maven = true
}
defaults {
publications('aar')
publishArtifacts = true
publishPom = true
}
}
}

apply from: rootProject.file('gradle/kotlin-static-analysis.gradle')
75 changes: 72 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,43 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

def versionName = {
def stdout = new ByteArrayOutputStream()
def errout = new ByteArrayOutputStream()
try {
exec {
commandLine 'git', 'tag', '--points-at', 'HEAD'
standardOutput = stdout
errorOutput = errout
ignoreExitValue = true
}
} catch (Exception ignored) {
return "unknown-SNAPSHOT"
}
def tag = stdout.toString().trim()
if (tag != null && !tag.isEmpty()) {
return tag
}
def branchStream = new ByteArrayOutputStream()
try {
exec {
commandLine 'git', 'rev-parse', '--abbrev-ref', 'HEAD'
standardOutput = branchStream
ignoreExitValue = true
}
} catch (Exception ignored) {
return "unknown-SNAPSHOT"
}
def branch = branchStream.toString().trim().replace('/', '-')
return "${branch}-SNAPSHOT"
}

android {
compileSdkVersion rootProject.compileSdkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
kotlinOptions.freeCompilerArgs += [
'-module-name', "com.github.ChuckerTeam.Chucker.library",
"-Xexplicit-api=strict"
Expand Down Expand Up @@ -66,6 +99,7 @@ dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutineVersion"

implementation "com.google.code.gson:gson:$gsonVersion"
implementation "com.meesho.android:jsonhandleview:$jsonhandleviewVersion"

implementation "org.brotli:dec:$brotliVersion"

Expand All @@ -75,15 +109,50 @@ dependencies {

testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
testImplementation "junit:junit:$junit4Version"
testImplementation "junit:junit:$vintageJunitVersion"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$junitVersion"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
testImplementation "io.mockk:mockk:$mockkVersion"
testImplementation "androidx.test:core:$androidxTestCoreVersion"
testImplementation "androidx.arch.core:core-testing:$androidXCoreVersion"
testImplementation "androidx.arch.core:core-testing:$androidXArchTestVersion"
testImplementation "com.google.truth:truth:$truthVersion"
testImplementation "org.robolectric:robolectric:$robolectricVersion"
}

apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
}

afterEvaluate {
publishing {
publications {
aar(MavenPublication) {
groupId = 'com.meesho.android.chucker'
artifactId = project.name
version = versionName()
from components.release
artifact androidSourcesJar
}
}
}
}

artifactory {
contextUrl = "${JFROG_ARTIFACTORY_URL}"
publish {
repository {
repoKey = versionName().endsWith('SNAPSHOT') ? "${SNAPSHOT_REPO_NAME}" : "${RELEASE_REPO_NAME}"
username = "${JFROG_ARTIFACTORY_USERNAME}"
password = "${JFROG_ARTIFACTORY_KEY}"
maven = true
}
defaults {
publications('aar')
publishArtifacts = true
publishPom = true
}
}
}

apply from: rootProject.file('gradle/kotlin-static-analysis.gradle')
4 changes: 1 addition & 3 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
</intent>
</queries>

<uses-permission
android:name="android.permission.WAKE_LOCK"
android:maxSdkVersion="25" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

<application>
<activity
Expand Down
16 changes: 16 additions & 0 deletions library/src/main/kotlin/com/chuckerteam/chucker/GsonInstance.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.chuckerteam.chucker

import com.google.gson.Gson
import com.google.gson.GsonBuilder

public object GsonInstance {

private val gson: Gson by lazy {
GsonBuilder()
.setLenient()
.setPrettyPrinting()
.create()
}

public fun get(): Gson? = gson
}
Loading
Loading