Skip to content

Commit

Permalink
Merge pull request #38 from MohamedRejeb/0.x
Browse files Browse the repository at this point in the history
Update Kotlin to 1.9.22
  • Loading branch information
MohamedRejeb authored Jan 5, 2024
2 parents 3714047 + 7f4bb4a commit b6bc211
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 2,317 deletions.
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask

plugins {
id("root.publication")
alias(libs.plugins.multiplatform).apply(false)
Expand Down
9 changes: 1 addition & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@
org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M"

#Kotlin
kotlin.code.style=official

#Android
android.useAndroidX=true

#MPP
kotlin.mpp.enableCInteropCommonization=true
kotlin.mpp.androidSourceSetLayoutVersion=2
kotlin.code.style=official
7 changes: 1 addition & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
[versions]
agp = "8.1.0"
kotlin = "1.9.21"
kotlin = "1.9.22"
kotlinx-kover = "0.7.4"

android-minSdk = "21"
android-compileSdk = "34"

nexus-publish = "2.0.0-rc-1"

[libraries]
nexus-publish = { module = "io.github.gradle-nexus.publish-plugin:io.github.gradle-nexus.publish-plugin.gradle.plugin", version.ref = "nexus-publish" }

[plugins]
multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
kotlinx-kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kotlinx-kover" }
2,282 changes: 11 additions & 2,271 deletions kotlin-js-store/yarn.lock

Large diffs are not rendered by default.

22 changes: 15 additions & 7 deletions ksoup-entities/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask

plugins {
alias(libs.plugins.multiplatform)
id("module.publication")
Expand All @@ -14,11 +17,7 @@ kotlin {
jvm {
jvmToolchain(11)
}
js(IR) {
browser()
nodejs()
binaries.executable()
}
js(IR).nodejs()
iosX64()
iosArm64()
iosSimulatorArm64()
Expand All @@ -36,9 +35,9 @@ kotlin {
macosArm64()
mingwX64()
@OptIn(org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl::class)
wasmJs()
wasmJs().nodejs()
@OptIn(org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl::class)
wasmWasi()
wasmWasi().nodejs()

sourceSets {
/* Main source sets */
Expand All @@ -55,4 +54,13 @@ kotlin {
}
}
}
}

rootProject.the<NodeJsRootExtension>().apply {
nodeVersion = "22.0.0-v8-canary20231127cbafc81f11"
nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
}

rootProject.tasks.withType<KotlinNpmInstallTask>().configureEach {
args.add("--ignore-engines")
}
22 changes: 15 additions & 7 deletions ksoup-html/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask

plugins {
alias(libs.plugins.multiplatform)
id("module.publication")
Expand All @@ -15,11 +18,7 @@ kotlin {
jvm {
jvmToolchain(11)
}
js(IR) {
browser()
nodejs()
binaries.executable()
}
js(IR).nodejs()
iosX64()
iosArm64()
iosSimulatorArm64()
Expand All @@ -37,9 +36,9 @@ kotlin {
macosArm64()
mingwX64()
@OptIn(org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl::class)
wasmJs()
wasmJs().nodejs()
@OptIn(org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl::class)
wasmWasi()
wasmWasi().nodejs()

sourceSets {
/* Main source sets */
Expand All @@ -57,4 +56,13 @@ kotlin {
}
}
}
}

rootProject.the<NodeJsRootExtension>().apply {
nodeVersion = "22.0.0-v8-canary20231127cbafc81f11"
nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
}

rootProject.tasks.withType<KotlinNpmInstallTask>().configureEach {
args.add("--ignore-engines")
}
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,15 @@ internal class KsoupTokenizer(
// Lowercase the character
val lower = c or 0x20
sectionStart = index
if (!xmlMode && lower == Sequences.TitleEnd[2].toInt()) {
startSpecial(Sequences.TitleEnd, 3)

if (xmlMode) {
state = State.InTagName
} else if (lower == Sequences.ScriptEnd[2].toInt()) {
this.state = State.BeforeSpecialS
} else if (lower == Sequences.TitleEnd[2].toInt()) {
this.state = State.BeforeSpecialT
} else {
state = if (!xmlMode && lower == Sequences.ScriptEnd[2].toInt())
State.BeforeSpecialS
else
State.InTagName
this.state = State.InTagName
}
} else if (c == CharCodes.Slash.code) {
state = State.BeforeClosingTagName
Expand Down Expand Up @@ -364,7 +366,7 @@ internal class KsoupTokenizer(
private fun stateInAttributeName(c: Int) {
if (c == CharCodes.Eq.code || isEndOfTagSection(c)) {
this.callbacks.onAttribName(this.sectionStart, this.index)
this.sectionStart = -1
this.sectionStart = this.index
this.state = State.AfterAttributeName
this.stateAfterAttributeName(c)
}
Expand All @@ -374,11 +376,12 @@ internal class KsoupTokenizer(
if (c == CharCodes.Eq.code) {
this.state = State.BeforeAttributeValue
} else if (c == CharCodes.Slash.code || c == CharCodes.Gt.code) {
this.callbacks.onAttribEnd(KsoupHtmlParser.QuoteType.NoValue, this.index)
this.callbacks.onAttribEnd(KsoupHtmlParser.QuoteType.NoValue, this.sectionStart)
this.sectionStart = -1
this.state = State.BeforeAttributeName
this.stateBeforeAttributeName(c)
} else if (!isWhitespace(c)) {
this.callbacks.onAttribEnd(KsoupHtmlParser.QuoteType.NoValue, this.index)
this.callbacks.onAttribEnd(KsoupHtmlParser.QuoteType.NoValue, this.sectionStart)
this.state = State.InAttributeName
this.sectionStart = this.index
}
Expand Down Expand Up @@ -406,9 +409,11 @@ internal class KsoupTokenizer(
this.callbacks.onAttribData(this.sectionStart, this.index)
this.sectionStart = -1
this.callbacks.onAttribEnd(
if (quote == CharCodes.DoubleQuote.code) KsoupHtmlParser.QuoteType.Double
else KsoupHtmlParser.QuoteType.Single,
this.index
if (quote == CharCodes.DoubleQuote.code)
KsoupHtmlParser.QuoteType.Double
else
KsoupHtmlParser.QuoteType.Single,
this.index + 1
)
this.state = State.BeforeAttributeName
} else if (this.decodeEntities && c == CharCodes.Amp.code) {
Expand Down Expand Up @@ -506,6 +511,22 @@ internal class KsoupTokenizer(
}
}

@OptIn(ExperimentalUnsignedTypes::class)
private fun stateBeforeSpecialT(c: Int) {
when (c or 0x20) {
Sequences.TitleEnd[3].toInt() -> {
this.startSpecial(Sequences.TitleEnd, 4)
}
Sequences.TextareaEnd[3].toInt() -> {
this.startSpecial(Sequences.TextareaEnd, 4)
}
else -> {
this.state = State.InTagName
this.stateInTagName(c) // Consume the token again
}
}
}

private fun startEntity() {
this.baseState = this.state
this.state = State.InEntity
Expand Down Expand Up @@ -607,6 +628,8 @@ internal class KsoupTokenizer(
this.stateAfterClosingTagName(c)
State.BeforeSpecialS ->
this.stateBeforeSpecialS(c)
State.BeforeSpecialT ->
this.stateBeforeSpecialT(c)
State.InAttributeValueNq ->
this.stateInAttributeValueNoQuotes(c)
State.InSelfClosingTag ->
Expand Down Expand Up @@ -763,6 +786,7 @@ internal class KsoupTokenizer(

// Special tags
BeforeSpecialS, // Decide if we deal with `<script` or `<style`
BeforeSpecialT, // Decide if we deal with `<title` or `<textarea`
SpecialStartSequence,
InSpecialTag,

Expand Down Expand Up @@ -811,17 +835,19 @@ internal class KsoupTokenizer(

@OptIn(ExperimentalUnsignedTypes::class)
private object Sequences {
val Cdata = ubyteArrayOf(67u, 68u, 65u, 84u, 65u, 91u)
val Cdata = ubyteArrayOf(67u, 68u, 65u, 84u, 65u, 91u) // CDATA[

val CdataEnd = ubyteArrayOf(93u, 93u, 62u) // ]]>

val CdataEnd = ubyteArrayOf(93u, 93u, 62u)
val CommentEnd = ubyteArrayOf(45u, 45u, 62u) // `-->`

val CommentEnd = ubyteArrayOf(45u, 45u, 62u)
val ScriptEnd = ubyteArrayOf(60u, 47u, 115u, 99u, 114u, 105u, 112u, 116u) // `</script`

val ScriptEnd = ubyteArrayOf(60u, 47u, 115u, 99u, 114u, 105u, 112u, 116u)
val StyleEnd = ubyteArrayOf(60u, 47u, 115u, 116u, 121u, 108u, 101u) // `</style`

val StyleEnd = ubyteArrayOf(60u, 47u, 115u, 116u, 121u, 108u, 101u)
val TitleEnd = ubyteArrayOf(60u, 47u, 116u, 105u, 116u, 108u, 101u) // `</title`

val TitleEnd = ubyteArrayOf(60u, 47u, 116u, 105u, 116u, 108u, 101u)
val TextareaEnd = ubyteArrayOf(60u, 47u, 116u, 101u, 120u, 116u, 97u, 114u, 101u, 97u) // `</textarea`
}

private companion object {
Expand Down

0 comments on commit b6bc211

Please sign in to comment.