Skip to content

Commit

Permalink
Merge pull request #42 from Meesho/feat-prakhar-target31
Browse files Browse the repository at this point in the history
APT-371 : Migrate to target31, v3.7
  • Loading branch information
Prakhar-kuls authored Oct 5, 2022
2 parents fd6513b + 6fd0ab0 commit c01033d
Show file tree
Hide file tree
Showing 14 changed files with 482 additions and 106 deletions.
86 changes: 41 additions & 45 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,49 +1,52 @@
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.2.0'
constraintLayoutVersion = '1.1.3'
materialComponentsVersion = '1.2.1'
roomVersion = '2.4.3'
fragmentVersion = '1.2.5'
lifecycleVersion = '2.2.0'
androidXArchTestVersion = '2.0.0'
paletteKtxVersion = '1.0.0'
jsonhandleviewVersion = '1.2.2'

// Networking
brotliVersion = '0.1.2'
gsonVersion = '2.9.0'
okhttpVersion = '4.9.3'
gsonVersion = '2.8.6'
okhttpVersion = '4.9.0'
retrofitVersion = '2.9.0'
wireVersion = '4.1.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.14.0'
dokkaVersion = '1.4.10.2'
ktLintVersion = '0.39.0'
ktLintGradleVersion = '10.0.0'
leakcanaryVersion = '2.9.1'

// 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'

// Publishing
nexusStagingPlugin = '0.30.0'
androidxTestCoreVersion = '1.3.0'
junitGradlePluignVersion = '1.6.1.0'
junitVersion = '5.5.2'
mockkVersion = '1.10.2'
robolectricVersion = '4.4'
truthVersion = '1.1'
vintageJunitVersion = '4.12'

//jfrog publish
jfrogExtractor = '4.28.3'
}

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

Expand All @@ -54,33 +57,31 @@ 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.jfrog.buildinfo:build-info-extractor-gradle:$jfrogExtractor"
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"
}
}
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: "com.jfrog.artifactory"
apply plugin: "maven-publish"

version = VERSION_NAME
group = GROUP

repositories {
google()
mavenCentral()
jcenter {
content {
includeModule("org.jetbrains.trove4j", "trove4j")
includeModule("org.jetbrains.kotlinx", "kotlinx-html-jvm")

def jfrogArtifactoryUrl = project.properties["JFROG_ARTIFACTORY_URL"]
def jfrogArtifactoryUserName = project.properties["JFROG_ARTIFACTORY_USERNAME"]
def jfrogArtifactoryKey = project.properties["JFROG_ARTIFACTORY_KEY"]
maven {
url "${jfrogArtifactoryUrl}/${project.properties["RELEASE_REPO_NAME"]}"
credentials {
username = jfrogArtifactoryUserName
password = jfrogArtifactoryKey
}
}
}
Expand Down Expand Up @@ -109,8 +110,3 @@ ext {
compileSdkVersion = 31
}

nexusStaging {
username = findProperty("NEXUS_USERNAME")
password = findProperty("NEXUS_PASSWORD")
stagingProfileId = "ea09119de9f4"
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ org.gradle.jvmargs=-Xmx1536m
# 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

android.enableJetifier=true
android.useAndroidX=true

VERSION_NAME=4.0.0-SNAPSHOT
Expand All @@ -28,4 +28,4 @@ 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
70 changes: 69 additions & 1 deletion library-no-op/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ android {
minSdkVersion rootProject.minSdkVersion
}

android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}

lintOptions {
warningsAsErrors true
abortOnError true
Expand All @@ -34,5 +41,66 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
}

apply from: rootProject.file('gradle/gradle-mvn-push.gradle')
apply from: rootProject.file('gradle/kotlin-static-analysis.gradle')

ext.versionName = { ->
def currentTag = 'git tag --points-at HEAD'.execute().in.text.toString().trim()
def currentBranch = 'git rev-parse --abbrev-ref HEAD'.execute().in.text.toString().trim()
def tagRegex = "[0-9.]*[0-9]"
if (!currentTag.isEmpty() && currentTag.matches(tagRegex)) {// is not empty and is in following format 8.0
return currentTag
} else {
return currentBranch + '-SNAPSHOT'
}
}

def libraryGroupId = 'com.meesho.android.chucker'
def libraryVersion = versionName()

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

artifactoryPublish.dependsOn('build')
publishing {
publications {
aar(MavenPublication) {
groupId = libraryGroupId
artifactId = 'library-no-op'
version = libraryVersion
// Tell maven to prepare the generated "*.aar" file for publishing
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
artifact androidSourcesJar

pom.withXml {
def dependencies = asNode().appendNode('dependencies')
configurations.getByName("releaseCompileClasspath").getResolvedConfiguration().getFirstLevelModuleDependencies().each {
def dependency = dependencies.appendNode('dependency')
dependency.appendNode('groupId', it.moduleGroup)
dependency.appendNode('artifactId', it.moduleName)
dependency.appendNode('version', it.moduleVersion)
}
}
}
}
}
artifactory {
//The base Artifactory URL if not overridden by the publisher/resolver
contextUrl = project.properties["JFROG_ARTIFACTORY_URL"]
publish {
repository {
repoKey = libraryVersion.endsWith('-SNAPSHOT') ? project.properties["SNAPSHOT_REPO_NAME"] :
project.properties["RELEASE_REPO_NAME"]
username = project.properties["JFROG_ARTIFACTORY_USERNAME"]
password = project.properties["JFROG_ARTIFACTORY_KEY"]
}
defaults {
// Tell the Artifactory Plugin which artifacts should be published to Artifactory.
publications('aar')
publishArtifacts = true
// Publish generated POM files to Artifactory (true by default)
publishPom = true
}
}
}
76 changes: 73 additions & 3 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ android {
}
}

android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}

resourcePrefix 'chucker_'
}

Expand Down Expand Up @@ -73,17 +80,80 @@ dependencies {
api "com.squareup.okhttp3:okhttp"
testImplementation "com.squareup.okhttp3:mockwebserver"

implementation "com.meesho.android:jsonhandleview:$jsonhandleviewVersion"

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')
apply from: rootProject.file('gradle/kotlin-static-analysis.gradle')

ext.versionName = { ->
def currentTag = 'git tag --points-at HEAD'.execute().in.text.toString().trim()
def currentBranch = 'git rev-parse --abbrev-ref HEAD'.execute().in.text.toString().trim()
def tagRegex = "[0-9.]*[0-9]"
if (!currentTag.isEmpty() && currentTag.matches(tagRegex)) {// is not empty and is in following format 8.0
return currentTag
} else {
return currentBranch + '-SNAPSHOT'
}
}

def libraryGroupId = 'com.meesho.android.chucker'
def libraryVersion = versionName()

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

artifactoryPublish.dependsOn('build')
publishing {
publications {
aar(MavenPublication) {
groupId = libraryGroupId
artifactId = 'library'
version = libraryVersion
// Tell maven to prepare the generated "*.aar" file for publishing
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
artifact androidSourcesJar

pom.withXml {
def dependencies = asNode().appendNode('dependencies')
configurations.getByName("releaseCompileClasspath").getResolvedConfiguration().getFirstLevelModuleDependencies().each {
def dependency = dependencies.appendNode('dependency')
dependency.appendNode('groupId', it.moduleGroup)
dependency.appendNode('artifactId', it.moduleName)
dependency.appendNode('version', it.moduleVersion)
}
}
}
}
}
artifactory {
//The base Artifactory URL if not overridden by the publisher/resolver
contextUrl = project.properties["JFROG_ARTIFACTORY_URL"]
publish {
repository {
repoKey = libraryVersion.endsWith('-SNAPSHOT') ? project.properties["SNAPSHOT_REPO_NAME"] :
project.properties["RELEASE_REPO_NAME"]
username = project.properties["JFROG_ARTIFACTORY_USERNAME"]
password = project.properties["JFROG_ARTIFACTORY_KEY"]
}
defaults {
// Tell the Artifactory Plugin which artifacts should be published to Artifactory.
publications('aar')
publishArtifacts = true
// Publish generated POM files to Artifactory (true by default)
publishPom = true
}
}
}
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
14 changes: 14 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,14 @@
package com.chuckerteam.chucker

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

public object GsonInstance {
private var gson: Gson? = null
public fun get(): Gson? {
if (gson == null) {
gson = GsonBuilder().setLenient().setPrettyPrinting().create()
}
return gson
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ internal class TransactionBodyAdapter : RecyclerView.Adapter<TransactionPayloadV
}
}

fun findNextHighlightedItem(offset: Int): Int {
return items.asSequence()
.drop(offset)
.indexOfFirst { item ->
if (item is TransactionPayloadItem.BodyLineItem) {
item.line.getSpans(0, item.line.length - 1, Any::class.java).isNotEmpty()
} else {
false
}
}
}

companion object {
private const val TYPE_HEADERS = 1
private const val TYPE_BODY_LINE = 2
Expand Down
Loading

0 comments on commit c01033d

Please sign in to comment.