Files
grpc-library/grpc/grpc-contract/build.gradle
DongHyeonka 41d73a174e refactor(grpc)!: Java·proto 패키지를 com.hyeonworks.grpc로 바꾼다
패키지 dev.caskeleton.grpc와 proto 조직 이름 caskeleton은 백엔드 템플릿의
자리표시 이름이다. 템플릿 재사용 체크리스트는 파생 서비스에게
dev.caskeleton을 자기 패키지로 바꾸라고 한다. 라이브러리 패키지가 같은
이름이면 그 일괄 바꾸기가 라이브러리 import까지 바꿔 클래스를 못 찾게
된다. Maven group(com.hyeonworks.grpc)과 패키지가 다른 말을 하는 것도
같은 문제다.

첫 배포(1.0.0) 전에 한 번 바꾼다(설계 Q4 NS3). 지금 이 패키지를 쓰는
소비자는 템플릿에도 파생 서비스에도 없다.

- Java: dev.caskeleton.grpc → com.hyeonworks.grpc(폴더도 옮김)
- proto: package caskeleton.grpc.common.v1 → hyeonworks.grpc.common.v1,
  생성 Java 패키지 → hyeonworks.grpc.common.v1.generated. 손으로 쓴
  com.hyeonworks와 겹치지 않는다는 기존 규칙(생성 코드 시험)을 그대로
  지킨다. proto 폴더도 Buf PACKAGE_DIRECTORY_MATCH에 맞게 옮겼다.
- 테스트의 가짜 서비스 이름 caskeleton.document.v1 등도 hyeonworks로.
  두 이름의 글자 수가 같아 길이·한도 시험에 영향이 없다.
- SpotBugs 제외 목록의 클래스 이름, AutoConfiguration.imports.

만든 법: git mv로 폴더를 옮기고, grpc·grpc-advanced·config의 추적
파일에서 dev.caskeleton → com.hyeonworks, caskeleton → hyeonworks를
바꾼 뒤 spotlessApply로 import 순서만 다시 맞췄다. build-logic(배포하지
않는 빌드 도구)과 결정 기록 본문은 바꾸지 않았다.

위험: proto 패키지는 wire 이름이다. 지금 쓰는 곳이 없어 깨질 상대가
없지만, 이 커밋 앞의 schema와 buf breaking으로 비교하면 깨짐으로 나온다.
1.0.0 전 한 번의 변경으로 받아들인다.

검증(desktop): spotlessApply rc=0. ci·mainCheck·releaseRehearsal은 이
커밋 위 트리에서 돌렸다(다음 커밋들 본문).

BREAKING CHANGE: Java 패키지 dev.caskeleton.grpc.* → com.hyeonworks.grpc.*,
proto 패키지 caskeleton.grpc.common.v1 → hyeonworks.grpc.common.v1. import와
proto import를 새 이름으로 바꾼다.
Refs: design-docs repo-structure/05-library-repos.md 6.3절 NS3
2026-11-08 11:12:58 +09:00

66 lines
2.7 KiB
Groovy

plugins {
id 'ca.platform-module'
alias(libs.plugins.protobuf)
}
// The Stable schema: the `.proto` sources under src/main/proto and the Java that protoc generates
// from them.
//
// protoc, not a hand-written parser, decides whether the schema is valid, and Buf (buf.yaml next to
// this file) owns lint and breaking-change policy. Buf is a native binary and not a Maven
// artifact, so bufLint and bufBreaking below run scripts/buf.sh (a pinned, checksum-verified
// binary), and the root `ci` stage depends on them rather than this module's `check`: the breaking
// check reads Git history and a download, which a local module check should not need. This build
// does not re-implement Buf's rules. Until 2026-09-28 this leaf was grpc-proto-contract +
// grpc-codegen, which did both with regular expressions (owner decision 18).
//
// Generated code lands under build/, in the package each file's `java_package` names
// (`hyeonworks.*.generated`), which is disjoint from the hand-written `com.hyeonworks` root.
// Messages only: the schema declares no service yet, so there is no grpc-java stub to generate.
dependencies {
// api: every generated message extends com.google.protobuf.GeneratedMessageV3.
api libs.protobuf.java.grpc
}
protobuf {
protoc {
artifact = libs.protoc.get().toString()
}
}
// The plugin resolves protoc through a configuration it creates when generateProto runs, after
// resolveAndLockAll has taken its snapshot. The coordinate is an exact catalog version (libs.protoc),
// so a lock entry would restate it; locking is switched off for that tool locator only.
configurations.matching { it.name.startsWith('protobufToolsLocator_') }.configureEach {
resolutionStrategy.deactivateDependencyLocking()
}
// Generated sources answer to protoc, not to the repository's formatter, lint or bug patterns.
spotless {
java {
target 'src/*/java/**/*.java'
}
}
tasks.named('checkstyleMain') {
exclude '**/generated/**'
}
tasks.withType(JavaCompile).configureEach {
options.errorprone.excludedPaths = '.*/build/generated/.*'
}
def protoSources = fileTree('src/main/proto') + files('buf.yaml')
tasks.register('bufLint', Exec) {
group = 'verification'
description = 'Runs buf lint over the Stable schema (buf.yaml).'
inputs.files(protoSources)
outputs.upToDateWhen { false }
commandLine 'bash', rootProject.file('scripts/buf.sh'), 'lint'
}
tasks.register('bufBreaking', Exec) {
group = 'verification'
description = 'Refuses a breaking change to the Stable schema against the baseline commit (scripts/buf.sh).'
inputs.files(protoSources)
outputs.upToDateWhen { false }
commandLine 'bash', rootProject.file('scripts/buf.sh'), 'breaking'
}