Skip to content

Commit

Permalink
Use unique moduleName parameters (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
05nelsonm authored Aug 31, 2024
1 parent 303d323 commit fff249f
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 75 deletions.
22 changes: 11 additions & 11 deletions .kotlin-js-store/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ brace-expansion@^2.0.1:
balanced-match "^1.0.0"

braces@~3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
version "3.0.3"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
dependencies:
fill-range "^7.0.1"
fill-range "^7.1.1"

[email protected]:
version "1.3.1"
Expand Down Expand Up @@ -151,19 +151,19 @@ emoji-regex@^8.0.0:
integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==

escalade@^3.1.1:
version "3.1.2"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27"
integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==
version "3.2.0"
resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.2.0.tgz#011a3f69856ba189dffa7dc8fcce99d2a87903e5"
integrity sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==

[email protected]:
version "4.0.0"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==

fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
fill-range@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
dependencies:
to-regex-range "^5.0.1"

Expand Down
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)
}
22 changes: 13 additions & 9 deletions build-logic/src/main/kotlin/-KmpConfigurationExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,25 @@ import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
fun KmpConfigurationExtension.configureShared(
java9ModuleName: String? = null,
publish: Boolean = false,
explicitApi: Boolean = true,
action: Action<KmpConfigurationContainerDsl>
) {
// TODO: Enable once module :library:hmac:hmac-md5 is removed
// 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()
Expand All @@ -46,11 +54,7 @@ fun KmpConfigurationExtension.configureShared(
useMocha { timeout = "30s" }
}
}
nodejs {
testTask {
useMocha { timeout = "30s" }
}
}
nodejs()
}
}

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

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

sourceSetTest {
dependencies {
Expand All @@ -81,7 +85,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,20 +13,16 @@
* 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.android.library) 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() }
Expand All @@ -41,24 +37,12 @@ allprojects {
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
}

}

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
56 changes: 30 additions & 26 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,34 +1,38 @@
[versions]
android = "8.1.4"
androidxTestRunner = "1.5.2"
binaryCompat = "0.14.0"
bouncyCastle = "1.73"
configuration = "0.2.1"
cryptoCore = "0.5.1"
cryptoHash = "0.5.1"
encoding = "2.2.1"
kotlin = "1.9.23"
publish = "0.27.0"
gradle-android = "8.2.2"
gradle-binary-compat = "0.14.0"
gradle-kmp-configuration = "0.3.2"
gradle-kotlin = "1.9.24"
gradle-publish-maven = "0.29.0"

kotlincrypto-core = "0.5.1"
kotlincrypto-hash = "0.5.1"

# tests
androidx-test-runner = "1.5.2"
bouncy-castle = "1.73"
encoding = "2.2.2"

[libraries]
kotlincrypto-core-digest = { module = "org.kotlincrypto.core:digest", version.ref = "cryptoCore" }
kotlincrypto-core-mac = { module = "org.kotlincrypto.core:mac", version.ref = "cryptoCore" }
kotlincrypto-core-xof = { module = "org.kotlincrypto.core:xof", version.ref = "cryptoCore" }
kotlincrypto-hash-md = { module = "org.kotlincrypto.hash:md", version.ref = "cryptoHash" }
kotlincrypto-hash-sha1 = { module = "org.kotlincrypto.hash:sha1", version.ref = "cryptoHash" }
kotlincrypto-hash-sha2 = { module = "org.kotlincrypto.hash:sha2", version.ref = "cryptoHash" }
kotlincrypto-hash-sha3 = { module = "org.kotlincrypto.hash:sha3", version.ref = "cryptoHash" }
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" }

kotlincrypto-core-digest = { module = "org.kotlincrypto.core:digest", version.ref = "kotlincrypto-core" }
kotlincrypto-core-mac = { module = "org.kotlincrypto.core:mac", version.ref = "kotlincrypto-core" }
kotlincrypto-core-xof = { module = "org.kotlincrypto.core:xof", version.ref = "kotlincrypto-core" }
kotlincrypto-hash-md = { module = "org.kotlincrypto.hash:md", version.ref = "kotlincrypto-hash" }
kotlincrypto-hash-sha1 = { module = "org.kotlincrypto.hash:sha1", version.ref = "kotlincrypto-hash" }
kotlincrypto-hash-sha2 = { module = "org.kotlincrypto.hash:sha2", version.ref = "kotlincrypto-hash" }
kotlincrypto-hash-sha3 = { module = "org.kotlincrypto.hash:sha3", version.ref = "kotlincrypto-hash" }

# Tests
androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidxTestRunner" }
bouncyCastle = { module = "org.bouncycastle:bcprov-ext-jdk15to18", version.ref = "bouncyCastle" }
# tests
androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test-runner" }
bouncy-castle = { module = "org.bouncycastle:bcprov-ext-jdk15to18", version.ref = "bouncy-castle" }
encoding-base16 = { module = "io.matthewnelson.encoding:base16", version.ref = "encoding" }
encoding-base64 = { module = "io.matthewnelson.encoding:base64", version.ref = "encoding" }

[plugins]
android-library = { id = "com.android.library", version.ref = "android" }
binaryCompat = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binaryCompat" }
multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
android-library = { id = "com.android.library", version.ref = "gradle-android" }
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/hmac/hmac-sha1/src/jvmMain/java9/module-info.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@SuppressWarnings("JavaModuleNaming")
@SuppressWarnings("module")
module org.kotlincrypto.macs.hmac.sha1 {
requires kotlin.stdlib;
requires org.kotlincrypto.hash.sha1;
Expand Down
2 changes: 1 addition & 1 deletion library/hmac/hmac-sha2/src/jvmMain/java9/module-info.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@SuppressWarnings("JavaModuleNaming")
@SuppressWarnings("module")
module org.kotlincrypto.macs.hmac.sha2 {
requires kotlin.stdlib;
requires org.kotlincrypto.hash.sha2;
Expand Down
2 changes: 1 addition & 1 deletion library/hmac/hmac-sha3/src/jvmMain/java9/module-info.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@SuppressWarnings("JavaModuleNaming")
@SuppressWarnings("module")
module org.kotlincrypto.macs.hmac.sha3 {
requires kotlin.stdlib;
requires org.kotlincrypto.hash.sha3;
Expand Down
2 changes: 1 addition & 1 deletion test-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ kmpConfiguration {

android {
namespace = "org.kotlincrypto.macs"
compileSdk = 33
compileSdk = 34

defaultConfig {
minSdk = 14
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
4 changes: 2 additions & 2 deletions tools/testing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ plugins {
}

kmpConfiguration {
configureShared(explicitApi = false) {
configureShared {
jvm {
sourceSetMain {
dependencies {
api(libs.bouncyCastle)
api(libs.bouncy.castle)
}
}
}
Expand Down

0 comments on commit fff249f

Please sign in to comment.