Skip to content

Commit 3810ae0

Browse files
committed
feat: add README and CLAUDE
1 parent a76edc1 commit 3810ae0

2 files changed

Lines changed: 161 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
2+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
3+
4+
## What This Project Is
5+
6+
A Gradle **settings plugin** (`com.morphismmc.mod-dev-catalog`) that provides curated version catalogs for Minecraft mod development. Modders apply it in `settings.gradle.kts` to get pre-defined, versioned dependencies for a given Minecraft version/mod loader combination.
7+
8+
## Build & Test Commands
9+
10+
```bash
11+
./gradlew build --no-daemon # Full build: compile, test, lint, detekt
12+
./gradlew test --no-daemon # Unit tests only
13+
./gradlew functionalTest --no-daemon # Gradle TestKit integration tests
14+
./gradlew ktlint --no-daemon # Kotlin code style check
15+
./gradlew detekt --no-daemon # Static analysis
16+
./gradlew publish --no-daemon # Publish (requires MAVEN_ADMIN_USERNAME / MAVEN_ADMIN_PASSWORD)
17+
```
18+
19+
To run a single test class:
20+
```bash
21+
./gradlew test --tests "com.morphismmc.moddevcatalog.MyTest" --no-daemon
22+
./gradlew functionalTest --tests "com.morphismmc.moddevcatalog.CatalogPluginFunctionalTest" --no-daemon
23+
```
24+
25+
## Architecture
26+
27+
### Plugin Entry Points
28+
29+
- [ModDevCatalogPlugin.kt](src/main/kotlin/com/morphismmc/moddevcatalog/ModDevCatalogPlugin.kt) — Implements `Plugin<Settings>`. Creates the `modDevCatalog` extension and is the only class registered in the plugin descriptor.
30+
- [ModDevCatalogExtension.kt](src/main/kotlin/com/morphismmc/moddevcatalog/ModDevCatalogExtension.kt) — All catalog loading and Gradle integration logic lives here (~116 lines).
31+
32+
### Code Flow
33+
34+
1. Consumer project applies `id("com.morphismmc.mod-dev-catalog")` in `settings.gradle.kts`.
35+
2. `ModDevCatalogPlugin.apply(settings)` creates the `modDevCatalog` extension.
36+
3. Consumer calls `modDevCatalog { catalog("1.20.1-forge") }`.
37+
4. `catalog(catalogId)` loads `/catalogs/{catalogId}.toml` from the plugin JAR's classpath, parses it with `tomlj`, and calls `settings.dependencyResolutionManagement.versionCatalogs.create(...)` to register versions, libraries, and bundles.
38+
5. A `settingsEvaluated` callback wires exclusive content repository rules — each group is restricted to its designated Maven repo to prevent dependency confusion.
39+
40+
### Catalog TOML Format
41+
42+
Catalogs live in [src/main/resources/catalogs/](src/main/resources/catalogs/). Custom sections map to Maven repositories:
43+
44+
```toml
45+
[repositories]
46+
BlameJared = "https://maven.blamejared.com/"
47+
48+
[versions]
49+
jei = "15.20.0.121"
50+
51+
[BlameJared]
52+
jei-api = { group = "mezz.jei", name = "jei-1.20.1-common-api", version-ref = "jei" }
53+
54+
[bundles]
55+
jei = ["jei-api", "jei-impl"]
56+
```
57+
58+
### Key Build Details
59+
60+
- **JDK 21** (`kotlin { jvmToolchain(21) }`)
61+
- `tomlj` (TOML parser) and its ANTLR runtime are **shaded** into the plugin JAR via the `shadow` plugin to avoid classpath conflicts.
62+
- Functional tests use a separate `functionalTest` source set with Gradle TestKit.
63+
- Configuration cache, build cache, and parallel builds are all enabled in `gradle.properties`.

README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Mod Dev Catalog
2+
3+
A Gradle **settings plugin** that provides curated version catalogs for Minecraft mod development. Apply it once in `settings.gradle.kts` to get pre-configured, versioned library definitions for popular mods — no more copy-pasting Maven coordinates.
4+
5+
## Supported Catalogs
6+
7+
| Catalog ID | Minecraft | Mod Loader |
8+
|-------------------|-----------|---------------------|
9+
| `1.20.1-forge` | 1.20.1 | Forge 47.4.3 |
10+
| `1.21.1-neoforge` | 1.21.1 | NeoForge |
11+
12+
## Setup
13+
14+
### 1. Apply the plugin in `settings.gradle.kts`
15+
16+
```kotlin
17+
plugins {
18+
id("com.morphismmc.mod-dev-catalog") version "26.3.25"
19+
}
20+
21+
modDevCatalog {
22+
catalog("1.21.1-neoforge") // registers as catalog named "mods"
23+
}
24+
```
25+
26+
The plugin is available from the [Gradle Plugin Portal](https://plugins.gradle.org/plugin/com.morphismmc.mod-dev-catalog) and the MorphismMC Maven repository (`https://maven.morphismmc.com/releases`).
27+
28+
### 2. Use dependencies in `build.gradle.kts`
29+
30+
The catalog is registered under the name `mods` by default. Alias kebab-case names (`jei-api`) become dot-accessor chains (`mods.jei.api`).
31+
32+
```kotlin
33+
dependencies {
34+
// Single library
35+
compileOnly(mods.jei.api)
36+
37+
// Bundle (group of related libraries)
38+
compileOnly(mods.bundles.jei)
39+
runtimeOnly(mods.bundles.rei)
40+
}
41+
```
42+
43+
To use a different catalog name, pass a second argument:
44+
45+
```kotlin
46+
modDevCatalog {
47+
catalog("1.21.1-neoforge", "modlibs")
48+
}
49+
// then: modlibs.jei.api, modlibs.bundles.jei, etc.
50+
```
51+
52+
The plugin also automatically configures exclusive-content repository rules for each Maven repository, so Gradle resolves each group from the correct source.
53+
54+
## Available Libraries
55+
56+
### `1.21.1-neoforge`
57+
58+
| Alias | Library |
59+
|---|---|
60+
| `jei.api` | JEI NeoForge API |
61+
| `jei.impl` | JEI NeoForge |
62+
| `rei.api` | REI NeoForge API |
63+
| `rei.impl` | REI NeoForge |
64+
| `rei.plugin` | REI Default Plugin NeoForge |
65+
| `patchouli` | Patchouli |
66+
| `emi` | EMI |
67+
| `jade` | Jade |
68+
| `ae2` | Applied Energistics 2 |
69+
| `kjs` | KubeJS NeoForge |
70+
| **`bundles.jei`** | jei.api + jei.impl |
71+
| **`bundles.rei`** | rei.api + rei.impl + rei.plugin |
72+
73+
### `1.20.1-forge`
74+
75+
| Alias | Library |
76+
|---|---|
77+
| `jei.api.common` | JEI Common API |
78+
| `jei.api.forge` | JEI Forge API |
79+
| `jei.impl` | JEI Forge |
80+
| `rei.api` | REI Forge API |
81+
| `rei.impl` | REI Forge |
82+
| `rei.plugin` | REI Default Plugin Forge |
83+
| `architectury` | Architectury Forge |
84+
| `jade` | Jade |
85+
| `modernui` | Modern UI |
86+
| `jecharacters` | Just Enough Characters |
87+
| `placebo` | Placebo |
88+
| `hostile.neural.networks` | Hostile Neural Networks |
89+
| `emi` | EMI |
90+
| `ftb.library` | FTB Library |
91+
| `appeng` | Applied Energistics 2 |
92+
| `mekanism` | Mekanism |
93+
| **`bundles.jei`** | jei.api.common + jei.api.forge + jei.impl |
94+
| **`bundles.rei`** | rei.api + rei.impl + rei.plugin |
95+
96+
## License
97+
98+
[MIT](LICENSE)

0 commit comments

Comments
 (0)