diff options
author | dimdim11 <dimdim11@yandex-team.com> | 2024-01-19 13:14:59 +0300 |
---|---|---|
committer | dimdim11 <dimdim11@yandex-team.com> | 2024-01-19 13:36:54 +0300 |
commit | bfcc9cbc107fdcd5285cc43e727d8f99d441c702 (patch) | |
tree | 68aa594feb1d415662ae076b5c3ee6ad18516c2d | |
parent | 5351f733cfec6523d9f9b766a0d14906c8082c0d (diff) | |
download | ydb-bfcc9cbc107fdcd5285cc43e727d8f99d441c702.tar.gz |
Prototype of ya ide gradle handler
5 files changed, 186 insertions, 101 deletions
diff --git a/build/export_generators/ide-gradle/build.gradle.kts.jinja b/build/export_generators/ide-gradle/build.gradle.kts.jinja index dd57a390f1..79d8b1b501 100644 --- a/build/export_generators/ide-gradle/build.gradle.kts.jinja +++ b/build/export_generators/ide-gradle/build.gradle.kts.jinja @@ -1,98 +1,93 @@ +{%- set mainClassTargets = targets|selectattr("app_main_class") -%} +{%- set publish = targets|selectattr('publish') -%} +{%- set hasJunit5Test = targets|selectattr('junit5_test') -%} +{%- set target0 = targets[0] -%} +{%- set with_kotlin = target0.with_kotlin -%} +{%- set kotlin_version = target0.kotlin_version -%} plugins { -{% if targets|selectattr("app_main_class") -%} +{%- if mainClassTargets %} `application` -{% else -%} +{%- else %} `java-library` -{% endif -%} -{% if targets|selectattr('publish') -%} +{%- endif %} +{%- if publish %} `maven-publish` `signing` -{% endif -%} - kotlin("jvm") version "1.8.22" - kotlin("plugin.allopen") version "1.8.22" +{%- endif -%} +{%- if with_kotlin and kotlin_version %} + kotlin("jvm") version "{{ kotlin_version }}" +{%- if target0.with_kotlinc_plugin_allopen %} + kotlin("plugin.allopen") version "{{ kotlin_version }}" +{% endif -%} +{%- if target0.with_kotlinc_plugin_lombok %} + kotlin("plugin.lombok") version "{{ kotlin_version }}" +{% endif -%} +{%- if target0.with_kotlinc_plugin_noarg %} + kotlin("plugin.noarg") version "{{ kotlin_version }}" +{% endif -%} +{%- if target0.with_kotlinc_plugin_serialization %} + kotlin("plugin.serialization") version "{{ kotlin_version }}" +{% endif -%} +{%- endif %} } +{%- if target0.with_kotlinc_plugin_allopen %} allOpen { annotation("org.springframework.stereotype.Component") } +{% endif -%} +{%- if with_kotlin %} kotlin { - jvmToolchain(17) + jvmToolchain({%- if target0.required_jdk -%}{{ target0.required_jdk }}{%- else -%}17{%- endif -%}) } +{% endif -%} +{%- if publish %} -{% if targets|selectattr('publish') -%} -group = "{{ targets[0].publish_group }}" -version = project.properties["version"] +group = "{{ target0.publish_group }}" +version = {% if target0.publish_version and target0.publish_version != "no" -%}"{{ target0.publish_version }}"{%- else -%}project.properties["version"]{%- endif %} +{% endif %} -{% endif -%} repositories { mavenCentral() } -configurations { - all { - exclude(group = "ch.qos.logback", module = "logback-classic") - exclude(group = "org.apache.logging.log4j", module = "log4j-to-slf4j") - } -} +val project_root="{%- if exportRoot.startswith(arcadiaRoot + '/') -%}{{ arcadiaRoot }}{%- else -%}{{ exportRoot }}{%- endif -%}" -{% if targets|selectattr("app_main_class") -%} +{% if mainClassTargets -%} application { -{% for target in targets|selectattr("app_main_class") -%} +{%- for target in mainClassTargets %} mainClass.set("{{ target.app_main_class }}") -{% endfor -%} +{% endfor -%} } -{% endif -%} +{% endif -%} java { withSourcesJar() withJavadocJar() } -{% if target.jar_source_set is defined -%} -{% for source_set in target.jar_source_set -%} -{%- set srcdir, glob = source_set.split(':') -%} -sourceSets.main.java.srcDirs += '{{ srcdir }}' -{% endfor -%} -{% endif -%} +configurations.api { + isTransitive = false +} -dependencies { -{% for target in targets -%} -{% if target.junit5_test -%} - testImplementation("org.junit.jupiter:junit-jupiter:5.8.2") - - api("org.apache.commons:commons-math3:3.6.1") - - api("com.google.guava:guava:31.0.1-jre") -{% endif -%} -{% for library in target.consumer -%} -{% set classpath = library.classpath -%} -{% if targets|selectattr("app_main_class") -%} -{% if library.excludes.consumer is defined %} - implementation({{ classpath }}) { -{% for exclude in library.excludes.consumer -%} -{% set classpath_parts = exclude.classpath.split(':') -%} - exclude group: '{{ classpath_parts[0] }}', module: '{{ classpath_parts[1] }}' -{% endfor -%} - } -{% else -%} - implementation({{ classpath }}) -{% endif -%} -{% elif target.isTest -%} - testImplementation({{ classpath }}) -{% else -%} - api({{ classpath }}) -{% endif -%} -{% endfor -%} -{% endfor -%} +configurations.implementation { + isTransitive = false } -{% if targets|selectattr("junit5_test") -%} -tasks.named<Test>("test") { - useJUnitPlatform() +configurations.testImplementation { + isTransitive = false } -{% endif -%} +{% if hasTest -%} +val testsJar by tasks.registering(Jar::class) { + dependsOn(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME) + archiveClassifier.set("tests") + from(sourceSets["test"].output) +} + +artifacts.add(configurations.create("testArtifacts").name, testsJar) + tasks.test { testLogging { showStandardStreams = true @@ -100,6 +95,58 @@ tasks.test { } } +{% endif -%} + +{% for target in targets -%} +{%- if target.jar_source_set is defined -%} +{%- for source_set in target.jar_source_set -%} +{%- set srcdir_glob = split(source_set, ':') -%} +sourceSets.main.java.srcDirs += "{{ srcdir_glob[0] }}" +{% endfor -%} +{%- endif -%} +{%- endfor -%} + +dependencies { +{%- for target in targets -%} +{%- for library in target.consumer if library.classpath -%} +{%- if library.prebuilt and library.jar and (library.type != "contrib" or build_contribs) -%} +{%- if target.isTest %} + testImplementation +{%- else %} + implementation +{%- endif -%}(files("$project_root/{{ library.jar }}")) +{%- else -%} +{%- if target.isTest %} +{%- if library.type != "contrib" and library.test2test %} + testImplementation(project(path = ":{{ library.test2test | replace("/", ":") }}", configuration = "testArtifacts")) +{%- else %} + testImplementation({{ library.classpath }}) +{%- endif %} +{%- elif library.type != "contrib" %} + implementation({{ library.classpath }}) +{%- else %} + api({{ library.classpath }}) +{%- endif -%} +{%- if library.excludes.consumer is defined %} { +{% for exclude in library.excludes.consumer if exclude.classpath -%} +{% set classpath = exclude.classpath|replace('"','') -%} +{% set classpath_parts = split(classpath, ':') -%} + exclude(group = "{{ classpath_parts[0] }}", module = "{{ classpath_parts[1] }}") +{% endfor -%} + } +{%- endif -%} +{%- endif -%} +{%- endfor -%} +{%- endfor %} +} + +{% if hasJunit5Test -%} +tasks.named<Test>("test") { + useJUnitPlatform() +} + +{% endif -%} + {% set runs = targets|selectattr("runs") -%} {% if runs -%} {% for run in runs -%} @@ -146,15 +193,9 @@ tasks.build.dependsOn( {% endfor -%} {% endif -%} -val testsJar by tasks.registering(Jar::class) { - dependsOn(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME) - archiveClassifier.set("tests") - from(sourceSets["test"].output) -} - -artifacts.add(configurations.create("testOutput").name, testsJar) - {% include "extra-tests.gradle.kts" ignore missing %} -{% if targets|selectattr('publish') -%} -{% include 'publish.gradle.kts' -%} +{% if publish -%} +{% include 'publish.gradle.kts' ignore missing -%} {% endif -%} + +{{ dump }} 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 43e6ec3529..c7e15a8779 100644 --- a/build/export_generators/ide-gradle/build.gradle.kts.proto.jinja +++ b/build/export_generators/ide-gradle/build.gradle.kts.proto.jinja @@ -1,3 +1,5 @@ +{%- set publish = targets|selectattr('publish') -%} +{%- set target0 = targets[0] -%} import com.google.protobuf.gradle.* val buildProtoDir = File("${buildDir}", "__proto__") @@ -5,16 +7,16 @@ val buildProtoDir = File("${buildDir}", "__proto__") plugins { id("java-library") id("com.google.protobuf") version "0.8.19" -{% if targets|selectattr('publish') -%} +{%- if publish %} `maven-publish` `signing` -{% endif -%} +{%- endif -%} } +{%- if publish %} -{% if targets|selectattr('publish') -%} -group = "{{ targets[0].publish_group }}" -version = project.properties["version"] -{% endif -%} +group = "{{ target0.publish_group }}" +version = {% if target0.publish_version -%}"{{ target0.publish_version }}"{%- else -%}project.properties["version"]{%- endif %} +{%- endif %} repositories { mavenCentral() @@ -25,15 +27,58 @@ java { withJavadocJar() } +configurations.api { + isTransitive = false +} + +configurations.implementation { + isTransitive = false +} + +configurations.testImplementation { + isTransitive = false +} + +{% for target in targets -%} +{%- if target.jar_source_set is defined -%} +{%- for source_set in target.jar_source_set -%} +{%- set srcdir_glob = split(source_set, ':') -%} +sourceSets.main.java.srcDirs += "{{ srcdir_glob[0] }}" +{% endfor -%} +{%- endif -%} +{%- endfor -%} + dependencies { -{% if targets[0].consumer is defined -%} -{%- for library in targets[0].consumer -%} - api({{ library.classpath }}) -{% endfor -%} -{%- endif -%} +{%- for target in targets -%} +{%- for library in target.consumer if library.classpath -%} +{%- if library.prebuilt and library.jar and (library.type != "contrib" or target.handler.build_contribs) -%} +{%- if target.isTest %} + testImplementation +{%- else %} + implementation +{%- endif -%}(files("$project_root/{{ library.jar }}")) +{%- else -%} +{%- if target.isTest %} + testImplementation +{%- elif library.type != "contrib" %} + implementation +{%- else %} + api +{%- endif -%}({{ library.classpath }}) +{%- if library.excludes.consumer is defined %} { +{% for exclude in library.excludes.consumer -%} +{% set classpath = exclude.classpath|replace('"','') -%} +{% set classpath_parts = split(classpath, ':') -%} + exclude(group = "{{ classpath_parts[0] }}", module = "{{ classpath_parts[1] }}") +{% endfor -%} + } +{%- endif -%} +{%- endif -%} +{%- endfor -%} +{%- endfor %} -{% if targets[0].proto_namespace is defined -%} - protobuf(files(File(buildProtoDir, "{{ targets[0].proto_namespace }}"))) +{% if target0.proto_namespace is defined -%} + protobuf(files(File(buildProtoDir, "{{ target0.proto_namespace }}"))) {% else -%} protobuf(files(buildProtoDir)) {% endif -%} @@ -42,18 +87,12 @@ dependencies { protobuf { protoc { // Download from repositories - artifact = "com.google.protobuf:protoc: -{%- if targets[0].proto_compiler_version is defined -%} -{{ targets[0].proto_compiler_version }} -{%- else -%} -3.22.5 -{%- endif -%} -" + artifact = "com.google.protobuf:protoc:{%- if target0.proto_compiler_version is defined -%}{{ target0.proto_compiler_version }}{%- else -%}3.22.5{%- endif -%}" } -{% if targets[0].proto_grpc is defined -%} +{% if target0.proto_grpc is defined -%} plugins { id("grpc") { - artifact = "io.grpc:protoc-gen-grpc-java:1.45.0" + artifact = "io.grpc:protoc-gen-grpc-java:{%- if target0.proto_grpc_version -%}{{ target0.proto_grpc_version }}{%- else -%}1.45.0{%- endif -%}" } } generateProtoTasks { @@ -68,9 +107,9 @@ protobuf { val prepareProto = tasks.register<Copy>("prepareProto") { from(rootDir) { -{% for proto in targets[0].proto_files -%} +{%- for proto in target0.proto_files %} include("{{ proto }}") -{% endfor -%} +{%- endfor %} } into(buildProtoDir) } @@ -78,6 +117,5 @@ val prepareProto = tasks.register<Copy>("prepareProto") { afterEvaluate { tasks.getByName("extractProto").dependsOn(prepareProto) } -{% if targets|selectattr('publish') -%} -{% include 'publish.gradle.kts' -%} -{% endif -%} + +{{ dump }} diff --git a/build/export_generators/ide-gradle/generator.toml b/build/export_generators/ide-gradle/generator.toml index ad5799c415..7a33da1647 100644 --- a/build/export_generators/ide-gradle/generator.toml +++ b/build/export_generators/ide-gradle/generator.toml @@ -1,3 +1,5 @@ +use_managed_peers_closure = true + [root] template="settings.gradle.kts.jinja" copy=[ diff --git a/build/export_generators/ide-gradle/settings.gradle.kts.jinja b/build/export_generators/ide-gradle/settings.gradle.kts.jinja index 9a22c7f6b5..623000ccf7 100644 --- a/build/export_generators/ide-gradle/settings.gradle.kts.jinja +++ b/build/export_generators/ide-gradle/settings.gradle.kts.jinja @@ -1,5 +1,9 @@ -rootProject.name = "{{projectName}}" +rootProject.name = "{{ projectName }}" {% for subdir in subdirs -%} -include("{{ subdir | replace("/", ":") }}") +{%- set classname = subdir | replace("/", ":") -%} +include(":{{ classname }}") +project(":{{ classname }}").projectDir = file("{{ exportRoot }}/{{ subdir }}") {% endfor -%} + +{{ dump }} diff --git a/contrib/libs/cxxsupp/libcxxmsvc/include/__iterator/iterator_traits.h b/contrib/libs/cxxsupp/libcxxmsvc/include/__iterator/iterator_traits.h index 79637f3fbf..6ae391b39f 100644 --- a/contrib/libs/cxxsupp/libcxxmsvc/include/__iterator/iterator_traits.h +++ b/contrib/libs/cxxsupp/libcxxmsvc/include/__iterator/iterator_traits.h @@ -437,7 +437,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS __iterator_traits_pointer<_Tp, false> {}; template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> : public __iterator_traits_pointer<_Tp, is_object_v<_Tp>> {}; +struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> : public __iterator_traits_pointer<_Tp, is_object<_Tp>::value> {}; #endif // !defined(_LIBCPP_HAS_NO_CONCEPTS) |