규칙
- cc_proto_library
- java_lite_proto_library
- java_proto_library
- proto_library
- py_proto_library
- proto_lang_toolchain
- proto_toolchain
cc_proto_library
규칙 소스 보기cc_proto_library(name, deps, compatible_with, deprecation, distribs, exec_compatible_with, exec_properties, features, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)
cc_proto_library는 .proto 파일에서 C++ 코드를 생성합니다.
deps은 proto_library
 규칙을 가리켜야 합니다.
예:
cc_library(
    name = "lib",
    deps = [":foo_cc_proto"],
)
cc_proto_library(
    name = "foo_cc_proto",
    deps = [":foo_proto"],
)
proto_library(
    name = "foo_proto",
)
인수
| 속성 | |
|---|---|
| name | 이름: 필수 이 타겟의 고유한 이름입니다. | 
| deps | 라벨 목록입니다. 기본값은  proto_library규칙 목록입니다. | 
java_lite_proto_library
규칙 소스 보기java_lite_proto_library(name, deps, compatible_with, deprecation, distribs, exec_compatible_with, exec_properties, features, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)
java_lite_proto_library는 .proto 파일에서 Java 코드를 생성합니다.
deps은 proto_library
 규칙을 가리켜야 합니다.
예:
java_library(
    name = "lib",
    runtime_deps = [":foo"],
)
java_lite_proto_library(
    name = "foo",
    deps = [":bar"],
)
proto_library(
    name = "bar",
)
인수
| 속성 | |
|---|---|
| name | 이름: 필수 이 타겟의 고유한 이름입니다. | 
| deps | 라벨 목록입니다. 기본값은  proto_library규칙 목록입니다. | 
java_proto_library
규칙 소스 보기java_proto_library(name, deps, compatible_with, deprecation, distribs, exec_compatible_with, exec_properties, features, licenses, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)
java_proto_library는 .proto 파일에서 Java 코드를 생성합니다.
deps은 proto_library
 규칙을 가리켜야 합니다.
예:
java_library(
    name = "lib",
    runtime_deps = [":foo_java_proto"],
)
java_proto_library(
    name = "foo_java_proto",
    deps = [":foo_proto"],
)
proto_library(
    name = "foo_proto",
)
인수
| 속성 | |
|---|---|
| name | 이름: 필수 이 타겟의 고유한 이름입니다. | 
| deps | 라벨 목록입니다. 기본값은  proto_library규칙 목록입니다. | 
proto_library
규칙 소스 보기proto_library(name, deps, srcs, data, allow_exports, compatible_with, deprecation, distribs, exec_compatible_with, exec_properties, exports, features, import_prefix, licenses, restricted_to, strip_import_prefix, tags, target_compatible_with, testonly, toolchains, visibility)
Bazel을 사용하는 경우 https://github.com/bazelbuild/rules_proto에서 규칙을 로드하세요.
proto_library를 사용하여 여러 언어에서 사용할 수 있는 프로토콜 버퍼 라이브러리를 정의합니다. proto_library은 java_proto_library와 같은 지원되는 규칙의 deps 절에 나열될 수 있습니다.
명령줄에서 컴파일하면 proto_library는 규칙이 src하는 메시지의 설명자 집합인 foo-descriptor-set.proto.bin라는 파일을 만듭니다. 이 파일은 FileDescriptorSet가 직렬화된 것으로, 
https://developers.google.com/protocol-buffers/docs/techniques#self-description에 설명되어 있습니다.
proto_library 규칙에서 직접 언급한 .proto 파일에 관한 정보만 포함합니다. 임시 설명자 세트의 컬렉션은 [ProtoInfo].transitive_descriptor_sets Starlark 제공자를 통해 사용할 수 있습니다.
proto_info.bzl의 문서를 참고하세요.
권장 코드 구성:
- .proto파일당 하나의- proto_library규칙
- foo.proto이라는 파일은 동일한 패키지에 있는- foo_proto이라는 규칙에 있습니다.
- foo_proto라는 이름의- proto_library을 래핑하는- [language]_proto_library은- foo_[language]_proto라고 해야 하며 동일한 패키지에 있어야 합니다.
인수
| 속성 | |
|---|---|
| name | 이름: 필수 이 타겟의 고유한 이름입니다. | 
| deps | 라벨 목록입니다. 기본값은  proto_library규칙의 목록입니다.proto_library는 다른proto_library타겟에만 종속될 수 있습니다. 언어별 라이브러리에 종속되지 않을 수 있습니다. | 
| srcs | 라벨 목록입니다. 기본값은  .proto및.protodevel파일 목록입니다. 일반적으로 비어 있지 않은 목록입니다.srcs가 비어 있을 수 있는 사용 사례 중 하나는 별칭 라이브러리입니다.deps에 하나 이상의 다른 proto_library가 있는 proto_library 규칙입니다.
이 패턴은 영구 이름으로 공개 API를 내보내는 데 사용할 수 있습니다. | 
| allow_exports | 라벨. 기본값은  | 
| exports | 라벨 목록입니다. 기본값은  | 
| import_prefix | 문자열, 기본값은  설정되면 이 규칙의  이 접두사가 추가되기 전에  | 
| strip_import_prefix | 문자열, 기본값은  설정되면 이 규칙의  슬래시로 시작하지 않는 상대 경로인 경우 패키지 상대 경로로 간주됩니다. 절대 경로인 경우 저장소 상대 경로로 이해됩니다. 
 | 
py_proto_library
규칙 소스 보기py_proto_library(name, deps, compatible_with, deprecation, distribs, exec_compatible_with, exec_properties, features, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)
인수
| 속성 | |
|---|---|
| name | 이름: 필수 이 타겟의 고유한 이름입니다. | 
| deps | 라벨 목록입니다. 기본값은  | 
proto_lang_toolchain
규칙 소스 보기proto_lang_toolchain(name, allowlist_different_package, blacklisted_protos, command_line, compatible_with, deprecation, distribs, exec_compatible_with, exec_properties, features, mnemonic, output_files, plugin, plugin_format_flag, progress_message, protoc_minimal_do_not_use, restricted_to, runtime, tags, target_compatible_with, testonly, toolchain_type, toolchains, visibility)
Bazel을 사용하는 경우 https://github.com/bazelbuild/rules_proto에서 규칙을 로드하세요.
LANG_proto_library 규칙 (예: java_proto_library)는 프로토 컴파일러를 호출해야 합니다.
일부 LANG_proto_library 규칙에서는 명령줄 플래그를 사용하여 사용할 도구 모음을 지정할 수 있습니다. 문서를 참고하세요.
일반적으로 Java 컴파일러를 조정하려는 경우가 아니면 이러한 종류의 규칙을 작성해서는 안 됩니다.
컴파일러가 없습니다. 프로토 컴파일러는 연결된 proto_library 규칙에서 가져옵니다. Blaze에 명령줄 플래그로 전달됩니다.
여러 기능에서는 proto_library 규칙 자체에서 프로토 컴파일러를 호출해야 합니다.
LANG_proto_library가 사용하는 컴파일러가 proto_library가 사용하는 컴파일러와 동일하도록 강제하는 것이 좋습니다.
예
간단한 예는 다음과 같습니다.
proto_lang_toolchain(
    name = "javalite_toolchain",
    command_line = "--javalite_out=shared,immutable:$(OUT)",
    plugin = ":javalite_plugin",
    runtime = ":protobuf_lite",
)
인수
| 속성 | |
|---|---|
| name | 이름: 필수 이 타겟의 고유한 이름입니다. | 
| allowlist_different_package | 라벨. 기본값은  | 
| blacklisted_protos | 라벨 목록입니다. 기본값은  blacklisted_protos의srcs속성에 있는 파일에 대해서는 코드가 생성되지 않습니다.
이는any.proto와 같이 이미 프로토 런타임에 연결된 .proto 파일에 사용됩니다. | 
| command_line | 문자열, 필수이 값은 코드를 생성하기 위해 프로토 컴파일러에 전달됩니다. 이 코드 생성기/플러그인과 관련된 부분만 포함합니다 (예: -I 매개변수는 포함하지 않음). 
 | 
| mnemonic | 문자열, 기본값은  | 
| output_files | 문자열, 기본값은  command_line의$(OUT)형식을 제어합니다(단일 파일 경로 또는 여러 파일의 경우 출력 디렉터리).
가능한 값은 'single', 'multiple'입니다. | 
| plugin | 라벨. 기본값은  --plugin=protoc-gen-PLUGIN=<executable>. | 
| plugin_format_flag | 문자열, 기본값은  --plugin=protoc-gen-PLUGIN=<executable>. | 
| progress_message | 문자열, 기본값은  | 
| protoc_minimal_do_not_use | 라벨. 기본값은  | 
| runtime | 라벨. 기본값은  | 
| toolchain_type | 라벨. 기본값은  | 
proto_toolchain
규칙 소스 보기proto_toolchain(name, command_line, compatible_with, deprecation, distribs, exec_compatible_with, exec_properties, features, mnemonic, output_files, progress_message, proto_compiler, restricted_to, tags, target_compatible_with, testonly, toolchains, visibility)
인수
| 속성 | |
|---|---|
| name | 이름: 필수 이 타겟의 고유한 이름입니다. | 
| command_line | 문자열, 기본값은  | 
| mnemonic | 문자열, 기본값은  | 
| output_files | 문자열, 기본값은  | 
| progress_message | 문자열, 기본값은  | 
| proto_compiler | 라벨. 기본값은  |