Files
DongHyeonka 414666cfc7 build: 템플릿 밖에서 혼자 빌드·배포되는 Gradle 루트를 만든다
옮겨 온 gRPC 모듈은 템플릿의 두 번째 빌드(optional build)였다. 그 빌드는
템플릿 build-logic·카탈로그·registry·config를 상대 경로로 읽었고,
grpc-operation-ledger-jpa는 템플릿 persistence-jpa의 testFixtures 파일
셋을 빌드 때 복사해 왔다. 별도 repo에는 그 경로가 없다.

repo 루트를 Gradle 루트로 둔다.
- build-logic: 템플릿 22df3525의 src/build-logic을 복사하고 쓰지 않는
  플러그인(bootrun-dotenv, redis topology, config contract,
  spring-library, optional registry, purity 태스크)을 뺐다. 출처와 고친
  곳은 build-logic/UPSTREAM.md에 적었다(설계 10.3절 L1).
- registry config/architecture/modules.json: 템플릿의 optional-grpc 9행,
  source_path는 Gradle 루트 기준.
- 카탈로그·config: 이 repo가 쓰는 항목만. SpotBugs 제외는 이 repo
  클래스와 일반 규칙만 남겼다.
- group은 gradle.properties의 libraryGroup(com.hyeonworks.grpc)에서
  읽는다. 버전은 -PreleaseVersion 말고 RELEASE_TAG(vX.Y.Z)에서도 읽고,
  다른 모양의 태그는 빌드 전에 거부한다.
- 배포: 새 ca.library-publishing이 모듈마다 Maven publication(sources·
  javadoc jar, versionMapping으로 해석된 버전)과 저장소 gitea·staging,
  SIGNING_KEY가 있으면 PGP 서명을 단다. 루트는 SBOM artifact
  grpc-library와 단계 태스크 ci·mainCheck·releaseCheck·release·
  releaseRehearsal을 가진다. Trivy·Buf는 scripts/tool.sh가 SHA-256으로
  고정해 받는다.
- testFixtures 결합(설계 4.6절 2번)은 integrationTest 안 사본으로 끊었다.
- Buf lint·breaking은 Gradle 태스크(scripts/buf.sh)로 ci에 넣었다.

버린 대안: build-logic을 템플릿이 배포(L2, 순환), 공통 repo(L3, repo가
하나 더), 표준 플러그인만으로 새로 쓰기(L4, strict lane과 방향 검사를
잃음). SBOM은 CycloneDX Gradle 플러그인 대신 이미 고정해 쓰는 Trivy로
만든다(도구를 늘리지 않는다).

위험: strictlane 단계 검사는 included build 태스크를 따라가다 실패해서
그 태스크를 건너뛰게 고쳤다(UPSTREAM.md). Gitea에 실제로 올리는 경로는
비밀 값이 없어 이 커밋에서는 시험하지 못했다.

검증(desktop, 이 트리): ./gradlew ci rc=0, 테스트 739개(build-logic
포함) 중 첫 실행 실패 1개(템플릿 경로를 찾던 GrpcPackageOwnershipTest)를
고친 뒤 통과. ./gradlew verifyStrictLaneStages --dry-run rc=0.

Refs: design-docs repo-structure/05-library-repos.md 4.6·7·10절
2026-11-08 11:10:21 +09:00

94 lines
4.6 KiB
XML

<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<!--
feature-static-analysis-quality-contract D2 — custom minimal Checkstyle ruleset.
Scope is deliberately limited to what google-java-format (Spotless, D1) CANNOT enforce:
naming and logical/design rules. Formatting and import-order modules are
intentionally ABSENT — the formatter owns them. Enabling LineLength/Indentation/Whitespace/
CustomImportOrder here would fight the formatter (checkstyle #6527) and trap CI in an
infinite reformat loop.
Test-source relaxations live in checkstyle-suppressions.xml (resolved via ${config_loc}).
-->
<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="error"/>
<property name="fileExtensions" value="java"/>
<!-- Test-source + generated-source relaxations (checkstyleTest is warning-only anyway). -->
<module name="SuppressionFilter">
<property name="file" value="${config_loc}/checkstyle-suppressions.xml"/>
<property name="optional" value="false"/>
</module>
<module name="TreeWalker">
<!-- ================= naming (KEEP, blocking) — CS-C2 / CS-C5 ================= -->
<module name="TypeName"/>
<module name="MethodName"/>
<!-- ConstantName: real constants are UPPER_SNAKE_CASE (code-conventions N9), but a
Logger has mutable observable state so it is NOT a constant — Google §5.2.4 names
it lowerCamelCase (log/logger). Permit those two idiomatic logger names. -->
<module name="ConstantName">
<property name="format" value="^(log|logger|[A-Z][A-Z0-9]*(_[A-Z0-9]+)*)$"/>
</module>
<module name="MemberName"/>
<module name="StaticVariableName"/>
<module name="ParameterName"/>
<module name="LambdaParameterName"/>
<module name="CatchParameterName"/>
<module name="LocalVariableName"/>
<module name="LocalFinalVariableName"/>
<module name="PackageName"/>
<!-- Type parameters are UPPER alphanumeric. Allows the conventional T/E/K/V/R and the
F-bounded self-type idiom SELF (see ResourceId<SELF extends ResourceId<SELF>>). -->
<module name="ClassTypeParameterName">
<property name="format" value="^[A-Z][A-Z0-9]*$"/>
</module>
<module name="InterfaceTypeParameterName">
<property name="format" value="^[A-Z][A-Z0-9]*$"/>
</module>
<module name="MethodTypeParameterName">
<property name="format" value="^[A-Z][A-Z0-9]*$"/>
</module>
<module name="RecordComponentName"/>
<module name="RecordTypeParameterName">
<property name="format" value="^[A-Z][A-Z0-9]*$"/>
</module>
<module name="PatternVariableName"/>
<!-- ================= file/type structure (code-conventions I6) =================
One top-level type per file, and the file is named after it.
These replace the hand-rolled `verifyOneTypePerFile` Gradle task, which matched
`^public ...` line by line. That regex could not see a package-private top-level type
(126 main sources declared none that it matched at all), read only `src/main/java`,
and anchored at column 0 so a block comment or text-block line starting with `public`
would have counted as a declaration. Checkstyle parses the file, so all three go away.
Neither rule is redundant with javac. javac rejects a *public* type whose name does not
match the file; both of these also hold for package-private top-level types, which
javac accepts.
Scope is main source only, which is exactly what the task it replaces checked. Test
sources declare 29 co-located fixture types that these rules would reject, and widening
the rule while claiming to replace a task is two changes wearing one name — the
exemption is in checkstyle-suppressions.xml with the count. -->
<module name="OneTopLevelClass"/>
<module name="OuterTypeFilename"/>
<!-- ================= logical / design (KEEP) — google_checks CS-C1 ================= -->
<module name="NeedBraces"/>
<module name="FallThrough"/>
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="expected|ignored"/>
</module>
<module name="OneStatementPerLine"/>
<module name="MissingSwitchDefault"/>
</module>
</module>