Added dagger dependencies and moved code to package to avoid kapt warnings

This commit is contained in:
Abdelilah El Aissaoui 2021-10-06 19:05:07 +02:00
parent e34ded9e29
commit 642cfd5f1e
42 changed files with 111 additions and 104 deletions

View file

@ -5,6 +5,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
// __KOTLIN_COMPOSE_VERSION__ // __KOTLIN_COMPOSE_VERSION__
kotlin("jvm") version "1.5.21" kotlin("jvm") version "1.5.21"
kotlin("kapt") version "1.5.21"
// __LATEST_COMPOSE_RELEASE_VERSION__ // __LATEST_COMPOSE_RELEASE_VERSION__
id("org.jetbrains.compose") version "1.0.0-alpha3" id("org.jetbrains.compose") version "1.0.0-alpha3"
} }
@ -18,10 +19,14 @@ repositories {
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") } maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
} }
dependencies { dependencies {
implementation(compose.desktop.currentOs) implementation(compose.desktop.currentOs)
implementation("org.eclipse.jgit:org.eclipse.jgit:5.13.0.202109080827-r") implementation("org.eclipse.jgit:org.eclipse.jgit:5.13.0.202109080827-r")
implementation("org.apache.sshd:sshd-core:2.7.0") implementation("org.apache.sshd:sshd-core:2.7.0")
implementation("com.google.dagger:dagger:2.38.1")
kapt("com.google.dagger:dagger-compiler:2.38.1")
} }
tasks.withType<KotlinCompile>() { tasks.withType<KotlinCompile>() {
@ -30,6 +35,7 @@ tasks.withType<KotlinCompile>() {
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
} }
compose.desktop { compose.desktop {
application { application {
mainClass = "MainKt" mainClass = "MainKt"

View file

@ -1 +1,3 @@
kotlin.code.style=official kotlin.code.style=official
# Workaround for sometimes happening this issue https://youtrack.jetbrains.com/issue/KT-40750
kapt.use.worker.api=false

Binary file not shown.

2
gradlew vendored Normal file → Executable file
View file

@ -72,7 +72,7 @@ case "`uname`" in
Darwin* ) Darwin* )
darwin=true darwin=true
;; ;;
MSYS* | MINGW* ) MINGW* )
msys=true msys=true
;; ;;
NONSTOP* ) NONSTOP* )

0
gradlew.bat vendored Executable file → Normal file
View file

View file

@ -1,3 +1,5 @@
package app
import java.util.prefs.Preferences import java.util.prefs.Preferences
private const val PREFERENCES_NAME = "GitnuroConfig" private const val PREFERENCES_NAME = "GitnuroConfig"

View file

@ -1,4 +1,4 @@
package credentials package app.credentials
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow

View file

@ -1,4 +1,4 @@
package credentials package app.credentials
import org.apache.sshd.client.channel.ChannelExec import org.apache.sshd.client.channel.ChannelExec
import org.apache.sshd.client.session.ClientSession import org.apache.sshd.client.session.ClientSession

View file

@ -1,11 +1,9 @@
package credentials package app.credentials
import org.apache.sshd.client.SshClient import org.apache.sshd.client.SshClient
import org.apache.sshd.client.future.ConnectFuture import org.apache.sshd.client.future.ConnectFuture
import org.eclipse.jgit.transport.RemoteSession import org.eclipse.jgit.transport.RemoteSession
import org.eclipse.jgit.transport.URIish import org.eclipse.jgit.transport.URIish
import java.io.PipedInputStream
import java.io.PipedOutputStream
private const val DEFAULT_SSH_PORT = 22 private const val DEFAULT_SSH_PORT = 22

View file

@ -1,4 +1,4 @@
package credentials package app.credentials
import org.eclipse.jgit.transport.CredentialsProvider import org.eclipse.jgit.transport.CredentialsProvider
import org.eclipse.jgit.transport.RemoteSession import org.eclipse.jgit.transport.RemoteSession

View file

@ -1,4 +1,4 @@
package credentials package app.credentials
import org.eclipse.jgit.transport.CredentialItem import org.eclipse.jgit.transport.CredentialItem
import org.eclipse.jgit.transport.CredentialsProvider import org.eclipse.jgit.transport.CredentialsProvider

View file

@ -0,0 +1,7 @@
package app.di
import dagger.Component
@Component
interface AppComponent {
}

View file

@ -1,4 +1,4 @@
package extensions package app.extensions
import java.text.DateFormat import java.text.DateFormat
import java.time.LocalDate import java.time.LocalDate

View file

@ -1,4 +1,4 @@
package extensions package app.extensions
import androidx.compose.material.MaterialTheme import androidx.compose.material.MaterialTheme
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
@ -10,8 +10,8 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.graphics.vector.ImageVector
import org.eclipse.jgit.diff.DiffEntry import org.eclipse.jgit.diff.DiffEntry
import theme.addFile import app.theme.addFile
import theme.modifyFile import app.theme.modifyFile
val DiffEntry.filePath: String val DiffEntry.filePath: String
get() { get() {

View file

@ -1,4 +1,4 @@
package extensions package app.extensions
import java.io.ByteArrayOutputStream import java.io.ByteArrayOutputStream
import java.io.InputStream import java.io.InputStream

View file

@ -1,4 +1,4 @@
package extensions package app.extensions
import org.eclipse.jgit.lib.Ref import org.eclipse.jgit.lib.Ref

View file

@ -1,4 +1,4 @@
package extensions package app.extensions
import org.eclipse.jgit.api.Status import org.eclipse.jgit.api.Status

View file

@ -1,4 +1,4 @@
package extensions package app.extensions
import java.math.BigInteger import java.math.BigInteger
import java.security.MessageDigest import java.security.MessageDigest

View file

@ -1,4 +1,4 @@
package git package app.git
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow

View file

@ -1,10 +1,8 @@
package git package app.git
import credentials.GRemoteSession import app.credentials.GSessionManager
import credentials.GSessionManager
import org.eclipse.jgit.api.Git import org.eclipse.jgit.api.Git
import org.eclipse.jgit.transport.* import org.eclipse.jgit.transport.*
import org.eclipse.jgit.util.FS
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException

View file

@ -1,4 +1,4 @@
package git package app.git
import org.eclipse.jgit.diff.DiffEntry import org.eclipse.jgit.diff.DiffEntry

View file

@ -1,4 +1,4 @@
package git package app.git
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
@ -39,7 +39,7 @@ class DiffManager {
// TODO This is just a workaround, try to find properly which lines have to be displayed by using a custom diff // TODO This is just a workaround, try to find properly which lines have to be displayed by using a custom diff
return@withContext diff.split("\n", "\r\n").filterNot { return@withContext diff.split("\n", "\r\n").filterNot {
it.startsWith("diff --git") it.startsWith("diff --app.git")
} }
} }

View file

@ -1,7 +1,7 @@
package git package app.git
import credentials.CredentialsState import app.credentials.CredentialsState
import credentials.CredentialsStateManager import app.credentials.CredentialsStateManager
import kotlinx.coroutines.* import kotlinx.coroutines.*
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.StateFlow
@ -83,10 +83,10 @@ class GitManager {
} }
fun openRepository(directory: File) { fun openRepository(directory: File) {
val gitDirectory = if (directory.name == ".git") { val gitDirectory = if (directory.name == ".app.git") {
directory directory
} else { } else {
val gitDir = File(directory, ".git") val gitDir = File(directory, ".app.git")
if (gitDir.exists() && gitDir.isDirectory) { if (gitDir.exists() && gitDir.isDirectory) {
gitDir gitDir
} else } else

View file

@ -1,4 +1,4 @@
package git package app.git
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ensureActive import kotlinx.coroutines.ensureActive

View file

@ -1,6 +1,6 @@
package git package app.git
import credentials.* import app.credentials.*
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import org.eclipse.jgit.api.Git import org.eclipse.jgit.api.Git

View file

@ -1,4 +1,4 @@
package git package app.git
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow
@ -6,8 +6,6 @@ import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import org.eclipse.jgit.api.Git import org.eclipse.jgit.api.Git
import org.eclipse.jgit.revwalk.RevCommit import org.eclipse.jgit.revwalk.RevCommit
import java.text.DateFormat
import java.util.*
class StashManager { class StashManager {
private val _stashStatus = MutableStateFlow<StashStatus>(StashStatus.Loaded(listOf())) private val _stashStatus = MutableStateFlow<StashStatus>(StashStatus.Loaded(listOf()))
@ -24,14 +22,14 @@ class StashManager {
} }
suspend fun popStash(git: Git) = withContext(Dispatchers.IO) { suspend fun popStash(git: Git) = withContext(Dispatchers.IO) {
// val firstStash = git.stashList().call().firstOrNull() ?: return@withContext // val firstStash = app.git.stashList().call().firstOrNull() ?: return@withContext
git git
.stashApply() .stashApply()
// .setStashRef(firstStash.) // .setStashRef(firstStash.)
.call() .call()
// git.stashDrop() // app.git.stashDrop()
// .setStashRef(firstStash.) // .setStashRef(firstStash.)
loadStashList(git) loadStashList(git)

View file

@ -1,7 +1,7 @@
package git package app.git
import extensions.filePath import app.extensions.filePath
import extensions.hasUntrackedChanges import app.extensions.hasUntrackedChanges
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ensureActive import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.MutableStateFlow

View file

@ -11,13 +11,13 @@ import androidx.compose.ui.draw.alpha
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.* import androidx.compose.ui.window.*
import androidx.compose.ui.zIndex import androidx.compose.ui.zIndex
import git.GitManager import app.git.GitManager
import git.RepositorySelectionStatus import app.git.RepositorySelectionStatus
import theme.* import app.theme.*
import ui.RepositoryOpenPage import app.ui.RepositoryOpenPage
import ui.WelcomePage import app.ui.WelcomePage
import ui.components.RepositoriesTabPanel import app.ui.components.RepositoriesTabPanel
import ui.components.TabInformation import app.ui.components.TabInformation
@OptIn(ExperimentalComposeUiApi::class) @OptIn(ExperimentalComposeUiApi::class)
fun main() = application { fun main() = application {

View file

@ -1,4 +1,4 @@
package theme package app.theme
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color

View file

@ -1,4 +1,4 @@
package theme package app.theme
import androidx.compose.material.* import androidx.compose.material.*
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable

View file

@ -1,4 +1,4 @@
package ui package app.ui
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
@ -18,11 +18,11 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import ui.components.ScrollableLazyColumn import app.ui.components.ScrollableLazyColumn
import extensions.simpleName import app.extensions.simpleName
import git.GitManager import app.git.GitManager
import org.eclipse.jgit.lib.Ref import org.eclipse.jgit.lib.Ref
import theme.headerBackground import app.theme.headerBackground
@Composable @Composable
fun Branches(gitManager: GitManager) { fun Branches(gitManager: GitManager) {

View file

@ -1,4 +1,4 @@
package ui package app.ui
import androidx.compose.foundation.* import androidx.compose.foundation.*
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
@ -17,20 +17,20 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import extensions.* import app.extensions.*
import kotlinx.coroutines.* import kotlinx.coroutines.*
import org.eclipse.jgit.diff.DiffEntry import org.eclipse.jgit.diff.DiffEntry
import org.eclipse.jgit.revwalk.RevCommit import org.eclipse.jgit.revwalk.RevCommit
import org.jetbrains.skija.Image.makeFromEncoded import org.jetbrains.skija.Image.makeFromEncoded
import theme.headerBackground import app.theme.headerBackground
import theme.primaryTextColor import app.theme.primaryTextColor
import theme.secondaryTextColor import app.theme.secondaryTextColor
import java.net.HttpURLConnection import java.net.HttpURLConnection
import java.net.URL import java.net.URL
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import ui.components.ScrollableLazyColumn import app.ui.components.ScrollableLazyColumn
import git.GitManager import app.git.GitManager
@Composable @Composable
fun CommitChanges( fun CommitChanges(

View file

@ -1,4 +1,4 @@
package ui package app.ui
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
@ -20,10 +20,10 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import ui.components.ScrollableLazyColumn import app.ui.components.ScrollableLazyColumn
import git.DiffEntryType import app.git.DiffEntryType
import git.GitManager import app.git.GitManager
import theme.primaryTextColor import app.theme.primaryTextColor
@Composable @Composable
fun Diff(gitManager: GitManager, diffEntryType: DiffEntryType, onCloseDiffView: () -> Unit) { fun Diff(gitManager: GitManager, diffEntryType: DiffEntryType, onCloseDiffView: () -> Unit) {

View file

@ -1,4 +1,4 @@
package ui package app.ui
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
@ -19,7 +19,7 @@ import androidx.compose.ui.input.pointer.pointerMoveFilter
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import theme.primaryTextColor import app.theme.primaryTextColor
@Composable @Composable
fun GMenu( fun GMenu(

View file

@ -1,4 +1,4 @@
package ui package app.ui
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
@ -15,13 +15,13 @@ import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import ui.components.ScrollableLazyColumn import app.ui.components.ScrollableLazyColumn
import extensions.toSmartSystemString import app.extensions.toSmartSystemString
import git.GitManager import app.git.GitManager
import git.LogStatus import app.git.LogStatus
import org.eclipse.jgit.revwalk.RevCommit import org.eclipse.jgit.revwalk.RevCommit
import theme.primaryTextColor import app.theme.primaryTextColor
import theme.secondaryTextColor import app.theme.secondaryTextColor
@Composable @Composable
fun Log( fun Log(

View file

@ -1,4 +1,4 @@
package ui package app.ui
import androidx.compose.animation.Crossfade import androidx.compose.animation.Crossfade
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
@ -11,10 +11,9 @@ import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import androidx.compose.ui.window.Dialog import androidx.compose.ui.window.Dialog
import credentials.CredentialsState import app.credentials.CredentialsState
import git.DiffEntryType import app.git.DiffEntryType
import git.GitManager import app.git.GitManager
import git.RepositorySelectionStatus
import openRepositoryDialog import openRepositoryDialog
import org.eclipse.jgit.revwalk.RevCommit import org.eclipse.jgit.revwalk.RevCommit
@ -52,7 +51,7 @@ fun RepositoryOpenPage(gitManager: GitManager) {
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center, verticalArrangement = Arrangement.Center,
) { ) {
Text("Introduce your remote server credentials") Text("Introduce your remote server app.credentials")
OutlinedTextField( OutlinedTextField(
value = userField, value = userField,

View file

@ -1,4 +1,4 @@
package ui package app.ui
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
@ -15,11 +15,11 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import ui.components.ScrollableLazyColumn import app.ui.components.ScrollableLazyColumn
import git.GitManager import app.git.GitManager
import git.StashStatus import app.git.StashStatus
import org.eclipse.jgit.revwalk.RevCommit import org.eclipse.jgit.revwalk.RevCommit
import theme.headerBackground import app.theme.headerBackground
@Composable @Composable
fun Stashes(gitManager: GitManager) { fun Stashes(gitManager: GitManager) {

View file

@ -1,4 +1,4 @@
import git.GitManager import app.git.GitManager
import javax.swing.JFileChooser import javax.swing.JFileChooser
fun openRepositoryDialog(gitManager: GitManager) { fun openRepositoryDialog(gitManager: GitManager) {

View file

@ -1,6 +1,6 @@
@file:Suppress("UNUSED_PARAMETER") @file:Suppress("UNUSED_PARAMETER")
package ui package app.ui
import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.animation.ExperimentalAnimationApi
@ -24,14 +24,14 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import ui.components.ScrollableLazyColumn import app.ui.components.ScrollableLazyColumn
import extensions.filePath import app.extensions.filePath
import extensions.icon import app.extensions.icon
import extensions.iconColor import app.extensions.iconColor
import git.GitManager import app.git.GitManager
import git.StageStatus import app.git.StageStatus
import org.eclipse.jgit.diff.DiffEntry import org.eclipse.jgit.diff.DiffEntry
import theme.headerBackground import app.theme.headerBackground
@OptIn(ExperimentalAnimationApi::class) @OptIn(ExperimentalAnimationApi::class)
@Composable @Composable

View file

@ -1,18 +1,15 @@
package ui package app.ui
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.material.* import androidx.compose.material.*
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import git.GitManager import app.git.GitManager
import openRepositoryDialog import openRepositoryDialog

View file

@ -1,4 +1,4 @@
package ui.components package app.ui.components
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
@ -14,7 +14,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import theme.primaryLight import app.theme.primaryLight
@Composable @Composable

View file

@ -1,4 +1,4 @@
package ui.components package app.ui.components
import androidx.compose.foundation.VerticalScrollbar import androidx.compose.foundation.VerticalScrollbar
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box