Skip to content

Commit

Permalink
Merge pull request #12 from fleeksoft/develop
Browse files Browse the repository at this point in the history
Release 0.0.8, fixing #9
  • Loading branch information
itboy87 authored Dec 6, 2023
2 parents f8e6807 + eeb11f8 commit 5146f3d
Show file tree
Hide file tree
Showing 62 changed files with 1,378 additions and 1,073 deletions.
65 changes: 33 additions & 32 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
name: Build

on:
push:
on:
push:
branches: [ "main" ]
pull_request:
pull_request:
branches: [ "main" ]

permissions:
permissions:
contents: read
pages: write
id-token: write

jobs:
build:
strategy:
matrix:
jobs:
build:
strategy:
matrix:
config: [
{ target: android, os: ubuntu-latest, tasks: testDebugUnitTest, continueOnError: false },
# { target: apple, os: macos-latest, tasks: iosX64Test iosSimulatorArm64Test, continueOnError: true },
# { target: linux, os: ubuntu-latest, tasks: linuxTest, continueOnError: false },
{ target: apple, os: macos-latest, tasks: iosX64Test iosSimulatorArm64Test, continueOnError: false },
{ target: nodejs, os: ubuntu-latest, tasks: jsNodeTest, continueOnError: false },
{ target: desktop, os: ubuntu-latest, tasks: jvmTest, continueOnError: false },
]
runs-on: ${{ matrix.config.os }}
name: Build ${{ matrix.config.target }}
steps:
steps:
- uses: actions/checkout@v3
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
with:
java-version: '17'
distribution: 'temurin'

Expand All @@ -37,22 +37,23 @@ jobs:
- name: Test ${{ matrix.config.target }} targets
continue-on-error: ${{ matrix.config.continueOnError }}
run: ./gradlew ${{ matrix.config.tasks }}
working-directory: ${{ github.workspace }}

release:
release:
if: ${{ github.event_name != 'pull_request' }}
runs-on: macos-latest
needs:
needs:
- build
environment:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
steps:
- uses: actions/checkout@v3

- name: Setup JDK 17
uses: actions/setup-java@v3
with:
with:
java-version: '17'
distribution: 'temurin'

Expand All @@ -62,28 +63,28 @@ jobs:
- name: Setup Pages
uses: actions/configure-pages@v3

# - name: Write secrets to local.properties
# if: ${{ github.event_name != 'pull_request' }}
# run: |
# echo mavenCentralUsername="${SONATYPE_USERNAME}" >> "local.properties"
# echo mavenCentralUsername="${SONATYPE_PASSWORD}" >> "local.properties"
# echo gpgKeyPassword="${GPG_KEY_PASSWORD}" >> "local.properties"
# echo gpgKeySecret="${GPG_KEY_SECRET}" >> "local.properties"
# env:
# SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
# SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
# GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }}
# GPG_KEY_SECRET: ${{ secrets.GPG_KEY_SECRET }}
# - name: Write secrets to local.properties
# if: ${{ github.event_name != 'pull_request' }}
# run: |
# echo mavenCentralUsername="${SONATYPE_USERNAME}" >> "local.properties"
# echo mavenCentralUsername="${SONATYPE_PASSWORD}" >> "local.properties"
# echo gpgKeyPassword="${GPG_KEY_PASSWORD}" >> "local.properties"
# echo gpgKeySecret="${GPG_KEY_SECRET}" >> "local.properties"
# env:
# SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
# SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
# GPG_KEY_PASSWORD: ${{ secrets.GPG_KEY_PASSWORD }}
# GPG_KEY_SECRET: ${{ secrets.GPG_KEY_SECRET }}

# - name: Release to sonatype
# run: ./gradlew publishAllPublicationsToMavenRepository
# - name: Release to sonatype
# run: ./gradlew publishAllPublicationsToMavenRepository

- name: Generate docs with dokka
run: ./gradlew dokkaHtmlMultiModule

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
with:
path: ${{ github.workspace }}/build/dokka/htmlMultiModule

- name: Release to GitHub Pages
Expand Down
28 changes: 18 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
![badge-android](http://img.shields.io/badge/platform-android-6EDB8D.svg?style=flat)
![badge-ios](http://img.shields.io/badge/platform-ios-CDCDCD.svg?style=flat)
![badge-jvm](http://img.shields.io/badge/platform-jvm-DB413D.svg?style=flat)
![badge-linux](http://img.shields.io/badge/platform-linux-2D3F6C.svg?style=flat)
![badge-nodejs](https://img.shields.io/badge/platform-jsNode-F8DB5D.svg?style=flat)

Ksoup implements the [WHATWG HTML5](https://html.spec.whatwg.org/multipage/) specification, parsing HTML to the same DOM as modern browsers do, but with support for Android, JVM, and native platforms.

Expand Down Expand Up @@ -46,7 +48,10 @@ This snippet demonstrates how to use `Ksoup.parse` for parsing an HTML string an
### Fetching and Parsing HTML from a URL using Ksoup
```kotlin
//Please note that the com.fleeksoft.ksoup:ksoup-network library is required for Ksoup.parseGetRequest.
val doc: Document = Ksoup.parseGetRequest(url = "https://en.wikipedia.org/")
val doc: Document = Ksoup.parseGetRequest(url = "https://en.wikipedia.org/") // suspend function
// or
val doc: Document = Ksoup.parseGetRequestBlocking(url = "https://en.wikipedia.org/")

println("title: ${doc.title()}")
val headlines: Elements = doc.select("#mp-itn b a")

Expand All @@ -59,8 +64,10 @@ headlines.forEach { headline: Element ->
```
In this example, `Ksoup.parseGetRequest` fetches and parses HTML content from Wikipedia, extracting and printing news headlines and their corresponding links.

#### For further documentation, please check here: [Ksoup](https://fleeksoft.github.io/ksoup/)

## Open source
Ksoup is an open source project, a Kotlin Multiplatform port of jsoup, distributed under the MIT license. The source code of Ksoup is available on [GitHub](https://github.com/fleeksoft/ksoup).
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).


## Development and Support
Expand All @@ -70,14 +77,15 @@ Report any issues on [our GitHub page](https://github.com/fleeksoft/ksoup/issues

## Library Status

| Platform | Status | Notes |
|------------------|---------------|-------------------------------|
| Android | Beta | |
| JVM | Beta | |
| iOS | Alpha | |
| Linux | Experimental | Does not support gzip files. |
| Native MacOS | Coming Soon | |
| Native Windows | Coming Soon | |
| Platform | Status | Notes |
|----------------|--------------|-----------------------------------------------|
| Android | Beta | |
| JVM | Beta | |
| iOS | Alpha | Does not support few charsets. |
| Linux | Experimental | Does not support gzip files and few charsets. |
| JS | Alpha | Does not support gzip files and few charsets. |
| Native MacOS | Coming Soon | |
| Native Windows | Coming Soon | |



Expand Down
8 changes: 6 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ agp = "8.1.3"
kotlin = "1.9.21"
compileSdk = "34"
minSdk = "21"
libraryVersion = "0.0.7"
junitJupiter = "5.9.3"
libraryVersion = "0.0.8"
junitJupiter = "5.10.0"
compose = "1.5.4"
compose-compiler = "1.5.4"
compose-material3 = "1.1.2"
androidx-activityCompose = "1.8.1"
ktor = "2.3.6"
coroutines = "1.7.3"
okio = "3.6.0"
kotlinxDatetime = "0.4.1"
kotlinx-io = "0.3.0"
Expand All @@ -28,12 +29,15 @@ compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref =
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" }
compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "compose-material3" }
kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktor" }
ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "ktor" }
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
okio = { module = "com.squareup.okio:okio", version.ref = "okio" }
okio-nodefilesystem = { module = "com.squareup.okio:okio-nodefilesystem", version.ref = "okio" }
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinxDatetime" }
kotlinx-io = { module = "org.jetbrains.kotlinx:kotlinx-io-core", version.ref = "kotlinx-io" }
codepoints = { module = "de.cketti.unicode:kotlin-codepoints-deluxe", version.ref = "codepoints" }
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
47 changes: 37 additions & 10 deletions ksoup-network/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ kotlin {

jvm()

js(IR) {
nodejs()
}

linuxX64()
linuxArm64()

Expand All @@ -30,14 +34,16 @@ kotlin {
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
iosSimulatorArm64(),
).forEach {
it.binaries.framework {
baseName = "ksoup-network"
isStatic = true
}
}

applyDefaultHierarchyTemplate()

sourceSets {
commonMain.dependencies {
compileOnly(projects.ksoup)
Expand All @@ -48,21 +54,42 @@ kotlin {
implementation(projects.ksoup)
}

jvmMain.dependencies {
implementation(libs.ktor.client.okhttp)
val nonJsMain by creating {
dependsOn(commonMain.get())
}

androidMain.dependencies {
implementation(libs.ktor.client.okhttp)
jvmMain {
dependsOn(nonJsMain)
dependencies {
implementation(libs.ktor.client.okhttp)
}
}

iosMain.dependencies {
implementation(libs.ktor.client.darwin)
androidMain {
dependsOn(nonJsMain)
dependencies {
implementation(libs.ktor.client.okhttp)
}
}

linuxMain.dependencies {
implementation(libs.ktor.client.cio)
iosMain {
dependsOn(nonJsMain)
dependencies {
implementation(libs.ktor.client.darwin)
}
}

linuxMain {
dependsOn(nonJsMain)
dependencies {
implementation(libs.ktor.client.cio)
}
}

jsMain.dependencies {
implementation(libs.ktor.client.js)
}

}
}

Expand Down Expand Up @@ -139,4 +166,4 @@ signing {
// TODO: remove after https://youtrack.jetbrains.com/issue/KT-46466 is fixed
project.tasks.withType(AbstractPublishToMaven::class.java).configureEach {
dependsOn(project.tasks.withType(Sign::class.java))
}
}
Loading

0 comments on commit 5146f3d

Please sign in to comment.