Skip to content

Commit

Permalink
🎉Initial commit for sisyphus project
Browse files Browse the repository at this point in the history
  • Loading branch information
devkanro committed May 17, 2020
0 parents commit 276ab47
Show file tree
Hide file tree
Showing 463 changed files with 33,044 additions and 0 deletions.
44 changes: 44 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Sisyphus

Sisyphus is the way how we provide backend services. It integrates all tools and libraries needed for designing API which follows the [Google API Improvement Proposals](https://aip.bybutter.com).

## We are rolling a huge boulder

Due to we can analyzing product documents completely, it is not particularly difficult to write an exquisite and easy-to-use API at the beginning for most APIs.

But many people will break the initial design of the API in the endless update of products.

It's hard to create a strong and extensible API in the whole project lifetime, just like roll a huge boulder endlessly up a steep hill.

So we need an all-encompassing guide book to guide us in creating, updating, and modifying APIs.

The [Google API Improvement Proposals](https://aip.bybutter.com) is the all-encompassing guide book. Google created it in their rich and extensive API design experience. Laid the foundation for possession for anyone to create an extensible API.

## Good tools can help you

Choosing good tools can help you 'rolling a huge boulder' faster and easier. Sisyphus provides and integrates many tools in your 'boulder rolling' route.

[**Kotlin**](https://kotlinlang.org/) is our target language, the mature JVM community and concise grammar are the reasons.

[**Spring boot**](https://spring.io/projects/spring-boot) is our old friend to manage and organize our components.

[**gRPC**](https://grpc.io/) is our target API framework, and Sisyphus also provides the [HTTP and gRPC Transcoding](https://aip.bybutter.com/127) component for the environment which not compatible with gRPC.

[**Sisyphus Protobuf**](/lib/sisyphus-protobuf) is our customized protobuf runtime, it design for Kotlin.

[**Sisyphus gRPC**](/lib/sisyphus-grpc) is our customized gRPC runtime, it design for Kotlin coroutine.

[**Sisyphus DTO**](/lib/sisyphus-dto) is our way to create structs without protobuf.

[**Sisyphus Middleware**](/middleware) is our way to connect Sisyphus and other system.

[**Sisyphus Configuration Artifact**](/middleware/sisyphus-configuration-artifact) is our way to manage configurations and developing environment.

[**Sisyphus Protobuf Compiler**](/tools/sisyphus-protoc) is our way to generate Kotlin codes by `.proto` files.

[**Sisyphus Project Plugin**](/tools/sisyphus-project-gradle-plugin) is our way to manage project and configurating Gradle.

[**Sisyphus Protobuf Plugin**](/tools/sisyphus-protobuf-gradle-plugin) is our way to generate code by `.proto` files in Gradle.

**And More** tools like [CEL(Common Expression Language)](https://github.com/google/cel-spec), [Filtering](https://aip.bybutter.com/160) and [Ordering](https://aip.bybutter.com/132#ordering) Script will help you to design APIs follow Google AIP.

17 changes: 17 additions & 0 deletions bom/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
plugins {
`java-platform`
id("nebula.maven-publish")
id("sisyphus.project")
}

group = "com.bybutter.sisyphus"

dependencies {
constraints {
rootProject.subprojects {
this.plugins.withId("org.gradle.java-base") {
api(this@subprojects)
}
}
}
}
20 changes: 20 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
plugins {
`java-library`
`kotlin-dsl`
id("idea")
id("sisyphus.project") version "higan-SNAPSHOT"
}

dependencies {
implementation(platform("com.bybutter.sisyphus:sisyphus-bom:higan-SNAPSHOT"))
implementation("com.bybutter.sisyphus.tools:sisyphus-protobuf-gradle-plugin")
implementation("com.bybutter.sisyphus.tools:sisyphus-project-gradle-plugin")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.70")
implementation("org.jetbrains.kotlin:kotlin-allopen:1.3.70")
implementation("org.springframework.boot:spring-boot-gradle-plugin:2.2.7.RELEASE")
implementation("org.jlleitschuh.gradle:ktlint-gradle:9.2.1")
implementation("com.github.ben-manes:gradle-versions-plugin:0.27.0")
implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.0.0-RC15")
implementation("com.netflix.nebula:nebula-publishing-plugin:17.2.1")
implementation("org.gradle.kotlin:plugins:1.2.11")
}
6 changes: 6 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}
154 changes: 154 additions & 0 deletions buildSrc/src/main/kotlin/dependencies.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies

object Dependencies {
object Kotlin {
private const val group = "org.jetbrains.kotlin"
const val stdlib = "$group:kotlin-stdlib-jdk8"
const val reflect = "$group:kotlin-reflect"
const val poet = "com.squareup:kotlinpoet"
const val plugin = "$group:kotlin-gradle-plugin"

object Coroutines {
private const val group = "org.jetbrains.kotlinx"
const val core = "$group:kotlinx-coroutines-core"
const val reactor = "$group:kotlinx-coroutines-reactor"
const val guava = "$group:kotlinx-coroutines-guava"
const val jdk = "$group:kotlinx-coroutines-jdk8"
}
}

object Jackson {
private const val group = "com.fasterxml.jackson.core"
const val databind = "$group:jackson-databind"
const val core = "$group:jackson-core"
const val annotations = "$group:jackson-annotations"

object Module {
private const val group = "com.fasterxml.jackson.module"
const val kotlin = "$group:jackson-module-kotlin"
}

object Dataformat {
private const val group = "com.fasterxml.jackson.dataformat"
const val xml = "$group:jackson-dataformat-xml"
const val yaml = "$group:jackson-dataformat-yaml"
const val properties = "$group:jackson-dataformat-properties"
const val cbor = "$group:jackson-dataformat-cbor"
const val smile = "$group:jackson-dataformat-smile"
}
}

object Spring {
object Framework {
private const val group = "org.springframework"

const val webflux = "$group:spring-webflux"

const val tx = "$group:spring-tx"
}

object Boot {
private const val group = "org.springframework.boot"

const val boot = "$group:spring-boot-starter"

const val webflux = "$group:spring-boot-starter-webflux"

const val jooq = "$group:spring-boot-starter-jooq"

const val jdbc = "$group:spring-boot-starter-jdbc"

const val test = "$group:spring-boot-starter-test"

const val redis = "$group:spring-boot-starter-data-redis"

const val amqp = "$group:spring-boot-starter-amqp"

const val cp = "$group:spring-boot-configuration-processor"

const val jackson = "$group:spring-boot-starter-json"
}
}

object Proto {
private const val group = "com.google.protobuf"

const val base = "$group:protobuf-java"
const val apiCompiler = "com.google.api:api-compiler:0.0.8"

const val runtimeProto = "$group:protobuf-java:3.11.4"
const val grpcProto = "com.google.api.grpc:proto-google-common-protos:1.18.0"
}

object Grpc {
private const val group = "io.grpc"

const val api = "$group:grpc-api"

const val core = "$group:grpc-core"

const val stub = "$group:grpc-stub"

const val netty = "$group:grpc-netty"

const val proto = "$group:grpc-protobuf"
}

object Maven {
private const val group = "org.apache.maven"

const val resolver = "$group:maven-resolver-provider"

const val resolverConnector = "$group.resolver:maven-resolver-connector-basic"

const val resolverWagon = "$group.resolver:maven-resolver-transport-wagon"

const val wagonFile = "$group.wagon:wagon-file"

const val wagonHttp = "$group.wagon:wagon-http"
}

const val elastic5 = "org.elasticsearch.client:transport"

const val mysql = "mysql:mysql-connector-java"

const val postgresql = "org.postgresql:postgresql"

const val junit = "org.junit.jupiter:junit-jupiter"

const val hbase = "com.aliyun.hbase:alihbase-client"

const val reflections = "org.reflections:reflections"

const val jooq = "org.jooq:jooq"

const val hikari = "com.zaxxer:HikariCP"

const val h2 = "com.h2database:h2"

const val protoc = "com.github.os72:protoc-jar"

const val nettyTcnative = "io.netty:netty-tcnative-boringssl-static"

const val retrofit = "com.squareup.retrofit2:retrofit"

const val okhttp = "com.squareup.okhttp3:okhttp"

const val resilience4j = "io.github.resilience4j:resilience4j-retrofit"

const val lettuce = "io.lettuce:lettuce-core"

const val antlr4 = "org.antlr:antlr4:4.8"

const val swagger = "io.swagger.core.v3:swagger-core"
}

val Project.managedDependencies: Project
get() {
dependencies {
add("implementation", platform(project(":sisyphus-dependencies")))
}

return this
}
27 changes: 27 additions & 0 deletions buildSrc/src/main/kotlin/kotlin.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import org.gradle.api.Project
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

val Project.kotlin: Project
get() {
apply {
plugin("kotlin")
plugin("kotlin-spring")
plugin("io.gitlab.arturbosch.detekt")
plugin("org.jlleitschuh.gradle.ktlint")
}

dependencies {
add("api", Dependencies.Kotlin.stdlib)
add("api", Dependencies.Kotlin.reflect)
add("api", Dependencies.Kotlin.Coroutines.core)
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
}

return this
}
11 changes: 11 additions & 0 deletions buildSrc/src/main/kotlin/plugin.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
inline val org.gradle.plugin.use.PluginDependenciesSpec.protobuf: org.gradle.plugin.use.PluginDependencySpec
get() = id("sisyphus.protobuf")

inline val org.gradle.plugin.use.PluginDependenciesSpec.sisyphus: org.gradle.plugin.use.PluginDependencySpec
get() = id("sisyphus.project")

inline val org.gradle.plugin.use.PluginDependenciesSpec.publish: org.gradle.plugin.use.PluginDependencySpec
get() {
id("nebula.maven-base-publish")
return id("nebula.source-jar")
}
69 changes: 69 additions & 0 deletions buildSrc/src/main/kotlin/project.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import com.bybutter.sisyphus.project.gradle.SisyphusProjectPlugin
import com.github.benmanes.gradle.versions.VersionsPlugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaLibraryPlugin
import org.gradle.api.tasks.testing.Test
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.withType
import org.gradle.plugins.ide.idea.IdeaPlugin

val Project.next: Project
get() {
pluginManager.apply(JavaLibraryPlugin::class.java)
pluginManager.apply(IdeaPlugin::class.java)
pluginManager.apply(VersionsPlugin::class.java)
pluginManager.apply(SisyphusProjectPlugin::class.java)

kotlin.managedDependencies

dependencies {
add("testImplementation", Dependencies.junit)
}

tasks.withType<Test> {
useJUnitPlatform()
}
return this
}

val Project.middleware: Project
get() {
next

group = "com.bybutter.sisyphus.middleware"

dependencies {
add("api", Dependencies.Spring.Boot.boot)
add("testImplementation", Dependencies.Spring.Boot.test)
}
return this
}

val Project.lib: Project
get() {
next

group = "com.bybutter.sisyphus"
return this
}

val Project.starter: Project
get() {
next

group = "com.bybutter.sisyphus.starter"

dependencies {
add("api", Dependencies.Spring.Boot.boot)
add("testImplementation", Dependencies.Spring.Boot.test)
}
return this
}

val Project.tools: Project
get() {
next

group = "com.bybutter.sisyphus.tools"
return this
}
Loading

0 comments on commit 276ab47

Please sign in to comment.