aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordimdim11 <dimdim11@yandex-team.com>2024-11-21 07:28:08 +0300
committerdimdim11 <dimdim11@yandex-team.com>2024-11-21 07:37:18 +0300
commit532123792431edd487519a254f2248603c2056e7 (patch)
tree481060c6def41f6d6d1111a8071ec30f3d9ed9a1
parentfedafa631a696950518e56d4c463dca8014ad701 (diff)
downloadydb-532123792431edd487519a254f2248603c2056e7.tar.gz
Fix most Gradle proto builds
Fix most Gradle proto builds commit_hash:d601ed32e402ea33de324070c013643e09f2b1c1
-rw-r--r--build/export_generators/ide-gradle/build.gradle.kts.proto.jinja58
1 files changed, 21 insertions, 37 deletions
diff --git a/build/export_generators/ide-gradle/build.gradle.kts.proto.jinja b/build/export_generators/ide-gradle/build.gradle.kts.proto.jinja
index 9b7b71f743..bb6de76adb 100644
--- a/build/export_generators/ide-gradle/build.gradle.kts.proto.jinja
+++ b/build/export_generators/ide-gradle/build.gradle.kts.proto.jinja
@@ -7,8 +7,6 @@ subprojects {
buildDir = file(baseBuildDir + project.path.replaceFirst(":", "/").replace(":", "."))
}
-val buildProtoDir = File("${buildDir}", "__proto__")
-
plugins {
id("java-library")
id("com.google.protobuf") version "0.8.19"
@@ -37,14 +35,23 @@ repositories {
}
}
+val project_root = "{{ arcadia_root }}"
+
sourceSets {
main {
- java.srcDir("build/generated/source/proto")
+ java.srcDir("$buildDir/generated/sources/proto/main/java")
+{%- if target.proto_grpc %}
+ java.srcDir("$buildDir/generated/sources/proto/main/grpc")
+{%- endif %}
+ }
+ test {
+ java.srcDir("$buildDir/generated/sources/proto/test/java")
+{%- if target.proto_grpc %}
+ java.srcDir("$buildDir/generated/sources/proto/test/grpc")
+{%- endif %}
}
}
-val project_root = "{{ arcadia_root }}"
-
java {
withSourcesJar()
withJavadocJar()
@@ -93,20 +100,18 @@ dependencies {
{%- endif -%}
{%- endif -%}
{%- endfor %}
-
-{%- if target.proto_namespace %}
- protobuf(files(File(buildProtoDir, "{{ target.proto_namespace }}")))
-{%- else %}
- protobuf(files(buildProtoDir))
-{%- endif %}
+ protobuf(files("$projectDir"))
}
protobuf {
+ generatedFilesBaseDir = "$buildDir/generated/sources/proto"
+
protoc {
// Download from repositories
artifact = "com.google.protobuf:protoc:{%- if target.proto_compiler_version -%}{{ target.proto_compiler_version }}{%- else -%}3.22.5{%- endif -%}"
}
-{% if target.proto_grpc -%}
+{%- if target.proto_grpc %}
+
plugins {
id("grpc") {
artifact = "io.grpc:protoc-gen-grpc-java:{%- if target.proto_grpc_version -%}{{ target.proto_grpc_version }}{%- else -%}1.45.0{%- endif -%}"
@@ -115,48 +120,27 @@ protobuf {
id("grpckt") {
artifact = "io.grpc:protoc-gen-grpc-kotlin:{%- if target.proto_kotlin_grpc_version -%}{{ target.proto_kotlin_grpc_version }}{%- else -%}1.3.1{%- endif -%}:jdk8@jar"
}
-{% endif -%}
+{%- endif %}
}
+
generateProtoTasks {
all().forEach {
it.plugins {
id("grpc")
{%- if target.proto_kotlin_grpc %}
id("grpckt")
-{% endif -%}
+{%- endif %}
}
{%- if target.proto_kotlin_grpc %}
it.builtins {
create("kotlin")
}
-{% endif -%}
+{%- endif %}
}
}
{%- endif %}
}
-val prepareProto = tasks.register<Copy>("prepareProto") {
- from(rootDir) {
-{%- for proto in target.proto_files %}
- include("{{ proto }}")
-{%- endfor %}
-{# Mining proto-deps sources directories #}
-{%- for library in target.consumer if library.prebuilt -%}
-{%- if library.type == "library" %}
-{%- set proto_rep = library.classpath|replace('project(":','') %}
-{%- set proto_rep = proto_rep|replace('")','') %}
-{%- set proto_rep = proto_rep|replace(':','/') %}
-{%- set proto = proto_rep + '/**' %}
- include("{{ proto }}")
-{%- endif -%}
-{%- endfor %}
- }
- into(buildProtoDir)
-}
-
-afterEvaluate {
- tasks.getByName("extractProto").dependsOn(prepareProto)
-}
{# To avoid problems when build project with proto #}
tasks.getByName("sourcesJar").dependsOn("generateProto")