mirror of https://github.com/usbharu/Hideout.git
chore: プロジェクト構造を修正
This commit is contained in:
parent
683bbc5eec
commit
abf3b329e2
|
@ -61,7 +61,7 @@ jobs:
|
|||
- name: Build
|
||||
uses: gradle/gradle-build-action@v3.3.2
|
||||
with:
|
||||
arguments: testClasses
|
||||
arguments: :hideout-core:testClasses
|
||||
|
||||
unit-test:
|
||||
name: Unit Test
|
||||
|
@ -113,7 +113,7 @@ jobs:
|
|||
- name: Unit Test
|
||||
uses: gradle/gradle-build-action@v3.3.2
|
||||
with:
|
||||
arguments: test
|
||||
arguments: :hideout-core:test
|
||||
|
||||
- name: Save Test Report
|
||||
if: always()
|
||||
|
@ -177,7 +177,7 @@ jobs:
|
|||
- name: Unit Test
|
||||
uses: gradle/gradle-build-action@v3.3.2
|
||||
with:
|
||||
arguments: integrationTest
|
||||
arguments: :hideout-core:integrationTest
|
||||
|
||||
- name: Save Test Report
|
||||
if: always()
|
||||
|
@ -236,7 +236,7 @@ jobs:
|
|||
- name: Run Kover
|
||||
uses: gradle/gradle-build-action@v3.3.2
|
||||
with:
|
||||
arguments: koverXmlReport -x integrationTest -x e2eTest --rerun-tasks
|
||||
arguments: :hideout-core:koverXmlReport -x :hideout-core:integrationTest -x :hideout-core:e2eTest --rerun-tasks
|
||||
|
||||
- name: Add coverage report to PR
|
||||
if: always()
|
||||
|
@ -331,7 +331,7 @@ jobs:
|
|||
- name: Build with Gradle
|
||||
uses: gradle/gradle-build-action@4c39dd82cd5e1ec7c6fa0173bb41b4b6bb3b86ff
|
||||
with:
|
||||
arguments: detektMain
|
||||
arguments: :hideout-core:detektMain
|
||||
|
||||
- name: "reviewdog-suggester: Suggest any code changes based on diff with reviewdog"
|
||||
if: ${{ always() }}
|
||||
|
@ -401,7 +401,7 @@ jobs:
|
|||
- name: E2E Test
|
||||
uses: gradle/gradle-build-action@v3.3.2
|
||||
with:
|
||||
arguments: e2eTest
|
||||
arguments: :hideout-core:e2eTest
|
||||
|
||||
|
||||
- name: Save Test Report
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (C) 2024 usbharu
|
||||
*
|
||||
* 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.jvm)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("dev.usbharu:hideout-core:0.0.1")
|
||||
implementation("dev.usbharu:hideout-worker:0.0.1")
|
||||
}
|
||||
|
||||
tasks.register("run") {
|
||||
dependsOn(gradle.includedBuild("hideout-core").task(":run"))
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Copyright (C) 2024 usbharu
|
||||
*
|
||||
* 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 dev.usbharu.hideout
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan
|
||||
import org.springframework.boot.runApplication
|
||||
|
||||
@SpringBootApplication
|
||||
@ConfigurationPropertiesScan
|
||||
class HideoutWorker
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
runApplication<HideoutWorker>(*args)
|
||||
}
|
|
@ -17,8 +17,10 @@
|
|||
package dev.usbharu.hideout
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper
|
||||
import dev.usbharu.hideout.worker.SpringConsumerConfig
|
||||
import dev.usbharu.owl.common.property.*
|
||||
import dev.usbharu.owl.consumer.StandaloneConsumer
|
||||
import dev.usbharu.owl.consumer.StandaloneConsumerConfig
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
@ -31,11 +33,13 @@ import org.springframework.stereotype.Component
|
|||
class WorkerRunner(
|
||||
private val springTaskRunnerLoader: SpringTaskRunnerLoader,
|
||||
@Qualifier("activitypub") private val objectMapper: ObjectMapper,
|
||||
private val springCConsumerConfig: SpringConsumerConfig,
|
||||
) : ApplicationRunner {
|
||||
override fun run(args: ApplicationArguments?) {
|
||||
GlobalScope.launch(Dispatchers.Default) {
|
||||
val consumer = StandaloneConsumer(
|
||||
taskRunnerLoader = springTaskRunnerLoader, propertySerializerFactory = CustomPropertySerializerFactory(
|
||||
taskRunnerLoader = springTaskRunnerLoader,
|
||||
propertySerializerFactory = CustomPropertySerializerFactory(
|
||||
setOf(
|
||||
IntegerPropertySerializer(),
|
||||
StringPropertyValueSerializer(),
|
||||
|
@ -45,6 +49,13 @@ class WorkerRunner(
|
|||
FloatPropertySerializer(),
|
||||
ObjectPropertySerializer(objectMapper),
|
||||
)
|
||||
),
|
||||
config = StandaloneConsumerConfig(
|
||||
springCConsumerConfig.address,
|
||||
springCConsumerConfig.port,
|
||||
springCConsumerConfig.name,
|
||||
springCConsumerConfig.hostname,
|
||||
springCConsumerConfig.concurrency
|
||||
)
|
||||
)
|
||||
consumer.init()
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (C) 2024 usbharu
|
||||
*
|
||||
* 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 dev.usbharu.hideout.worker
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
|
||||
@ConfigurationProperties("hideout.worker")
|
||||
data class SpringConsumerConfig(
|
||||
val address: String = "localhost",
|
||||
val port: Int = 50051,
|
||||
val name: String = "hideout-worker",
|
||||
val hostname: String = "localhost",
|
||||
val concurrency: Int = 10,
|
||||
)
|
|
@ -19,7 +19,8 @@ plugins {
|
|||
}
|
||||
rootProject.name = "hideout"
|
||||
|
||||
includeBuild("owl")
|
||||
includeBuild("hideout-core")
|
||||
includeBuild("hideout-worker")
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositories {
|
||||
|
|
Loading…
Reference in New Issue