diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0c93443..584fc96 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,24 @@
+## [0.5.0]
+
+### Added
+- Maven publication
+
+### Changed
+- README sections
+- KodeView dependency import style
+
+## [0.4.0]
+
+### Added
+- Maven local publication
+
+### Changed
+- KodeView import model
+
## [0.3.1]
### Added
+
- Web section to README
## [0.3.0]
diff --git a/README.md b/README.md
index d43e540..0de3355 100644
--- a/README.md
+++ b/README.md
@@ -1,23 +1,47 @@
![kodeview_banner_opaque](https://github.com/SnipMeDev/KodeView/assets/8405055/59c6a2af-1b32-4a02-998f-ecae2296363a)
+[![Maven Central](https://img.shields.io/maven-central/v/dev.snipme/kodeview)](https://mvnrepository.com/artifact/dev.snipme)
+[![Kotlin](https://img.shields.io/badge/kotlin-1.9.10-blue.svg?logo=kotlin)](http://kotlinlang.org)
+[![GitHub License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)
+
# KodeView
Kotlin Compose Multiplatform components for syntax highlighting based on
-[Highlights](https://github.com/SnipMeDev/Highlights/blob/main/CHANGELOG.md) library.
+[Highlights](https://github.com/SnipMeDev/Highlights) library.
## Preview
-## Installation
-TBD
+## Installation ⬇️
+```shell
+repositories {
+ mavenCentral()
+}
+```
-## Components
+```shell
+implementation("dev.snipme:kodeview:0.5.0")
+```
-### CodeTextView
-The basic component that takes instance of Highlights and applies coloring on text.
+## Features ✨
+- CodeTextView UI view
+- Code component analysis (Keyword, comment, etc.)
+- Multiple syntax languages (Java, Swift, Kotlin, C, ...)
+- Themes
+- Text bolding (emphasis)
+- Written in pure Kotlin, so available for many platforms 📱 💻 🖥️
+
+## Support ☕
+Kotlin Multiplatform is a fresh environment and developing for it is neither fast nor easy 🥲
+
+If you feel that any of our project has saved you a time or effort, then consider supporting us via:
+[🧋 Buy Me A Coffee](https://bmc.link/SnipMeDev)
-#### Android
+## Components 🧩
+
+### CodeTextView
+The basic component that takes instance of Highlights and applies coloring on a text.
```kotlin
@Composable
@@ -40,92 +64,36 @@ fun MyApp() {
}
```
-#### iOS
+## Run examples 🏎️
-```swift
-struct MyApp: App {
- var body: some Scene {
- WindowGroup {
- ContentView()
- }
- }
-}
+Not all examples can be executed from command line, so recommended way is to use pre-created configurations:
-struct ContentView: View {
- @State var highlights = Highlights.companion.default()
-
- init() {
- highlights.setCode(code: "public static void main(String[] args) {}")
- }
-
- var body: some View {
- VStack {
- CodeTextView(newHighlights: $highlights)
- .ignoresSafeArea(.keyboard)
- .padding()
- }
- }
-}
-```
+
-#### Desktop
+## TODO 🚧
+- [ ] CodeEditText
-```kotlin
-private val windowSize = 500.dp
-
-fun main() = application {
- Window(
- onCloseRequest = ::exitApplication,
- state = rememberWindowState(
- width = windowSize,
- height = windowSize,
- )
- ) {
- val highlights = remember {
- mutableStateOf(
- Highlights
- .default()
- .getBuilder()
- .code("public static void main(String[] args) {}")
- .build()
- )
- }
-
- MaterialTheme {
- Column {
- CodeTextView(highlights = highlights.value)
- }
- }
- }
-}
-```
+## Contribution 💻
+Any form of support is very welcomed.
+Bugs, problems and new feature requests should be placed in the `Issues` tab with proper labeling.
+New feature can be also submitted via `Pull Requests`.
+Then make sure:
+- CHANGELOG and README have been updated
+- New code matches library's vision and code style
-#### Web
+License 🖋️
+=======
-```kotlin
-@ExperimentalComposeUiApi
-fun main() {
- onWasmReady {
- CanvasBasedWindow(
- canvasElementId = "ComposeTarget",
- applyDefaultStyles = true,
- ) {
- val highlights = remember {
- mutableStateOf(
- Highlights
- .default()
- .getBuilder()
- .code("public static void main(String[] args) {}")
- .build()
- )
- }
-
- MaterialTheme {
- Column {
- CodeTextView(highlights = highlights.value)
- }
- }
- }
- }
-}
-```
+ Copyright 2023 Tomasz Kądziołka.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/androidExample/build.gradle.kts b/androidExample/build.gradle.kts
index 145fe4f..73cdb37 100644
--- a/androidExample/build.gradle.kts
+++ b/androidExample/build.gradle.kts
@@ -57,5 +57,5 @@ dependencies {
implementation("androidx.compose.ui:ui-tooling-preview")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
- implementation("dev.snipme:kodeview:0.4.0")
+ implementation(libs.kodeview)
}
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
index 314e6e4..a71dfcc 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,4 +8,6 @@ plugins {
id("com.android.library") apply false
id("org.jetbrains.compose") apply false
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
-}
\ No newline at end of file
+}
+
+apply(from = "publish-root.gradle")
\ No newline at end of file
diff --git a/desktopExample/build.gradle.kts b/desktopExample/build.gradle.kts
index 109a249..e00a472 100644
--- a/desktopExample/build.gradle.kts
+++ b/desktopExample/build.gradle.kts
@@ -13,7 +13,7 @@ dependencies {
@OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class)
implementation(compose.components.resources)
implementation(compose.desktop.currentOs)
- implementation("dev.snipme:kodeview:0.4.0")
+ implementation(libs.kodeview)
}
compose.desktop {
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 4b91a4c..82c8187 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -9,6 +9,10 @@ kotlinMultiplatform = "1.9.10"
compose = "1.5.1"
composeCompiler = "1.5.1"
androidLibrary = "8.0.0"
+kodeview = "0.5.0"
+
+[libraries]
+kodeview = { group = "dev.snipme", name = "kodeview", version.ref = "kodeview" }
[plugins]
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
diff --git a/kodeview/build.gradle.kts b/kodeview/build.gradle.kts
index 5368576..95df644 100644
--- a/kodeview/build.gradle.kts
+++ b/kodeview/build.gradle.kts
@@ -4,10 +4,11 @@ plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.compose)
id("maven-publish")
+ id("signing")
}
group = "dev.snipme"
-version = "0.4.0"
+version = "0.5.0"
android {
namespace = "dev.snipme.kodeview"
@@ -44,58 +45,6 @@ kotlin {
}
}
- publishing {
- val emptyJar = tasks.register("emptyJar") {
- archiveAppendix.set("empty")
- }
-
- publications.forEach {
- val publication = it as? MavenPublication ?: return@forEach
-
- publication.artifact(emptyJar) {
- classifier = "javadoc"
- }
-
- publication.pom.withXml {
- val root = asNode()
- root.appendNode("name", "kodeview")
- root.appendNode(
- "description",
- "Kotlin Multiplatform syntax highlighting views"
- )
- root.appendNode("url", "https://github.com/SnipMeDev/KodeView")
-
- root.appendNode("licenses").apply {
- appendNode("license").apply {
- appendNode("name", "The Apache Software License, Version 2.0")
- appendNode("url", "https://www.apache.org/licenses/LICENSE-2.0.txt")
- appendNode("distribution", "repo")
- }
- }
-
- root.appendNode("developers").apply {
- appendNode("developer").apply {
- appendNode("id", "tkadziolka")
- appendNode("name", "Tomasz Kądziołka")
- appendNode("email", "kontakt@tkadziolka.pl")
- }
- }
-
- root.appendNode("scm").apply {
- appendNode(
- "connection",
- "scm:git:ssh://git@github.com:SnipMeDev/KodeView.git"
- )
- appendNode(
- "developerConnection",
- "scm:git:ssh://git@github.org:SnipMeDev/KodeView.git",
- )
- appendNode("url", "https://github.com/SnipMeDev/KodeView")
- }
- }
- }
- }
-
sourceSets {
// Common
val commonMain by getting {
@@ -135,3 +84,73 @@ kotlin {
}
}
}
+
+signing {
+ useInMemoryPgpKeys(
+ rootProject.ext["signing.keyId"] as String,
+ rootProject.ext["signing.key"] as String,
+ rootProject.ext["signing.password"] as String
+ )
+ sign(publishing.publications)
+}
+
+publishing {
+ val emptyJar = tasks.register("emptyJar") {
+ archiveAppendix.set("empty")
+ }
+
+ publications.forEach {
+ val publication = it as? MavenPublication ?: return@forEach
+
+ publication.artifact(emptyJar) {
+ classifier = "javadoc"
+ }
+
+ publication.pom.withXml {
+ val root = asNode()
+ root.appendNode("name", "kodeview")
+ root.appendNode(
+ "description",
+ "Kotlin Multiplatform syntax highlighting views"
+ )
+ root.appendNode("url", "https://github.com/SnipMeDev/KodeView")
+
+ root.appendNode("licenses").apply {
+ appendNode("license").apply {
+ appendNode("name", "The Apache Software License, Version 2.0")
+ appendNode("url", "https://www.apache.org/licenses/LICENSE-2.0.txt")
+ appendNode("distribution", "repo")
+ }
+ }
+
+ root.appendNode("developers").apply {
+ appendNode("developer").apply {
+ appendNode("id", "tkadziolka")
+ appendNode("name", "Tomasz Kądziołka")
+ appendNode("email", "kontakt@tkadziolka.pl")
+ }
+ }
+
+ root.appendNode("scm").apply {
+ appendNode(
+ "connection",
+ "scm:git:ssh://git@github.com:SnipMeDev/KodeView.git"
+ )
+ appendNode(
+ "developerConnection",
+ "scm:git:ssh://git@github.org:SnipMeDev/KodeView.git",
+ )
+ appendNode("url", "https://github.com/SnipMeDev/KodeView")
+ }
+ }
+ }
+}
+
+tasks.withType {
+ dependsOn(":kodeview:signIosSimulatorArm64Publication")
+ dependsOn(":kodeview:signIosArm64Publication")
+ dependsOn(":kodeview:signIosX64Publication")
+ dependsOn(":kodeview:signJvmPublication")
+ dependsOn(":kodeview:signJsPublication")
+ dependsOn(":kodeview:signKotlinMultiplatformPublication")
+}
\ No newline at end of file
diff --git a/publish-root.gradle b/publish-root.gradle
new file mode 100644
index 0000000..ecbba45
--- /dev/null
+++ b/publish-root.gradle
@@ -0,0 +1,25 @@
+// Create variables with empty default values
+ext["signing.keyId"] = ''
+ext["signing.password"] = ''
+ext["signing.key"] = ''
+ext["ossrhUsername"] = ''
+ext["ossrhPassword"] = ''
+ext["sonatypeStagingProfileId"] = ''
+
+// Read local.properties file first if it exists
+Properties p = new Properties()
+new FileInputStream("local.properties").withCloseable { is -> p.load(is) }
+p.each { name, value -> ext[name] = value }
+
+// Set up Sonatype repository
+nexusPublishing {
+ repositories {
+ sonatype {
+ stagingProfileId = sonatypeStagingProfileId
+ username = ossrhUsername
+ password = ossrhPassword
+ nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
+ snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
+ }
+ }
+}
\ No newline at end of file
diff --git a/webExample/build.gradle.kts b/webExample/build.gradle.kts
index 5bb3fc9..7522bf0 100644
--- a/webExample/build.gradle.kts
+++ b/webExample/build.gradle.kts
@@ -17,7 +17,7 @@ kotlin {
implementation(compose.foundation)
implementation(compose.material)
implementation(compose.material3)
- implementation("dev.snipme:kodeview:0.4.0")
+ implementation(libs.kodeview)
}
}
}