Skip to content

Commit

Permalink
Merge pull request #6 from bee-produced/5-restructure-project
Browse files Browse the repository at this point in the history
Restructure project
  • Loading branch information
kurbaniec authored Oct 23, 2023
2 parents 5f71162 + 3345fc5 commit 3e7833f
Show file tree
Hide file tree
Showing 164 changed files with 644 additions and 674 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Extend DGS:

Some changes are currently being made:

* `lib.data`
* `bee.persistent`
Easier data handling for GraphQL + JPA, [documentation](./lib.data/README.md)
* `lib.result`
Functional kotlin bindings, integration with DGS & more
* `lib.events`
* `bee.functional`
Functional kotlin bindings, integration with DGS, `bee.persistent` & more
* `bee.buzz`
Simple event manager based on the mediator pattern, based on C#'s [MediatR library](https://github.com/jbogard/MediatR)

14 changes: 8 additions & 6 deletions lib.events/build.gradle.kts → bee.buzz/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/*
The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable.
Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required.
*/
@Suppress("DSL_SCOPE_VIOLATION")
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.spring.boot).apply(false)
Expand All @@ -14,6 +11,11 @@ group = "com.beeproduced"
version = libs.versions.bee.built.get()
java.sourceCompatibility = JavaVersion.VERSION_17
java.targetCompatibility = JavaVersion.VERSION_17
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "17"
}
}

repositories {
mavenCentral()
Expand Down Expand Up @@ -45,7 +47,7 @@ java {
}

dependencies {
implementation("com.beeproduced:result")
implementation("com.beeproduced:bee.functional")
implementation(libs.kotlin.stdlib)
implementation(libs.spring.boot.starter.web)
testImplementation(libs.junit.api)
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
rootProject.name = "events"
rootProject.name = "bee.buzz"

dependencyResolutionManagement {
versionCatalogs {
create("libs") { from(files("../gradle/libs.versions.toml")) }
}
}

includeBuild("../lib.result")
includeBuild("../bee.functional")
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.beeproduced.lib.events
package com.beeproduced.bee.buzz

/**
* Inspired by https://github.com/jbogard/MediatR/wiki.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.beeproduced.lib.events
package com.beeproduced.bee.buzz

import com.beeproduced.result.errors.AppError
import com.beeproduced.bee.functional.result.errors.AppError
import com.github.michaelbull.result.Result

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.beeproduced.lib.events.manager
package com.beeproduced.bee.buzz.manager

import com.beeproduced.result.errors.InternalAppError
import com.beeproduced.result.errors.ResultError
import com.beeproduced.bee.functional.result.errors.InternalAppError
import com.beeproduced.bee.functional.result.errors.ResultError

/**
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.beeproduced.lib.events.manager
package com.beeproduced.bee.buzz.manager

/**
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.beeproduced.lib.events.manager
package com.beeproduced.bee.buzz.manager

import com.beeproduced.lib.events.Notification
import com.beeproduced.lib.events.NotificationHandler
import com.beeproduced.lib.events.Request
import com.beeproduced.lib.events.RequestHandler
import com.beeproduced.result.errors.AppError
import com.beeproduced.bee.buzz.Notification
import com.beeproduced.bee.buzz.NotificationHandler
import com.beeproduced.bee.buzz.Request
import com.beeproduced.bee.buzz.RequestHandler
import com.beeproduced.bee.functional.result.errors.AppError
import com.github.michaelbull.result.Result

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.beeproduced.lib.events.manager
package com.beeproduced.bee.buzz.manager

import java.util.concurrent.ScheduledFuture
import java.util.concurrent.TimeUnit
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.beeproduced.bee.buzz.autoconfig

import com.beeproduced.bee.buzz.manager.EventManager
import com.beeproduced.bee.buzz.manager.Mediator
import com.beeproduced.bee.buzz.manager.Scheduler
import com.beeproduced.bee.buzz.manager.SimpleEventManager
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration

/**
*
*
* @author Kacper Urbaniec
* @version 2023-10-23
*/
@Configuration
@ConditionalOnClass(value = [EventManager::class, Mediator::class, Scheduler::class])
open class BeeBuzzAutoConfiguration {
@Bean
open fun beeBuzzEventManager() : EventManager {
return SimpleEventManager()
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.beeproduced.lib.events.manager
package com.beeproduced.bee.buzz.manager

import com.beeproduced.lib.events.Notification
import com.beeproduced.lib.events.NotificationHandler
import com.beeproduced.lib.events.Request
import com.beeproduced.lib.events.RequestHandler
import com.beeproduced.lib.events.manager.exceptions.NotificationHandlerNotFound
import com.beeproduced.lib.events.manager.exceptions.RequestHandlerNotFound
import com.beeproduced.result.errors.AppError
import com.beeproduced.bee.buzz.Notification
import com.beeproduced.bee.buzz.NotificationHandler
import com.beeproduced.bee.buzz.Request
import com.beeproduced.bee.buzz.RequestHandler
import com.beeproduced.bee.buzz.manager.exceptions.NotificationHandlerNotFound
import com.beeproduced.bee.buzz.manager.exceptions.RequestHandlerNotFound
import com.beeproduced.bee.functional.result.errors.AppError
import com.github.michaelbull.result.Result
import org.slf4j.LoggerFactory
import org.springframework.util.LinkedMultiValueMap
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.beeproduced.lib.events.manager
package com.beeproduced.bee.buzz.manager

import com.beeproduced.lib.events.Request
import com.beeproduced.result.errors.AppError
import com.beeproduced.bee.buzz.Request
import com.beeproduced.bee.functional.result.errors.AppError
import com.github.michaelbull.result.Result

open class TestEventManager : SimpleEventManager() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.beeproduced.lib.events.manager.exceptions
package com.beeproduced.bee.buzz.manager.exceptions

/**
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.beeproduced.lib.events.manager.exceptions
package com.beeproduced.bee.buzz.manager.exceptions

/**
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.beeproduced.bee.buzz.autoconfig.BeeBuzzAutoConfiguration
28 changes: 12 additions & 16 deletions bee.fetched.test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
import com.netflix.graphql.dgs.codegen.gradle.GenerateJavaTask

/*
The Library Loader plugin currently has an IDEA bug that causes it to not recognize the "libs" variable.
Until https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed the suppress annotation is required.
*/
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.spring)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.spring.boot)
alias(libs.plugins.spring.dependencymanagement)
alias(libs.plugins.kotlin.jpa)
// ksp plugin must be placed before kapt
// https://github.com/google/ksp/issues/1445#issuecomment-1763422067
alias(libs.plugins.ksp)
alias(libs.plugins.kotlin.kapt)
alias(libs.plugins.dgs.codegen)
alias(libs.plugins.kotlin.allopen)
alias(libs.plugins.kotlin.noarg)
java
alias(libs.plugins.ksp)
id("bee.generative")

}

allprojects {
Expand Down Expand Up @@ -60,16 +56,16 @@ repositories {

dependencies {
// in-house libraries
implementation("com.beeproduced:events")
implementation("com.beeproduced:events") {
capabilities { requireCapability("com.beeproduced:events-simple") }
implementation("com.beeproduced:bee.buzz")
implementation("com.beeproduced:bee.buzz") {
capabilities { requireCapability("com.beeproduced:bee.buzz-simple") }
}
implementation("com.beeproduced:result") {
capabilities { requireCapability("com.beeproduced:result-dgs") }
implementation("com.beeproduced:bee.functional") {
capabilities { requireCapability("com.beeproduced:bee.functional-dgs") }
}
implementation("com.beeproduced:data")
implementation("com.beeproduced:data") {
capabilities { requireCapability("com.beeproduced:data-dgs") }
implementation("com.beeproduced:bee.persistent")
implementation("com.beeproduced:bee.persistent") {
capabilities { requireCapability("com.beeproduced:bee.persistent-dgs") }
}
beeGenerative("com.beeproduced:bee.fetched")
// external dependencies
Expand Down Expand Up @@ -156,4 +152,4 @@ tasks.getByName<Jar>("jar") {

tasks.bootRun {
jvmArgs = listOf("-Dspring.output.ansi.enabled=ALWAYS")
}
}
Binary file modified bee.fetched.test/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion bee.fetched.test/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
28 changes: 19 additions & 9 deletions bee.fetched.test/gradlew
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,10 +32,10 @@
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
Expand All @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -205,6 +209,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
15 changes: 9 additions & 6 deletions bee.fetched.test/gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
Loading

0 comments on commit 3e7833f

Please sign in to comment.