Skip to content

Commit 13ab05a

Browse files
committed
Copyright and general improvements
1 parent 70828b2 commit 13ab05a

File tree

53 files changed

+837
-37
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+837
-37
lines changed

build-logic/build.gradle.kts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import io.gitlab.arturbosch.detekt.DetektPlugin
2-
import org.jlleitschuh.gradle.ktlint.KtlintPlugin
3-
41
/*
52
* Copyright 2024 Sujan Poudel
63
*
@@ -17,6 +14,9 @@ import org.jlleitschuh.gradle.ktlint.KtlintPlugin
1714
* limitations under the License.
1815
*/
1916

17+
import io.gitlab.arturbosch.detekt.DetektPlugin
18+
import org.jlleitschuh.gradle.ktlint.KtlintPlugin
19+
2020
plugins {
2121
`kotlin-dsl`
2222
alias(libs.plugins.kotlin.jvm)

build.gradle.kts

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2024 Sujan Poudel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
import io.gitlab.arturbosch.detekt.Detekt
218
import org.jlleitschuh.gradle.ktlint.tasks.KtLintCheckTask
319
import org.jlleitschuh.gradle.ktlint.tasks.KtLintFormatTask

context-provider/build.gradle.kts

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright 2024 Sujan Poudel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116

217
plugins {
318
id("module")

context-provider/src/androidUnitTest/kotlin/me/sujanpoudel/utils/contextProvider/ApplicationContextInitializerTest.kt

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2024 Sujan Poudel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package me.sujanpoudel.utils.contextProvider
218

319
import android.app.Application

multiplatform-paths/build.gradle.kts

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright 2024 Sujan Poudel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116

217
plugins {
318
id("packaging")
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1+
/*
2+
* Copyright 2024 Sujan Poudel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package me.sujanpoudel.utils.paths
218

19+
import kotlinx.io.files.Path
320
import me.sujanpoudel.utils.contextProvider.applicationContext
421
import me.sujanpoudel.utils.paths.utils.toPath
522

6-
actual fun dataDirectory(appId: String) = applicationContext.applicationInfo.dataDir.toPath()
23+
actual fun dataDirectory(appId: String): Path = applicationContext.applicationInfo.dataDir.toPath()
724

8-
actual fun cacheDirectory(appId: String) = applicationContext.cacheDir.absolutePath.toPath()
25+
actual fun cacheDirectory(appId: String): Path = applicationContext.cacheDir.absolutePath.toPath()

multiplatform-paths/src/commonMain/kotlin/me/sujanpoudel/utils/paths/directories.kt

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2024 Sujan Poudel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package me.sujanpoudel.utils.paths
218

319
import kotlinx.io.files.Path
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
1+
/*
2+
* Copyright 2024 Sujan Poudel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package me.sujanpoudel.utils.paths.utils
218

319
import kotlinx.io.files.Path
420

521
inline fun String.toPath(): Path = Path(this)
622

7-
operator fun Path.div(child: String) = Path(this, child)
23+
operator fun Path.div(child: String): Path = Path(this, child)

multiplatform-paths/src/darwinMain/kotlin/me/sujanpoudel/utils/paths/directories.darwin.kt

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2024 Sujan Poudel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package me.sujanpoudel.utils.paths
218

319
import kotlinx.io.files.Path

multiplatform-paths/src/desktopCommonMain/kotlin/me/sujanpoudel/utils/paths/directories.desktopCommon.kt

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
1+
/*
2+
* Copyright 2024 Sujan Poudel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package me.sujanpoudel.utils.paths
218

19+
import kotlinx.io.files.Path
320
import me.sujanpoudel.utils.paths.utils.div
421
import me.sujanpoudel.utils.paths.utils.toPath
522
import me.sujanpoudel.utils.platformIdentifier.Platform
623

7-
fun desktopAppHomeDirectory(appId: String, os: Platform.OS, getEnv: (String) -> String) = when (os) {
24+
fun desktopAppHomeDirectory(appId: String, os: Platform.OS, getEnv: (String) -> String): Path = when (os) {
825
is Platform.OS.MacOs -> getEnv("HOME").toPath() / "Library/Application Support" / appId
926
is Platform.OS.Windows -> getEnv("APPDATA").toPath() / appId
1027
is Platform.OS.Linux -> getEnv("HOME").toPath() / ".local" / "share" / appId
1128
else -> getEnv("HOME").toPath() / ".$appId"
1229
}
1330

14-
fun desktopCacheDirectory(appId: String, os: Platform.OS, getEnv: (String) -> String) = when (os) {
31+
fun desktopCacheDirectory(appId: String, os: Platform.OS, getEnv: (String) -> String): Path = when (os) {
1532
is Platform.OS.MacOs -> getEnv("HOME").toPath() / "Library/Caches" / appId
1633
is Platform.OS.Windows -> getEnv("APPDATA").toPath() / "Caches" / appId
1734
is Platform.OS.Linux -> getEnv("HOME").toPath() / ".cache" / appId

multiplatform-paths/src/desktopMain/kotlin/me/sujanpoudel/utils/paths/directories.desktop.kt

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2024 Sujan Poudel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package me.sujanpoudel.utils.paths
218

319
import me.sujanpoudel.utils.platformIdentifier.hostOs

multiplatform-paths/src/jsMain/kotlin/me/sujanpoudel/utils/paths/directories.js.kt

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,28 @@
1+
/*
2+
* Copyright 2024 Sujan Poudel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package me.sujanpoudel.utils.paths
218

19+
import kotlinx.io.files.Path
320
import me.sujanpoudel.utils.platformIdentifier.Platform
421
import me.sujanpoudel.utils.platformIdentifier.platform
522

623
private val platform = platform() as Platform.JS
724

8-
actual fun dataDirectory(appId: String) = when (platform) {
25+
actual fun dataDirectory(appId: String): Path = when (platform) {
926
is Platform.JS.Node -> desktopAppHomeDirectory(
1027
appId = appId,
1128
os = platform.os,
@@ -15,7 +32,7 @@ actual fun dataDirectory(appId: String) = when (platform) {
1532
else -> error("Non node environment")
1633
}
1734

18-
actual fun cacheDirectory(appId: String) = when (platform) {
35+
actual fun cacheDirectory(appId: String): Path = when (platform) {
1936
is Platform.JS.Node -> desktopCacheDirectory(
2037
appId = appId,
2138
os = platform.os,

platform-identifier/build.gradle.kts

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright 2024 Sujan Poudel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116

217
plugins {
318
id("packaging")

platform-identifier/src/androidMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.android.kt

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2024 Sujan Poudel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package me.sujanpoudel.utils.platformIdentifier
218

319
import android.content.pm.PackageManager

platform-identifier/src/androidNativeMain/kotlin/me/sujanpoudel/utils/platformIdentifier/platform.androidNative.kt

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2024 Sujan Poudel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package me.sujanpoudel.utils.platformIdentifier
218

319
import kotlinx.cinterop.ByteVar
@@ -8,8 +24,8 @@ import kotlinx.cinterop.toKString
824
import platform.posix.__system_property_get
925
import kotlin.experimental.ExperimentalNativeApi
1026

11-
const val SYSTEM_PROP_BUILD_VERSION = "ro.build.version.sdk"
12-
const val SYSTEM_PROP_OS_VERSION = "ro.build.version.release"
27+
private const val SYSTEM_PROP_BUILD_VERSION: String = "ro.build.version.sdk"
28+
private const val SYSTEM_PROP_OS_VERSION: String = "ro.build.version.release"
1329

1430
@OptIn(ExperimentalNativeApi::class)
1531
actual fun platform(): Platform {

platform-identifier/src/androidNativeTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2024 Sujan Poudel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package me.sujanpoudel.utils.platformIdentifier
218

319
import kotlin.test.Test

platform-identifier/src/androidUnitTest/kotlin/me/sujanpoudel/utils/platformIdentifier/PlatformTest.kt

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright 2024 Sujan Poudel
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package me.sujanpoudel.utils.platformIdentifier
218

319
import android.content.Context

0 commit comments

Comments
 (0)