-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
92 changed files
with
4,040 additions
and
382 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,41 +5,39 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent | |
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
val kotlinVersion: String by project | ||
val kotlinCoroutinesVersion: String by project | ||
val reactorVersion: String by project | ||
val springBootVersion: String by project | ||
val springCloudVersion: String by project | ||
val jacocoToolVersion: String by project | ||
val logbackVersion: String by project | ||
val javaxAnnotationApiVersion: String by project | ||
val caffeineCacheVersion: String by project | ||
|
||
val ioGrpcVersion: String by project | ||
val ioGrpcKotlinVersion: String by project | ||
val protobufVersion: String by project | ||
|
||
val junitPlatformLauncherVersion: String by project | ||
val junitBom: String by project | ||
val mockkVersion: String by project | ||
val springMockkVersion: String by project | ||
val wireMockVersion: String by project | ||
|
||
val ktorVersion: String by project | ||
|
||
val weMavenUser: String? by project | ||
val weMavenPassword: String? by project | ||
|
||
val sonaTypeMavenUser: String? by project | ||
val sonaTypeMavenPassword: String? by project | ||
|
||
val weMavenBasePath = "https://artifacts.wavesenterprise.com/repository/" | ||
val weMavenBasePath: String by project | ||
|
||
val sonaTypeBasePath = "https://s01.oss.sonatype.org" | ||
val gitHubProject = "waves-enterprise/we-node-client" | ||
val githubUrl = "https://github.com/$gitHubProject" | ||
val sonaTypeBasePath: String by project | ||
val gitHubProject: String by project | ||
val githubUrl: String by project | ||
|
||
val feignVersion: String by project | ||
val jacksonModuleKotlin: String by project | ||
|
||
val weNodeClientVersion: String by project | ||
val weContractSdkVersion: String by project | ||
|
||
val aspectjVersion: String by project | ||
|
||
val kotlinCoroutinesVersion: String by project | ||
|
||
plugins { | ||
kotlin("jvm") apply false | ||
`maven-publish` | ||
|
@@ -77,13 +75,70 @@ allprojects { | |
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
if (weMavenUser != null && weMavenPassword != null) { | ||
maven { | ||
name = "we-snapshots" | ||
url = uri("https://artifacts.wavesenterprise.com/repository/maven-snapshots/") | ||
mavenContent { | ||
snapshotsOnly() | ||
} | ||
credentials { | ||
username = weMavenUser | ||
password = weMavenPassword | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
subprojects { | ||
apply(plugin = "maven-publish") | ||
|
||
publishing { | ||
repositories { | ||
if (weMavenUser != null && weMavenPassword != null) { | ||
maven { | ||
name = "WE-artifacts" | ||
afterEvaluate { | ||
url = uri( | ||
"$weMavenBasePath${ | ||
if (project.version.toString() | ||
.endsWith("-SNAPSHOT") | ||
) "maven-snapshots" else "maven-releases" | ||
}" | ||
) | ||
} | ||
credentials { | ||
username = weMavenUser | ||
password = weMavenPassword | ||
} | ||
} | ||
} | ||
|
||
if (sonaTypeMavenPassword != null && sonaTypeMavenUser != null) { | ||
maven { | ||
name = "SonaType-maven-central-staging" | ||
val releasesUrl = uri("$sonaTypeBasePath/service/local/staging/deploy/maven2/") | ||
afterEvaluate { | ||
url = if (version.toString() | ||
.endsWith("SNAPSHOT") | ||
) throw kotlin.Exception("shouldn't publish snapshot") else releasesUrl | ||
} | ||
credentials { | ||
username = sonaTypeMavenUser | ||
password = sonaTypeMavenPassword | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
configure( | ||
subprojects.filter { it.name != "we-sdk-spring-bom" } | ||
) { | ||
apply(plugin = "io.spring.dependency-management") | ||
apply(plugin = "kotlin") | ||
apply(plugin = "maven-publish") | ||
apply(plugin = "signing") | ||
apply(plugin = "io.gitlab.arturbosch.detekt") | ||
apply(plugin = "org.jlleitschuh.gradle.ktlint") | ||
|
@@ -143,41 +198,6 @@ subprojects { | |
} | ||
|
||
publishing { | ||
repositories { | ||
if (weMavenUser != null && weMavenPassword != null) { | ||
maven { | ||
name = "WE-artifacts" | ||
afterEvaluate { | ||
url = uri("$weMavenBasePath${ | ||
if (project.version.toString() | ||
.endsWith("-SNAPSHOT") | ||
) "maven-snapshots" else "maven-releases" | ||
}") | ||
} | ||
credentials { | ||
username = weMavenUser | ||
password = weMavenPassword | ||
} | ||
} | ||
} | ||
|
||
if (sonaTypeMavenPassword != null && sonaTypeMavenUser != null) { | ||
maven { | ||
name = "SonaType-maven-central-staging" | ||
val releasesUrl = uri("$sonaTypeBasePath/service/local/staging/deploy/maven2/") | ||
afterEvaluate { | ||
url = if (version.toString() | ||
.endsWith("SNAPSHOT") | ||
) throw kotlin.Exception("shouldn't publish snapshot") else releasesUrl | ||
} | ||
credentials { | ||
username = sonaTypeMavenUser | ||
password = sonaTypeMavenPassword | ||
} | ||
} | ||
} | ||
} | ||
|
||
publications { | ||
create<MavenPublication>("mavenJava") { | ||
from(components["java"]) | ||
|
@@ -193,8 +213,8 @@ subprojects { | |
pom { | ||
packaging = "jar" | ||
name.set(project.name) | ||
url.set(githubUrl) | ||
description.set("WE Node Client for Java/Kotlin") | ||
url.set(githubUrl + gitHubProject) | ||
description.set("WE starter for Java/Kotlin") | ||
|
||
licenses { | ||
license { | ||
|
@@ -204,9 +224,9 @@ subprojects { | |
} | ||
|
||
scm { | ||
connection.set("scm:$githubUrl") | ||
connection.set("scm:$githubUrl$gitHubProject") | ||
developerConnection.set("scm:[email protected]:$gitHubProject.git") | ||
url.set(githubUrl) | ||
url.set(githubUrl + gitHubProject) | ||
} | ||
|
||
developers { | ||
|
@@ -216,9 +236,9 @@ subprojects { | |
email.set("[email protected]") | ||
} | ||
developer { | ||
id.set("bekirev") | ||
name.set("Artem Bekirev") | ||
email.set("abekirev@gmail.com") | ||
id.set("donyfutura") | ||
name.set("Daniil Georgiev") | ||
email.set("donyfutura@gmail.com") | ||
} | ||
} | ||
} | ||
|
@@ -236,47 +256,18 @@ subprojects { | |
|
||
the<DependencyManagementExtension>().apply { | ||
imports { | ||
mavenBom("org.springframework.boot:spring-boot-dependencies:$springBootVersion") | ||
mavenBom("org.springframework.cloud:spring-cloud-dependencies:$springCloudVersion") | ||
mavenBom("org.springframework.boot:spring-boot-dependencies:$springBootVersion") { | ||
bomProperty("kotlin.version", kotlinVersion) | ||
} | ||
mavenBom("com.wavesenterprise:we-node-client-bom:$weNodeClientVersion") | ||
mavenBom("com.wavesenterprise:we-contract-sdk-bom:$weContractSdkVersion") | ||
mavenBom("io.github.openfeign:feign-bom:$feignVersion") | ||
mavenBom("org.junit:junit-bom:$junitBom") | ||
} | ||
dependencies { | ||
dependency("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:$kotlinCoroutinesVersion") | ||
dependency("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$kotlinCoroutinesVersion") | ||
dependency("org.jetbrains.kotlinx:kotlinx-coroutines-slf4j:$kotlinCoroutinesVersion") | ||
|
||
dependency("javax.annotation:javax.annotation-api:$javaxAnnotationApiVersion") | ||
|
||
dependency("io.projectreactor:reactor-core:$reactorVersion") | ||
|
||
dependency("com.google.protobuf:protobuf-java:$protobufVersion") | ||
dependency("io.grpc:grpc-core:$ioGrpcVersion") | ||
dependency("io.grpc:grpc-stub:$ioGrpcVersion") | ||
dependency("io.grpc:grpc-netty:$ioGrpcVersion") | ||
dependency("io.grpc:grpc-protobuf:$ioGrpcVersion") | ||
|
||
dependency("com.google.protobuf:protobuf-kotlin:$protobufVersion") | ||
dependency("io.grpc:grpc-kotlin-stub:$ioGrpcKotlinVersion") | ||
|
||
dependency("ch.qos.logback:logback-classic:$logbackVersion") | ||
|
||
dependency("io.ktor:ktor-client-core:$ktorVersion") | ||
dependency("io.ktor:ktor-client-cio:$ktorVersion") | ||
dependency("io.ktor:ktor-client-logging:$ktorVersion") | ||
dependency("io.ktor:ktor-client-content-negotiation:$ktorVersion") | ||
dependency("io.ktor:ktor-serialization-jackson:$ktorVersion") | ||
|
||
dependency("io.github.openfeign:feign-core:$feignVersion") | ||
dependency("io.github.openfeign:feign-jackson:$feignVersion") | ||
dependency("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonModuleKotlin") | ||
dependency("com.github.ben-manes.caffeine:caffeine:$caffeineCacheVersion") | ||
|
||
dependency("org.junit.platform:junit-platform-launcher:$junitPlatformLauncherVersion") | ||
dependency("io.mockk:mockk:$mockkVersion") | ||
dependency("com.ninja-squad:springmockk:$springMockkVersion") | ||
dependency("com.github.tomakehurst:wiremock-jre8:$wireMockVersion") | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
plugins { | ||
`java-gradle-plugin` | ||
`kotlin-dsl` | ||
kotlin("jvm") version "1.5.21" | ||
} | ||
|
||
group = "com.wavesenterprise.sdk.spring.plugin" | ||
version = "1.0" | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
|
||
gradlePlugin { | ||
plugins { | ||
create("optionalDependencyPlugin") { | ||
id = "com.wavesenterprise.sdk.spring.plugin.optional" | ||
implementationClass = "com.wavesenterprise.sdk.spring.plugin.optional.OptionalDependenciesPlugin" | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(kotlin("stdlib")) | ||
} |
35 changes: 35 additions & 0 deletions
35
.../main/kotlin/com/wavesenterprise/sdk/spring/plugin/optional/OptionalDependenciesPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.wavesenterprise.sdk.spring.plugin.optional | ||
|
||
import org.gradle.api.Action | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.api.artifacts.Configuration | ||
import org.gradle.api.plugins.JavaPlugin | ||
import org.gradle.api.plugins.JavaPluginExtension | ||
import org.gradle.api.tasks.SourceSet | ||
import org.gradle.api.tasks.SourceSetContainer | ||
|
||
|
||
/** | ||
* OptionalDependenciesPlugin from spring-boot | ||
* @see org.springframework.boot.build.optional.OptionalDependenciesPlugin | ||
*/ | ||
class OptionalDependenciesPlugin : Plugin<Project> { | ||
override fun apply(project: Project) { | ||
val optional: Configuration = project.getConfigurations().create(OPTIONAL_CONFIGURATION_NAME) | ||
optional.setCanBeConsumed(false) | ||
optional.setCanBeResolved(false) | ||
project.getPlugins().withType(JavaPlugin::class.java) { | ||
val sourceSets: SourceSetContainer = | ||
project.getExtensions().getByType(JavaPluginExtension::class.java).getSourceSets() | ||
sourceSets.all { | ||
project.getConfigurations().getByName(this.compileClasspathConfigurationName).extendsFrom(optional) | ||
project.getConfigurations().getByName(this.runtimeClasspathConfigurationName).extendsFrom(optional) | ||
} | ||
} | ||
} | ||
|
||
companion object { | ||
private const val OPTIONAL_CONFIGURATION_NAME = "optional" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
buildSrc/src/main/resources/META-INF/optional.plugin.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
implementation-class=com.wavesenterprise.sdk.spring.plugin.optional.OptionalDependenciesPlugin |
Oops, something went wrong.