-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95af440
commit 28d6a8e
Showing
72 changed files
with
14,652 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright 2024, the wasm-sqlite-open-helper project authors and contributors. Please see the AUTHORS file | ||
* for details. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
group = "ru.pixnews.sqlite.open.helper.gradle.multiplatform" | ||
|
||
dependencies { | ||
implementation(project(":lint")) | ||
implementation(libs.agp.plugin.api) | ||
implementation(libs.kotlin.gradle.plugin) | ||
implementation(libs.gradle.maven.publish.plugin) | ||
implementation(libs.dokka.plugin) | ||
runtimeOnly(libs.agp.plugin) | ||
} |
35 changes: 35 additions & 0 deletions
35
...orm/src/main/kotlin/ru.pixnews.sqlite.open.helper.gradle.multiplatform.android.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2024, the wasm-sqlite-open-helper project authors and contributors. Please see the AUTHORS file | ||
* for details. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import com.android.build.api.dsl.LibraryExtension | ||
|
||
/* | ||
* Convention plugin that configures Android target in projects with the Kotlin Multiplatform plugin | ||
*/ | ||
plugins { | ||
id("org.jetbrains.kotlin.multiplatform") | ||
id("ru.pixnews.sqlite.open.helper.gradle.multiplatform.kotlin") | ||
id("ru.pixnews.sqlite.open.helper.gradle.lint.android-lint") | ||
id("com.android.library") | ||
} | ||
|
||
kotlin { | ||
androidTarget { | ||
publishLibraryVariants = listOf("release") | ||
} | ||
} | ||
|
||
extensions.configure<LibraryExtension>("android") { | ||
compileSdk = versionCatalogs.named("libs").findVersion("androidCompileSdk").get().displayName.toInt() | ||
defaultConfig { | ||
minSdk = versionCatalogs.named("libs").findVersion("androidMinSdk").get().displayName.toInt() | ||
} | ||
compileOptions { | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
isCoreLibraryDesugaringEnabled = false | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...form/src/main/kotlin/ru.pixnews.sqlite.open.helper.gradle.multiplatform.kotlin.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) 2024, the pixnews-debuglayout project authors and contributors. | ||
* Please see the AUTHORS file for details. | ||
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. | ||
*/ | ||
|
||
import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode | ||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile | ||
|
||
/* | ||
* Convention plugin that configures Kotlin in projects with the Kotlin Multiplatform plugin | ||
*/ | ||
plugins { | ||
id("org.jetbrains.kotlin.multiplatform") | ||
} | ||
|
||
kotlin { | ||
explicitApi = ExplicitApiMode.Warning | ||
|
||
sourceSets { | ||
all { | ||
languageSettings { | ||
languageVersion = "1.9" | ||
apiVersion = "1.9" | ||
listOf( | ||
"kotlin.RequiresOptIn", | ||
"ru.pixnews.sqlite.open.helper.common.api.InternalWasmSqliteHelperApi", | ||
).forEach(::optIn) | ||
} | ||
} | ||
} | ||
} | ||
|
||
tasks.withType<KotlinJvmCompile>().configureEach { | ||
compilerOptions { | ||
jvmTarget.set(JvmTarget.JVM_17) | ||
freeCompilerArgs.addAll( | ||
"-Xjvm-default=all", | ||
) | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
...orm/src/main/kotlin/ru.pixnews.sqlite.open.helper.gradle.multiplatform.publish.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright (c) 2024, the pixnews-debuglayout project authors and contributors. | ||
* Please see the AUTHORS file for details. | ||
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. | ||
*/ | ||
|
||
import com.vanniktech.maven.publish.JavadocJar | ||
import com.vanniktech.maven.publish.KotlinMultiplatform | ||
import org.jetbrains.dokka.gradle.DokkaTask | ||
|
||
/* | ||
* Convention plugin with publishing defaults | ||
*/ | ||
plugins { | ||
id("org.jetbrains.kotlin.multiplatform") | ||
id("com.vanniktech.maven.publish.base") | ||
id("org.jetbrains.dokka") | ||
} | ||
|
||
tasks.withType<AbstractArchiveTask>().configureEach { | ||
isPreserveFileTimestamps = false | ||
isReproducibleFileOrder = true | ||
} | ||
|
||
mavenPublishing { | ||
publishing { | ||
repositories { | ||
maven { | ||
name = "test" | ||
setUrl(project.rootProject.layout.buildDirectory.dir("localMaven")) | ||
} | ||
maven { | ||
name = "PixnewsS3" | ||
setUrl("s3://maven.pixnews.ru/") | ||
credentials(AwsCredentials::class) { | ||
accessKey = providers.environmentVariable("YANDEX_S3_ACCESS_KEY_ID").getOrElse("") | ||
secretKey = providers.environmentVariable("YANDEX_S3_SECRET_ACCESS_KEY").getOrElse("") | ||
} | ||
} | ||
} | ||
} | ||
|
||
signAllPublications() | ||
|
||
configure( | ||
KotlinMultiplatform(javadocJar = JavadocJar.Dokka("dokkaHtml")), | ||
) | ||
|
||
pom { | ||
name.set(project.name) | ||
description.set("mplementation of SupportSQLiteOpenHelper based on SQLite compiled for WASM") | ||
url.set("https://github.com/illarionov/wasm-sqlite-open-helper") | ||
|
||
licenses { | ||
license { | ||
name.set("The Apache License, Version 2.0") | ||
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") | ||
distribution.set("http://www.apache.org/licenses/LICENSE-2.0.txt") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("illarionov") | ||
name.set("Alexey Illarionov") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
connection.set("scm:git:git://github.com/illarionov/wasm-sqlite-open-helper.git") | ||
developerConnection.set("scm:git:ssh://github.com:illarionov/wasm-sqlite-open-helper.git") | ||
url.set("https://github.com/illarionov/wasm-sqlite-open-helper") | ||
} | ||
} | ||
} | ||
|
||
tasks.withType<DokkaTask> { | ||
notCompatibleWithConfigurationCache("https://github.com/Kotlin/dokka/issues/2231") | ||
dokkaSourceSets.configureEach { | ||
skipDeprecated.set(true) | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...atform/src/main/kotlin/ru.pixnews.sqlite.open.helper.gradle.multiplatform.test.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright (c) 2024, the pixnews-debuglayout project authors and contributors. | ||
* Please see the AUTHORS file for details. | ||
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. | ||
*/ | ||
|
||
import org.gradle.api.tasks.testing.Test | ||
import org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED | ||
import org.gradle.kotlin.dsl.withType | ||
|
||
/* | ||
* Convention plugin that configures unit tests in projects with the Kotlin Multiplatform plugin | ||
*/ | ||
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
maxHeapSize = "2G" | ||
testLogging { | ||
events = mutableSetOf( | ||
FAILED, | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2024, the wasm-sqlite-open-helper project authors and contributors. Please see the AUTHORS file | ||
* for details. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
plugins { | ||
id("ru.pixnews.sqlite.open.helper.gradle.multiplatform.kotlin") | ||
} | ||
|
||
group = "ru.pixnews.sqlite.open.helper.common.api" | ||
|
||
dependencies { | ||
} | ||
|
||
kotlin { | ||
jvm() | ||
js(IR) { | ||
nodejs() | ||
} | ||
linuxX64() | ||
mingwX64() | ||
|
||
sourceSets { | ||
commonTest.dependencies { | ||
implementation(kotlin("test")) | ||
implementation(libs.assertk) | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...commonMain/kotlin/ru/pixnews/sqlite/open/helper/common/api/InternalWasmSqliteHelperApi.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright 2024, the wasm-sqlite-open-helper project authors and contributors. Please see the AUTHORS file | ||
* for details. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package ru.pixnews.sqlite.open.helper.common.api | ||
|
||
@RequiresOptIn( | ||
level = RequiresOptIn.Level.ERROR, | ||
message = "This API is internal in wasm-sqlite-open-helper and should not be used. " + | ||
"It could be removed or changed without notice.", | ||
) | ||
@Target( | ||
AnnotationTarget.CLASS, | ||
AnnotationTarget.TYPEALIAS, | ||
AnnotationTarget.FUNCTION, | ||
AnnotationTarget.PROPERTY, | ||
AnnotationTarget.FIELD, | ||
AnnotationTarget.CONSTRUCTOR, | ||
AnnotationTarget.PROPERTY_SETTER, | ||
AnnotationTarget.PROPERTY_SETTER, | ||
) | ||
@Retention(AnnotationRetention.BINARY) | ||
public annotation class InternalWasmSqliteHelperApi |
34 changes: 34 additions & 0 deletions
34
...n-api/src/commonMain/kotlin/ru/pixnews/sqlite/open/helper/common/api/SqliteUintBitMask.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2024, the wasm-sqlite-open-helper project authors and contributors. Please see the AUTHORS file | ||
* for details. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
@file:Suppress("NOTHING_TO_INLINE") | ||
|
||
package ru.pixnews.sqlite.open.helper.common.api | ||
|
||
public interface SqliteUintBitMask<T : SqliteUintBitMask<T>> { | ||
public val newInstance: (UInt) -> T | ||
public val mask: UInt | ||
} | ||
|
||
public inline fun SqliteUintBitMask<*>.contains(flags: SqliteUintBitMask<*>): Boolean { | ||
return this.mask and flags.mask == flags.mask | ||
} | ||
|
||
public inline infix fun <T : SqliteUintBitMask<T>> SqliteUintBitMask<T>.and(flags: SqliteUintBitMask<*>): T { | ||
return newInstance(mask and flags.mask) | ||
} | ||
|
||
public inline infix fun <T : SqliteUintBitMask<T>> SqliteUintBitMask<T>.or(flags: SqliteUintBitMask<*>): T { | ||
return newInstance(mask or flags.mask) | ||
} | ||
|
||
public inline infix fun <T : SqliteUintBitMask<T>> SqliteUintBitMask<T>.xor(flags: SqliteUintBitMask<*>): T { | ||
return newInstance(mask xor flags.mask) | ||
} | ||
|
||
public inline infix fun <T : SqliteUintBitMask<T>> SqliteUintBitMask<T>.clear(flags: SqliteUintBitMask<*>): T { | ||
return newInstance(mask and flags.mask.inv()) | ||
} |
33 changes: 33 additions & 0 deletions
33
common-api/src/commonMain/kotlin/ru/pixnews/sqlite/open/helper/common/api/WasmPtr.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright 2024, the wasm-sqlite-open-helper project authors and contributors. Please see the AUTHORS file | ||
* for details. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package ru.pixnews.sqlite.open.helper.common.api | ||
|
||
import ru.pixnews.sqlite.open.helper.common.api.WasmPtr.Companion | ||
import kotlin.jvm.JvmInline | ||
|
||
@InternalWasmSqliteHelperApi | ||
@JvmInline | ||
public value class WasmPtr<out P : Any?>( | ||
public val addr: Int, | ||
) { | ||
@Suppress("MagicNumber") | ||
override fun toString(): String = "0x${addr.toString(16)}" | ||
|
||
@Suppress("UNCHECKED_CAST") | ||
@InternalWasmSqliteHelperApi | ||
public companion object { | ||
public const val WASM_SIZEOF_PTR: UInt = 4U | ||
public val SQLITE3_NULL: WasmPtr<*> = WasmPtr<Unit>(0) | ||
public fun <P> sqlite3Null(): WasmPtr<P> = SQLITE3_NULL as WasmPtr<P> | ||
} | ||
} | ||
|
||
@InternalWasmSqliteHelperApi | ||
public fun WasmPtr<*>.isSqlite3Null(): Boolean = this == Companion.SQLITE3_NULL | ||
|
||
@InternalWasmSqliteHelperApi | ||
public operator fun <P> WasmPtr<P>.plus(bytes: Int): WasmPtr<P> = WasmPtr(addr + bytes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.