Skip to content

Commit 8658968

Browse files
authored
Merge pull request #5 from tolgee/jirikuchynka/gettin-production-ready
2 parents 364c7bf + 694544f commit 8658968

151 files changed

Lines changed: 3064 additions & 3127 deletions

File tree

Some content is hidden

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

.junie/guidelines.md

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
# Development Guidelines for Tolgee Mobile Kotlin SDK
2+
3+
This document provides essential information for developers working on the Tolgee Mobile Kotlin SDK project.
4+
5+
## Build/Configuration Instructions
6+
7+
### Project Structure
8+
9+
The project consists of several modules:
10+
11+
- **core**: The Kotlin Multiplatform library providing runtime support for Tolgee translations
12+
- **compose**: Compose Multiplatform integration for Tolgee
13+
- **compiler-plugin**: Kotlin compiler plugin for Tolgee
14+
- **gradle-plugin**: Gradle plugin for integrating Tolgee into projects
15+
- **demo**: Demo applications showcasing Tolgee usage
16+
17+
### Building the Project
18+
19+
1. **Prerequisites**:
20+
- JDK 11 or higher
21+
- Kotlin 1.9.0 or higher
22+
- Android SDK (for Android targets)
23+
- Xcode (for Apple targets)
24+
25+
2. **Building from the command line**:
26+
```bash
27+
./gradlew build
28+
```
29+
30+
3. **Building specific modules**:
31+
```bash
32+
./gradlew :core:build
33+
./gradlew :compose:build
34+
./gradlew :gradle-plugin:build
35+
./gradlew :compiler-plugin:build
36+
```
37+
38+
4. **Publishing to Maven Local** (for local testing):
39+
```bash
40+
./gradlew publishToMavenLocal
41+
```
42+
You may need to disable signing temporarily as it is enforced by default.
43+
44+
## Testing Information
45+
46+
Testing infrastructure is in a relatively ok state, but there are no tests at the moment.
47+
48+
### Running Tests
49+
50+
Tests can be run using the Gradle test task:
51+
52+
```bash
53+
# Run all tests
54+
./gradlew test
55+
56+
# Run tests for a specific module
57+
./gradlew :gradle-plugin:test
58+
./gradlew :core:test
59+
./gradlew :compose:test
60+
./gradlew :compiler-plugin:test
61+
62+
# Run a specific test class
63+
./gradlew :gradle-plugin:test --tests "TolgeeTest"
64+
65+
# Run a specific test method
66+
./gradlew :gradle-plugin:test --tests "TolgeeTest.tolgee cli version check"
67+
```
68+
69+
### Adding New Tests
70+
71+
1. **Create a test file** in the appropriate module's test directory:
72+
- For JVM modules: `<module>/src/test/kotlin/`
73+
- For Android modules: `<module>/src/androidTest/kotlin/`
74+
- For multiplatform modules: `<module>/src/commonTest/kotlin/` (or platform-specific test directories)
75+
76+
2. **Test structure example**:
77+
78+
```kotlin
79+
class MyTest {
80+
81+
@Test
82+
fun `test some functionality`() {
83+
// Test implementation
84+
assertEquals(expected, actual, "Error message")
85+
}
86+
}
87+
```
88+
89+
3. **Running your new test**:
90+
```bash
91+
./gradlew :<module>:test --tests "MyTest"
92+
```
93+
94+
### Test Example
95+
96+
Here's a simple test example that was created and verified to work:
97+
98+
```kotlin
99+
class SimpleTest {
100+
101+
@Test
102+
fun `simple addition test`() {
103+
// A simple test to demonstrate testing in this project
104+
assertEquals(4, 2 + 2, "Basic addition should work correctly")
105+
}
106+
}
107+
```
108+
109+
## Additional Development Information
110+
111+
### Code Style
112+
113+
- The project follows Kotlin coding conventions
114+
- Use 4 spaces for indentation
115+
- The maximum line length is 120 characters (not fully enforced at the moment)
116+
- Use trailing commas in parameter lists and collection literals that span multiple lines
117+
118+
### Multiplatform Considerations
119+
120+
- Common code should be placed in `commonMain` source sets
121+
- Platform-specific code should be placed in the appropriate platform-specific source sets:
122+
- `androidMain` for Android
123+
- `jvmMain` for JVM
124+
- `appleMain` for Apple platforms (iOS, macOS, etc.)
125+
- `jsMain` for JavaScript
126+
- etc.
127+
128+
### Dependency Management
129+
130+
- Dependencies are managed through Version Catalog in `gradle/libs.versions.toml`
131+
- When adding new dependencies, add them to the Version Catalog rather than directly in build scripts
132+
133+
### Publishing
134+
135+
The project uses the Vanniktech Maven Publish plugin for publishing to Maven Central:
136+
137+
```kotlin
138+
mavenPublishing {
139+
publishToMavenCentral(host = SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
140+
signAllPublications()
141+
142+
coordinates(
143+
groupId = "io.tolgee",
144+
artifactId = "module-name",
145+
version = "version"
146+
)
147+
}
148+
```
149+
150+
### API Compatibility
151+
152+
The project uses the Binary Compatibility Validator plugin to ensure API compatibility. After making changes to public APIs, run:
153+
154+
```bash
155+
./gradlew apiDump
156+
```
157+
158+
This will update the API dump files in the `api` directory of each module. These files should be committed to the repository.

0 commit comments

Comments
 (0)