File tree Expand file tree Collapse file tree
sdk-platform-java/hermetic_build/library_generation Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232from pathlib import Path
3333from typing import List
3434import library_generation .utils .utilities as util
35+ from library_generation .utils .proto_path_utils import remove_version_from
3536from common .model .generation_config import GenerationConfig
3637from common .model .gapic_config import GapicConfig
3738from common .model .gapic_inputs import GapicInputs
@@ -72,12 +73,14 @@ def generate_composed_library(
7273 # overridden by the config object if specified. Note that this override
7374 # does not affect library generation but instead used only for
7475 # generating postprocessing files such as README.
76+ has_version = remove_version_from (gapic .proto_path ) != gapic .proto_path
7577 util .generate_postprocessing_prerequisite_files (
7678 config = config ,
7779 library = library ,
7880 proto_path = util .remove_version_from (gapic .proto_path ),
7981 library_path = library_path ,
8082 transport = library .get_transport (gapic_inputs ),
83+ has_version = has_version ,
8184 )
8285 temp_destination_path = f"java-{ gapic .proto_path .replace ('/' ,'-' )} "
8386 effective_arguments = _construct_effective_arg (
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ deep-preserve-regex:
2323- "/{{ module_name }}/google-.*/src/test/java/com/google/cloud/.*/v.*/it/IT.*Test.java"
2424
2525deep-copy-regex:
26+ {% - if has_version %}
2627- source: "/{{ proto_path }}/(v.*)/.*-java/proto-google-.*/src"
2728 dest: "/owl-bot-staging/{{ module_name }}/$1/proto-{{ artifact_id }}-$1/src"
2829- source: "/{{ proto_path }}/(v.*)/.*-java/grpc-google-.*/src"
@@ -31,6 +32,16 @@ deep-copy-regex:
3132 dest: "/owl-bot-staging/{{ module_name }}/$1/{{ artifact_id }}/src"
3233- source: "/{{ proto_path }}/(v.*)/.*-java/samples/snippets/generated"
3334 dest: "/owl-bot-staging/{{ module_name }}/$1/samples/snippets/generated"
35+ {% - else %}
36+ - source: "/{{ proto_path }}/.*-java/proto-google-.*/src"
37+ dest: "/owl-bot-staging/{{ module_name }}/proto-{{ artifact_id }}/src"
38+ - source: "/{{ proto_path }}/.*-java/grpc-google-.*/src"
39+ dest: "/owl-bot-staging/{{ module_name }}/grpc-{{ artifact_id }}/src"
40+ - source: "/{{ proto_path }}/.*-java/gapic-google-.*/src"
41+ dest: "/owl-bot-staging/{{ module_name }}/{{ artifact_id }}/src"
42+ - source: "/{{ proto_path }}/.*-java/samples/snippets/generated"
43+ dest: "/owl-bot-staging/{{ module_name }}/samples/snippets/generated"
44+ {% - endif %}
3445{% - endif %}
3546
3647api-name: {{ api_shortname }}
Original file line number Diff line number Diff line change @@ -205,6 +205,7 @@ def generate_postprocessing_prerequisite_files(
205205 transport : str ,
206206 library_path : str ,
207207 language : str = "java" ,
208+ has_version : bool = True ,
208209) -> None :
209210 """
210211 Generates the postprocessing prerequisite files for a library.
@@ -307,6 +308,7 @@ def generate_postprocessing_prerequisite_files(
307308 proto_path = remove_version_from (proto_path ),
308309 module_name = repo_metadata ["repo_short" ],
309310 api_shortname = library .api_shortname ,
311+ has_version = has_version ,
310312 )
311313
312314 # generate owlbot.py
You can’t perform that action at this time.
0 commit comments