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

feature/marge-mcsm #25

Merged
merged 45 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
881b529
Release/3.0.0 (#24)
kigawa01 Oct 13, 2023
fe3b82d
release: 3.0.0
kigawa01 Oct 13, 2023
64b26eb
release: 3.0.0
kigawa01 Oct 13, 2023
0546cbe
release: 3.0.0
kigawa01 Oct 14, 2023
ecd9074
release: 3.0.0
kigawa01 Oct 14, 2023
8c83a33
release: 3.0.0
kigawa01 Oct 14, 2023
ecd4c06
release: 3.0.0
kigawa01 Oct 14, 2023
cf361cd
release: 3.0.0
kigawa01 Oct 14, 2023
d96ded9
release: 3.0.0
kigawa01 Oct 16, 2023
35654d6
release: 3.0.0
kigawa01 Oct 16, 2023
7d2bc1e
release: 3.0.0
kigawa01 Oct 16, 2023
7a2098e
release: 3.0.0
kigawa01 Oct 16, 2023
ca23e4d
release: 3.0.0
kigawa01 Oct 16, 2023
6ed8c33
release: 3.0.0
kigawa01 Oct 16, 2023
d5aa0a5
release: 3.0.0
kigawa01 Jan 4, 2024
eb5948d
release: 3.0.0
kigawa01 Jan 4, 2024
a72f42f
.java を .kt に名前変更
kigawa01 Jan 5, 2024
ac73d65
release: 3.0.0
kigawa01 Jan 5, 2024
99afbd2
release: 3.0.0
kigawa01 Jan 5, 2024
fb38411
release: 3.0.0
kigawa01 Jan 5, 2024
fd13b7b
release: 3.0.0
kigawa01 Jan 5, 2024
7a539ed
release: 3.0.0
kigawa01 Jan 5, 2024
662a085
release: 3.0.0
kigawa01 Jan 5, 2024
09e9255
release: 3.0.0
kigawa01 Jan 5, 2024
07f6e73
release: 3.0.0
kigawa01 Jan 5, 2024
1dc1361
release: 3.0.0
kigawa01 Jan 5, 2024
b5f7962
release: 3.0.0
kigawa01 Jan 5, 2024
64f257f
release: 3.0.0
kigawa01 Jan 5, 2024
aee8162
release: 3.0.0
kigawa01 Jan 5, 2024
36689bd
release: 3.0.0
kigawa01 Jan 5, 2024
73a2e12
release: 3.0.0
kigawa01 Jan 5, 2024
223f733
release: 3.0.0
kigawa01 Jan 5, 2024
7c0dc79
release: 3.0.0
kigawa01 Jan 6, 2024
42ba9c6
Merge branch 'master' into feature/marge-mcsm
kigawa01 Jan 6, 2024
5734b96
.java を .kt に名前変更
kigawa01 Jan 14, 2024
635827b
logger
kigawa01 Jan 14, 2024
32594bc
.java を .kt に名前変更
kigawa01 Mar 19, 2024
f3e815a
fix: compile err
kigawa01 Mar 19, 2024
65a6e5a
fix: compile err
kigawa01 Mar 19, 2024
92d470e
fix: compile warn
kigawa01 Mar 19, 2024
f0d7726
merge dev
kigawa01 Mar 23, 2024
7fb13e0
add test
kigawa01 Mar 23, 2024
e1bd05c
add test
kigawa01 Mar 23, 2024
b0cd68c
add test
kigawa01 Mar 23, 2024
b77570d
add test
kigawa01 Mar 23, 2024
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
19 changes: 14 additions & 5 deletions .github/workflows/deploy_maven_central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,26 @@ jobs:
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@ccb4328a959376b642e027874838f60f8e596de3
uses: gradle/wrapper-validation-action@v1
- name: Restore gradle.properties
env:
GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
run: |
echo "$GPG_PRIVATE_KEY" | base64 -d > kutil/sec.pem
echo "signing.keyId=ED76201E" >> ./gradle.properties
echo "signing.password=${GPG_PASSPHRASE}" >> ./gradle.properties
echo "signing.secretKeyRingFile=sec.pem" >> ./gradle.properties
- name: Publish package
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
uses: gradle/gradle-build-action@v2
with:
arguments: publish
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
# gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
# MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
####
29 changes: 29 additions & 0 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: run test

on:
push:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Make gradlew executable
run: chmod +x ./gradlew
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: run test
uses: gradle/gradle-build-action@v2
with:
arguments: allTests
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
####
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ out/
*.ctxt

# Package Files #
*.jar
*.war
*.nar
*.ear
Expand Down Expand Up @@ -127,4 +126,4 @@ run/
/.idea/
/log1/
/log/
/api/build/
/*/build/
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## About

* javaのutility
* kotlinのutility

## Use

Expand All @@ -11,20 +11,20 @@
<dependency>
<groupId>net.kigawa.kutil</groupId>
<artifactId>kutil</artifactId>
<version>2.2.1</version>
<version>3.0.0</version>
</dependency>
......
</dependencies>
```

## Requirement

* java
* kotlin

## Author

* kigawa
* kigawa.[email protected]
* contact@kigawa.net

# Making

Expand Down
3 changes: 2 additions & 1 deletion api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ plugins {
}

dependencies {
}
commonMainImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
}
10 changes: 10 additions & 0 deletions api/src/commonMain/kotlin/net/kigawa/kutil/kutil/api/Func.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package net.kigawa.kutil.kutil.api

import kotlinx.coroutines.channels.Channel


suspend inline fun <T> Channel<T>.forEach(func: (T) -> Unit) {
for (item in this) {
func(item)
}
}

This file was deleted.

56 changes: 56 additions & 0 deletions api/src/commonMain/kotlin/net/kigawa/kutil/kutil/api/Kutil.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
@file:Suppress("unused")

package net.kigawa.kutil.kutil.api

import net.kigawa.kutil.kutil.api.io.KuCloseable
import net.kigawa.kutil.kutil.api.io.SuspendCloseable
import kotlin.contracts.ExperimentalContracts
import kotlin.contracts.InvocationKind
import kotlin.contracts.contract

@Suppress("unused")
object Kutil {
fun fillStr(src: String, size: Int, fillChar: Char = ' '): String {
val sb = StringBuilder(size)
for (i in 0 until size) {
sb.append(src.getOrNull(i) ?: fillChar)
}
return sb.toString()
}

}

@OptIn(ExperimentalContracts::class)
inline fun <T : KuCloseable, R> T.tryCatch(
block: (self: T) -> R,
): R {
contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}
try {
return block(this)
} catch (e: Throwable) {
throw e
} finally {
close()
}
}

@OptIn(ExperimentalContracts::class)
suspend inline fun <T : KuCloseable, R> T.tryCatchSuspend(
block: (self: T) -> R,
): R {
contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}
try {
return block(this)
} catch (e: Throwable) {
throw e
} finally {
when (this) {
is SuspendCloseable -> suspendClose()
else -> close()
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package net.kigawa.kutil.kutil.api

/**
* utilities about array
*/
@Suppress("unused", "EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING")
expect object KutilArray

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package net.kigawa.kutil.kutil.api

/**
* utilities about file
*/
@Suppress("unused", "EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING")
expect object KutilFile {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package net.kigawa.kutil.kutil.api

@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING")
expect object KutilPlatform {
fun getSystemProperty(name: String): String
fun getEnv(name: String): String?
}
10 changes: 10 additions & 0 deletions api/src/commonMain/kotlin/net/kigawa/kutil/kutil/api/Option.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package net.kigawa.kutil.kutil.api

@Suppress("unused")
interface Option {
val name: String
val optName: String
val shortName: String?
val description: String
val defaultValue: String
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package net.kigawa.kutil.kutil.api

@Suppress("unused")
class OptionStore {
private val options = mutableMapOf<Option, String>()

fun add(option: Option, value: String) {
options[option] = value
}


fun get(option: Option): String = options[option]
?: KutilPlatform.getEnv(option.name)
?: option.defaultValue

}
11 changes: 11 additions & 0 deletions api/src/commonMain/kotlin/net/kigawa/kutil/kutil/api/Paths.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package net.kigawa.kutil.kutil.api

import net.kigawa.kutil.kutil.api.io.fs.KuPath

@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING")
expect enum class Paths {
JAVA
;

val path: KuPath
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package net.kigawa.kutil.kutil.api

@Suppress("unused")
data class PlatFormInstance(
val exitProcess: (Int) -> Nothing,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package net.kigawa.kutil.kutil.api

@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING")
expect object SignalHandler {
fun shutdownHook(hook: () -> Unit)
}
Loading
Loading