diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..f78bbab3 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,23 @@ +name: Check + +on: + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.11 + uses: actions/setup-java@v1 + with: + java-version: 1.11 + - uses: ButterCam/prepare-sisyphus-build@bc33e0b + with: + dependency: nexus + nexus-url: ${{ secrets.NEXUS_PUBLIC_URL }} + nexus-username: ${{ secrets.NEXUS_USERNAME }} + nexus-password: ${{ secrets.NEXUS_PASSWORD }} + - name: Build with Gradle + run: gradle build \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..2a0d07d0 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,50 @@ +name: Publish + +on: + push: + branches: [ master ] + release: + types: [ created ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.11 + uses: actions/setup-java@v1 + with: + java-version: 1.11 + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v2 + env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + - uses: ButterCam/prepare-sisyphus-build@bc33e0b + with: + snapshot: snapshot,mavenSnapshot + release: release,mavenRelease + dependency: nexus + nexus-url: ${{ secrets.NEXUS_PUBLIC_URL }} + nexus-username: ${{ secrets.NEXUS_USERNAME }} + nexus-password: ${{ secrets.NEXUS_PASSWORD }} + snapshot-url: ${{ secrets.NEXUS_SNAPSHOT_URL }} + snapshot-username: ${{ secrets.NEXUS_USERNAME }} + snapshot-password: ${{ secrets.NEXUS_PASSWORD }} + mavenSnapshot-url: https://oss.sonatype.org/content/repositories/snapshots + mavenSnapshot-username: ${{ secrets.OSSRH_USERNAME }} + mavenSnapshot-password: ${{ secrets.OSSRH_PASSWORD }} + release-url: ${{ secrets.NEXUS_RELEASE_URL }} + release-username: ${{ secrets.NEXUS_USERNAME }} + release-password: ${{ secrets.NEXUS_PASSWORD }} + mavenRelease-url: https://oss.sonatype.org/service/local/staging/deploy/maven2 + mavenRelease-username: ${{ secrets.OSSRH_USERNAME }} + mavenRelease-password: ${{ secrets.OSSRH_PASSWORD }} + gradle-portal-key: ${{ secrets.GRADLE_PUBLISH_KEY }} + gradle-portal-secret: ${{ secrets.GRADLE_PUBLISH_SECRET }} + gpg-key-name: ${{ secrets.GPG_KEY_NAME }} + - name: Publish with Gradle + run: gradle publish \ No newline at end of file diff --git a/.github/workflows/publishplugins.yml b/.github/workflows/publishplugins.yml new file mode 100644 index 00000000..0031f4bb --- /dev/null +++ b/.github/workflows/publishplugins.yml @@ -0,0 +1,34 @@ +name: Publish Plugins + +on: + release: + types: [ created ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.11 + uses: actions/setup-java@v1 + with: + java-version: 1.11 + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v2 + env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + - uses: ButterCam/prepare-sisyphus-build@bc33e0b + with: + dependency: nexus + nexus-url: ${{ secrets.NEXUS_PUBLIC_URL }} + nexus-username: ${{ secrets.NEXUS_USERNAME }} + nexus-password: ${{ secrets.NEXUS_PASSWORD }} + gradle-portal-key: ${{ secrets.GRADLE_PUBLISH_KEY }} + gradle-portal-secret: ${{ secrets.GRADLE_PUBLISH_SECRET }} + gpg-key-name: ${{ secrets.GPG_KEY_NAME }} + - name: Publish plugins to Gradle Portal + run: gradle publishPlugins \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..2a13e87d --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +.gradle +/build/ +!foundation/gradle/wrapper/gradle-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ + +logs/ +out/ +data/elasticsearch +.DS_Store \ No newline at end of file diff --git a/ReadMe.md b/ReadMe.md index 06924ead..f37a35be 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,12 +1,14 @@ # 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). +[![Maven Central](https://img.shields.io/maven-central/v/com.bybutter.sisyphus/sisyphus-bom)](https://mvnrepository.com/artifact/com.bybutter.sisyphus/sisyphus-bom) + +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. +Due to we can analyze 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. +However, 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. @@ -24,11 +26,11 @@ Choosing good tools can help you 'rolling a huge boulder' faster and easier. Sis [**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 Protobuf**](/lib/sisyphus-protobuf) is our customized protobuf runtime, it designed for Kotlin. -[**Sisyphus gRPC**](/lib/sisyphus-grpc) is our customized gRPC runtime, it design for Kotlin coroutine. +[**Sisyphus gRPC**](/lib/sisyphus-grpc) is our customized gRPC runtime, it designed for Kotlin coroutine. -[**Sisyphus DTO**](/lib/sisyphus-dto) is our way to create structs without protobuf. +[**Sisyphus DTO**](/lib/sisyphus-dto) is our way to create struct without protobuf. [**Sisyphus Middleware**](/middleware) is our way to connect Sisyphus and other system. @@ -36,7 +38,7 @@ Choosing good tools can help you 'rolling a huge boulder' faster and easier. Sis [**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 Project Plugin**](/tools/sisyphus-project-gradle-plugin) is our way to manage project and configuring Gradle. [**Sisyphus Protobuf Plugin**](/tools/sisyphus-protobuf-gradle-plugin) is our way to generate code by `.proto` files in Gradle. diff --git a/bom/build.gradle.kts b/bom/build.gradle.kts index d567d204..a366ac36 100644 --- a/bom/build.gradle.kts +++ b/bom/build.gradle.kts @@ -1,10 +1,12 @@ plugins { `java-platform` id("nebula.maven-publish") - id("sisyphus.project") + sisyphus } group = "com.bybutter.sisyphus" +description = "Sisyphus Project (Bill of Materials)" + dependencies { constraints { diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..7185ed09 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,21 @@ +plugins { + id("nebula.contacts") +} + +contacts { + addPerson("higan@live.cn", delegateClosureOf { + moniker = "higan" + github = "devkanro" + roles.add("owner") + }) + addPerson("wzlylv@163.com", delegateClosureOf { + moniker = "wangzheng" + github = "GuoDuanLZ" + roles.add("maintainer") + }) + addPerson("zhaoy_xin@163.com", delegateClosureOf { + moniker = "future" + github = "yuxin-zhao" + roles.add("maintainer") + }) +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 123b288e..eb98c769 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -2,19 +2,22 @@ plugins { `java-library` `kotlin-dsl` id("idea") - id("sisyphus.project") version "higan-SNAPSHOT" + id("com.bybutter.sisyphus.project") version "0.0.1-M6" } dependencies { - implementation(platform("com.bybutter.sisyphus:sisyphus-bom:higan-SNAPSHOT")) + implementation(platform("com.bybutter.sisyphus:sisyphus-dependencies:0.0.1-M6")) 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") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin") + implementation("org.jetbrains.kotlin:kotlin-allopen") + implementation("org.springframework.boot:spring-boot-gradle-plugin") + implementation("org.jlleitschuh.gradle:ktlint-gradle") + implementation("com.github.ben-manes:gradle-versions-plugin") + implementation("com.netflix.nebula:nebula-publishing-plugin") + implementation("com.netflix.nebula:gradle-contacts-plugin") + implementation("com.netflix.nebula:gradle-info-plugin") + implementation("org.gradle.kotlin:plugins") + implementation("com.gradle.publish:plugin-publish-plugin") + implementation("org.eclipse.jgit:org.eclipse.jgit") } \ No newline at end of file diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts deleted file mode 100644 index 588dcaf8..00000000 --- a/buildSrc/settings.gradle.kts +++ /dev/null @@ -1,6 +0,0 @@ -pluginManagement { - repositories { - mavenLocal() - gradlePluginPortal() - } -} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/kotlin.kt b/buildSrc/src/main/kotlin/kotlin.kt index e472e408..d6b46740 100644 --- a/buildSrc/src/main/kotlin/kotlin.kt +++ b/buildSrc/src/main/kotlin/kotlin.kt @@ -8,7 +8,6 @@ val Project.kotlin: Project apply { plugin("kotlin") plugin("kotlin-spring") - plugin("io.gitlab.arturbosch.detekt") plugin("org.jlleitschuh.gradle.ktlint") } diff --git a/buildSrc/src/main/kotlin/plugin.kt b/buildSrc/src/main/kotlin/plugin.kt index ffea1b67..80bc1a62 100644 --- a/buildSrc/src/main/kotlin/plugin.kt +++ b/buildSrc/src/main/kotlin/plugin.kt @@ -1,11 +1,5 @@ inline val org.gradle.plugin.use.PluginDependenciesSpec.protobuf: org.gradle.plugin.use.PluginDependencySpec - get() = id("sisyphus.protobuf") + get() = id("com.bybutter.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") - } + get() = id("com.bybutter.sisyphus.project") \ No newline at end of file diff --git a/dependencies/build.gradle.kts b/dependencies/build.gradle.kts index 8739ed94..d0ae1e68 100644 --- a/dependencies/build.gradle.kts +++ b/dependencies/build.gradle.kts @@ -1,10 +1,11 @@ plugins { `java-platform` id("nebula.maven-publish") - id("sisyphus.project") + sisyphus } group = "com.bybutter.sisyphus" +description = "Dependencies of Sisyphus Project (Bill of Materials)" javaPlatform { allowDependencies() @@ -12,29 +13,40 @@ javaPlatform { dependencies { api(platform(project(":sisyphus-bom"))) - api(platform("org.springframework.boot:spring-boot-dependencies:2.2.7.RELEASE")) - api(platform("org.jetbrains.kotlin:kotlin-bom:1.3.70")) - api(platform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.3.6")) + api(platform("org.springframework.boot:spring-boot-dependencies:2.3.0.RELEASE")) + api(platform("org.jetbrains.kotlin:kotlin-bom:1.3.72")) + api(platform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.3.7")) api(platform("org.apache.maven:maven:3.6.3")) api(platform("io.grpc:grpc-bom:1.29.0")) - api(platform("com.google.protobuf:protobuf-bom:3.11.4")) + api(platform("com.google.protobuf:protobuf-bom:3.12.0")) constraints { api("com.squareup:kotlinpoet:1.5.0") api("org.elasticsearch.client:transport:5.6.3") api("com.aliyun.hbase:alihbase-client:2.0.3") - api("org.reflections:reflections:0.9.11") + api("org.reflections:reflections:0.9.12") api("com.github.os72:protoc-jar:3.11.4") - api("io.netty:netty-tcnative-boringssl-static:2.0.20.Final") - api("org.apache.maven.wagon:wagon-http:3.3.4") - api("org.junit.jupiter:junit-jupiter:5.5.1") + api("io.netty:netty-tcnative-boringssl-static:2.0.30.Final") + api("org.apache.maven.wagon:wagon-http:3.4.0") + api("org.junit.jupiter:junit-jupiter:5.6.2") api("org.reflections:reflections:0.9.11") - api("com.squareup.okhttp3:okhttp:4.2.2") - api("com.squareup.retrofit2:retrofit:2.7.1") - api("io.github.resilience4j:resilience4j-retrofit:1.3.1") + api("com.squareup.okhttp3:okhttp:4.7.1") + api("com.squareup.retrofit2:retrofit:2.8.2") + api("io.github.resilience4j:resilience4j-retrofit:1.4.0") api("org.antlr:antlr4:4.8") - api("io.swagger.core.v3:swagger-core:2.1.1") + api("io.swagger.core.v3:swagger-core:2.1.2") api("org.jooq:jooq:3.13.1") api("com.google.api.grpc:proto-google-common-protos:1.18.0") + api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.70") + api("org.jetbrains.kotlin:kotlin-allopen:1.3.70") + api("org.springframework.boot:spring-boot-gradle-plugin:2.2.7.RELEASE") + api("org.jlleitschuh.gradle:ktlint-gradle:9.2.1") + api("com.github.ben-manes:gradle-versions-plugin:0.27.0") + api("com.netflix.nebula:nebula-publishing-plugin:17.2.1") + api("com.netflix.nebula:gradle-contacts-plugin:5.1.0") + api("com.netflix.nebula:gradle-info-plugin:7.1.4") + api("org.gradle.kotlin:plugins:1.2.11") + api("com.gradle.publish:plugin-publish-plugin:0.11.0") + api("org.eclipse.jgit:org.eclipse.jgit:5.7.0.202003110725-r") } } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6623300b..21e622da 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/lib/sisyphus-common/build.gradle.kts b/lib/sisyphus-common/build.gradle.kts index ac938e0a..c3ac5243 100644 --- a/lib/sisyphus-common/build.gradle.kts +++ b/lib/sisyphus-common/build.gradle.kts @@ -4,6 +4,8 @@ plugins { `java-library` } +description = "Common lib of Sisyphus Project" + dependencies { compileOnly(Dependencies.Spring.Boot.boot) } diff --git a/lib/sisyphus-dto/build.gradle.kts b/lib/sisyphus-dto/build.gradle.kts index 4b58632f..6c790ed4 100644 --- a/lib/sisyphus-dto/build.gradle.kts +++ b/lib/sisyphus-dto/build.gradle.kts @@ -4,6 +4,8 @@ plugins { `java-library` } +description = "Easy to create struct in Sisyphus" + dependencies { compileOnly(project(":lib:sisyphus-jackson")) implementation(project(":lib:sisyphus-common")) diff --git a/lib/sisyphus-grpc/build.gradle.kts b/lib/sisyphus-grpc/build.gradle.kts index c722f254..f0a97fc1 100644 --- a/lib/sisyphus-grpc/build.gradle.kts +++ b/lib/sisyphus-grpc/build.gradle.kts @@ -6,6 +6,8 @@ plugins { protobuf } +description = "Sisyphus customized gRPC runtime for Kotlin coroutine" + dependencies { implementation(project(":lib:sisyphus-jackson")) api(project(":lib:sisyphus-protobuf")) diff --git a/lib/sisyphus-grpc/src/main/kotlin/com/bybutter/sisyphus/cel/CelEngine.kt b/lib/sisyphus-grpc/src/main/kotlin/com/bybutter/sisyphus/cel/CelEngine.kt index 410e5adb..30f81aec 100644 --- a/lib/sisyphus-grpc/src/main/kotlin/com/bybutter/sisyphus/cel/CelEngine.kt +++ b/lib/sisyphus-grpc/src/main/kotlin/com/bybutter/sisyphus/cel/CelEngine.kt @@ -26,8 +26,3 @@ class CelEngine(global: Map, val runtime: CelRuntime = CelRuntime( } } } - -fun main() { - val engine = CelEngine(mapOf("intValue" to 1L, "test" to 1)) - engine -} diff --git a/lib/sisyphus-jackson/build.gradle.kts b/lib/sisyphus-jackson/build.gradle.kts index a3c3c79b..08ab4aab 100644 --- a/lib/sisyphus-jackson/build.gradle.kts +++ b/lib/sisyphus-jackson/build.gradle.kts @@ -4,6 +4,8 @@ plugins { `java-library` } +description = "Jackson utils for Sisyphus" + dependencies { api(project(":lib:sisyphus-common")) api(Dependencies.Jackson.Module.kotlin) diff --git a/lib/sisyphus-protobuf/build.gradle.kts b/lib/sisyphus-protobuf/build.gradle.kts index 27083290..67eed5ec 100644 --- a/lib/sisyphus-protobuf/build.gradle.kts +++ b/lib/sisyphus-protobuf/build.gradle.kts @@ -5,6 +5,8 @@ plugins { protobuf } +description = "Sisyphus customized Protobuf runtime for Kotlin" + dependencies { implementation(project(":lib:sisyphus-jackson")) api(project(":lib:sisyphus-common")) diff --git a/middleware/sisyphus-amqp/build.gradle.kts b/middleware/sisyphus-amqp/build.gradle.kts index 6e967e20..cea8c9a5 100644 --- a/middleware/sisyphus-amqp/build.gradle.kts +++ b/middleware/sisyphus-amqp/build.gradle.kts @@ -4,6 +4,8 @@ plugins { `java-library` } +description = "Middleware for using AMQP in Sisyphus Project" + dependencies { implementation(project(":lib:sisyphus-dto")) implementation(project(":lib:sisyphus-jackson")) diff --git a/middleware/sisyphus-configuration-artifact/build.gradle.kts b/middleware/sisyphus-configuration-artifact/build.gradle.kts index 9e220bde..ea6af686 100644 --- a/middleware/sisyphus-configuration-artifact/build.gradle.kts +++ b/middleware/sisyphus-configuration-artifact/build.gradle.kts @@ -4,6 +4,8 @@ plugins { `java-library` } +description = "Middleware for manage configuration of Sisyphus Project" + dependencies { implementation(project(":lib:sisyphus-common")) implementation(Dependencies.Maven.resolver) diff --git a/middleware/sisyphus-configuration-artifact/src/main/kotlin/com/bybutter/sisyphus/middleware/configuration/ConfigArtifactProvider.kt b/middleware/sisyphus-configuration-artifact/src/main/kotlin/com/bybutter/sisyphus/middleware/configuration/ConfigArtifactProvider.kt index b388068c..858b4345 100644 --- a/middleware/sisyphus-configuration-artifact/src/main/kotlin/com/bybutter/sisyphus/middleware/configuration/ConfigArtifactProvider.kt +++ b/middleware/sisyphus-configuration-artifact/src/main/kotlin/com/bybutter/sisyphus/middleware/configuration/ConfigArtifactProvider.kt @@ -40,6 +40,10 @@ class ConfigArtifactProvider : EnvironmentPostProcessor { aether.registerJCenter() null } + "portal" -> properties.repositories[repositoryKey] ?: run { + aether.registerGradlePortal() + null + } else -> properties.repositories[repositoryKey] } diff --git a/middleware/sisyphus-configuration-artifact/src/main/kotlin/com/bybutter/sisyphus/middleware/configuration/SisyphusProperty.kt b/middleware/sisyphus-configuration-artifact/src/main/kotlin/com/bybutter/sisyphus/middleware/configuration/SisyphusProperty.kt index 34ed35cf..debdafe4 100644 --- a/middleware/sisyphus-configuration-artifact/src/main/kotlin/com/bybutter/sisyphus/middleware/configuration/SisyphusProperty.kt +++ b/middleware/sisyphus-configuration-artifact/src/main/kotlin/com/bybutter/sisyphus/middleware/configuration/SisyphusProperty.kt @@ -11,7 +11,7 @@ val dependency: TargetRepositorySetting = TargetRepositorySetting(), val config: SisyphusConfigArtifacts ) -data class TargetRepositorySetting(val repositories: List = listOf("local", "central", "jcenter")) +data class TargetRepositorySetting(val repositories: List = listOf("local", "central", "jcenter", "portal")) data class Repository( val url: String, diff --git a/middleware/sisyphus-configuration-artifact/src/main/kotlin/com/bybutter/sisyphus/middleware/configuration/maven/Aether.kt b/middleware/sisyphus-configuration-artifact/src/main/kotlin/com/bybutter/sisyphus/middleware/configuration/maven/Aether.kt index 8da73c7c..48855526 100644 --- a/middleware/sisyphus-configuration-artifact/src/main/kotlin/com/bybutter/sisyphus/middleware/configuration/maven/Aether.kt +++ b/middleware/sisyphus-configuration-artifact/src/main/kotlin/com/bybutter/sisyphus/middleware/configuration/maven/Aether.kt @@ -61,6 +61,10 @@ class Aether { return registerRepository("https://jcenter.bintray.com/") } + fun registerGradlePortal(): RemoteRepository { + return registerRepository("https://plugins.gradle.org/m2/") + } + fun registerRepository(url: String, user: String? = null, password: String? = null): RemoteRepository { val authentication = if (user != null && password != null) { AuthenticationBuilder().addUsername(user).addPassword(password).build() diff --git a/middleware/sisyphus-elastic/build.gradle.kts b/middleware/sisyphus-elastic/build.gradle.kts index 54275acf..5b5d401b 100644 --- a/middleware/sisyphus-elastic/build.gradle.kts +++ b/middleware/sisyphus-elastic/build.gradle.kts @@ -4,6 +4,8 @@ plugins { `java-library` } +description = "Middleware for using ElasticSearch in Sisyphus Project" + dependencies { api(Dependencies.elastic5) } diff --git a/middleware/sisyphus-grpc-client/build.gradle.kts b/middleware/sisyphus-grpc-client/build.gradle.kts index 694fc0ea..6cbcb213 100644 --- a/middleware/sisyphus-grpc-client/build.gradle.kts +++ b/middleware/sisyphus-grpc-client/build.gradle.kts @@ -5,6 +5,8 @@ plugins { protobuf } +description = "Middleware for using gRPC client in Sisyphus Project" + dependencies { api(project(":lib:sisyphus-grpc")) implementation(Dependencies.Grpc.stub) diff --git a/middleware/sisyphus-grpc-client/src/test/kotlin/com/bybutter/sisyphus/middleware/grpc/test/RegisterTest.kt b/middleware/sisyphus-grpc-client/src/test/kotlin/com/bybutter/sisyphus/middleware/grpc/test/RegisterTest.kt index dfdd51c5..786338ea 100644 --- a/middleware/sisyphus-grpc-client/src/test/kotlin/com/bybutter/sisyphus/middleware/grpc/test/RegisterTest.kt +++ b/middleware/sisyphus-grpc-client/src/test/kotlin/com/bybutter/sisyphus/middleware/grpc/test/RegisterTest.kt @@ -2,9 +2,6 @@ package com.bybutter.sisyphus.middleware.grpc.test import com.bybutter.sisyphus.middleware.grpc.RpcServiceImpl import com.bybutter.sisyphus.middleware.grpc.SisyphusGrpcClientAutoConfiguration -import com.bybutter.sisyphus.middleware.grpc.test.Request -import com.bybutter.sisyphus.middleware.grpc.test.Response -import com.bybutter.sisyphus.middleware.grpc.test.RpcService import com.bybutter.sisyphus.rpc.GrpcContextCoroutineContextElement import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.channels.ReceiveChannel diff --git a/middleware/sisyphus-hbase/build.gradle.kts b/middleware/sisyphus-hbase/build.gradle.kts index f4de27f7..77486d95 100644 --- a/middleware/sisyphus-hbase/build.gradle.kts +++ b/middleware/sisyphus-hbase/build.gradle.kts @@ -4,6 +4,8 @@ plugins { `java-library` } +description = "Middleware for using HBase in Sisyphus Project" + dependencies { api(project(":lib:sisyphus-dto")) api(project(":lib:sisyphus-jackson")) diff --git a/middleware/sisyphus-jdbc/build.gradle.kts b/middleware/sisyphus-jdbc/build.gradle.kts index ae109695..d384dfe6 100644 --- a/middleware/sisyphus-jdbc/build.gradle.kts +++ b/middleware/sisyphus-jdbc/build.gradle.kts @@ -4,6 +4,8 @@ plugins { `java-library` } +description = "Middleware for using JDBC in Sisyphus Project" + dependencies { api(Dependencies.jooq) implementation(Dependencies.hikari) diff --git a/middleware/sisyphus-jdbc/src/test/kotlin/com/bybutter/sisyphus/middleware/jdbc/test/EmbeddedDatasourceConfig.kt b/middleware/sisyphus-jdbc/src/test/kotlin/com/bybutter/sisyphus/middleware/jdbc/test/EmbeddedDatasourceConfig.kt index 1e5373c2..a1c45ed9 100644 --- a/middleware/sisyphus-jdbc/src/test/kotlin/com/bybutter/sisyphus/middleware/jdbc/test/EmbeddedDatasourceConfig.kt +++ b/middleware/sisyphus-jdbc/src/test/kotlin/com/bybutter/sisyphus/middleware/jdbc/test/EmbeddedDatasourceConfig.kt @@ -4,8 +4,6 @@ import com.bybutter.sisyphus.middleware.jdbc.DefaultDslContextFactory import com.bybutter.sisyphus.middleware.jdbc.DslContextFactory import com.bybutter.sisyphus.middleware.jdbc.JdbcDatabaseProperty import com.bybutter.sisyphus.middleware.jdbc.JooqConfigInterceptor -import com.bybutter.sisyphus.middleware.jdbc.transaction.SisyphusTransactionProvider -import org.jooq.TransactionProvider import org.springframework.beans.factory.annotation.Autowired import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration diff --git a/middleware/sisyphus-redis/build.gradle.kts b/middleware/sisyphus-redis/build.gradle.kts index 1d987a4c..b64a9a5d 100644 --- a/middleware/sisyphus-redis/build.gradle.kts +++ b/middleware/sisyphus-redis/build.gradle.kts @@ -4,6 +4,8 @@ plugins { `java-library` } +description = "Middleware for using Redis cache in Sisyphus Project" + dependencies { api(project(":lib:sisyphus-common")) api(Dependencies.Spring.Boot.redis) diff --git a/middleware/sisyphus-retrofit/build.gradle.kts b/middleware/sisyphus-retrofit/build.gradle.kts index 2c4d5e40..7ae60260 100644 --- a/middleware/sisyphus-retrofit/build.gradle.kts +++ b/middleware/sisyphus-retrofit/build.gradle.kts @@ -4,6 +4,8 @@ plugins { `java-library` } +description = "Middleware for using Retrofit in Sisyphus Project" + dependencies { api(Dependencies.Kotlin.Coroutines.jdk) api(Dependencies.retrofit) diff --git a/starter/sisyphus-grpc-server-starter/build.gradle.kts b/starter/sisyphus-grpc-server-starter/build.gradle.kts index 76d343f5..d988daf8 100644 --- a/starter/sisyphus-grpc-server-starter/build.gradle.kts +++ b/starter/sisyphus-grpc-server-starter/build.gradle.kts @@ -5,6 +5,8 @@ plugins { protobuf } +description = "Starter for building gRPC server in Sisyphus Framework" + dependencies { api(project(":lib:sisyphus-protobuf")) api(project(":middleware:sisyphus-grpc-client")) diff --git a/starter/sisyphus-grpc-transcoding-starter/build.gradle.kts b/starter/sisyphus-grpc-transcoding-starter/build.gradle.kts index 671fbb2d..d73d5514 100644 --- a/starter/sisyphus-grpc-transcoding-starter/build.gradle.kts +++ b/starter/sisyphus-grpc-transcoding-starter/build.gradle.kts @@ -4,6 +4,8 @@ plugins { `java-library` } +description = "Starter for building gRPC server which with HTTP and gRPC Transcoding in Sisyphus Framework" + dependencies { api(project(":lib:sisyphus-protobuf")) api(project(":lib:sisyphus-grpc")) diff --git a/starter/sisyphus-jackson-starter/build.gradle.kts b/starter/sisyphus-jackson-starter/build.gradle.kts index 43b73eda..c52d2934 100644 --- a/starter/sisyphus-jackson-starter/build.gradle.kts +++ b/starter/sisyphus-jackson-starter/build.gradle.kts @@ -4,6 +4,8 @@ plugins { `java-library` } +description = "Starter for configuring HttpMessageEncoder with Jackson in Sisyphus Framework" + dependencies { api(project(":lib:sisyphus-jackson")) api(Dependencies.Spring.Boot.jackson) diff --git a/starter/sisyphus-protobuf-type-server-starter/build.gradle.kts b/starter/sisyphus-protobuf-type-server-starter/build.gradle.kts index 712bcb73..d3f069a6 100644 --- a/starter/sisyphus-protobuf-type-server-starter/build.gradle.kts +++ b/starter/sisyphus-protobuf-type-server-starter/build.gradle.kts @@ -4,6 +4,8 @@ plugins { `java-library` } +description = "Starter for build application with Protobuf type server in Sisyphus Framework" + dependencies { api(project(":lib:sisyphus-protobuf")) api(project(":lib:sisyphus-grpc")) diff --git a/starter/sisyphus-webflux-starter/build.gradle.kts b/starter/sisyphus-webflux-starter/build.gradle.kts index 1dd187b7..0c469c83 100644 --- a/starter/sisyphus-webflux-starter/build.gradle.kts +++ b/starter/sisyphus-webflux-starter/build.gradle.kts @@ -4,6 +4,8 @@ plugins { `java-library` } +description = "Starter for build application with String Webflux in Sisyphus Framework" + dependencies { api(project(":starter:sisyphus-jackson-starter")) api(Dependencies.Spring.Boot.webflux) diff --git a/tools/sisyphus-project-gradle-plugin/build.gradle.kts b/tools/sisyphus-project-gradle-plugin/build.gradle.kts index 2555f5c4..9c702fd3 100644 --- a/tools/sisyphus-project-gradle-plugin/build.gradle.kts +++ b/tools/sisyphus-project-gradle-plugin/build.gradle.kts @@ -3,23 +3,40 @@ tools plugins { `java-library` `java-gradle-plugin` + id("com.gradle.plugin-publish") } +description = "Plugin for easy configuring Gradle and plugins in Sisyphus Framework" + dependencies { implementation(Dependencies.Kotlin.reflect) implementation(Dependencies.Kotlin.plugin) - compileOnly("com.netflix.nebula:nebula-publishing-plugin:17.2.1") - compileOnly("org.jlleitschuh.gradle:ktlint-gradle:9.2.1") + compileOnly("com.netflix.nebula:nebula-publishing-plugin") + compileOnly("com.netflix.nebula:gradle-info-plugin") + compileOnly("com.netflix.nebula:gradle-contacts-plugin") + compileOnly("org.jlleitschuh.gradle:ktlint-gradle") } gradlePlugin { plugins { create("sisyphus") { - id = "sisyphus.project" - displayName = "Plugin for developing project based on sisyphus framework." - description = "Easy configuare develop environment for project based on sisyphus framework." + id = "com.bybutter.sisyphus.project" + displayName = "Sisyphus Project Plugin" + description = "Easy configure develop environment for project based on sisyphus framework." implementationClass = "com.bybutter.sisyphus.project.gradle.SisyphusProjectPlugin" } } } + +pluginBundle { + website = "https://github.com/ButterCam/sisyphus" + vcsUrl = "https://github.com/ButterCam/sisyphus" + description = "Easy configure develop environment for project based on sisyphus framework." + + (plugins) { + "sisyphus" { + tags = listOf("sisyphus", "project") + } + } +} diff --git a/tools/sisyphus-project-gradle-plugin/src/main/kotlin/com/bybutter/sisyphus/project/gradle/SisyphusExtension.kt b/tools/sisyphus-project-gradle-plugin/src/main/kotlin/com/bybutter/sisyphus/project/gradle/SisyphusExtension.kt index 8782bfcf..83694461 100644 --- a/tools/sisyphus-project-gradle-plugin/src/main/kotlin/com/bybutter/sisyphus/project/gradle/SisyphusExtension.kt +++ b/tools/sisyphus-project-gradle-plugin/src/main/kotlin/com/bybutter/sisyphus/project/gradle/SisyphusExtension.kt @@ -19,15 +19,13 @@ open class SisyphusExtension(val project: Project) { var repositories: MutableMap = hashMapOf() - var dependencyRepositories: MutableList = mutableListOf("local", "central", "jcenter") + var dependencyRepositories: MutableList = mutableListOf("local", "central", "jcenter", "portal") var releaseRepositories: MutableList = mutableListOf("release") var snapshotRepositories: MutableList = mutableListOf("snapshot") - var internalGroupPrefix: MutableList = mutableListOf() - - var externalGroups: MutableSet = hashSetOf() + val signKeyName: String? init { val developer: String? = project.findProperty("sisyphus.developer") as? String @@ -59,10 +57,8 @@ open class SisyphusExtension(val project: Project) { ?: releaseRepositories snapshotRepositories = (project.findProperty("sisyphus.snapshot.repositories") as? String)?.split(',')?.toMutableList() ?: snapshotRepositories - internalGroupPrefix = (project.findProperty("sisyphus.internalGroupPrefix") as? String)?.split(',')?.toMutableList() - ?: internalGroupPrefix - externalGroups = (project.findProperty("sisyphus.externalGroups") as? String)?.split(',')?.toMutableSet() - ?: externalGroups + + signKeyName = project.findProperty("signing.gnupg.keyName") as? String } companion object { diff --git a/tools/sisyphus-project-gradle-plugin/src/main/kotlin/com/bybutter/sisyphus/project/gradle/SisyphusProjectPlugin.kt b/tools/sisyphus-project-gradle-plugin/src/main/kotlin/com/bybutter/sisyphus/project/gradle/SisyphusProjectPlugin.kt index 9bd0502d..ad7ddb08 100644 --- a/tools/sisyphus-project-gradle-plugin/src/main/kotlin/com/bybutter/sisyphus/project/gradle/SisyphusProjectPlugin.kt +++ b/tools/sisyphus-project-gradle-plugin/src/main/kotlin/com/bybutter/sisyphus/project/gradle/SisyphusProjectPlugin.kt @@ -2,7 +2,9 @@ package com.bybutter.sisyphus.project.gradle import java.io.File import java.net.URI +import nebula.plugin.contacts.ContactsExtension import nebula.plugin.publishing.maven.MavenPublishPlugin +import nebula.plugin.publishing.publications.JavadocJarPlugin import nebula.plugin.publishing.publications.SourceJarPlugin import org.gradle.api.Action import org.gradle.api.Plugin @@ -11,6 +13,8 @@ import org.gradle.api.artifacts.dsl.RepositoryHandler import org.gradle.api.publish.PublishingExtension import org.gradle.api.publish.maven.MavenPublication import org.gradle.api.tasks.SourceSetContainer +import org.gradle.plugins.signing.SigningExtension +import org.gradle.plugins.signing.SigningPlugin import org.jlleitschuh.gradle.ktlint.KtlintExtension import org.jlleitschuh.gradle.ktlint.reporter.ReporterType @@ -53,6 +57,7 @@ class SisyphusProjectPlugin : Plugin { try { target.pluginManager.apply(MavenPublishPlugin::class.java) target.pluginManager.apply(SourceJarPlugin::class.java) + target.pluginManager.apply(JavadocJarPlugin::class.java) } catch (exception: NoClassDefFoundError) { target.logger.debug("Skip apply library plugin due to java library plugins not existed.") return @@ -90,9 +95,48 @@ class SisyphusProjectPlugin : Plugin { return } + target.tryApplyPluginClass("nebula.plugin.info.InfoPlugin") + if (target.tryApplyPluginClass("nebula.plugin.contacts.ContactsPlugin")) { + if (target != target.rootProject) { + val rootContacts = target.rootProject.extensions.findByType(ContactsExtension::class.java) + if (rootContacts != null) { + val currentContacts = target.extensions.getByType(ContactsExtension::class.java) + + for ((email, person) in rootContacts.people) { + if (!currentContacts.people.containsKey(email)) { + currentContacts.people[email] = person + } + } + } + } + } + val extension = target.extensions.getByType(SisyphusExtension::class.java) val publishingExtension = target.extensions.getByType(PublishingExtension::class.java) + publishingExtension.publications.withType(MavenPublication::class.java) { + it.pom { + it.licenses { + it.license { + it.name.set("MIT License") + it.url.set("https://github.com/ButterCam/sisyphus/blob/master/LICENSE") + it.distribution.set("repo") + } + } + } + } + + if (!extension.signKeyName.isNullOrEmpty()) { + target.pluginManager.apply(SigningPlugin::class.java) + val signing = target.extensions.getByType(SigningExtension::class.java) + signing.useGpgCmd() + target.afterEvaluate { + publishingExtension.publications.all { + signing.sign(it) + } + } + } + if (extension.isRelease) { publishingExtension.repositories.applyFromRepositoryKeys(extension.repositories, extension.releaseRepositories) } @@ -159,6 +203,10 @@ class SisyphusProjectPlugin : Plugin { this.jcenter() null } + "portal" -> repositories[repositoryKey] ?: run { + this.gradlePluginPortal() + null + } else -> repositories[repositoryKey] } @@ -167,9 +215,19 @@ class SisyphusProjectPlugin : Plugin { this.maven { it.name = repositoryKey it.url = URI.create(repository.url) - it.credentials.username = repository.username - it.credentials.password = repository.password + it.credentials.username = repository.username ?: "" + it.credentials.password = repository.password ?: "" } } } + + private fun Project.tryApplyPluginClass(className: String): Boolean { + return try { + val plugin = Class.forName(className) + this.pluginManager.apply(plugin) + true + } catch (ex: ClassNotFoundException) { + false + } + } } diff --git a/tools/sisyphus-protobuf-gradle-plugin/build.gradle.kts b/tools/sisyphus-protobuf-gradle-plugin/build.gradle.kts index 1cf76d06..d282f725 100644 --- a/tools/sisyphus-protobuf-gradle-plugin/build.gradle.kts +++ b/tools/sisyphus-protobuf-gradle-plugin/build.gradle.kts @@ -3,8 +3,11 @@ tools plugins { `java-library` `java-gradle-plugin` + id("com.gradle.plugin-publish") } +description = "Plugin for compiling proto files with Gradle in Sisyphus Framework" + dependencies { implementation(project(":lib:sisyphus-common")) implementation(project(":lib:sisyphus-grpc")) @@ -19,8 +22,22 @@ dependencies { gradlePlugin { plugins { create("protobuf") { - id = "sisyphus.protobuf" + id = "com.bybutter.sisyphus.protobuf" + displayName = "Sisyphus Protobuf Plugin" + description = "Protobuf compiler plugin for sisyphus framework." implementationClass = "com.bybutter.sisyphus.protobuf.gradle.ProtobufPlugin" } } } + +pluginBundle { + website = "https://github.com/ButterCam/sisyphus" + vcsUrl = "https://github.com/ButterCam/sisyphus" + description = "Protobuf compiler plugin for sisyphus framework." + + (plugins) { + "protobuf" { + tags = listOf("sisyphus", "protobuf", "grpc") + } + } +} diff --git a/tools/sisyphus-protoc/build.gradle.kts b/tools/sisyphus-protoc/build.gradle.kts index 36232cd7..c5b7c907 100644 --- a/tools/sisyphus-protoc/build.gradle.kts +++ b/tools/sisyphus-protoc/build.gradle.kts @@ -4,6 +4,8 @@ plugins { `java-library` } +description = "Protoc plugin for Sisyphus customized Protobuf runtime" + dependencies { implementation(project(":lib:sisyphus-protobuf")) implementation(project(":lib:sisyphus-grpc"))