Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework source sets to have rich hierarchy #130

Merged
merged 7 commits into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
project adheres to [Semantic Versioning](https://semver.org/).

## [0.6.0] - 2022-11-07
Copy link
Owner

@benasher44 benasher44 Nov 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol (the date)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will try to release today, but no promises!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about the date? looks correct

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh it looks fine. It's just optimistic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, heh. Not a rush at all!

I thought I messed up the month/day order, but you've been using a sane system since the beginning :)

### Changed
- Rework source sets to form a rich hierarchy (#130)

## [0.5.0] - 2022-07-13
### Changed
- Upgrade to Kotlin 1.7.10 (#126)
Expand Down
142 changes: 68 additions & 74 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -58,90 +58,84 @@ kotlin {
linuxArm32Hfp()
}
}

sourceSets {
commonMain {
dependencies {
// can remove this once https://youtrack.jetbrains.com/issue/KT-40333 is fixed
implementation(kotlin("stdlib-common"))
}
}
commonTest {
val commonMain by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}

val nix64MainSourceDirs = listOf(
"src/nonJvmMain/kotlin",
"src/nativeMain/kotlin",
"src/nix64Main/kotlin"
)

val nix32MainSourceDirs = listOf(
"src/nonJvmMain/kotlin",
"src/nativeMain/kotlin",
"src/nix32Main/kotlin"
)

if (HostManager.hostIsMac) {
val jsMain by getting {
kotlin.srcDir("src/nonJvmMain/kotlin")
}

val appleMain32SourceDirs = listOf(
"src/appleMain/kotlin"
) + nix32MainSourceDirs

val appleMain64SourceDirs = listOf(
"src/appleMain/kotlin"
) + nix64MainSourceDirs

val macosX64Main by getting { kotlin.srcDirs(appleMain64SourceDirs) }
val macosX64Test by getting { kotlin.srcDir("src/appleTest/kotlin") }
val macosArm64Main by getting { kotlin.srcDirs(appleMain64SourceDirs) }
val macosArm64Test by getting { kotlin.srcDir("src/appleTest/kotlin") }
val iosArm64Main by getting { kotlin.srcDirs(appleMain64SourceDirs) }
val iosArm64Test by getting { kotlin.srcDir("src/appleTest/kotlin") }
val iosArm32Main by getting { kotlin.srcDirs(appleMain32SourceDirs) }
val iosArm32Test by getting { kotlin.srcDir("src/appleTest/kotlin") }
val iosX64Main by getting { kotlin.srcDirs(appleMain64SourceDirs) }
val iosX64Test by getting { kotlin.srcDir("src/appleTest/kotlin") }
val iosSimulatorArm64Main by getting { kotlin.srcDirs(appleMain64SourceDirs) }
val iosSimulatorArm64Test by getting { kotlin.srcDir("src/appleTest/kotlin") }
val watchosArm32Main by getting { kotlin.srcDirs(appleMain32SourceDirs) }
val watchosArm32Test by getting { kotlin.srcDir("src/appleTest/kotlin") }
val watchosArm64Main by getting { kotlin.srcDirs(appleMain64SourceDirs) }
val watchosArm64Test by getting { kotlin.srcDir("src/appleTest/kotlin") }
val watchosX64Main by getting { kotlin.srcDirs(appleMain64SourceDirs) }
val watchosX64Test by getting { kotlin.srcDir("src/appleTest/kotlin") }
val watchosX86Main by getting { kotlin.srcDirs(appleMain32SourceDirs) }
val watchosX86Test by getting { kotlin.srcDir("src/appleTest/kotlin") }
val watchosSimulatorArm64Main by getting { kotlin.srcDirs(appleMain64SourceDirs) }
val watchosSimulatorArm64Test by getting { kotlin.srcDir("src/appleTest/kotlin") }
val tvosArm64Main by getting { kotlin.srcDirs(appleMain64SourceDirs) }
val tvosArm64Test by getting { kotlin.srcDir("src/appleTest/kotlin") }
val tvosX64Main by getting { kotlin.srcDirs(appleMain64SourceDirs) }
val tvosX64Test by getting { kotlin.srcDir("src/appleTest/kotlin") }
val tvosSimulatorArm64Main by getting { kotlin.srcDirs(appleMain64SourceDirs) }
val tvosSimulatorArm64Test by getting { kotlin.srcDir("src/appleTest/kotlin") }
val nonJvmMain by creating { dependsOn(commonMain) }
val nonJvmTest by creating { dependsOn(commonTest) }
val jsMain by getting { dependsOn(nonJvmMain) }
val jsTest by getting { dependsOn(nonJvmTest) }
Comment on lines +72 to +73
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like jsMain doesn't exist. guessing it's named differently between the IR and non-IR JS variants

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would comment this out, list the tasks, see what the names are like, and update based on that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weird, I'm not really sure how it was compiling previously, because js and jvm targets were only declared if the host was a Mac machine. I added a bunch of HostManager checks and it looks like it is building successfully now

val nativeMain by creating { dependsOn(nonJvmMain) }
val nativeTest by creating { dependsOn(nonJvmTest) }
val nix64Main by creating { dependsOn(nativeMain) }
val nix64Test by creating { dependsOn(nativeTest) }
val nix32Main by creating { dependsOn(nativeMain) }
val nix32Test by creating { dependsOn(nativeTest) }
val appleMain by creating { dependsOn(nativeMain) }
val appleTest by creating { dependsOn(nativeTest) }
val apple64Main by creating {
dependsOn(appleMain)
dependsOn(nix64Main)
}
val apple64Test by creating {
dependsOn(appleTest)
dependsOn(nix64Test)
}
val apple32Main by creating {
dependsOn(appleMain)
dependsOn(nix32Main)
}
val apple32Test by creating {
dependsOn(appleTest)
dependsOn(nix32Test)
}
val iosX64Main by getting { dependsOn(apple64Main) }
val iosX64Test by getting { dependsOn(apple64Test) }
val iosArm64Main by getting { dependsOn(apple64Main) }
val iosArm64Test by getting { dependsOn(apple64Test) }
val macosX64Main by getting { dependsOn(apple64Main) }
val macosX64Test by getting { dependsOn(apple64Test) }
val macosArm64Main by getting { dependsOn(apple64Main) }
val macosArm64Test by getting { dependsOn(apple64Test) }
val iosArm32Main by getting { dependsOn(apple32Main) }
val iosArm32Test by getting { dependsOn(apple32Test) }
val iosSimulatorArm64Main by getting { dependsOn(apple64Main) }
val iosSimulatorArm64Test by getting { dependsOn(apple64Test) }
val watchosArm32Main by getting { dependsOn(apple32Main) }
val watchosArm32Test by getting { dependsOn(apple32Test) }
val watchosArm64Main by getting { dependsOn(apple64Main) }
val watchosArm64Test by getting { dependsOn(apple64Test) }
val watchosX64Main by getting { dependsOn(apple64Main) }
val watchosX64Test by getting { dependsOn(apple64Test) }
val watchosX86Main by getting { dependsOn(apple32Main) }
val watchosX86Test by getting { dependsOn(apple32Test) }
val watchosSimulatorArm64Main by getting { dependsOn(apple64Main) }
val watchosSimulatorArm64Test by getting { dependsOn(apple64Test) }
val tvosArm64Main by getting { dependsOn(apple64Main) }
val tvosArm64Test by getting { dependsOn(apple64Test) }
val tvosX64Main by getting { dependsOn(apple64Main) }
val tvosX64Test by getting { dependsOn(apple64Test) }
val tvosSimulatorArm64Main by getting { dependsOn(apple64Main) }
val tvosSimulatorArm64Test by getting { dependsOn(apple64Test) }

if (HostManager.hostIsMingw || HostManager.hostIsMac) {
val mingwX64Main by getting {
kotlin.srcDirs(
listOf(
"src/nonJvmMain/kotlin",
"src/nativeMain/kotlin",
"src/mingwMain/kotlin"
)
)
}
val mingwX64Test by getting {
kotlin.srcDir("src/mingwTest/kotlin")
}
val mingwMain by creating { dependsOn(nativeMain) }
val mingwTest by creating { dependsOn(nativeTest) }
val mingwX64Main by getting { dependsOn(mingwMain) }
val mingwX64Test by getting { dependsOn(mingwTest) }
}

if (HostManager.hostIsLinux || HostManager.hostIsMac) {
val linuxX64Main by getting { kotlin.srcDirs(nix64MainSourceDirs) }
val linuxArm32HfpMain by getting { kotlin.srcDirs(nix32MainSourceDirs) }
val linuxX64Main by getting { dependsOn(nix64Main) }
val linuxX64Test by getting { dependsOn(nix64Test) }
val linuxArm32HfpMain by getting { dependsOn(nix32Main) }
val linuxArm32HfpTest by getting { dependsOn(nix32Test) }
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ kotlin.code.style=official
kotlin.incremental=true

GROUP=com.benasher44
VERSION=0.5.0
VERSION=0.6.0

POM_URL=https://github.com/benasher44/uuid/
POM_SCM_URL=https://github.com/benasher44/uuid/
Expand Down
2 changes: 2 additions & 0 deletions src/nix64Main/kotlin/platform.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.benasher44.uuid

import kotlinx.cinterop.UnsafeNumber
import kotlinx.cinterop.convert
import platform.posix.read

@OptIn(UnsafeNumber::class)
internal actual fun getRandomUuidBytes(): ByteArray {
return bytesWithURandomFd { fd, bytePtr ->
read(fd, bytePtr, UUID_BYTES.convert())
Expand Down