Skip to content

Commit 3653172

Browse files
Canatoclaude
andcommitted
Add build-project skill - Build configurations utility
- Level 1 utility skill - Multiple build types (full/library/sample/clean) - Quality checks integration - Documentation generation Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 7ce14f7 commit 3653172

1 file changed

Lines changed: 317 additions & 0 deletions

File tree

.claude/skills/build-project.md

Lines changed: 317 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,317 @@
1+
---
2+
name: build-project
3+
description: Build the Android Image Cropper project with various configurations
4+
argument-hint: "[build-type: full|library|sample|clean]"
5+
level: 1
6+
triggers:
7+
- "build"
8+
- "build project"
9+
- "compile"
10+
---
11+
12+
# Build Project Skill
13+
14+
Build the Android Image Cropper project with different configurations and targets.
15+
16+
## Quick Commands
17+
18+
### Full Build with All Checks
19+
```bash
20+
./gradlew clean build --stacktrace
21+
```
22+
23+
### Build with All Quality Checks
24+
```bash
25+
./gradlew licensee ktlint testDebug build --stacktrace
26+
```
27+
28+
### Build Library Only
29+
```bash
30+
./gradlew :cropper:build
31+
```
32+
33+
### Build Sample App
34+
```bash
35+
./gradlew :sample:assembleDebug
36+
```
37+
38+
### Install Sample App on Device
39+
```bash
40+
./gradlew :sample:installDebug
41+
```
42+
43+
## Build Configurations
44+
45+
### Clean Build
46+
**When**: Before releases, after major changes, when build is acting weird
47+
48+
```bash
49+
./gradlew clean
50+
./gradlew build --stacktrace
51+
```
52+
53+
### Debug Build
54+
**When**: During development
55+
56+
```bash
57+
./gradlew assembleDebug
58+
```
59+
60+
### Release Build
61+
**When**: Testing release configuration
62+
63+
```bash
64+
./gradlew assembleRelease
65+
```
66+
67+
## Quality Checks
68+
69+
### All Quality Checks
70+
```bash
71+
./gradlew licensee ktlint testDebug build --stacktrace
72+
```
73+
74+
### Individual Checks
75+
76+
**License Check**:
77+
```bash
78+
./gradlew licensee
79+
```
80+
81+
**Code Style**:
82+
```bash
83+
./gradlew ktlint
84+
```
85+
86+
**Tests**:
87+
```bash
88+
./gradlew testDebug
89+
```
90+
91+
**Lint**:
92+
```bash
93+
./gradlew lint
94+
```
95+
96+
## Documentation Generation
97+
98+
### Generate API Docs with Dokka
99+
```bash
100+
./gradlew dokkaHtml
101+
```
102+
103+
**Output**: `cropper/build/dokka/html/index.html`
104+
105+
### Generate All Documentation
106+
```bash
107+
./gradlew dokka
108+
```
109+
110+
## Build Artifacts
111+
112+
### Library AAR
113+
**Location**: `cropper/build/outputs/aar/`
114+
115+
```bash
116+
./gradlew :cropper:assembleRelease
117+
ls -lh cropper/build/outputs/aar/
118+
```
119+
120+
### Sample APK
121+
**Location**: `sample/build/outputs/apk/debug/`
122+
123+
```bash
124+
./gradlew :sample:assembleDebug
125+
ls -lh sample/build/outputs/apk/debug/
126+
```
127+
128+
## Publishing (Local)
129+
130+
### Publish to Maven Local
131+
**When**: Testing library changes in another project locally
132+
133+
```bash
134+
./gradlew publishToMavenLocal
135+
```
136+
137+
**Then in consuming project**:
138+
```groovy
139+
repositories {
140+
mavenLocal()
141+
}
142+
143+
dependencies {
144+
implementation("com.vanniktech:android-image-cropper:4.8.0-SNAPSHOT")
145+
}
146+
```
147+
148+
## Gradle Tasks Reference
149+
150+
### View All Tasks
151+
```bash
152+
./gradlew tasks --all
153+
```
154+
155+
### View Specific Module Tasks
156+
```bash
157+
./gradlew :cropper:tasks
158+
./gradlew :sample:tasks
159+
```
160+
161+
### Dependency Tasks
162+
```bash
163+
# View dependencies
164+
./gradlew :cropper:dependencies
165+
166+
# Check for dependency updates
167+
./gradlew dependencyUpdates
168+
```
169+
170+
## Build Performance
171+
172+
### Build with Performance Metrics
173+
```bash
174+
./gradlew build --profile
175+
```
176+
177+
**Report**: `build/reports/profile/`
178+
179+
### Build Cache Info
180+
```bash
181+
./gradlew build --build-cache
182+
```
183+
184+
### Parallel Build
185+
```bash
186+
./gradlew build --parallel
187+
```
188+
189+
## Troubleshooting Builds
190+
191+
### Issue: Build fails with "Out of Memory"
192+
**Solution**:
193+
```bash
194+
# Increase heap size (already set in gradle.properties)
195+
# If still failing, try:
196+
export GRADLE_OPTS="-Xmx4096m"
197+
./gradlew build
198+
```
199+
200+
### Issue: Build fails with "Permission denied"
201+
**Solution**:
202+
```bash
203+
chmod +x gradlew
204+
./gradlew build
205+
```
206+
207+
### Issue: Gradle daemon issues
208+
**Solution**:
209+
```bash
210+
./gradlew --stop
211+
./gradlew build
212+
```
213+
214+
### Issue: Dependency resolution fails
215+
**Solution**:
216+
```bash
217+
./gradlew build --refresh-dependencies
218+
```
219+
220+
### Issue: Build cache corruption
221+
**Solution**:
222+
```bash
223+
rm -rf ~/.gradle/caches/
224+
./gradlew build
225+
```
226+
227+
### Issue: Android SDK not found
228+
**Solution**:
229+
1. Install Android SDK
230+
2. Set `ANDROID_HOME` environment variable
231+
3. Create `local.properties`:
232+
```properties
233+
sdk.dir=/path/to/android/sdk
234+
```
235+
236+
## Build Verification
237+
238+
### Pre-Commit Checks
239+
```bash
240+
./gradlew ktlintFormat testDebug
241+
```
242+
243+
### Pre-PR Checks
244+
```bash
245+
./gradlew clean licensee ktlint testDebug build --stacktrace
246+
```
247+
248+
### Pre-Release Checks
249+
```bash
250+
./gradlew clean
251+
./gradlew licensee ktlint testDebug verifyPaparazziDebug build --stacktrace
252+
./gradlew :sample:installDebug
253+
# Manual testing of sample app
254+
```
255+
256+
## Continuous Integration
257+
258+
### CI Build Command
259+
This is what runs in GitHub Actions:
260+
```bash
261+
./gradlew licensee ktlint testDebug build --stacktrace
262+
```
263+
264+
### Local CI Simulation
265+
```bash
266+
# Clean environment
267+
./gradlew clean
268+
269+
# Run CI checks
270+
./gradlew licensee ktlint testDebug build --stacktrace
271+
272+
# Check exit code
273+
echo $? # Should be 0
274+
```
275+
276+
## Build Output Locations
277+
278+
```
279+
Android-Image-Cropper/
280+
├── cropper/build/
281+
│ ├── outputs/aar/ # Library artifacts
282+
│ ├── reports/tests/ # Test reports
283+
│ ├── reports/lint/ # Lint reports
284+
│ └── dokka/ # API documentation
285+
├── sample/build/
286+
│ └── outputs/apk/ # Sample APKs
287+
└── build/
288+
├── reports/ # Root project reports
289+
└── dokka/ # Combined documentation
290+
```
291+
292+
## Quick Reference
293+
294+
| Task | Command |
295+
|------|---------|
296+
| **Full build** | `./gradlew build` |
297+
| **Clean build** | `./gradlew clean build` |
298+
| **With checks** | `./gradlew licensee ktlint testDebug build --stacktrace` |
299+
| **Format code** | `./gradlew ktlintFormat` |
300+
| **Run tests** | `./gradlew testDebug` |
301+
| **Install sample** | `./gradlew :sample:installDebug` |
302+
| **Generate docs** | `./gradlew dokkaHtml` |
303+
| **Publish local** | `./gradlew publishToMavenLocal` |
304+
305+
## Best Practices
306+
307+
1. **Always clean before release builds**: `./gradlew clean`
308+
2. **Use --stacktrace for debugging**: Shows full error details
309+
3. **Run ktlintFormat before committing**: Auto-fix style issues
310+
4. **Test both modules**: Library and sample app
311+
5. **Check build reports**: Review test and lint reports
312+
6. **Use build cache**: Speeds up incremental builds
313+
7. **Keep Gradle updated**: Follow project's Gradle version
314+
315+
---
316+
317+
*A clean build is a happy build.*

0 commit comments

Comments
 (0)