summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Kumar <amitkma@e.email>2021-04-28 14:17:57 +0530
committerAmit Kumar <amitkma@e.email>2021-04-28 14:19:13 +0530
commitc00ab1009aa512fe89b8965cb0bee3827c64fd98 (patch)
tree957a5888d9272cc6909cedd1a4824445d71c779b
parentf3759a7935fcba76195d52084ee3254ec85391c3 (diff)
Initialize kotlin flow based mvi library
-rw-r--r--.idea/misc.xml10
-rw-r--r--build.gradle26
-rw-r--r--dependencies.gradle2
-rw-r--r--flow-mvi/.gitignore1
-rw-r--r--flow-mvi/build.gradle30
-rw-r--r--flow-mvi/src/main/java/foundation/e/flowmvi/MyClass.kt20
-rw-r--r--gradle/dependencyGraph.gradle140
-rw-r--r--settings.gradle1
8 files changed, 224 insertions, 6 deletions
diff --git a/.idea/misc.xml b/.idea/misc.xml
index af6eff4..2f6c31d 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -5,7 +5,7 @@
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
- <list size="12">
+ <list size="15">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
@@ -18,12 +18,15 @@
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
<item index="10" class="java.lang.String" itemvalue="android.annotation.Nullable" />
<item index="11" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
+ <item index="12" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.Nullable" />
+ <item index="13" class="java.lang.String" itemvalue="io.reactivex.annotations.Nullable" />
+ <item index="14" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
- <list size="11">
+ <list size="14">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
@@ -35,6 +38,9 @@
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
<item index="9" class="java.lang.String" itemvalue="android.annotation.NonNull" />
<item index="10" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
+ <item index="11" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.NonNull" />
+ <item index="12" class="java.lang.String" itemvalue="io.reactivex.annotations.NonNull" />
+ <item index="13" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.NonNull" />
</list>
</value>
</option>
diff --git a/build.gradle b/build.gradle
index 8dba9aa..f4952ba 100644
--- a/build.gradle
+++ b/build.gradle
@@ -4,8 +4,26 @@ buildscript {
'compileSdk': 30,
'minSdk' : 24,
'targetSdk' : 30,
+ 'version': [
+ 'major': 1,
+ 'minor': 0,
+ 'patch': 0,
+ 'build': "alpha",
+ ],
]
+ ext.buildConfig.version['name'] = "${buildConfig.version.major}.${buildConfig.version.minor}.${buildConfig.version.patch}"
+ ext.buildConfig.version['fullName'] = "${buildConfig.version.name}.${buildConfig.version.build}"
+ def buildNumber
+ if(buildConfig.version.build == 'alpha') {
+ buildNumber = -2
+ } else if (buildConfig.version.build == 'beta') {
+ buildNumber = -1
+ } else {
+ buildNumber = 0
+ }
+ ext.buildConfig.version['code'] = buildConfig.version.major * 1000000 + buildConfig.version.minor * 10000 + buildConfig.version.patch * 100 + buildNumber
+
apply from: rootProject.file('dependencies.gradle')
repositories {
google()
@@ -23,8 +41,8 @@ buildscript {
}
plugins {
- id 'com.diffplug.spotless' version '5.12.1'
- id 'com.github.ben-manes.versions' version '0.36.0'
+ id 'com.diffplug.spotless' version '5.12.4'
+ id 'com.github.ben-manes.versions' version '0.38.0'
}
allprojects {
@@ -87,4 +105,6 @@ tasks.named("dependencyUpdates").configure {
Object propOrDef(String propertyName, Object defaultValue) {
def propertyValue = project.properties[propertyName]
return propertyValue != null ? propertyValue : defaultValue
-} \ No newline at end of file
+}
+
+apply from: file('gradle/dependencyGraph.gradle')
diff --git a/dependencies.gradle b/dependencies.gradle
index 23d3f02..1787d22 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -19,7 +19,7 @@ libs.leakCanary = "com.squareup.leakcanary:leakcanary-android:2.6"
libs.truth = "com.google.truth:truth:1.1"
-versions.kotlin = "1.4.32"
+versions.kotlin = "1.5.0"
libs.Kotlin = [
stdlib: "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$versions.kotlin",
gradlePlugin: "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin",
diff --git a/flow-mvi/.gitignore b/flow-mvi/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/flow-mvi/.gitignore
@@ -0,0 +1 @@
+/build \ No newline at end of file
diff --git a/flow-mvi/build.gradle b/flow-mvi/build.gradle
new file mode 100644
index 0000000..52478d7
--- /dev/null
+++ b/flow-mvi/build.gradle
@@ -0,0 +1,30 @@
+/*
+* Copyright (C) 2021 E FOUNDATION
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+plugins {
+ id 'java-library'
+ id 'kotlin'
+}
+
+java {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+}
+
+dependencies {
+ implementation Libs.Kotlin.stdlib
+}
diff --git a/flow-mvi/src/main/java/foundation/e/flowmvi/MyClass.kt b/flow-mvi/src/main/java/foundation/e/flowmvi/MyClass.kt
new file mode 100644
index 0000000..32b47a1
--- /dev/null
+++ b/flow-mvi/src/main/java/foundation/e/flowmvi/MyClass.kt
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2021 E FOUNDATION
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package foundation.e.flowmvi
+
+class MyClass
diff --git a/gradle/dependencyGraph.gradle b/gradle/dependencyGraph.gradle
new file mode 100644
index 0000000..29eafa4
--- /dev/null
+++ b/gradle/dependencyGraph.gradle
@@ -0,0 +1,140 @@
+/*
+ * Copyright (C) 2021 E FOUNDATION
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Taken from https://github.com/JakeWharton/SdkSearch/blob/master/gradle/projectDependencyGraph.gradle
+ */
+
+def font = "Helvetica"
+
+task projectDependencyGraph {
+ doLast {
+ def dot = new File(rootProject.buildDir, 'reports/dependency-graph/project.dot')
+ dot.parentFile.mkdirs()
+ dot.delete()
+
+ dot << 'digraph {\n'
+ dot << " graph [label=\"${rootProject.name}\\n \",labelloc=t,fontsize=30,ranksep=1.4,fontname=\"$font\"];\n"
+ dot << " node [style=filled, fillcolor=\"#bbbbbb\", fontname=\"$font\"];\n"
+ dot << " edge [fontname = \"$font\"];"
+ dot << ' rankdir=TB;\n'
+
+ def rootProjects = []
+ def queue = [rootProject]
+ while (!queue.isEmpty()) {
+ def project = queue.remove(0)
+ rootProjects.add(project)
+ queue.addAll(project.childProjects.values())
+ }
+
+ def projects = new LinkedHashSet<Project>()
+ def dependencies = new LinkedHashMap<Tuple2<Project, Project>, List<String>>()
+ def multiplatformProjects = []
+ def jsProjects = []
+ def androidProjects = []
+ def javaProjects = []
+
+ queue = [rootProject]
+ while (!queue.isEmpty()) {
+ def project = queue.remove(0)
+ queue.addAll(project.childProjects.values())
+
+ if (project.plugins.hasPlugin('org.jetbrains.kotlin.multiplatform')) {
+ multiplatformProjects.add(project)
+ }
+ if (project.plugins.hasPlugin('org.jetbrains.kotlin.js')) {
+ jsProjects.add(project)
+ }
+ if (project.plugins.hasPlugin('com.android.library') || project.plugins.hasPlugin('com.android.application')) {
+ androidProjects.add(project)
+ }
+ if (project.plugins.hasPlugin('java-library') || project.plugins.hasPlugin('java')) {
+ javaProjects.add(project)
+ }
+
+ project.configurations.all { config ->
+ config.dependencies
+ .withType(ProjectDependency)
+ .collect { it.dependencyProject }
+ .each { dependency ->
+ projects.add(project)
+ projects.add(dependency)
+ rootProjects.remove(dependency)
+
+ def graphKey = new Tuple2<Project, Project>(project, dependency)
+ def traits = dependencies.computeIfAbsent(graphKey) { new ArrayList<String>() }
+
+ if (config.name.toLowerCase().endsWith('implementation')) {
+ traits.add('style=dotted')
+ }
+ }
+ }
+ }
+
+ projects = projects.sort { it.path }
+
+ dot << '\n # Projects\n\n'
+ for (project in projects) {
+ def traits = []
+
+ if (rootProjects.contains(project)) {
+ traits.add('shape=box')
+ }
+
+ if (multiplatformProjects.contains(project)) {
+ traits.add('fillcolor="#ffd2b3"')
+ } else if (jsProjects.contains(project)) {
+ traits.add('fillcolor="#ffffba"')
+ } else if (androidProjects.contains(project)) {
+ traits.add('fillcolor="#baffc9"')
+ } else if (javaProjects.contains(project)) {
+ traits.add('fillcolor="#ffb3ba"')
+ } else {
+ traits.add('fillcolor="#eeeeee"')
+ }
+
+ dot << " \"${project.path}\" [${traits.join(", ")}];\n"
+ }
+
+ dot << '\n {rank = same;'
+ for (project in projects) {
+ if (rootProjects.contains(project)) {
+ dot << " \"${project.path}\";"
+ }
+ }
+ dot << '}\n'
+
+ dot << '\n # Dependencies\n\n'
+ dependencies.forEach { key, traits ->
+ dot << " \"${key.first.path}\" -> \"${key.second.path}\""
+ if (!traits.isEmpty()) {
+ dot << " [${traits.join(", ")}]"
+ }
+ dot << '\n'
+ }
+
+ dot << '}\n'
+
+ def p = 'dot -Tpng -O project.dot'.execute([], dot.parentFile)
+ p.waitFor()
+ if (p.exitValue() != 0) {
+ throw new RuntimeException(p.errorStream.text)
+ }
+
+ println("Project module dependency graph created at ${dot.absolutePath}.png")
+ }
+} \ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index e39b561..dca731c 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,2 +1,3 @@
+include ':flow-mvi'
include ':app'
rootProject.name = "PrivacyCentralApp" \ No newline at end of file