Browse Source

Ya ide gradle improvements

В этом ПРе починил проблему с симлинками на исходники, и с симлинками на прото. Также захардкодил поддержку lombok
4ca78811a8f815a0328643e556b92830eddc48eb
c0nsumer 1 year ago
parent
commit
73c17daac8

+ 24 - 0
build/export_generators/ide-gradle/build.gradle.kts.jinja

@@ -4,6 +4,11 @@
 {%- set kotlin_version = target.kotlin_version -%}
 {%- set hasJunit5Test = extra_targets|selectattr('junit5_test') -%}
 plugins {
+{%- for processor in target.annotation_processors -%}
+{%-     if processor == "lombok.launch.AnnotationProcessorHider$AnnotationProcessor" %}
+    id("io.freefair.lombok") version "8.6"
+{%-     endif -%}
+{%- endfor %}
 {%- if mainClass %}
     `application`
 {%- else %}
@@ -208,6 +213,25 @@ dependencies {
 {%- endfor %}
 }
 
+{%- for processor in target.annotation_processors -%}
+{%-     if processor == "lombok.launch.AnnotationProcessorHider$AnnotationProcessor" %}
+val confs: List<Configuration> = project.configurations.toList()
+
+confs.forEach { configuration ->
+    configuration.dependencies.forEach { dependency ->
+        if (dependency.name == "lombok") {
+            val lombok = dependency.group + ":" + dependency.name + ":" + dependency.version
+
+            dependencies {
+                annotationProcessor(lombok)
+                testAnnotationProcessor(lombok)
+            }
+        }
+    }
+}
+{%-     endif -%}
+{%- endfor %}
+
 {% if hasJunit5Test -%}
 tasks.named<Test>("test") {
     useJUnitPlatform()

+ 11 - 1
build/export_generators/ide-gradle/build.gradle.kts.proto.jinja

@@ -103,7 +103,7 @@ protobuf {
         }
     }
     generateProtoTasks {
-        ofSourceSet("main").forEach {
+        all().forEach {
             it.plugins {
                 id("grpc")
             }
@@ -116,6 +116,16 @@ 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)

+ 1 - 1
build/export_generators/ide-gradle/gradle/wrapper/gradle-wrapper.properties

@@ -1,6 +1,6 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
+distributionUrl=https\://bucket.yandex-team.ru/v1/maven/gradle-distributions/distributions/gradle-8.6-bin.zip
 networkTimeout=10000
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists