+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..6e6eec1
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copyright/Multiplatform_Paths.xml b/.idea/copyright/Multiplatform_Paths.xml
new file mode 100644
index 0000000..214858e
--- /dev/null
+++ b/.idea/copyright/Multiplatform_Paths.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
+
diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts
index c1792ff..0f8b799 100644
--- a/build-logic/build.gradle.kts
+++ b/build-logic/build.gradle.kts
@@ -1,6 +1,3 @@
-import io.gitlab.arturbosch.detekt.DetektPlugin
-import org.jlleitschuh.gradle.ktlint.KtlintPlugin
-
/*
* Copyright 2024 Sujan Poudel
*
@@ -17,6 +14,9 @@ import org.jlleitschuh.gradle.ktlint.KtlintPlugin
* limitations under the License.
*/
+import io.gitlab.arturbosch.detekt.DetektPlugin
+import org.jlleitschuh.gradle.ktlint.KtlintPlugin
+
plugins {
`kotlin-dsl`
alias(libs.plugins.kotlin.jvm)
diff --git a/build.gradle.kts b/build.gradle.kts
index 9082b90..0f9a060 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
import io.gitlab.arturbosch.detekt.Detekt
import org.jlleitschuh.gradle.ktlint.tasks.KtLintCheckTask
import org.jlleitschuh.gradle.ktlint.tasks.KtLintFormatTask
diff --git a/context-provider/build.gradle.kts b/context-provider/build.gradle.kts
index 77ab99b..5113ed5 100644
--- a/context-provider/build.gradle.kts
+++ b/context-provider/build.gradle.kts
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
plugins {
id("module")
diff --git a/context-provider/src/androidUnitTest/kotlin/me/sujanpoudel/utils/contextProvider/ApplicationContextInitializerTest.kt b/context-provider/src/androidUnitTest/kotlin/me/sujanpoudel/utils/contextProvider/ApplicationContextInitializerTest.kt
index ee7676c..89b9527 100644
--- a/context-provider/src/androidUnitTest/kotlin/me/sujanpoudel/utils/contextProvider/ApplicationContextInitializerTest.kt
+++ b/context-provider/src/androidUnitTest/kotlin/me/sujanpoudel/utils/contextProvider/ApplicationContextInitializerTest.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.contextProvider
import android.app.Application
diff --git a/multiplatform-paths/build.gradle.kts b/multiplatform-paths/build.gradle.kts
index 3f89d48..6ddb465 100644
--- a/multiplatform-paths/build.gradle.kts
+++ b/multiplatform-paths/build.gradle.kts
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
plugins {
id("packaging")
diff --git a/multiplatform-paths/src/androidMain/kotlin/me/sujanpoudel/utils/paths/directories.android.kt b/multiplatform-paths/src/androidMain/kotlin/me/sujanpoudel/utils/paths/directories.android.kt
index 13b539e..d8ecc9e 100644
--- a/multiplatform-paths/src/androidMain/kotlin/me/sujanpoudel/utils/paths/directories.android.kt
+++ b/multiplatform-paths/src/androidMain/kotlin/me/sujanpoudel/utils/paths/directories.android.kt
@@ -1,8 +1,25 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.paths
+import kotlinx.io.files.Path
import me.sujanpoudel.utils.contextProvider.applicationContext
import me.sujanpoudel.utils.paths.utils.toPath
-actual fun dataDirectory(appId: String) = applicationContext.applicationInfo.dataDir.toPath()
+actual fun dataDirectory(appId: String): Path = applicationContext.applicationInfo.dataDir.toPath()
-actual fun cacheDirectory(appId: String) = applicationContext.cacheDir.absolutePath.toPath()
+actual fun cacheDirectory(appId: String): Path = applicationContext.cacheDir.absolutePath.toPath()
diff --git a/multiplatform-paths/src/commonMain/kotlin/me/sujanpoudel/utils/paths/directories.kt b/multiplatform-paths/src/commonMain/kotlin/me/sujanpoudel/utils/paths/directories.kt
index 2c8a19b..8cfd495 100644
--- a/multiplatform-paths/src/commonMain/kotlin/me/sujanpoudel/utils/paths/directories.kt
+++ b/multiplatform-paths/src/commonMain/kotlin/me/sujanpoudel/utils/paths/directories.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.paths
import kotlinx.io.files.Path
diff --git a/multiplatform-paths/src/commonMain/kotlin/me/sujanpoudel/utils/paths/utils/Path.kt b/multiplatform-paths/src/commonMain/kotlin/me/sujanpoudel/utils/paths/utils/Path.kt
index fd766fb..b5ed6c2 100644
--- a/multiplatform-paths/src/commonMain/kotlin/me/sujanpoudel/utils/paths/utils/Path.kt
+++ b/multiplatform-paths/src/commonMain/kotlin/me/sujanpoudel/utils/paths/utils/Path.kt
@@ -1,7 +1,23 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.paths.utils
import kotlinx.io.files.Path
inline fun String.toPath(): Path = Path(this)
-operator fun Path.div(child: String) = Path(this, child)
+operator fun Path.div(child: String): Path = Path(this, child)
diff --git a/multiplatform-paths/src/darwinMain/kotlin/me/sujanpoudel/utils/paths/directories.darwin.kt b/multiplatform-paths/src/darwinMain/kotlin/me/sujanpoudel/utils/paths/directories.darwin.kt
index cb6366a..5682a76 100644
--- a/multiplatform-paths/src/darwinMain/kotlin/me/sujanpoudel/utils/paths/directories.darwin.kt
+++ b/multiplatform-paths/src/darwinMain/kotlin/me/sujanpoudel/utils/paths/directories.darwin.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.paths
import kotlinx.io.files.Path
diff --git a/multiplatform-paths/src/desktopCommonMain/kotlin/me/sujanpoudel/utils/paths/directories.desktopCommon.kt b/multiplatform-paths/src/desktopCommonMain/kotlin/me/sujanpoudel/utils/paths/directories.desktopCommon.kt
index 69dde0e..358e5e4 100644
--- a/multiplatform-paths/src/desktopCommonMain/kotlin/me/sujanpoudel/utils/paths/directories.desktopCommon.kt
+++ b/multiplatform-paths/src/desktopCommonMain/kotlin/me/sujanpoudel/utils/paths/directories.desktopCommon.kt
@@ -1,17 +1,34 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.paths
+import kotlinx.io.files.Path
import me.sujanpoudel.utils.paths.utils.div
import me.sujanpoudel.utils.paths.utils.toPath
import me.sujanpoudel.utils.platformIdentifier.Platform
-fun desktopAppHomeDirectory(appId: String, os: Platform.OS, getEnv: (String) -> String) = when (os) {
+fun desktopAppHomeDirectory(appId: String, os: Platform.OS, getEnv: (String) -> String): Path = when (os) {
is Platform.OS.MacOs -> getEnv("HOME").toPath() / "Library/Application Support" / appId
is Platform.OS.Windows -> getEnv("APPDATA").toPath() / appId
is Platform.OS.Linux -> getEnv("HOME").toPath() / ".local" / "share" / appId
else -> getEnv("HOME").toPath() / ".$appId"
}
-fun desktopCacheDirectory(appId: String, os: Platform.OS, getEnv: (String) -> String) = when (os) {
+fun desktopCacheDirectory(appId: String, os: Platform.OS, getEnv: (String) -> String): Path = when (os) {
is Platform.OS.MacOs -> getEnv("HOME").toPath() / "Library/Caches" / appId
is Platform.OS.Windows -> getEnv("APPDATA").toPath() / "Caches" / appId
is Platform.OS.Linux -> getEnv("HOME").toPath() / ".cache" / appId
diff --git a/multiplatform-paths/src/desktopMain/kotlin/me/sujanpoudel/utils/paths/directories.desktop.kt b/multiplatform-paths/src/desktopMain/kotlin/me/sujanpoudel/utils/paths/directories.desktop.kt
index cd1dd03..07e546b 100644
--- a/multiplatform-paths/src/desktopMain/kotlin/me/sujanpoudel/utils/paths/directories.desktop.kt
+++ b/multiplatform-paths/src/desktopMain/kotlin/me/sujanpoudel/utils/paths/directories.desktop.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.paths
import me.sujanpoudel.utils.platformIdentifier.hostOs
diff --git a/multiplatform-paths/src/jsMain/kotlin/me/sujanpoudel/utils/paths/directories.js.kt b/multiplatform-paths/src/jsMain/kotlin/me/sujanpoudel/utils/paths/directories.js.kt
index 6edf87a..764f7d5 100644
--- a/multiplatform-paths/src/jsMain/kotlin/me/sujanpoudel/utils/paths/directories.js.kt
+++ b/multiplatform-paths/src/jsMain/kotlin/me/sujanpoudel/utils/paths/directories.js.kt
@@ -1,11 +1,28 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.paths
+import kotlinx.io.files.Path
import me.sujanpoudel.utils.platformIdentifier.Platform
import me.sujanpoudel.utils.platformIdentifier.platform
private val platform = platform() as Platform.JS
-actual fun dataDirectory(appId: String) = when (platform) {
+actual fun dataDirectory(appId: String): Path = when (platform) {
is Platform.JS.Node -> desktopAppHomeDirectory(
appId = appId,
os = platform.os,
@@ -15,7 +32,7 @@ actual fun dataDirectory(appId: String) = when (platform) {
else -> error("Non node environment")
}
-actual fun cacheDirectory(appId: String) = when (platform) {
+actual fun cacheDirectory(appId: String): Path = when (platform) {
is Platform.JS.Node -> desktopCacheDirectory(
appId = appId,
os = platform.os,
diff --git a/platform-identifier/build.gradle.kts b/platform-identifier/build.gradle.kts
index 3790b55..52ae12d 100644
--- a/platform-identifier/build.gradle.kts
+++ b/platform-identifier/build.gradle.kts
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
plugins {
id("packaging")
diff --git a/platform-identifier/src/androidMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.android.kt b/platform-identifier/src/androidMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.android.kt
index a2b7c2a..88f2b2a 100644
--- a/platform-identifier/src/androidMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.android.kt
+++ b/platform-identifier/src/androidMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.android.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.platformIdentifier
import android.content.pm.PackageManager
diff --git a/platform-identifier/src/androidNativeMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.androidNative.kt b/platform-identifier/src/androidNativeMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.androidNative.kt
index b7991ae..fb03a9d 100644
--- a/platform-identifier/src/androidNativeMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.androidNative.kt
+++ b/platform-identifier/src/androidNativeMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.androidNative.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.platformIdentifier
import kotlinx.cinterop.ByteVar
@@ -8,8 +24,8 @@ import kotlinx.cinterop.toKString
import platform.posix.__system_property_get
import kotlin.experimental.ExperimentalNativeApi
-const val SYSTEM_PROP_BUILD_VERSION = "ro.build.version.sdk"
-const val SYSTEM_PROP_OS_VERSION = "ro.build.version.release"
+private const val SYSTEM_PROP_BUILD_VERSION: String = "ro.build.version.sdk"
+private const val SYSTEM_PROP_OS_VERSION: String = "ro.build.version.release"
@OptIn(ExperimentalNativeApi::class)
actual fun platform(): Platform {
diff --git a/platform-identifier/src/androidNativeTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt b/platform-identifier/src/androidNativeTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
index 86c8dc9..932dbe0 100644
--- a/platform-identifier/src/androidNativeTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
+++ b/platform-identifier/src/androidNativeTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.platformIdentifier
import kotlin.test.Test
diff --git a/platform-identifier/src/androidUnitTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt b/platform-identifier/src/androidUnitTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
index 5f0dabe..9ea33d4 100644
--- a/platform-identifier/src/androidUnitTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
+++ b/platform-identifier/src/androidUnitTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.platformIdentifier
import android.content.Context
diff --git a/platform-identifier/src/appleMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.macos.kt b/platform-identifier/src/appleMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.macos.kt
index ee78ea3..57a10f3 100644
--- a/platform-identifier/src/appleMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.macos.kt
+++ b/platform-identifier/src/appleMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.macos.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.platformIdentifier
import platform.Foundation.NSProcessInfo
diff --git a/platform-identifier/src/appleTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt b/platform-identifier/src/appleTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
index c1de7e1..d494ec9 100644
--- a/platform-identifier/src/appleTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
+++ b/platform-identifier/src/appleTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.platformIdentifier
import kotlin.experimental.ExperimentalNativeApi
diff --git a/platform-identifier/src/commonMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.kt b/platform-identifier/src/commonMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.kt
index 0b4dd40..c0f08c7 100644
--- a/platform-identifier/src/commonMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.kt
+++ b/platform-identifier/src/commonMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.platformIdentifier
/**
diff --git a/platform-identifier/src/commonTest/kotlin/me/sujanpoudel/utils/platformIdentifier/commonTest.kt b/platform-identifier/src/commonTest/kotlin/me/sujanpoudel/utils/platformIdentifier/commonTest.kt
deleted file mode 100644
index d172a0a..0000000
--- a/platform-identifier/src/commonTest/kotlin/me/sujanpoudel/utils/platformIdentifier/commonTest.kt
+++ /dev/null
@@ -1,11 +0,0 @@
-package me.sujanpoudel.utils.platformIdentifier
-
-// expect fun assertPlatform(platform: Platform)
-
-class TestPlatform {
-//
-// @Test
-// fun should_have_correct_platform() {
-// assertPlatform(platform())
-// }
-}
diff --git a/platform-identifier/src/desktopCommonMain/kotlin/me/sujanpoudel/utils/platformIdentifier/arch.kt b/platform-identifier/src/desktopCommonMain/kotlin/me/sujanpoudel/utils/platformIdentifier/arch.kt
index 7cc217b..4e35415 100644
--- a/platform-identifier/src/desktopCommonMain/kotlin/me/sujanpoudel/utils/platformIdentifier/arch.kt
+++ b/platform-identifier/src/desktopCommonMain/kotlin/me/sujanpoudel/utils/platformIdentifier/arch.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.platformIdentifier
internal fun hostArch(archName: String) = when (archName) {
diff --git a/platform-identifier/src/desktopCommonMain/kotlin/me/sujanpoudel/utils/platformIdentifier/os.kt b/platform-identifier/src/desktopCommonMain/kotlin/me/sujanpoudel/utils/platformIdentifier/os.kt
index 8fd2acb..2bfc35f 100644
--- a/platform-identifier/src/desktopCommonMain/kotlin/me/sujanpoudel/utils/platformIdentifier/os.kt
+++ b/platform-identifier/src/desktopCommonMain/kotlin/me/sujanpoudel/utils/platformIdentifier/os.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.platformIdentifier
enum class DesktopOs {
diff --git a/platform-identifier/src/desktopMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.desktop.kt b/platform-identifier/src/desktopMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.desktop.kt
index ace1468..8c61ced 100644
--- a/platform-identifier/src/desktopMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.desktop.kt
+++ b/platform-identifier/src/desktopMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.desktop.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.platformIdentifier
val hostOs: Platform.OS = hostOs(
diff --git a/platform-identifier/src/desktopTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt b/platform-identifier/src/desktopTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
index d1c1b99..e36abef 100644
--- a/platform-identifier/src/desktopTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
+++ b/platform-identifier/src/desktopTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
@@ -1,12 +1,23 @@
package me.sujanpoudel.utils.platformIdentifier
import org.junit.Test
+import kotlin.test.assertTrue
class PlatformTest {
@Test
fun should_have_correct_platform() {
val platform = platform()
-// assertTrue { platform is Platform.OS.Android }
+ val osName = System.getProperty("os.name").lowercase()
+
+ when {
+ osName.startsWith("mac") ||
+ osName.startsWith("osx") ||
+ osName.startsWith("darwin") -> assertTrue { platform is Platform.OS.MacOs }
+
+ osName.startsWith("win") -> assertTrue { platform is Platform.OS.Windows }
+ osName.startsWith("linux") -> assertTrue { platform is Platform.OS.Linux }
+ else -> assertTrue { platform is Platform.OS.Unknown }
+ }
}
}
diff --git a/platform-identifier/src/jsMain/kotlin/me/sujanpoudel/utils/platformIdentifier/browser.kt b/platform-identifier/src/jsMain/kotlin/me/sujanpoudel/utils/platformIdentifier/browser.kt
index e0e2983..ddd7a4b 100644
--- a/platform-identifier/src/jsMain/kotlin/me/sujanpoudel/utils/platformIdentifier/browser.kt
+++ b/platform-identifier/src/jsMain/kotlin/me/sujanpoudel/utils/platformIdentifier/browser.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.platformIdentifier
fun getBrowserPlatform(): Platform.JS.Browser = Platform.JS.Browser(
diff --git a/platform-identifier/src/jsMain/kotlin/me/sujanpoudel/utils/platformIdentifier/node.kt b/platform-identifier/src/jsMain/kotlin/me/sujanpoudel/utils/platformIdentifier/node.kt
index 1fd0646..25cac6f 100644
--- a/platform-identifier/src/jsMain/kotlin/me/sujanpoudel/utils/platformIdentifier/node.kt
+++ b/platform-identifier/src/jsMain/kotlin/me/sujanpoudel/utils/platformIdentifier/node.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.platformIdentifier
internal fun getNodePlatform(): Platform.JS.Node {
diff --git a/platform-identifier/src/jsMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.js.kt b/platform-identifier/src/jsMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.js.kt
index 24109ab..f3bdd06 100644
--- a/platform-identifier/src/jsMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.js.kt
+++ b/platform-identifier/src/jsMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.js.kt
@@ -1,12 +1,28 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.platformIdentifier
-fun isBrowser() = js("""typeof window !== "undefined" && typeof window.document !== "undefined;" """) as Boolean
+fun isBrowser(): Boolean =
+ js("""typeof window !== "undefined" && typeof window.document !== "undefined;" """) as Boolean
-fun isNode() =
+fun isNode(): Boolean =
js("""typeof process !== "undefined" && process.versions != null && process.versions.node != null;""") as Boolean
actual fun platform(): Platform = when {
- isBrowser() -> getBrowserPlatform()
isBrowser() -> getBrowserPlatform()
isNode() -> getNodePlatform()
else -> getBrowserPlatform()
diff --git a/platform-identifier/src/jsTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt b/platform-identifier/src/jsTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
index 2fae116..6e3c151 100644
--- a/platform-identifier/src/jsTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
+++ b/platform-identifier/src/jsTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.platformIdentifier
import kotlin.test.Test
diff --git a/platform-identifier/src/mingwMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.mingw.kt b/platform-identifier/src/mingwMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.mingw.kt
index 818549c..c699d17 100644
--- a/platform-identifier/src/mingwMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.mingw.kt
+++ b/platform-identifier/src/mingwMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.mingw.kt
@@ -1,11 +1,26 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.platformIdentifier
-import kotlinx.cinterop.ExperimentalForeignApi
import platform.posix._winmajor
import platform.posix._winminor
import kotlin.experimental.ExperimentalNativeApi
-@OptIn(ExperimentalNativeApi::class, ExperimentalForeignApi::class)
+@OptIn(ExperimentalNativeApi::class)
actual fun platform(): Platform = Platform.OS.Windows(
arch = kotlin.native.Platform.cpuArchitecture.asArch(),
version = "$_winmajor.$_winminor",
diff --git a/platform-identifier/src/mingwTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt b/platform-identifier/src/mingwTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
index 2583ae3..e0a7ca5 100644
--- a/platform-identifier/src/mingwTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
+++ b/platform-identifier/src/mingwTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.platformIdentifier
import kotlin.test.Test
diff --git a/platform-identifier/src/nativeMain/kotlin/me/sujanpoudel/utils/platformIdentifier/CpuArchitecture.kt b/platform-identifier/src/nativeMain/kotlin/me/sujanpoudel/utils/platformIdentifier/CpuArchitecture.kt
index dd79447..b0ab8d1 100644
--- a/platform-identifier/src/nativeMain/kotlin/me/sujanpoudel/utils/platformIdentifier/CpuArchitecture.kt
+++ b/platform-identifier/src/nativeMain/kotlin/me/sujanpoudel/utils/platformIdentifier/CpuArchitecture.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.platformIdentifier
import kotlin.experimental.ExperimentalNativeApi
diff --git a/sample/androidApp/build.gradle.kts b/sample/androidApp/build.gradle.kts
index d5e0fba..45bf7ea 100644
--- a/sample/androidApp/build.gradle.kts
+++ b/sample/androidApp/build.gradle.kts
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
plugins {
id("android-application")
}
diff --git a/sample/androidApp/src/androidMain/kotlin/me/sujanpoudel/utils/sample/MainActivity.kt b/sample/androidApp/src/androidMain/kotlin/me/sujanpoudel/utils/sample/MainActivity.kt
index 1f78db7..001ca3d 100644
--- a/sample/androidApp/src/androidMain/kotlin/me/sujanpoudel/utils/sample/MainActivity.kt
+++ b/sample/androidApp/src/androidMain/kotlin/me/sujanpoudel/utils/sample/MainActivity.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.sample
import android.os.Bundle
diff --git a/sample/desktopApp/build.gradle.kts b/sample/desktopApp/build.gradle.kts
index 0aea441..2aee944 100644
--- a/sample/desktopApp/build.gradle.kts
+++ b/sample/desktopApp/build.gradle.kts
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
plugins {
id("module")
alias(libs.plugins.kotlin.multiplatform)
diff --git a/sample/desktopApp/src/jvmMain/kotlin/Main.kt b/sample/desktopApp/src/jvmMain/kotlin/Main.kt
index b143ea0..92fa7a0 100644
--- a/sample/desktopApp/src/jvmMain/kotlin/Main.kt
+++ b/sample/desktopApp/src/jvmMain/kotlin/Main.kt
@@ -1,10 +1,26 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.WindowState
import androidx.compose.ui.window.singleWindowApplication
import me.sujanpoudel.utils.sample.common.MainDesktopView
-fun main() = singleWindowApplication(
+fun main(): Unit = singleWindowApplication(
title = "Sample",
state = WindowState(
size = DpSize(400.dp, 800.dp),
diff --git a/sample/macosApp/build.gradle.kts b/sample/macosApp/build.gradle.kts
index 7763547..7579572 100644
--- a/sample/macosApp/build.gradle.kts
+++ b/sample/macosApp/build.gradle.kts
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithHostTests
plugins {
diff --git a/sample/macosApp/src/macosMain/kotlin/main.macos.kt b/sample/macosApp/src/macosMain/kotlin/main.macos.kt
index 053dc80..1b6a1a8 100644
--- a/sample/macosApp/src/macosMain/kotlin/main.macos.kt
+++ b/sample/macosApp/src/macosMain/kotlin/main.macos.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
import androidx.compose.ui.window.Window
import me.sujanpoudel.utils.sample.common.MainUI
import platform.AppKit.NSApp
diff --git a/sample/nodeApp/build.gradle.kts b/sample/nodeApp/build.gradle.kts
index 34b3c8d..85842e7 100644
--- a/sample/nodeApp/build.gradle.kts
+++ b/sample/nodeApp/build.gradle.kts
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
plugins {
id("module")
alias(libs.plugins.kotlin.multiplatform)
diff --git a/sample/nodeApp/src/jsMain/kotlin/me/sujanpoudel/utils/sample/main.kt b/sample/nodeApp/src/jsMain/kotlin/me/sujanpoudel/utils/sample/main.kt
index 8306191..a8a8a4d 100644
--- a/sample/nodeApp/src/jsMain/kotlin/me/sujanpoudel/utils/sample/main.kt
+++ b/sample/nodeApp/src/jsMain/kotlin/me/sujanpoudel/utils/sample/main.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.sample
import me.sujanpoudel.utils.paths.appCacheDirectory
diff --git a/sample/shared/build.gradle.kts b/sample/shared/build.gradle.kts
index ef7cde5..69c9951 100644
--- a/sample/shared/build.gradle.kts
+++ b/sample/shared/build.gradle.kts
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
diff --git a/sample/shared/src/androidMain/kotlin/me/sujanpoudel/utils/sample/common/App.kt b/sample/shared/src/androidMain/kotlin/me/sujanpoudel/utils/sample/common/App.kt
index bd1dc98..bbccd97 100644
--- a/sample/shared/src/androidMain/kotlin/me/sujanpoudel/utils/sample/common/App.kt
+++ b/sample/shared/src/androidMain/kotlin/me/sujanpoudel/utils/sample/common/App.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.sample.common
import androidx.compose.runtime.Composable
diff --git a/sample/shared/src/commonMain/kotlin/me/sujanpoudel/utils/sample/common/Color.kt b/sample/shared/src/commonMain/kotlin/me/sujanpoudel/utils/sample/common/Color.kt
index 8ec1177..ed07aeb 100644
--- a/sample/shared/src/commonMain/kotlin/me/sujanpoudel/utils/sample/common/Color.kt
+++ b/sample/shared/src/commonMain/kotlin/me/sujanpoudel/utils/sample/common/Color.kt
@@ -1,9 +1,25 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.sample.common
import androidx.compose.ui.graphics.Color
-val SampleGreen = Color(0xff09B3AF)
-val SampleGreenDark = Color(0xff008380)
+val SampleGreen: Color = Color(0xff09B3AF)
+val SampleGreenDark: Color = Color(0xff008380)
-val Red200 = Color(0xfff297a2)
-val Red800 = Color(0xffd00036)
+val Red200: Color = Color(0xfff297a2)
+val Red800: Color = Color(0xffd00036)
diff --git a/sample/shared/src/commonMain/kotlin/me/sujanpoudel/utils/sample/common/Constants.kt b/sample/shared/src/commonMain/kotlin/me/sujanpoudel/utils/sample/common/Constants.kt
index e835573..755d927 100644
--- a/sample/shared/src/commonMain/kotlin/me/sujanpoudel/utils/sample/common/Constants.kt
+++ b/sample/shared/src/commonMain/kotlin/me/sujanpoudel/utils/sample/common/Constants.kt
@@ -1,5 +1,21 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.sample.common
object Constants {
- const val APP_ID = "me.sujanpoudel.multiplatform.utils.sample"
+ const val APP_ID: String = "me.sujanpoudel.multiplatform.utils.sample"
}
diff --git a/sample/shared/src/commonMain/kotlin/me/sujanpoudel/utils/sample/common/MainUI.kt b/sample/shared/src/commonMain/kotlin/me/sujanpoudel/utils/sample/common/MainUI.kt
index 688e39f..0c9c378 100644
--- a/sample/shared/src/commonMain/kotlin/me/sujanpoudel/utils/sample/common/MainUI.kt
+++ b/sample/shared/src/commonMain/kotlin/me/sujanpoudel/utils/sample/common/MainUI.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.sample.common
import androidx.compose.foundation.layout.Arrangement
diff --git a/sample/shared/src/commonMain/kotlin/me/sujanpoudel/utils/sample/common/Theme.kt b/sample/shared/src/commonMain/kotlin/me/sujanpoudel/utils/sample/common/Theme.kt
index 61a50fc..2f0f708 100644
--- a/sample/shared/src/commonMain/kotlin/me/sujanpoudel/utils/sample/common/Theme.kt
+++ b/sample/shared/src/commonMain/kotlin/me/sujanpoudel/utils/sample/common/Theme.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.sample.common
import androidx.compose.foundation.isSystemInDarkTheme
diff --git a/sample/shared/src/desktopMain/kotlin/me/sujanpoudel/utils/sample/common/main.desktop.kt b/sample/shared/src/desktopMain/kotlin/me/sujanpoudel/utils/sample/common/main.desktop.kt
index 17c050d..c7961e8 100644
--- a/sample/shared/src/desktopMain/kotlin/me/sujanpoudel/utils/sample/common/main.desktop.kt
+++ b/sample/shared/src/desktopMain/kotlin/me/sujanpoudel/utils/sample/common/main.desktop.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.sample.common
import androidx.compose.runtime.Composable
diff --git a/sample/shared/src/iosMain/kotlin/me/sujanpoudel/utils/sample/common/main.ios.kt b/sample/shared/src/iosMain/kotlin/me/sujanpoudel/utils/sample/common/main.ios.kt
index f34a57c..240099d 100644
--- a/sample/shared/src/iosMain/kotlin/me/sujanpoudel/utils/sample/common/main.ios.kt
+++ b/sample/shared/src/iosMain/kotlin/me/sujanpoudel/utils/sample/common/main.ios.kt
@@ -1,8 +1,25 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.sample.common
import androidx.compose.ui.window.ComposeUIViewController
+import platform.UIKit.UIViewController
@Suppress("FunctionName", "unused")
-fun MainViewController() = ComposeUIViewController {
+fun MainViewController(): UIViewController = ComposeUIViewController {
MainUI()
}
diff --git a/sample/wearosApp/build.gradle.kts b/sample/wearosApp/build.gradle.kts
index 7a75d9a..eb88242 100644
--- a/sample/wearosApp/build.gradle.kts
+++ b/sample/wearosApp/build.gradle.kts
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
plugins {
id("android-application")
}
diff --git a/sample/wearosApp/src/androidMain/kotlin/me/sujanpoudel/utils/sample/wearOs/MainActivity.kt b/sample/wearosApp/src/androidMain/kotlin/me/sujanpoudel/utils/sample/wearOs/MainActivity.kt
index b2a0bfe..95beda0 100644
--- a/sample/wearosApp/src/androidMain/kotlin/me/sujanpoudel/utils/sample/wearOs/MainActivity.kt
+++ b/sample/wearosApp/src/androidMain/kotlin/me/sujanpoudel/utils/sample/wearOs/MainActivity.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.sample.wearOs
import android.os.Bundle
diff --git a/sample/webApp/build.gradle.kts b/sample/webApp/build.gradle.kts
index 14234f7..19ac333 100644
--- a/sample/webApp/build.gradle.kts
+++ b/sample/webApp/build.gradle.kts
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
plugins {
alias(libs.plugins.kotlin.multiplatform)
diff --git a/sample/webApp/src/jsMain/kotlin/me/sujanpoudel/utils/sample/main.kt b/sample/webApp/src/jsMain/kotlin/me/sujanpoudel/utils/sample/main.kt
index abee274..84b49ec 100644
--- a/sample/webApp/src/jsMain/kotlin/me/sujanpoudel/utils/sample/main.kt
+++ b/sample/webApp/src/jsMain/kotlin/me/sujanpoudel/utils/sample/main.kt
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package me.sujanpoudel.utils.sample
import androidx.compose.ui.ExperimentalComposeUiApi
@@ -6,7 +22,7 @@ import me.sujanpoudel.utils.sample.common.MainUI
import org.jetbrains.skiko.wasm.onWasmReady
@OptIn(ExperimentalComposeUiApi::class)
-fun main() = onWasmReady {
+fun main(): Unit = onWasmReady {
CanvasBasedWindow("title", canvasElementId = "root") {
MainUI()
}
diff --git a/settings.gradle.kts b/settings.gradle.kts
index ec82ff4..469e265 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2024 Sujan Poudel
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
rootProject.name = "Multiplatform_Utils"
pluginManagement {