diff options
author | dimdim11 <dimdim11@yandex-team.com> | 2024-10-29 14:07:47 +0300 |
---|---|---|
committer | dimdim11 <dimdim11@yandex-team.com> | 2024-10-29 14:26:13 +0300 |
commit | f51abcba01783196193b5146bc452c1ce0c14ef7 (patch) | |
tree | 2a4c87251ad37de2008c6f5a6aea11bfc5584b65 /build/export_generators | |
parent | 3cb0de63de40f2be41fde99697cfdf98f2d928dc (diff) | |
download | ydb-f51abcba01783196193b5146bc452c1ce0c14ef7.tar.gz |
Symlinks for ya ide gradle
Symlinks for ya ide gradle
commit_hash:72f215d46631be1bd442cf10535a4431ed3cd4fb
Diffstat (limited to 'build/export_generators')
4 files changed, 52 insertions, 39 deletions
diff --git a/build/export_generators/ide-gradle/build.gradle.kts.jinja b/build/export_generators/ide-gradle/build.gradle.kts.jinja index 3f7755b94e..3833801b66 100644 --- a/build/export_generators/ide-gradle/build.gradle.kts.jinja +++ b/build/export_generators/ide-gradle/build.gradle.kts.jinja @@ -1,20 +1,26 @@ -{%- set mainClass = target.app_main_class -%} +val baseBuildDir = "{{ export_root }}/gradle.build/" +buildDir = file(baseBuildDir + project.path.replaceFirst(":", "/").replace(":", ".")) +subprojects { + buildDir = file(baseBuildDir + project.path.replaceFirst(":", "/").replace(":", ".")) +} + +{% set mainClass = target.app_main_class -%} {%- set publish = target.publish -%} {%- set with_kotlin = target.with_kotlin -%} {%- set kotlin_version = target.kotlin_version -%} {%- set hasJunit5Test = extra_targets|selectattr('junit5_test') -%} {%- set errorprone_plugin_version = "4.0.0" -%} plugins { -{# some plugins configuration #} +{#- some plugins configuration -#} {%- for library in target.consumer if library.classpath -%} -{# error prone plugin configuration #} +{#- error prone plugin configuration -#} {%- if library.prebuilt and library.jar and (library.type != "contrib" or build_contribs) and "contrib/java/com/google/errorprone/error_prone_annotations/" in library.jar -%} id("net.ltgt.errorprone") version "{{ errorprone_plugin_version }}" {%- endif -%} {%- endfor -%} -{# lombok configuration #} +{#- lombok configuration -#} {%- if "lombok.launch.AnnotationProcessorHider$AnnotationProcessor" in target.annotation_processors %} id("io.freefair.lombok") version "8.6" {%- endif -%} @@ -43,7 +49,7 @@ plugins { {% endif -%} {%- endif %} } -{# language level #} +{#- language level -#} {%- if target.required_jdk is defined and target.required_jdk|length %} java { toolchain { @@ -98,7 +104,7 @@ tasks.withType<Javadoc> { } {% endif %} -{# javac flags #} +{#- javac flags -#} {%- if (target.javac.flags is defined) and (target.javac.flags|length) %} tasks.withType<JavaCompile> { {%- for javac_flag in target.javac.flags %} @@ -113,20 +119,18 @@ tasks.withType<JavaCompile> { val bucketUsername: String by project val bucketPassword: String by project repositories { - repositories { - maven { - url = uri("https://bucket.yandex-team.ru/v1/maven/central") - credentials { - username = "$bucketUsername" - password = "$bucketPassword" + repositories { + maven { + url = uri("https://bucket.yandex-team.ru/v1/maven/central") + credentials { + username = "$bucketUsername" + password = "$bucketPassword" + } } } } - -} - -val project_root="{%- if export_root.startswith(arcadia_root + '/') -%}{{ arcadia_root }}{%- else -%}{{ export_root }}/.hic_sunt_dracones{%- endif -%}" +val project_root = "{{ arcadia_root }}" {% if mainClass -%} application { @@ -269,13 +273,13 @@ tasks.named<Test>("test") { useJUnitPlatform() } -{% endif -%} +{% endif -%} -{# run_java_program #} -{# {% set runs = targets|selectattr("runs") -%} #} -{% set runs = target.runs -%} -{% if runs -%} -{% for run in runs -%} +{#- run_java_program -#} +{#- {% set runs = targets|selectattr("runs") -%} -#} +{%- set runs = target.runs -%} +{%- if runs -%} +{%- for run in runs -%} val runJav{{ loop.index }} = task<JavaExec>("runJavaProgram{{ loop.index }}") { group = "build" @@ -287,7 +291,7 @@ val runJav{{ loop.index }} = task<JavaExec>("runJavaProgram{{ loop.index }}") { {% set real_classpath = classpath|replace('@', '') -%} {% set real_classpath = real_classpath|replace('.run.cp', '') -%} {% set real_classpath = real_classpath|replace('.cplst', '') -%} -{% set real_classpath = real_classpath|replace(export_root, '') -%} +{% set real_classpath = real_classpath|replace(export_root, '')|replace(arcadia_root, '') -%} {% set real_gradle_classpath = real_classpath|replace('/', ':') %} val classPath = "{{ real_gradle_classpath }}" val classPathParts = classPath.split(":") @@ -321,15 +325,15 @@ val runJav{{ loop.index }} = task<JavaExec>("runJavaProgram{{ loop.index }}") { {% for dir in run.out_dir -%} outputs.dir("{{ dir }}") {% endfor -%} -{# +{#- Не использованы аттрибуты run-cwd="str" run-in_dirs_inputs="list" run-in_noparse="list" run-out_dir="list" run-tool="list" -#} -{% endif -%} +-#} +{%- endif -%} } tasks { build { 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 9a930779d4..d81a7ea0b0 100644 --- a/build/export_generators/ide-gradle/build.gradle.kts.proto.jinja +++ b/build/export_generators/ide-gradle/build.gradle.kts.proto.jinja @@ -1,6 +1,12 @@ {%- set publish = target.publish -%} import com.google.protobuf.gradle.* +val baseBuildDir = "{{ export_root }}/gradle.build/" +buildDir = file(baseBuildDir + project.path.replaceFirst(":", "/").replace(":", ".")) +subprojects { + buildDir = file(baseBuildDir + project.path.replaceFirst(":", "/").replace(":", ".")) +} + val buildProtoDir = File("${buildDir}", "__proto__") plugins { @@ -9,7 +15,7 @@ plugins { {%- if publish %} `maven-publish` `signing` -{%- endif -%} +{%- endif %} } {%- if publish %} @@ -20,16 +26,16 @@ version = {% if target.publish_version -%}"{{ target.publish_version }}"{%- else val bucketUsername: String by project val bucketPassword: String by project repositories { - repositories { - maven { - url = uri("https://bucket.yandex-team.ru/v1/maven/central") - credentials { - username = "$bucketUsername" - password = "$bucketPassword" + repositories { + maven { + url = uri("https://bucket.yandex-team.ru/v1/maven/central") + credentials { + username = "$bucketUsername" + password = "$bucketPassword" + } } } } -} sourceSets { main { @@ -37,7 +43,7 @@ sourceSets { } } -val project_root="{%- if export_root.startswith(arcadia_root + '/') -%}{{ arcadia_root }}{%- else -%}{{ export_root }}{%- endif -%}" +val project_root = "{{ arcadia_root }}" java { withSourcesJar() @@ -58,10 +64,10 @@ configurations.testImplementation { {%- if target.jar_source_set is defined -%} {%- for source_set in target.jar_source_set -%} -{%- set srcdir_glob = split(source_set, ':') -%} +{%- set srcdir_glob = split(source_set, ':') %} sourceSets.main.java.srcDirs += "{{ srcdir_glob[0] }}" {% endfor -%} -{%- endif -%} +{%- endif %} dependencies { {%- for library in target.consumer if library.classpath -%} diff --git a/build/export_generators/ide-gradle/generator.toml b/build/export_generators/ide-gradle/generator.toml index ea589c40f5..24ddd14f35 100644 --- a/build/export_generators/ide-gradle/generator.toml +++ b/build/export_generators/ide-gradle/generator.toml @@ -8,9 +8,12 @@ copy=[ "gradlew.bat", "gradle/wrapper/gradle-wrapper.jar", "gradle/wrapper/gradle-wrapper.properties", - ".idea/vcs.xml" + ".idea/vcs.xml", ] +[targets.EMPTY] +template="build.gradle.kts.jinja" + [targets.jar] template="build.gradle.kts.jinja" diff --git a/build/export_generators/ide-gradle/settings.gradle.kts.jinja b/build/export_generators/ide-gradle/settings.gradle.kts.jinja index da32f75ab1..a71aefe4f4 100644 --- a/build/export_generators/ide-gradle/settings.gradle.kts.jinja +++ b/build/export_generators/ide-gradle/settings.gradle.kts.jinja @@ -3,7 +3,7 @@ rootProject.name = "{{ project_name }}" {% for subdir in subdirs -%} {%- set classname = subdir | replace("/", ":") -%} include(":{{ classname }}") -project(":{{ classname }}").projectDir = file("{{ export_root }}/{{ subdir }}") +project(":{{ classname }}").projectDir = file("{{ arcadia_root }}/{{ subdir }}") {% endfor -%} {%- include "[generator]/debug.jinja" ignore missing -%} |