Skip to content

Commit 77b6af3

Browse files
authored
Integrate documentation into main repository (#1388)
2 parents c30641e + 319107e commit 77b6af3

File tree

99 files changed

+27673
-12
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+27673
-12
lines changed

.readthedocs.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the version of Python and other tools you might need
9+
build:
10+
os: ubuntu-22.04
11+
tools:
12+
python: "3.11"
13+
14+
# Build documentation in the docs/ directory with Sphinx
15+
sphinx:
16+
configuration: docs/conf.py
17+
builder: dirhtml
18+
19+
# We recommend specifying your dependencies to enable reproducible builds:
20+
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
21+
python:
22+
install:
23+
- requirements: docs/requirements.txt

CLAUDE.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ SQL files use special comments for dynamic SQL that remain valid SQL when run di
8080

8181
## Development Guidelines
8282

83+
### Setting Up Development Environment
84+
- Install JDK 21 (recommended via [SDKMAN](https://sdkman.io/jdks))
85+
- Clone repository: `git clone https://github.com/domaframework/doma.git`
86+
- Build project: `./gradlew build`
87+
- For IDE setup, import as a Gradle project (IntelliJ IDEA recommended)
88+
8389
### Annotation Processing Configuration
8490
When modifying annotation processors or entity/domain classes, the `ap` property in `gradle.properties` can be used to pass additional annotation processor options in CSV format.
8591

@@ -93,8 +99,51 @@ All code must pass Spotless formatting checks. The build automatically applies f
9399
- Always use explicit imports for each class (e.g., `import java.util.List;`, `import java.util.Map;`)
94100
- This improves code readability and makes dependencies explicit
95101

102+
### Contributing Guidelines
103+
- Submit contributions via GitHub Pull Requests from your own fork
104+
- Write issues and PRs in English for broader accessibility
105+
- All contributions are licensed under Apache License 2.0
106+
- Use snapshot versions from Sonatype repository for testing unreleased features
107+
96108
### Database Compatibility Testing
97109
When making changes that affect SQL generation or JDBC operations, run tests against multiple databases using `./gradlew testAll` to ensure compatibility.
98110

99111
### Integration Test Structure
100112
Integration tests use Testcontainers for database provisioning. Database URLs are configured in `gradle.properties` with the `TC_DAEMON=true` flag to improve test performance by reusing containers.
113+
114+
## Documentation
115+
116+
### Documentation System
117+
The project uses Sphinx for documentation generation, hosted on ReadTheDocs:
118+
- **Source**: Documentation source files are in the `docs/` directory
119+
- **Format**: Written in reStructuredText (`.rst`) format
120+
- **Languages**: English and Japanese (full translation support)
121+
- **URL**: https://doma.readthedocs.io/
122+
123+
### Documentation Structure
124+
- **Getting Started**: Setup guide and quickstart (`getting-started.rst`)
125+
- **Core Concepts**: Entity, Domain, DAO, Embeddable documentation
126+
- **Query Operations**: Comprehensive guides for all database operations in `query/` subdirectory
127+
- **Query Building**: Criteria API, Query DSL, SQL templates documentation
128+
- **Framework Integration**: Spring Boot, Quarkus, Lombok, Kotlin support guides
129+
- **Development**: Build configuration, annotation processing, code generation
130+
131+
### Building Documentation Locally
132+
```bash
133+
# Install dependencies
134+
cd docs
135+
pip install -r requirements.txt
136+
137+
# Generate HTML documentation with auto-reload
138+
sphinx-autobuild . _build/html
139+
# Visit http://127.0.0.1:8000
140+
141+
# Generate translation files
142+
sphinx-build -b gettext . _build/gettext
143+
```
144+
145+
### Documentation Guidelines
146+
- Verify RST syntax and rendering before submitting PRs
147+
- Maintain consistency with existing documentation style
148+
- Update both English and Japanese translations when applicable
149+
- Test documentation builds locally using `sphinx-autobuild`

CONTRIBUTING.md

Lines changed: 123 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ To contribute, use GitHub Pull Requests, from your own fork.
2626
Clone the repository and navigate to the root directory.
2727
Then run the Gradle `build` task:
2828

29-
```
29+
```bash
3030
$ git clone https://github.com/domaframework/doma.git
3131
$ cd doma
3232
$ ./gradlew build
@@ -35,18 +35,43 @@ $ ./gradlew build
3535
#### Using snapshots
3636

3737
Instead of building Doma from the master branch, you may want to use snapshots.
38-
To use snapshots, define a Maven repository in your build.gradle as follows:
38+
Snapshots are automatically published when each pull request is merged into the master branch.
39+
40+
##### Gradle configuration
41+
42+
Add the Sonatype snapshot repository to your `build.gradle.kts`:
3943

40-
```groovy
44+
```kotlin
4145
repositories {
42-
maven {url 'https://oss.sonatype.org/content/repositories/snapshots/'}
46+
mavenCentral()
47+
maven("https://central.sonatype.com/repository/maven-snapshots/")
48+
}
49+
```
50+
51+
Then use the snapshot version (e.g., `3.10.0-SNAPSHOT`):
52+
53+
```kotlin
54+
dependencies {
55+
implementation("org.seasar.doma:doma-core:3.10.0-SNAPSHOT")
56+
annotationProcessor("org.seasar.doma:doma-processor:3.10.0-SNAPSHOT")
4357
}
4458
```
4559

46-
Snapshots are published when each pull request is merged into the master branch.
47-
You can check the last publication date here:
60+
##### Maven configuration
61+
62+
Add the repository to your `pom.xml`:
4863

49-
- https://oss.sonatype.org/content/repositories/snapshots/org/seasar/doma/
64+
```xml
65+
<repositories>
66+
<repository>
67+
<id>sonatype-snapshots</id>
68+
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
69+
<snapshots>
70+
<enabled>true</enabled>
71+
</snapshots>
72+
</repository>
73+
</repositories>
74+
```
5075

5176
### IDE - IntelliJ IDEA
5277

@@ -57,15 +82,101 @@ Import the root directory as a Gradle project.
5782
We use [spotless](https://github.com/diffplug/spotless) and
5883
[google-java-format](https://github.com/google/google-java-format) for code formatting.
5984

60-
To format, just run the Gradle `build` task:
85+
#### Automatic formatting
6186

62-
```
87+
Code formatting is automatically applied when running the build:
88+
89+
```bash
6390
$ ./gradlew build
6491
```
6592

66-
To run google-java-format in your IDE,
67-
see https://github.com/google/google-java-format#using-the-formatter.
93+
To only check formatting without building:
94+
95+
```bash
96+
$ ./gradlew spotlessCheck
97+
```
98+
99+
To apply formatting without building:
100+
101+
```bash
102+
$ ./gradlew spotlessApply
103+
```
104+
105+
#### IDE integration
106+
107+
To run google-java-format in your IDE:
108+
- IntelliJ IDEA: Install the [google-java-format plugin](https://plugins.jetbrains.com/plugin/8527-google-java-format)
109+
- Eclipse: Follow instructions at https://github.com/google/google-java-format#eclipse
110+
- VS Code: Install the [Language Support for Java extension](https://marketplace.visualstudio.com/items?itemName=redhat.java)
111+
112+
**Important**: Do not use wildcard imports (e.g., `import java.util.*;`). Always use explicit imports.
68113

69114
### Documentation
70115

71-
See https://github.com/domaframework/doma-docs
116+
We use [Sphinx](http://sphinx-doc.org) to generate documents.
117+
The generated documents are hosted on ReadTheDocs.
118+
119+
- **Production**: https://doma.readthedocs.io/
120+
- **Latest (master branch)**: https://doma.readthedocs.io/en/latest/
121+
122+
To contribute to documentation, you need Python 3.x.
123+
124+
#### Install Sphinx
125+
126+
Navigate to the docs directory and install dependencies:
127+
128+
```bash
129+
$ cd docs
130+
$ pip install -r requirements.txt
131+
```
132+
133+
#### Generate HTML files
134+
135+
Use `sphinx-autobuild` for live-reloading development server:
136+
137+
```bash
138+
$ cd docs
139+
$ sphinx-autobuild . _build/html
140+
```
141+
142+
Visit http://127.0.0.1:8000 to preview your changes. The page automatically reloads when you modify RST files.
143+
144+
#### Build documentation
145+
146+
To build HTML documentation without auto-reload:
147+
148+
```bash
149+
$ cd docs
150+
$ make html
151+
```
152+
153+
The generated HTML files will be in `docs/_build/html/`.
154+
155+
#### Translations
156+
157+
Doma documentation supports Japanese translations. To work with translations:
158+
159+
Generate POT files (translation templates):
160+
161+
```bash
162+
$ cd docs
163+
$ sphinx-build -b gettext . _build/gettext
164+
```
165+
166+
Update PO files (translation files):
167+
168+
```bash
169+
$ cd docs
170+
$ sphinx-intl update -p _build/gettext -l ja
171+
```
172+
173+
The Japanese translation files are located in `docs/locale/ja/LC_MESSAGES/`.
174+
175+
#### Documentation guidelines
176+
177+
- Write documentation in English first
178+
- Use clear, concise language
179+
- Include code examples where appropriate
180+
- Test all code examples to ensure they work
181+
- Verify RST syntax and rendering before submitting PRs
182+
- Update the table of contents (`index.rst`) when adding new pages

docs/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/_build/
2+
/locale/**/*.mo

docs/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
SOURCEDIR = .
8+
BUILDDIR = _build
9+
10+
# Put it first so that "make" without argument is like "make help".
11+
help:
12+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
13+
14+
.PHONY: help Makefile
15+
16+
# Catch-all target: route all unknown targets to Sphinx using the new
17+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
18+
%: Makefile
19+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/_static/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)