Skip to content

Commit

Permalink
Merge pull request #10 from bee-produced/9-result-type-data-fetchers
Browse files Browse the repository at this point in the history
Result Data Fetchers
  • Loading branch information
kurbaniec authored Nov 4, 2023
2 parents 4674e05 + faaf0c6 commit 3563d84
Show file tree
Hide file tree
Showing 42 changed files with 1,317 additions and 74 deletions.
28 changes: 18 additions & 10 deletions .github/workflows/github-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
run: |
chmod +x ./bee.persistent/gradlew
chmod +x ./bee.functional/gradlew
chmod +x ./bee.functional.test/gradlew
chmod +x ./bee.buzz/gradlew
chmod +x ./bee.generative/gradlew
chmod +x ./bee.fetched/gradlew
Expand All @@ -30,15 +31,18 @@ jobs:
- name: Build & Test bee.persistent
working-directory: ./bee.persistent
run: ./gradlew build
- name: Build & Test bee.functional
working-directory: ./bee.functional
- name: Build & Test bee.generative
working-directory: ./bee.generative
run: ./gradlew build
- name: Build & Test bee.functional
run: |
cd ./bee.functional/
./gradlew build
cd ../bee.functional.test/
./gradlew build
- name: Build & Test bee.buzz
working-directory: ./bee.buzz
run: ./gradlew build
- name: Build & Test bee.generative
working-directory: ./bee.generative
run: ./gradlew build
- name: Build & Test bee.fetched
run: |
cd ./bee.fetched/
Expand Down Expand Up @@ -74,6 +78,7 @@ jobs:
run: |
chmod +x ./bee.persistent/gradlew
chmod +x ./bee.functional/gradlew
chmod +x ./bee.functional.test/gradlew
chmod +x ./bee.buzz/gradlew
chmod +x ./bee.generative/gradlew
chmod +x ./bee.fetched/gradlew
Expand All @@ -82,15 +87,18 @@ jobs:
- name: Build & Test bee.persistent
working-directory: ./bee.persistent
run: ./gradlew build
- name: Build & Test bee.functional
working-directory: ./bee.functional
- name: Build & Test bee.generative
working-directory: ./bee.generative
run: ./gradlew build
- name: Build & Test bee.functional
run: |
cd ./bee.functional/
./gradlew build
cd ../bee.functional.test/
./gradlew build
- name: Build & Test bee.buzz
working-directory: ./bee.buzz
run: ./gradlew build
- name: Build & Test bee.generative
working-directory: ./bee.generative
run: ./gradlew build
- name: Build & Test bee.fetched
run: |
cd ./bee.fetched/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Some changes are currently being made:
* `bee.persistent`
Easier data handling for GraphQL + JPA, [documentation](./bee.persistent/README.md)
* `bee.functional`
Functional kotlin bindings, integration with DGS, `bee.persistent` & more
Functional Kotlin bindings, integration with DGS, `bee.persistent` & more, [documentation](./bee.functional/README.md)
* `bee.buzz`
Simple event manager based on the mediator pattern, based on C#'s [MediatR library](https://github.com/jbogard/MediatR)

4 changes: 2 additions & 2 deletions bee.fetched/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ pluginManagement {
}
```

> ⚠️ As `bee.generative` is currently not published to the gradle plugin portal, the publication on maven central has no [plugin marker](https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_markers) and thus requires this [workaround](https://github.com/GoogleCloudPlatform/app-gradle-plugin/issues/397#issuecomment-1484070866).
> ⚠️ As `bee.generative` is currently not published to the gradle plugin portal, the publication on maven central has no [plugin marker](https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_markers) and thus requires this [workaround](https://github.com/GoogleCloudPlatform/app-gradle-plugin/issues/397#issuecomment-1484070866).
`build.gradle.kts`:

```kotlin
plugins {
id("bee.generative")
id("com.google.devtools.ksp") version "1.8.0-1.0.9"
id("com.google.devtools.ksp") version "1.9.10-1.0.13"
}

dependencies {
Expand Down
143 changes: 143 additions & 0 deletions bee.functional.test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
import com.netflix.graphql.dgs.codegen.gradle.GenerateJavaTask

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
id("bee.generative")
}

allprojects {

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "17"
}
}

tasks.register<Task>(name = "resolveDependencies") {
group = "Build Setup"
description = "Resolve and prefetch dependencies"
doLast {
rootProject.allprojects.forEach {
it.buildscript.configurations.filter(Configuration::isCanBeResolved).forEach { it.resolve() }
it.configurations.filter(Configuration::isCanBeResolved).forEach { it.resolve() }
}
}
}
}

group = "com.beeproduced"
version = libs.versions.bee.built.get()
java.sourceCompatibility = JavaVersion.VERSION_17
java.targetCompatibility = JavaVersion.VERSION_17

configurations {
compileOnly {
extendsFrom(configurations.annotationProcessor.get())
}
}

repositories {
mavenCentral()
}

dependencies {
// in-house libraries
implementation("com.beeproduced:bee.functional")
implementation("com.beeproduced:bee.functional") {
capabilities { requireCapability("com.beeproduced:bee.functional-dgs") }
}

// external dependencies
implementation(libs.kotlin.stdlib)
implementation(libs.spring.boot.starter.web)
implementation(libs.spring.boot.starter.data.jpa)
implementation(libs.spring.boot.starter.websocket)
implementation(libs.spring.boot.starter.validation)
implementation(libs.spring.boot.starter.cache)
implementation(libs.spring.boot.starter.actuator)
implementation(libs.spring.boot.starter.aop)
implementation(libs.spring.boot.starter.security)
implementation(libs.spring.boot.starter.oauth2.resource.server)
implementation(libs.spring.boot.starter.oauth2.client)
implementation(libs.spring.security.config)
implementation(libs.spring.security.messaging)
implementation(libs.spring.security.web)
implementation(libs.jackson.module.kotlin)
implementation(platform(libs.dgs.platform))
implementation(libs.dgs.spring.starter)
implementation(libs.dgs.pagination)
implementation(libs.dgs.subscription.websockets)
implementation(libs.dgs.extended.scalars)
implementation(libs.konform)
implementation(libs.mapstruct)
implementation(libs.datafaker)
implementation("org.apache.tika:tika-core:2.4.1")
kapt(libs.mapstruct.processor)
testImplementation(libs.spring.boot.starter.test)
testImplementation(libs.spring.boot.starter.data.jpa)
testImplementation(libs.spring.security.test)
testImplementation(libs.junit.api)
testImplementation(libs.kotlin.test)
testRuntimeOnly(libs.junit.engine)
implementation(libs.h2)
testImplementation(libs.springmockk)

if (System.getProperty("os.arch") == "aarch64" && System.getProperty("os.name") == "Mac OS X") {
runtimeOnly("io.netty:netty-resolver-dns-native-macos:4.1.76.Final:osx-aarch_64")
}
}

tasks.withType<Test> {
useJUnitPlatform()
}


// DGS Codegen
// See: https://stackoverflow.com/a/70954759/12347616
tasks.withType<GenerateJavaTask> {
notCompatibleWithConfigurationCache("Remove later")
packageName = "com.beeproduced.bee.functional.graphql"
subPackageNameTypes = "dto"
generateCustomAnnotations = true
generateClient = true
typeMapping = mutableMapOf(
"DateTime" to "java.time.Instant",
"Upload" to "org.springframework.web.multipart.MultipartFile"
)
}

kapt {
// Fix error: incompatible types: NonExistentClass cannot be converted to Annotation
// @error.NonExistentClass
// https://stackoverflow.com/a/55646891/12347616
correctErrorTypes = true
arguments {
// Set Mapstruct Configuration options here
// https://kotlinlang.org/docs/reference/kapt.html#annotation-processor-arguments
// https://mapstruct.org/documentation/stable/reference/html/#configuration-options
arg("mapstruct.defaultComponentModel", "spring")
}
}

tasks.getByName<Jar>("jar") {
enabled = false
}


tasks.bootRun {
jvmArgs = listOf("-Dspring.output.ansi.enabled=ALWAYS")
}
9 changes: 9 additions & 0 deletions bee.functional.test/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
kotlin.code.style=official
org.gradle.console=rich
# See: https://docs.gradle.org/current/userguide/performance.html
org.gradle.parallel=true
# https://proandroiddev.com/how-we-reduced-our-gradle-build-times-by-over-80-51f2b6d6b05b
org.gradle.vfs.watch=true
org.gradle.caching=true
# org.gradle.unsafe.configuration-cache=true
org.gradle.jvmargs=-Xmx3g
Binary file not shown.
6 changes: 6 additions & 0 deletions bee.functional.test/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 3563d84

Please sign in to comment.