-
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
16 changed files
with
727 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# | ||
# https://help.github.com/articles/dealing-with-line-endings/ | ||
# | ||
# Linux start script should use lf | ||
/gradlew text eol=lf | ||
|
||
# These are Windows script files and should use crlf | ||
*.bat text eol=crlf | ||
|
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 @@ | ||
name: Test Build | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- 'main' | ||
|
||
jobs: | ||
tests: | ||
name: "Test build" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: zulu | ||
java-version: 8 | ||
- uses: gradle/gradle-build-action@v2 | ||
with: | ||
gradle-version: 8.3 | ||
- run: git submodule update --init --recursive && sleep 10 && gradle build | ||
- name: Dump docker logs | ||
if: always() | ||
uses: jwalton/gh-docker-logs@v2 | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "xdb-apis"] | ||
path = xdb-apis | ||
url = https://github.com/xdblab/xdb-apis |
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 |
---|---|---|
@@ -1 +1 @@ | ||
# xdb-java-sdk | ||
# xdb-java-sdk |
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,196 @@ | ||
/* | ||
* This file was generated by the Gradle 'init' task. | ||
* | ||
* This is a general purpose Gradle build. | ||
* To learn more about Gradle by exploring our Samples at https://docs.gradle.org/8.3/samples | ||
* This project uses @Incubating APIs which are subject to change. | ||
*/ | ||
|
||
plugins { | ||
id 'java-library' | ||
id "org.openapi.generator" version "6.6.0" | ||
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' | ||
id "maven-publish" | ||
id 'signing' | ||
id 'jacoco' | ||
id 'com.diffplug.spotless' version "6.13.0" | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
withJavadocJar() | ||
withSourcesJar() | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
// for openapi generator | ||
implementation 'com.google.guava:guava:32.1.2-jre' | ||
implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" | ||
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2' | ||
implementation 'io.github.openfeign:feign-okhttp:12.5' | ||
implementation 'io.github.openfeign:feign-jackson:12.5' | ||
implementation 'io.github.openfeign:feign-slf4j:12.5' | ||
implementation 'io.github.openfeign.form:feign-form:3.8.0' | ||
implementation 'org.openapitools:jackson-databind-nullable:0.2.6' | ||
implementation 'javax.annotation:javax.annotation-api:1.3.2' | ||
|
||
// lombok | ||
compileOnly 'org.projectlombok:lombok:1.18.30' | ||
annotationProcessor 'org.projectlombok:lombok:1.18.30' | ||
|
||
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0' | ||
testCompileOnly 'org.projectlombok:lombok:1.18.30' | ||
testAnnotationProcessor 'org.projectlombok:lombok:1.18.30' | ||
} | ||
|
||
// open api | ||
|
||
openApiValidate { | ||
inputSpec.set("$rootDir/xdb-apis/api-schema/xdb.yaml") | ||
} | ||
|
||
openApiGenerate { | ||
generatorName = "java" | ||
inputSpec = "$rootDir/xdb-apis/api-schema/xdb.yaml".toString() | ||
outputDir = "$buildDir/generated".toString() | ||
apiPackage = "io.xdb.gen.api" | ||
modelPackage = "io.xdb.gen.models" | ||
invokerPackage = "io.xdb.gen.api" | ||
configOptions = [ | ||
configPackage: "io.xdb.gen.configuration", | ||
basePackage : "io.xdb.gen", | ||
library : "feign", | ||
interfaceOnly: "true" | ||
] | ||
} | ||
|
||
compileJava.dependsOn tasks.openApiGenerate | ||
sourceSets.main.java.srcDirs += "$buildDir/generated/src/main/java" | ||
|
||
tasks.named('sourcesJar').configure { | ||
dependsOn tasks.openApiGenerate | ||
} | ||
|
||
// test | ||
|
||
tasks.named('test') { | ||
// Use JUnit Platform for unit tests. | ||
useJUnitPlatform() | ||
} | ||
|
||
jacocoTestReport { | ||
reports { | ||
html.outputLocation = layout.buildDirectory.dir('jacocoHtml') | ||
} | ||
} | ||
|
||
check.dependsOn tasks.jacocoTestReport | ||
|
||
// spotless | ||
|
||
spotless { | ||
def prettierPlugins = [ | ||
"prettier": "2.5.1", | ||
"prettier-plugin-java": "1.6.1", | ||
] | ||
|
||
def ignoredDirs = [ | ||
'.gradle/**', | ||
'.idea/**', | ||
'build/**' | ||
] | ||
|
||
format 'misc', { | ||
// define the files to apply `misc` to | ||
target '*.gradle', '.gitignore' | ||
targetExclude(ignoredDirs) | ||
|
||
// define the steps to apply to those files | ||
trimTrailingWhitespace() | ||
indentWithTabs() // or spaces. Takes an integer argument if you don't like 4 | ||
endWithNewline() | ||
} | ||
format 'markdown', { | ||
target '*.md' | ||
targetExclude(ignoredDirs) | ||
|
||
prettier(prettierPlugins).config([ | ||
'parser': 'markdown' | ||
]) | ||
} | ||
java { | ||
targetExclude(ignoredDirs) | ||
|
||
importOrder() | ||
|
||
removeUnusedImports() | ||
|
||
prettier(prettierPlugins).config([ | ||
'parser': 'java', | ||
'tabWidth': 4, | ||
'printWidth': 120 | ||
]) | ||
} | ||
} | ||
|
||
test.dependsOn tasks.spotlessApply | ||
|
||
// publish | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from(components.java) | ||
|
||
pom { | ||
name = "xdb-java-sdk" | ||
description = "xdb java sdk core" | ||
url = 'https://github.com/xdblab/xdb-java-sdk' | ||
|
||
scm { | ||
connection = 'scm:[email protected]:xdblab/xdb-java-sdk.git' | ||
developerConnection = 'scm:[email protected]:xdblab/xdb-java-sdk.git' | ||
url = 'https://github.com/xdblab/xdb-java-sdk' | ||
} | ||
|
||
licenses { | ||
license { | ||
name = 'The Apache License, Version 2.0' | ||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id = 'zhukaili' | ||
name = 'Kaili Zhu' | ||
email = '[email protected]' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
sign publishing.publications.mavenJava | ||
} | ||
|
||
group = "io.xdb" | ||
version = "0.0.1" | ||
|
||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) | ||
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) | ||
// username = project.property('myNexusUsername') | ||
// password = project.property('myNexusPassword') | ||
} | ||
} | ||
} |
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,6 @@ | ||
# This file was generated by the Gradle 'init' task. | ||
# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties | ||
|
||
org.gradle.parallel=true | ||
org.gradle.caching=true | ||
|
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,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.