-
-
Notifications
You must be signed in to change notification settings - Fork 141
Infra: Add gradle p.1 #783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6e4b3ec
b4e6cb0
e57268b
29b1cb0
505c719
1689458
6cf9492
4a0e132
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,3 +43,6 @@ build/ | |
|
||
/docker/*.override.yaml | ||
/e2e-tests/allure-results/ | ||
out/ | ||
node_modules/ | ||
.gradle |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
|
||
plugins { | ||
id 'antlr' | ||
id 'checkstyle' | ||
alias(libs.plugins.spring.boot) | ||
alias(libs.plugins.git.properties) | ||
alias(libs.plugins.docker.remote.api) | ||
} | ||
|
||
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage | ||
|
||
dependencies { | ||
implementation project(":contract") | ||
if (prod) { | ||
implementation project(":frontend") | ||
} | ||
implementation project(":serde-api") | ||
implementation libs.spring.starter.webflux | ||
implementation libs.spring.starter.security | ||
implementation libs.spring.starter.actuator | ||
implementation libs.spring.starter.logging | ||
implementation libs.spring.starter.oauth2.client | ||
implementation libs.spring.boot.actuator | ||
compileOnly libs.spring.boot.devtools | ||
|
||
implementation libs.spring.security.ldap | ||
|
||
implementation libs.kafka.clients | ||
|
||
implementation libs.apache.avro | ||
implementation libs.apache.commons | ||
implementation libs.apache.commons.pool2 | ||
implementation libs.apache.datasketches | ||
|
||
implementation libs.confluent.schema.registry.client | ||
implementation libs.confluent.avro.serializer | ||
implementation libs.confluent.protobuf.serializer | ||
implementation libs.confluent.json.schema.serializer | ||
|
||
implementation libs.aws.msk.auth | ||
implementation (libs.azure.identity) { | ||
exclude group: 'io.netty', module: 'netty-tcnative-boringssl-static' | ||
} | ||
|
||
implementation libs.jackson.databind.nullable | ||
implementation libs.cel | ||
antlr libs.antlr | ||
implementation libs.antlr.runtime | ||
|
||
implementation libs.opendatadiscovery.oddrn | ||
implementation (libs.opendatadiscovery.client) { | ||
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-webflux' | ||
exclude group: 'io.projectreactor', module: 'reactor-core' | ||
exclude group: 'io.projectreactor.ipc', module: 'reactor-netty' | ||
} | ||
|
||
runtimeOnly libs.micrometer.registry.prometheus | ||
|
||
// CVE Fixes | ||
implementation libs.apache.commons.compress | ||
implementation libs.okhttp3.logging.intercepter | ||
|
||
// Annotation processors | ||
implementation libs.lombok | ||
implementation libs.mapstruct | ||
annotationProcessor libs.lombok | ||
annotationProcessor libs.mapstruct.processor | ||
annotationProcessor libs.spring.boot.configuration.processor | ||
testAnnotationProcessor libs.lombok | ||
testAnnotationProcessor libs.mapstruct.processor | ||
|
||
// Tests | ||
testImplementation libs.spring.starter.test | ||
testImplementation libs.reactor.test | ||
testImplementation libs.testcontainers | ||
testImplementation libs.testcontainers.kafka | ||
testImplementation libs.testcontainers.jupiter | ||
testImplementation libs.junit.jupiter.engine | ||
testImplementation libs.mockito.core | ||
testImplementation libs.mockito.jupiter | ||
testImplementation libs.bytebuddy | ||
testImplementation libs.assertj | ||
testImplementation libs.jsonschemavalidator | ||
|
||
testImplementation libs.okhttp3 | ||
testImplementation libs.okhttp3.mockwebserver | ||
} | ||
|
||
generateGrammarSource { | ||
maxHeapSize = "64m" | ||
arguments += ["-package", "ksql"] | ||
} | ||
|
||
sourceSets { | ||
main { | ||
antlr { | ||
srcDirs = ["src/main/antlr4"] | ||
} | ||
java { | ||
srcDirs += generateGrammarSource.outputDirectory | ||
} | ||
} | ||
} | ||
|
||
tasks.withType(Checkstyle) { | ||
exclude '**/ksql/**' | ||
} | ||
|
||
checkstyle { | ||
toolVersion = libs.versions.checkstyle.get() | ||
configFile = rootProject.file('etc/checkstyle/checkstyle.xml') | ||
ignoreFailures = false | ||
maxWarnings = 0 | ||
maxErrors = 0 | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} | ||
|
||
tasks.register('buildDockerImage', DockerBuildImage) { | ||
inputDir = projectDir | ||
dockerFile = project.layout.projectDirectory.file('Dockerfile') | ||
buildArgs = [ | ||
'JAR_FILE': "build/libs/${project.name}-${project.version}.jar" | ||
] | ||
images.add("ghcr.io/kafbat/kafka-ui:${project.version}") | ||
} | ||
|
||
tasks.build.finalizedBy buildDockerImage |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -456,10 +456,10 @@ | |
<goal>copy-resources</goal> | ||
</goals> | ||
<configuration> | ||
<outputDirectory>${basedir}/target/classes/static</outputDirectory> | ||
<outputDirectory>${basedir}/target/classes/</outputDirectory> | ||
<resources> | ||
<resource> | ||
<directory>../frontend/build</directory> | ||
<directory>../frontend/build/vite/static</directory> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After this change and https://github.com/kafbat/kafka-ui/pull/783/files/4a0e1329e6ec4132ef5dc00e0ecdf8135836688f#diff-f35103f068e191d5d8933637b2d4217d8f90a78728ccab1bada951a8d1c83590R459, if you build the project as before using Maven and the command
@Haarolean Could you please let me know if there are plans to support Maven builds during some transition period, or will the files related to Maven be removed in the near future? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wernerdv gradle migration is complete though, you can achieve the same this way:
The rest of maven-related files are to be removed. Let me know if you experience any issues with building via gradle. |
||
</resource> | ||
</resources> | ||
</configuration> | ||
|
@@ -522,7 +522,7 @@ | |
<build> | ||
<contextDir>${project.basedir}</contextDir> | ||
<args> | ||
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE> | ||
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE> | ||
</args> | ||
</build> | ||
</image> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
plugins { | ||
alias(libs.plugins.nexus.publish.plugin) | ||
} | ||
|
||
subprojects { | ||
apply plugin: "java" | ||
|
||
repositories { | ||
mavenCentral() | ||
maven { | ||
name = 'confluent' | ||
url = 'https://packages.confluent.io/maven/' | ||
} | ||
} | ||
|
||
group = 'io.kafbat' | ||
version = version | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_21 | ||
targetCompatibility = JavaVersion.VERSION_21 | ||
} | ||
} | ||
|
||
boolean resolveBooleanProperty(String propertyName, boolean defaultValue = false) { | ||
def propertyValueStr = findProperty(propertyName) | ||
return propertyValueStr == null ? defaultValue : propertyValueStr.toBoolean(); | ||
} | ||
|
||
ext { | ||
prod = resolveBooleanProperty("prod") | ||
} | ||
|
||
if (prod) { | ||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
nexusUrl = uri("https://s01.oss.sonatype.org/service/local/") | ||
snapshotRepositoryUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/") | ||
|
||
username = sonatypeUsername | ||
password = sonatypePassword | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask | ||
|
||
plugins { | ||
id "java-library" | ||
alias(libs.plugins.openapi.generator) | ||
} | ||
|
||
|
||
def specDir = project.layout.projectDirectory.dir("src/main/resources/swagger/") | ||
def targetDir = project.layout.buildDirectory.dir("generated").get() | ||
|
||
dependencies { | ||
implementation libs.spring.starter.webflux | ||
implementation libs.spring.starter.validation | ||
api libs.swagger.integration.jakarta | ||
api libs.jackson.databind.nullable | ||
api libs.annotation.api | ||
compileOnly libs.lombok | ||
annotationProcessor libs.lombok | ||
} | ||
|
||
tasks.register('generateUiClient', GenerateTask) { | ||
generatorName = "java" | ||
inputSpec = specDir.file("kafbat-ui-api.yaml").asFile.absolutePath | ||
outputDir = targetDir.dir("kafbat-ui-client").asFile.absolutePath | ||
apiPackage = "io.kafbat.ui.api.api" | ||
invokerPackage = "io.kafbat.ui.api" | ||
modelPackage = "io.kafbat.ui.api.model" | ||
|
||
configOptions = [library : 'webclient', | ||
asyncNative : 'true', | ||
useBeanValidation: 'true', | ||
dateLibrary : 'java8', | ||
useJakartaEe : 'true',] | ||
} | ||
|
||
tasks.register('generateBackendApi', GenerateTask) { | ||
generatorName = "spring" | ||
inputSpec = specDir.file("kafbat-ui-api.yaml").asFile.absolutePath | ||
outputDir = targetDir.dir("api").asFile.absolutePath | ||
apiPackage = "io.kafbat.ui.api" | ||
invokerPackage = "io.kafbat.ui.api" | ||
modelPackage = "io.kafbat.ui.model" | ||
modelNameSuffix = "DTO" | ||
|
||
additionalProperties = [removeEnumValuePrefix: "false"] | ||
|
||
configOptions = [reactive : "true", | ||
interfaceOnly : "true", | ||
skipDefaultInterface : "true", | ||
useTags : "true", | ||
useSpringBoot3 : "true", | ||
dateLibrary : "java8", | ||
generateConstructorWithAllArgs : "false", | ||
generatedConstructorWithRequiredArgs: "false", | ||
additionalModelTypeAnnotations : """ | ||
@lombok.experimental.SuperBuilder | ||
@lombok.AllArgsConstructor | ||
@lombok.NoArgsConstructor | ||
"""] | ||
} | ||
|
||
tasks.register('generateConnectClient', GenerateTask) { | ||
generatorName = "java" | ||
inputSpec = specDir.file("kafka-connect-api.yaml").asFile.absolutePath | ||
outputDir = targetDir.dir("kafka-connect-client").asFile.absolutePath | ||
generateApiTests = false | ||
generateModelTests = false | ||
apiPackage = "io.kafbat.ui.connect.api" | ||
modelPackage = "io.kafbat.ui.connect.model" | ||
invokerPackage = "io.kafbat.ui.connect" | ||
|
||
|
||
configOptions = [asyncNative : "true", | ||
library : "webclient", | ||
useJakartaEe : "true", | ||
useBeanValidation: "true", | ||
dateLibrary : "java8",] | ||
} | ||
|
||
tasks.register('generateSchemaRegistryClient', GenerateTask) { | ||
generatorName = "java" | ||
inputSpec = specDir.file("kafka-sr-api.yaml").asFile.absolutePath | ||
outputDir = targetDir.dir("kafka-sr-client").asFile.absolutePath | ||
generateApiTests = false | ||
generateModelTests = false | ||
apiPackage = "io.kafbat.ui.sr.api" | ||
invokerPackage = "io.kafbat.ui.sr" | ||
modelPackage = "io.kafbat.ui.sr.model" | ||
|
||
configOptions = [asyncNative : "true", | ||
library : "webclient", | ||
useJakartaEe : "true", | ||
useBeanValidation: "true", | ||
dateLibrary : "java8",] | ||
} | ||
|
||
sourceSets { | ||
main { | ||
java { | ||
srcDir targetDir.dir("api/src/main/java") | ||
srcDir targetDir.dir("kafka-connect-client/src/main/java") | ||
srcDir targetDir.dir("kafbat-ui-client/src/main/java") | ||
srcDir targetDir.dir("kafka-sr-client/src/main/java") | ||
} | ||
|
||
resources { | ||
srcDir specDir | ||
} | ||
} | ||
} | ||
|
||
compileJava.dependsOn generateUiClient, generateBackendApi, generateConnectClient, generateSchemaRegistryClient | ||
processResources.dependsOn generateUiClient, generateBackendApi, generateConnectClient, generateSchemaRegistryClient | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
plugins { | ||
id 'java' | ||
id 'checkstyle' | ||
alias(libs.plugins.allure) | ||
} | ||
|
||
dependencies { | ||
implementation project(":contract") | ||
implementation libs.apache.kafka | ||
implementation libs.apache.commons.io | ||
implementation libs.aspectj | ||
implementation libs.testng | ||
implementation libs.codeborne.selenide | ||
implementation libs.allure.testng | ||
implementation libs.allure.selenide | ||
implementation libs.bonigarcia.webdrivermanager | ||
implementation libs.spring.starter.webflux | ||
implementation libs.netty.resolver.dns.native | ||
|
||
implementation libs.lombok | ||
|
||
annotationProcessor libs.lombok | ||
testAnnotationProcessor libs.lombok | ||
} | ||
|
||
checkstyle { | ||
toolVersion = libs.versions.checkstyle.get() | ||
configFile = rootProject.file('etc/checkstyle/checkstyle-e2e.xml') | ||
ignoreFailures = false | ||
maxWarnings = 10 | ||
maxErrors = 0 | ||
} | ||
|
||
|
||
test { | ||
useTestNG() | ||
} | ||
|
||
tasks.named('test') { | ||
enabled = prod | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.