diff --git a/build.gradle.kts b/build.gradle.kts index 9862822..33c9efe 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,7 +2,7 @@ plugins { - kotlin("jvm") + `ghidralite-conventions` alias(libs.plugins.ksp) alias(libs.plugins.kotlinx.serialization) alias(libs.plugins.composeDesktop) @@ -10,30 +10,9 @@ plugins { val ghidraDistribution = extra["ghidra.dir"] as String -repositories { - google() - gradlePluginPortal() - mavenCentral() - - // JetBrains repositories for compose-desktop and compose-multiplatform - maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") - maven("https://packages.jetbrains.team/maven/p/kpm/public/") - - // JetBrains repositories for IntelliJ components - maven("https://www.jetbrains.com/intellij-repository/releases/") - maven("https://cache-redirector.jetbrains.com/intellij-dependencies") -} - -kotlin { - jvmToolchain { - vendor = JvmVendorSpec.JETBRAINS - languageVersion = JavaLanguageVersion.of(17) - } -} - dependencies { - implementation(project(":ghidra-schema-ksp")) - ksp(project(":ghidra-schema-ksp")) + implementation(project(":ghidralite-core-ksp")) + ksp(project(":ghidralite-core-ksp")) implementation(libs.kotlin.reflect) implementation(libs.kotlinx.serialization.json) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 0000000..dd4ce1c --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,23 @@ +plugins { + `kotlin-dsl` + alias(libs.plugins.kotlinx.serialization) +} + +kotlin { + sourceSets { + all { + languageSettings { + optIn("kotlinx.serialization.ExperimentalSerializationApi") + } + } + } +} + +dependencies { + implementation(libs.kotlin.gradlePlugin) + + // Enables using type-safe accessors to reference plugins from the [plugins] block defined in + // version catalogs. + // Context: https://github.com/gradle/gradle/issues/15383#issuecomment-779893192 + implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) +} \ No newline at end of file diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts new file mode 100644 index 0000000..b576728 --- /dev/null +++ b/buildSrc/settings.gradle.kts @@ -0,0 +1,19 @@ +@file:Suppress("UnstableApiUsage") + +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + +rootProject.name = "buildSrc" + +dependencyResolutionManagement { + repositories { + google() + gradlePluginPortal() + mavenCentral() + } + + versionCatalogs { + create("libs") { + from(files("../versions.toml")) + } + } +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/ghidralite-conventions.gradle.kts b/buildSrc/src/main/kotlin/ghidralite-conventions.gradle.kts new file mode 100644 index 0000000..2ae999c --- /dev/null +++ b/buildSrc/src/main/kotlin/ghidralite-conventions.gradle.kts @@ -0,0 +1,36 @@ +@file:Suppress("UnstableApiUsage") + +plugins { + kotlin("jvm") +} + +group = "io.github.garyttierney.ghidralite" +version = "0.1.0" + +repositories { + google() + mavenCentral() + + // JetBrains repositories for compose-desktop and compose-multiplatform + maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") + maven("https://packages.jetbrains.team/maven/p/kpm/public/") + + // JetBrains repositories for IntelliJ components + maven("https://www.jetbrains.com/intellij-repository/releases/") + maven("https://cache-redirector.jetbrains.com/intellij-dependencies") +} + +dependencies { + testImplementation(kotlin("test")) +} + +tasks.test { + useJUnitPlatform() +} + +kotlin { + jvmToolchain { + vendor = JvmVendorSpec.JETBRAINS + languageVersion = JavaLanguageVersion.of(17) + } +} \ No newline at end of file diff --git a/ghidra-schema-ksp/build.gradle.kts b/ghidralite-core-ksp/build.gradle.kts similarity index 91% rename from ghidra-schema-ksp/build.gradle.kts rename to ghidralite-core-ksp/build.gradle.kts index 4ba5e63..64f53cb 100644 --- a/ghidra-schema-ksp/build.gradle.kts +++ b/ghidralite-core-ksp/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - kotlin("jvm") version "1.9.23" + `ghidralite-conventions` } group = "io.github.garyttierney" diff --git a/ghidra-schema-ksp/src/main/kotlin/GhidraSchema.kt b/ghidralite-core-ksp/src/main/kotlin/GhidraSchema.kt similarity index 100% rename from ghidra-schema-ksp/src/main/kotlin/GhidraSchema.kt rename to ghidralite-core-ksp/src/main/kotlin/GhidraSchema.kt diff --git a/ghidra-schema-ksp/src/main/kotlin/GhidraSchemaProcessor.kt b/ghidralite-core-ksp/src/main/kotlin/GhidraSchemaProcessor.kt similarity index 100% rename from ghidra-schema-ksp/src/main/kotlin/GhidraSchemaProcessor.kt rename to ghidralite-core-ksp/src/main/kotlin/GhidraSchemaProcessor.kt diff --git a/ghidra-schema-ksp/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider b/ghidralite-core-ksp/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider similarity index 100% rename from ghidra-schema-ksp/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider rename to ghidralite-core-ksp/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider diff --git a/ghidralite-core/build.gradle.kts b/ghidralite-core/build.gradle.kts new file mode 100644 index 0000000..67b2c99 --- /dev/null +++ b/ghidralite-core/build.gradle.kts @@ -0,0 +1,22 @@ +plugins { + `ghidralite-conventions` + id("me.champeau.jmh") version "0.7.2" +} + +group = "io.github.garyttierney" +version = "unspecified" + +repositories { + mavenCentral() +} + +dependencies { + testImplementation(kotlin("test")) +} + +tasks.test { + useJUnitPlatform() +} +kotlin { + jvmToolchain(17) +} \ No newline at end of file diff --git a/ghidralite-extension/build.gradle.kts b/ghidralite-extension/build.gradle.kts new file mode 100644 index 0000000..00a7dd0 --- /dev/null +++ b/ghidralite-extension/build.gradle.kts @@ -0,0 +1,21 @@ +plugins { + `ghidralite-conventions` +} + +group = "io.github.garyttierney" +version = "unspecified" + +repositories { + mavenCentral() +} + +dependencies { + testImplementation(kotlin("test")) +} + +tasks.test { + useJUnitPlatform() +} +kotlin { + jvmToolchain(17) +} \ No newline at end of file diff --git a/ghidralite-standalone/build.gradle.kts b/ghidralite-standalone/build.gradle.kts new file mode 100644 index 0000000..00a7dd0 --- /dev/null +++ b/ghidralite-standalone/build.gradle.kts @@ -0,0 +1,21 @@ +plugins { + `ghidralite-conventions` +} + +group = "io.github.garyttierney" +version = "unspecified" + +repositories { + mavenCentral() +} + +dependencies { + testImplementation(kotlin("test")) +} + +tasks.test { + useJUnitPlatform() +} +kotlin { + jvmToolchain(17) +} \ No newline at end of file diff --git a/ghidralite-ui/build.gradle.kts b/ghidralite-ui/build.gradle.kts new file mode 100644 index 0000000..e132ccd --- /dev/null +++ b/ghidralite-ui/build.gradle.kts @@ -0,0 +1,3 @@ +plugins { + `ghidralite-conventions` +} diff --git a/settings.gradle.kts b/settings.gradle.kts index 6b05622..bfc8ac9 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -27,4 +27,9 @@ dependencyResolutionManagement { } rootProject.name = "ghidralite" -include("ghidra-schema-ksp") + +include("ghidralite-core") +include("ghidralite-core-ksp") +include("ghidralite-extension") +include("ghidralite-ui") +include("ghidralite-standalone") diff --git a/src/main/kotlin/Ghidralite.kt b/src/main/kotlin/Ghidralite.kt index fb2e042..1483af8 100644 --- a/src/main/kotlin/Ghidralite.kt +++ b/src/main/kotlin/Ghidralite.kt @@ -57,7 +57,7 @@ class Ghidralite : GhidraLaunchable { } val icon = svgResource("icons/jewel-logo.svg") - val windowSize = IntSize(0, 0) + application { val windowState = rememberWindowState() @@ -78,6 +78,7 @@ class Ghidralite : GhidraLaunchable { icon = icon, ) { window.state + CompositionLocalProvider(LocalWindowPosition provides windowState.position) { GhidraliteRoot(searchBarFocusRequester = searchBarFocusRequester) } diff --git a/src/main/kotlin/ui/root/components/OnboardingComponent.kt b/src/main/kotlin/ui/root/components/OnboardingComponent.kt index cea0c81..f796a22 100644 --- a/src/main/kotlin/ui/root/components/OnboardingComponent.kt +++ b/src/main/kotlin/ui/root/components/OnboardingComponent.kt @@ -1,15 +1,16 @@ package io.github.garyttierney.ghidralite.ui.main.components -import androidx.compose.foundation.* +import androidx.compose.foundation.background +import androidx.compose.foundation.border import androidx.compose.foundation.layout.* -import androidx.compose.foundation.lazy.* +import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.runtime.* -import androidx.compose.ui.* -import androidx.compose.ui.unit.* +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp import ghidra.framework.model.DomainFolder import ghidra.framework.model.Project import ghidra.program.database.ProgramDB -import ghidra.program.model.listing.Program import ghidra.util.task.TaskMonitor import io.github.garyttierney.ghidralite.GhidraWorkerContext import io.github.garyttierney.ghidralite.framework.GhidraliteProjectManager @@ -46,7 +47,10 @@ fun Onboarding(onOnboardingComplete: (Workspace) -> Unit) { } } - Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { + Box( + modifier = Modifier.fillMaxSize().background(JewelTheme.globalColors.paneBackground), + contentAlignment = Alignment.Center + ) { if (project == null) { DefaultButton(onClick = { showFilePicker = true }) { Text("Select project (.gpr) file ") @@ -63,26 +67,26 @@ fun Onboarding(onOnboardingComplete: (Workspace) -> Unit) { DefaultButton( onClick = { - projectLoadScope.launch { - val workspace = withContext(Dispatchers.IO) { - val program = file.getDomainObject( - GhidraWorkerContext, - false, - false, - TaskMonitor.DUMMY - ) + projectLoadScope.launch { + val workspace = withContext(Dispatchers.IO) { + val program = file.getDomainObject( + GhidraWorkerContext, + false, + false, + TaskMonitor.DUMMY + ) - Workspace.load(project!!, program as ProgramDB) - } + Workspace.load(project!!, program as ProgramDB) + } - onOnboardingComplete(workspace) + onOnboardingComplete(workspace) - } - }) { + } + }) { Text("Open") } - } } + } } } } diff --git a/src/main/kotlin/ui/search/QuickSearchResultsView.kt b/src/main/kotlin/ui/search/QuickSearchResultsView.kt index 444aab7..ed450f6 100644 --- a/src/main/kotlin/ui/search/QuickSearchResultsView.kt +++ b/src/main/kotlin/ui/search/QuickSearchResultsView.kt @@ -62,6 +62,7 @@ fun QuickSearch( modifier = Modifier.fillMaxWidth() .focusRequester(focusRequester) .focusable(true) + , placeholder = { Text("Type a query to begin searching") }, interactionSource = interactionSource, ) diff --git a/versions.toml b/versions.toml index ad212bb..f114757 100644 --- a/versions.toml +++ b/versions.toml @@ -9,13 +9,13 @@ intellij = "241.14494.241" ghidra = "11.1" jewel = "0.17.0" jna = "5.14.0" -kotlin = "1.9.23" +kotlin = "1.9.0" kotlinSarif = "0.5.0" kotlinpoet = "1.15.2" kotlinterGradlePlugin = "3.16.0" kotlinxSerialization = "1.5.1" kotlinxBinaryCompat = "0.14.0" -ksp = "1.9.23-1.0.20" +ksp = "1.9.20-1.0.14" poko = "0.13.1" [libraries]