Skip to content

Commit

Permalink
Merge pull request #100 from fleeksoft/release-0.2.1
Browse files Browse the repository at this point in the history
Release 0.2.1
  • Loading branch information
itboy87 authored Nov 30, 2024
2 parents 2a0fa4f + f1efddd commit a836e6c
Show file tree
Hide file tree
Showing 176 changed files with 1,967 additions and 4,459 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ jobs:
strategy:
matrix:
buildType:
- "common"
- "lite"
- "core"
- "kotlinx"
- "korlibs"
- "ktor2"
- "okio"
runs-on: macos-latest
name: Publish ${{ matrix.buildType }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
{ target: windows, os: windows-latest, tasks: mingwX64Test, continueOnError: false },
{ target: linux, os: ubuntu-latest, tasks: linuxX64Test, continueOnError: false },
]
libBuildType: [ "lite", "korlibs", "kotlinx", "okio", "ktor2" ]
libBuildType: [ "core", "korlibs", "kotlinx", "okio" ]
runs-on: ${{ matrix.config.os }}
name: Build ${{ matrix.config.target }} with libBuildType=${{ matrix.libBuildType }}
steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ xcuserdata
/gpg/
/kotlin-js-store/
.kotlin
.fleet
39 changes: 12 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

**Ksoup** is a Kotlin Multiplatform library for working with real-world HTML and XML. It's a port of the renowned Java library, **jsoup**, and offers an easy-to-use API for URL fetching, data parsing, extraction, and manipulation using DOM and CSS selectors.

[![Kotlin](https://img.shields.io/badge/Kotlin-2.0.20-blue.svg?style=flat&logo=kotlin)](https://kotlinlang.org)
[![Kotlin](https://img.shields.io/badge/Kotlin-2.0.21-blue.svg?style=flat&logo=kotlin)](https://kotlinlang.org)
[![Apache-2.0](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0)
[![Maven Central](https://img.shields.io/maven-central/v/com.fleeksoft.ksoup/ksoup.svg)](https://central.sonatype.com/artifact/com.fleeksoft.ksoup/ksoup)

Expand Down Expand Up @@ -32,20 +32,20 @@ Ksoup is adept at handling all varieties of HTML found in the wild.
Include the dependency in `commonMain`. Latest version [![Maven Central](https://img.shields.io/maven-central/v/com.fleeksoft.ksoup/ksoup.svg)](https://central.sonatype.com/artifact/com.fleeksoft.ksoup/ksoup)

Ksoup published in four variants. Pick the one that suits your needs and start building!
1. **This variant is built without any external IO or Network dependencies. Use this if you want to parse HTML from a string.**
1. **Lightweight variant: Use this if you only need to parse HTML from a string.**
```kotlin
implementation("com.fleeksoft.ksoup:ksoup-lite:<version>")
implementation("com.fleeksoft.ksoup:ksoup:<version>")
```
2. **This variant built with [kotlinx-io](https://github.com/Kotlin/kotlinx-io) and [Ktor 3](https://github.com/ktorio/ktor)**
2. **This variant use [kotlinx-io](https://github.com/Kotlin/kotlinx-io) for I/O and [Ktor 3](https://github.com/ktorio/ktor) for networking**
```kotlin
implementation("com.fleeksoft.ksoup:ksoup:<version>")
implementation("com.fleeksoft.ksoup:ksoup-kotlinx:<version>")

// Optional: Include only if you need to use network request functions such as
// Ksoup.parseGetRequest, Ksoup.parseSubmitRequest, and Ksoup.parsePostRequest
implementation("com.fleeksoft.ksoup:ksoup-network:<version>")
```

3. **This variant is built with [korlibs-io](https://github.com/korlibs/korlibs-io)**
3. **This variant use [korlibs-io](https://github.com/korlibs/korlibs-io) for I/O and networking**
```kotlin
implementation("com.fleeksoft.ksoup:ksoup-korlibs:<version>")

Expand All @@ -54,15 +54,15 @@ Ksoup published in four variants. Pick the one that suits your needs and start b
implementation("com.fleeksoft.ksoup:ksoup-network-korlibs:<version>")
```

4. **This variant built with [kotlinx-io](https://github.com/Kotlin/kotlinx-io) and [Ktor 2](https://github.com/ktorio/ktor)**
4. **This variant use [kotlinx-io](https://github.com/Kotlin/kotlinx-io) for I/O and [Ktor 2](https://github.com/ktorio/ktor) for networking**
```kotlin
implementation("com.fleeksoft.ksoup:ksoup-ktor2:<version>")

// Optional: Include only if you need to use network request functions such as
// Ksoup.parseGetRequest, Ksoup.parseSubmitRequest, and Ksoup.parsePostRequest
implementation("com.fleeksoft.ksoup:ksoup-network-ktor2:<version>")
```
5. **This variant built with [okio](https://github.com/square/okio) and [Ktor 2](https://github.com/ktorio/ktor)**
5. **This variant use [okio](https://github.com/square/okio) for I/O and [Ktor 2](https://github.com/ktorio/ktor) for networking**
```kotlin
implementation("com.fleeksoft.ksoup:ksoup-okio:<version>")

Expand All @@ -71,8 +71,8 @@ Ksoup published in four variants. Pick the one that suits your needs and start b
implementation("com.fleeksoft.ksoup:ksoup-network-ktor2:<version>")
```

**NOTE:** Variants built with kotlinx do not support gzip files.

#### Ksoup supports [Charsets](https://github.com/fleeksoft/fleeksoft-io/blob/main/CharsetsReadme.md)
- Standard charsets are already supported by **Ksoup IO**, but for extended charsets, plesae add `com.fleeksoft.charset:charset-ext`, For more details, visit the [Charsets Documentation](https://github.com/fleeksoft/fleeksoft-io/blob/main/CharsetsReadme.md)

### Parsing HTML from a String with Ksoup
For API documentation you can check [Jsoup](https://jsoup.org/). Most of the APIs work without any changes.
Expand Down Expand Up @@ -139,10 +139,8 @@ In this example, `Ksoup.parseGetRequest` fetches and parses HTML content from Wi

#### For further documentation, please check here: [Jsoup](https://jsoup.org/)

### Ksoup vs. Jsoup Performance: Parsing & Selecting 448KB HTML File [test.tx](https://github.com/fleeksoft/ksoup/blob/develop/ksoup-test/testResources/test.txt)
![Ksoup vs Jsoup](performance1.png)

![Ksoup vs Jsoup](performance.png)
### Ksoup vs. Jsoup Benchmarks: Parsing & Selecting 448KB HTML File [test.tx](https://github.com/fleeksoft/ksoup/blob/develop/ksoup-test/testResources/test.txt)
![Ksoup vs Jsoup](benchmark1.png)

## Open source
Ksoup is an open source project, a Kotlin Multiplatform port of jsoup, distributed under the Apache License, Version 2.0. The source code of Ksoup is available on [GitHub](https://github.com/fleeksoft/ksoup).
Expand All @@ -155,19 +153,6 @@ If you wish to contribute, please read the [Contributing Guidelines](CONTRIBUTIN

To report any issues, visit our [GitHub issues](https://github.com/fleeksoft/ksoup/issues), Please ensure to check for duplicates before submitting a new issue.

## Library Status

| Platform | Status | Notes |
|----------------|--------------|--------------------------|
| Android | Stable | |
| JVM | Stable | |
| iOS | Stable | |
| JS | Alpha | |
| WasmJs | Alpha | not supported with ktor2 |
| Native MacOS | Alpha | |
| Linux | Experimental | |
| Native Windows | Experimental | |



## License
Expand Down
Binary file added benchmark1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ allprojects {
mavenCentral()
google()
gradlePluginPortal()
mavenLocal()
maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
}
version = REAL_VERSION
group = GROUP
Expand Down Expand Up @@ -249,14 +251,14 @@ class MicroAmper(val project: Project) {
browser {
testTask {
useMocha {
timeout = "9s"
timeout = "15s"
}
}
}
nodejs {
testTask {
useMocha {
timeout = "9s"
timeout = "15s"
}
}
}
Expand All @@ -267,14 +269,14 @@ class MicroAmper(val project: Project) {
browser {
testTask {
useMocha {
timeout = "9s"
timeout = "15s"
}
}
}
nodejs {
testTask {
useMocha {
timeout = "9s"
timeout = "15s"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions common.module-template.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
settings:
kotlin:
apiVersion: 1.9
languageVersion: 1.9
apiVersion: 2.0
languageVersion: 2.0
jvm:
release: 17
android:
Expand Down
8 changes: 2 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ android.nonTransitiveRClass=true
kotlin.native.ignoreIncorrectDependencies=true
kotlin.mpp.enableCInteropCommonization=true
kotlin.mpp.applyDefaultHierarchyTemplate=false
# dev, common, lite, kotlinx, korlibs, okio, ktor2
# dev will include all modules in settings.gradle.kts but use kotlinx dep for engine
libBuildType=lite


SONATYPE_HOST=CENTRAL_PORTAL
RELEASE_SIGNING_ENABLED=true
# core, kotlinx, korlibs, okio, ktor2
libBuildType=core
19 changes: 13 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[versions]
agp = "8.7.1"
kotlin = "2.0.21"
agp = "8.7.2"
kotlin = "2.1.0"
compileSdk = "35"
minSdk = "21"
libraryVersion = "0.2.0"
libraryVersion = "0.2.1"
ktor = "3.0.1"
ktor2 = "2.3.12"
ktor2 = "2.3.13"
coroutines = "1.9.0"
kotlinxDatetime = "0.6.1"
kotlinx-io = "0.5.4"
kotlinx-io = "0.6.0"
okio = "3.9.1"
dokka = "1.9.20"
kotlinx-benchmark = "0.4.12"
Expand All @@ -18,7 +18,8 @@ korlibs = "6.0.1"
mavenPublish = "0.30.0"

stately = "2.1.0"
jsoup = "1.18.1"
jsoup = "1.18.2"
fleeksoft-io = "0.0.2"

[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
Expand Down Expand Up @@ -50,6 +51,12 @@ jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" }
okio = { module = "com.squareup.okio:okio", version.ref = "okio" }
okio-nodefilesystem = { module = "com.squareup.okio:okio-nodefilesystem", version.ref = "okio" }
kotlinx-benchmark-runtime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinx-benchmark" }
fleeksoft-io-core = { module = "com.fleeksoft.io:io-core", version.ref = "fleeksoft-io" }
fleeksoft-io = { module = "com.fleeksoft.io:io", version.ref = "fleeksoft-io" }
fleeksoft-io-kotlinx = { module = "com.fleeksoft.io:kotlinx-io", version.ref = "fleeksoft-io" }
fleeksoft-io-okio = { module = "com.fleeksoft.io:okio", version.ref = "fleeksoft-io" }
fleeksoft-charset = { module = "com.fleeksoft.charset:charset", version.ref = "fleeksoft-io" }
fleeksoft-charset-ext = { module = "com.fleeksoft.charset:charset-ext", version.ref = "fleeksoft-io" }

[plugins]
androidLibrary = { id = "com.android.library", version.ref = "agp" }
Expand Down
1 change: 0 additions & 1 deletion ksoup-benchmark/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ repositories:
dependencies:
- $libs.kotlinx.io
- $libs.kotlinx.benchmark.runtime
# - com.fleeksoft.ksoup:ksoup-lite:0.1.8
- ../ksoup

dependencies@jvm:
Expand Down
8 changes: 0 additions & 8 deletions ksoup-engine-common/module.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions ksoup-engine-common/src/com/fleeksoft/ksoup/engine/KsoupEngine.kt

This file was deleted.

This file was deleted.

27 changes: 0 additions & 27 deletions ksoup-engine-common/src/com/fleeksoft/ksoup/io/Charset.kt

This file was deleted.

9 changes: 0 additions & 9 deletions ksoup-engine-common/src/com/fleeksoft/ksoup/io/FileSource.kt

This file was deleted.

Loading

0 comments on commit a836e6c

Please sign in to comment.