Skip to content

Commit

Permalink
Merge pull request #74 from infinum/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
bojankoma authored Feb 1, 2021
2 parents dcd810b + e3c3aa6 commit 5f05a9d
Show file tree
Hide file tree
Showing 132 changed files with 919 additions and 1,404 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Changelog
=========

## Version 5.2.2

_2021-02-01_

* Fix Timber planting multiple trees.
* Update Gradle plugin to 4.1.2.
* Update dependencies.
* Add CPD plugin.
* Add ktlint plugin.

## Version 5.2.1

_2021-01-22_
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[ ![Download](https://api.bintray.com/packages/infinum/android/dbinspector/images/download.svg?version=5.2.1) ](https://bintray.com/infinum/android/dbinspector/5.2.1/link) ![Validate Gradle Wrapper](https://github.com/infinum/android_dbinspector/workflows/Validate%20Gradle%20Wrapper/badge.svg)
[ ![Download](https://api.bintray.com/packages/infinum/android/dbinspector/images/download.svg?version=5.2.2) ](https://bintray.com/infinum/android/dbinspector/5.2.2/link) ![Validate Gradle Wrapper](https://github.com/infinum/android_dbinspector/workflows/Validate%20Gradle%20Wrapper/badge.svg)

### <img align="left" src="logo.svg" width="48">
# DbInspector
Expand Down Expand Up @@ -47,13 +47,13 @@ Then add the following dependencies in your app `build.gradle` or `build.gradle.

**Groovy**
```groovy
debugImplementation "com.infinum.dbinspector:dbinspector:5.2.1"
releaseImplementation "com.infinum.dbinspector:dbinspector-no-op:5.2.1"
debugImplementation "com.infinum.dbinspector:dbinspector:5.2.2"
releaseImplementation "com.infinum.dbinspector:dbinspector-no-op:5.2.2"
```
**KotlinDSL**
```kotlin
debugImplementation("com.infinum.dbinspector:dbinspector:5.2.1")
releaseImplementation("com.infinum.dbinspector:dbinspector-no-op:5.2.1")
debugImplementation("com.infinum.dbinspector:dbinspector:5.2.2")
releaseImplementation("com.infinum.dbinspector:dbinspector-no-op:5.2.2")
```

### Usage
Expand Down
46 changes: 35 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,41 +1,44 @@
buildscript {

ext.buildConfig = [
"minSdk" : 21,
"compileSdk": 30,
"targetSdk" : 30,
"minSdk" : 21,
"compileSdk": 30,
"targetSdk" : 30,

"buildTools": "30.0.3"
"buildTools": "30.0.3"
]

apply from: "dependencies.gradle"

repositories {
google()
jcenter()
maven { url "https://dl.bintray.com/infinum/android" }
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath packages.gradle
classpath packages.bintray
classpath packages.kotlin.plugin
classpath packages.cpd.plugin
classpath packages.detekt.plugin
classpath packages.ktlint.plugin
classpath packages.dokka.plugin
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.14'
classpath packages.google.protobuf.plugin
}
}

allprojects {

repositories {
google()
maven { url "https://dl.bintray.com/infinum/android" }
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://dl.bintray.com/infinum/android" }
}

def buildProperties = new Properties()
file(rootDir.absolutePath+"/build.properties").withInputStream { buildProperties.load(it) }
file(rootDir.absolutePath + "/build.properties").withInputStream { buildProperties.load(it) }
if (buildProperties.getProperty("build.debug").toBoolean()) {
configurations.all {
resolutionStrategy {
Expand All @@ -51,12 +54,14 @@ allprojects {
subprojects {
repositories {
google()
maven { url "https://dl.bintray.com/infinum/android" }
jcenter()
mavenCentral()
maven { url "https://dl.bintray.com/infinum/android" }
}

apply from: "../cpd.gradle"
apply from: "../detekt.gradle"
apply from: "../ktlint.gradle"
apply from: "../dokka.gradle"
}

Expand All @@ -69,11 +74,30 @@ task clean(type: Delete) {
}

task detektAll(dependsOn: [
':dbinspector:detekt',
':dbinspector-no-op:detekt'
':dbinspector:detekt',
':dbinspector-no-op:detekt'
]) {
group = "Verification"
description = "Run detekt on all modules"
}

task runStaticChecks(dependsOn: ordered(
':detektAll',
':dbinspector:ktlintCheck',
':dbinspector-no-op:ktlintCheck',
':dbinspector:cpdCheck',
':dbinspector-no-op:cpdCheck'
)) {
group = "Verification"
description = "Run static checks on all modules"
}

apply from: "deploy.gradle"

def ordered(String... taskPaths) {
def allTasks = taskPaths.collect { tasks.getByPath(it) }
for (int i = 0; i < allTasks.size() - 1; i++) {
allTasks[i + 1].mustRunAfter(allTasks[i])
}
return allTasks
}
12 changes: 12 additions & 0 deletions cpd.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apply plugin: "cpd"

cpd {
language = 'kotlin'
}

cpdCheck {
reports {
xml.enabled = true
}
source = allprojects*.file("src/main/kotlin")
}
3 changes: 2 additions & 1 deletion dbinspector-no-op/bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ afterEvaluate {
publications {
infinum(MavenPublication) {
groupId = dbinspector.group
artifactId = "dbinspector-no-op"
version = dbinspector.version

artifactId = "dbinspector-no-op"

artifact bundleReleaseAar
artifact javadocsJar
artifact sourcesJar
Expand Down
9 changes: 7 additions & 2 deletions dbinspector-no-op/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ android {
}

buildTypes {

release {
debug {
testCoverageEnabled true
debuggable true
minifyEnabled false
}
release {
debuggable false
minifyEnabled true
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.txt"
}
}
Expand Down
3 changes: 3 additions & 0 deletions dbinspector-no-op/proguard-rules.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-keep public class com.infinum.dbinspector.DbInspector {
public protected *;
}
3 changes: 2 additions & 1 deletion dbinspector/bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ afterEvaluate {
publications {
infinum(MavenPublication) {
groupId = dbinspector.group
artifactId = "dbinspector"
version = dbinspector.version

artifactId = "dbinspector"

artifact bundleReleaseAar
artifact javadocsJar
artifact sourcesJar
Expand Down
12 changes: 8 additions & 4 deletions dbinspector/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ android {
}

buildTypes {

release {
debug {
testCoverageEnabled true
debuggable true
minifyEnabled false
}
release {
debuggable false
minifyEnabled false // TODO: Enable once R8/D8 works with Protobuf
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.txt"
}
}
Expand Down Expand Up @@ -50,14 +55,13 @@ dependencies {
implementation packages.androidx.core
implementation packages.androidx.appcompat
implementation packages.androidx.fragment
implementation packages.androidx.lifecycle.common
implementation packages.androidx.recyclerview
implementation packages.androidx.viewpager
implementation packages.androidx.paging
implementation packages.androidx.startup
implementation packages.androidx.swiperefreshlayout
implementation packages.androidx.datastore
implementation packages.google.protobuf
implementation packages.google.protobuf.javalite
implementation packages.google.design
implementation packages.kotlinx.coroutines
implementation packages.koin.android
Expand Down
31 changes: 14 additions & 17 deletions dbinspector/proguard-rules.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Applications/Android Studio.app/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-keep public class com.infinum.dbinspector.* {
public protected *;
}
-keep public class com.infinum.dbinspector.DbInspector {
public protected *;
}
-keep class androidx.datastore.*.* {*;}
-keepclassmembers class * extends androidx.datastore.* {
<fields>;
}
-keep class * extends com.google.protobuf.GeneratedMessageLite { *; }
-keep public class com.infinum.dbinspector.data.models.local.proto.output.* {
public protected *;
}
5 changes: 1 addition & 4 deletions dbinspector/protobuf.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ apply plugin: "com.google.protobuf"

protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.10.0"
artifact = packages.google.protobuf.artifact
}

// Generates the java Protobuf-lite code for the Protobufs in this project. See
// https://github.com/google/protobuf-gradle-plugin#customizing-protobuf-compilation
// for more information.
generateProtoTasks {
all().each { task ->
task.builtins {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package com.infinum.dbinspector.data

import android.database.sqlite.SQLiteDatabase
import androidx.datastore.core.DataStore
import com.infinum.dbinspector.data.models.local.cursor.input.Query
import com.infinum.dbinspector.data.models.local.cursor.output.QueryResult
import com.infinum.dbinspector.data.models.local.proto.output.SettingsEntity
import com.infinum.dbinspector.domain.database.models.Operation
import com.infinum.dbinspector.data.models.local.cursor.input.Query
import java.io.File

internal interface Sources {
Expand Down Expand Up @@ -35,6 +35,8 @@ internal interface Sources {
interface Store {

suspend fun settings(): DataStore<SettingsEntity>

suspend fun current(): SettingsEntity
}

interface Schema {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.infinum.dbinspector.data.models.local.proto.output.SettingsEntity
internal data class Field(
val type: FieldType,
val text: String? = null,
val data: ByteArray? = null,
val blob: ByteArray? = null,
val linesCount: Int = Int.MAX_VALUE,
val truncate: SettingsEntity.TruncateMode = SettingsEntity.TruncateMode.UNRECOGNIZED,
val blobPreview: SettingsEntity.BlobPreviewMode = SettingsEntity.BlobPreviewMode.UNRECOGNIZED
Expand All @@ -18,10 +18,10 @@ internal data class Field(

if (type != other.type) return false
if (text != other.text) return false
if (data != null) {
if (other.data == null) return false
if (!data.contentEquals(other.data)) return false
} else if (other.data != null) return false
if (blob != null) {
if (other.blob == null) return false
if (!blob.contentEquals(other.blob)) return false
} else if (other.blob != null) return false
if (linesCount != other.linesCount) return false
if (truncate != other.truncate) return false
if (blobPreview != other.blobPreview) return false
Expand All @@ -32,7 +32,7 @@ internal data class Field(
override fun hashCode(): Int {
var result = type.hashCode()
result = 31 * result + (text?.hashCode() ?: 0)
result = 31 * result + (data?.contentHashCode() ?: 0)
result = 31 * result + (blob?.contentHashCode() ?: 0)
result = 31 * result + linesCount
result = 31 * result + truncate.hashCode()
result = 31 * result + blobPreview.hashCode()
Expand Down
Loading

0 comments on commit 5f05a9d

Please sign in to comment.