Skip to content

Commit

Permalink
Use unique moduleName parameters (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
05nelsonm authored Aug 31, 2024
1 parent d7c5eb5 commit 1ba63b5
Show file tree
Hide file tree
Showing 8 changed files with 1,516 additions and 76 deletions.
1,505 changes: 1,480 additions & 25 deletions .kotlin-js-store/yarn.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ plugins {
}

dependencies {
implementation(libs.gradle.kotlin)
implementation(libs.gradle.maven.publish)
implementation(libs.gradle.kmp.configuration)
implementation(libs.gradle.kotlin)
implementation(libs.gradle.publish.maven)
}
27 changes: 13 additions & 14 deletions build-logic/src/main/kotlin/-KmpConfigurationExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,34 +23,33 @@ import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
fun KmpConfigurationExtension.configureShared(
java9ModuleName: String? = null,
publish: Boolean = false,
explicitApi: Boolean = true,
action: Action<KmpConfigurationContainerDsl>
) {
if (publish) {
require(!java9ModuleName.isNullOrBlank()) { "publications must specify a module-info name" }
}

configure {
options {
useUniqueModuleNames = true
}

jvm {
kotlinJvmTarget = JavaVersion.VERSION_1_8
compileSourceCompatibility = JavaVersion.VERSION_1_8
compileTargetCompatibility = JavaVersion.VERSION_1_8

@OptIn(ExperimentalKmpConfigurationApi::class)
java9MultiReleaseModuleInfo(java9ModuleName)
java9ModuleInfoName = java9ModuleName
}

js()

@OptIn(ExperimentalWasmDsl::class)
wasmJs {
target {
browser {
testTask {
useMocha { timeout = "30s" }
}
}
nodejs {
testTask {
useMocha { timeout = "30s" }
}
}
browser()
nodejs()
}
}

Expand All @@ -72,7 +71,7 @@ fun KmpConfigurationExtension.configureShared(
mingwAll()

common {
if (publish) { pluginIds("publication") }
if (publish) pluginIds("publication")

sourceSetTest {
dependencies {
Expand All @@ -81,7 +80,7 @@ fun KmpConfigurationExtension.configureShared(
}
}

if (explicitApi) { kotlin { explicitApi() } }
if (publish) kotlin { explicitApi() }

action.execute(this)
}
Expand Down
20 changes: 2 additions & 18 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
import org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension

plugins {
alias(libs.plugins.multiplatform) apply(false)
alias(libs.plugins.binaryCompat)
alias(libs.plugins.binary.compat)
alias(libs.plugins.kotlin.multiplatform) apply(false)
}

allprojects {

findProperty("GROUP")?.let { group = it }
findProperty("VERSION_NAME")?.let { version = it }
findProperty("POM_DESCRIPTION")?.let { description = it.toString() }

repositories {
mavenCentral()
}

}

plugins.withType<YarnPlugin> {
the<YarnRootExtension>().lockFileDirectory = rootDir.resolve(".kotlin-js-store")
}

plugins.withType<NodeJsRootPlugin> {
the<NodeJsRootExtension>().apply {
nodeVersion = "21.0.0-v8-canary202309167e82ab1fa2"
nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
}

tasks.withType<KotlinNpmInstallTask>().configureEach {
args.add("--ignore-engines")
}
}

apiValidation {
if (findProperty("CHECK_PUBLICATION") != null) {
ignoredProjects.add("check-publication")
Expand Down
28 changes: 15 additions & 13 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
[versions]
binaryCompat = "0.14.0"
configuration = "0.2.1"
encoding = "2.2.1"
endians = "0.3.0"
kotlin = "1.9.23"
publish = "0.27.0"
gradle-binary-compat = "0.14.0"
gradle-kmp-configuration = "0.3.2"
gradle-kotlin = "1.9.24"
gradle-publish-maven = "0.29.0"

# tests
encoding = "2.2.2"
kotlincrypto-endians = "0.3.0"

[libraries]
gradle-kmp-configuration = { module = "io.matthewnelson:gradle-kmp-configuration-plugin", version.ref = "configuration" }
gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
gradle-maven-publish = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "publish" }
gradle-kmp-configuration = { module = "io.matthewnelson:gradle-kmp-configuration-plugin", version.ref = "gradle-kmp-configuration" }
gradle-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "gradle-kotlin" }
gradle-publish-maven = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "gradle-publish-maven" }

# Tests
# tests
encoding-base16 = { module = "io.matthewnelson.encoding:base16", version.ref = "encoding" }
endians-endians = { module = "org.kotlincrypto.endians:endians", version.ref = "endians" }
kotlincrypto-endians-endians = { module = "org.kotlincrypto.endians:endians", version.ref = "kotlincrypto-endians" }

[plugins]
binaryCompat = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binaryCompat" }
multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
binary-compat = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "gradle-binary-compat" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "gradle-kotlin" }
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

# https://gradle.org/release-checksums/
distributionSha256Sum=85719317abd2112f021d4f41f09ec370534ba288432065f4b477b6a3b652910d
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
distributionSha256Sum=f8b4f4772d302c8ff580bc40d0f56e715de69b163546944f787c87abf209c961
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
2 changes: 1 addition & 1 deletion library/keccak/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ kmpConfiguration {
sourceSetTest {
dependencies {
implementation(libs.encoding.base16)
implementation(libs.endians.endians)
implementation(libs.kotlincrypto.endians.endians)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/check-publication/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ repositories {
}

kmpConfiguration {
configureShared(explicitApi = false) {
configureShared {
common {
sourceSetMain {
dependencies {
Expand Down

0 comments on commit 1ba63b5

Please sign in to comment.