|
| 1 | +# Contributing to Godot AdMob Plugin |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the Godot AdMob Plugin! This guide will help you get started with the development process. |
| 4 | + |
| 5 | +## 🤝 How to Contribute |
| 6 | + |
| 7 | +### Reporting Bugs |
| 8 | +- Check the [existing issues](https://github.com/poingstudios/godot-admob-plugin/issues) to see if the bug has already been reported. |
| 9 | +- If not, open a new issue with a clear title and description. |
| 10 | +- Provide reproduction steps and, if possible, a minimal reproduction project. |
| 11 | +- Include information about your Godot version and target platform (Android/iOS). |
| 12 | + |
| 13 | +### Feature Requests |
| 14 | +- Check [existing issues](https://github.com/poingstudios/godot-admob-plugin/issues) or [discussions](https://github.com/poingstudios/godot-admob-plugin/discussions). |
| 15 | +- Open a new issue to discuss the feature before starting implementation. |
| 16 | + |
| 17 | +## 💻 Development Setup |
| 18 | + |
| 19 | +### Requirements |
| 20 | +- **Godot 4.2+** (Standard or .NET edition). |
| 21 | +- **Android**: Android Studio & SDK (minimum API 24). |
| 22 | +- **iOS**: macOS with Xcode 15+ and SCons installed (`brew install scons`). |
| 23 | +- **Python 3.x**: Required for Godot's build system and internal scripts. |
| 24 | + |
| 25 | +### Workflow |
| 26 | +1. Fork the repository. |
| 27 | +2. Clone your fork locally. |
| 28 | +3. Create a branch for your changes (`git checkout -b feature/my-new-feature`). |
| 29 | + |
| 30 | +--- |
| 31 | + |
| 32 | +## 🛠️ Build Process |
| 33 | + |
| 34 | +The plugin consists of a Godot editor component and native binaries for Android and iOS. |
| 35 | + |
| 36 | +### General Build (Auto-updating the Editor Plugin) |
| 37 | +To build the native binaries and automatically copy/extract them to the [`platforms/godot_editor/`](./platforms/godot_editor/) directory, use the provided local build script. **This script handles the export process automatically for the selected platform(s).** |
| 38 | + |
| 39 | +- **Android** binaries are built via Gradle and exported to `platforms/godot_editor/addons/admob/android/bin/`. |
| 40 | +- **iOS** binaries are built via SCons/SPM and extracted to `platforms/godot_editor/ios/plugins/`. |
| 41 | + |
| 42 | +```bash |
| 43 | +# Usage: ./scripts/build_local.sh [android|ios|all] <godot_version> |
| 44 | +./scripts/build_local.sh all 4.6.1 |
| 45 | +``` |
| 46 | + |
| 47 | +### 🤖 Android Build Details |
| 48 | +Located in [`platforms/android/`](./platforms/android/). Build and export are handled via Gradle. |
| 49 | + |
| 50 | +- **Tools**: Android Studio / SDK. |
| 51 | +- **Manual Build**: |
| 52 | + ```bash |
| 53 | + cd platforms/android |
| 54 | + ./gradlew build |
| 55 | + ./gradlew exportFiles -PpluginExportPath=../godot_editor/addons/admob/android/bin |
| 56 | + ``` |
| 57 | +- **Logging**: `adb logcat -s poing-godot-admob godot` |
| 58 | + |
| 59 | +### 🍎 iOS Build Details |
| 60 | +Located in [`platforms/ios/`](./platforms/ios/). Build is handled via a dedicated shell script. |
| 61 | + |
| 62 | +- **Tools**: Xcode 15+, SCons. |
| 63 | +- **Manual Build**: |
| 64 | + ```bash |
| 65 | + cd platforms/ios |
| 66 | + ./scripts/build.sh <godot_version> |
| 67 | + ``` |
| 68 | +- **Note**: This script generates the `.xcframework` files and headers. When using `./scripts/build_local.sh ios`, the resulting zip is automatically extracted to the editor plugin folder. |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +## 📜 Code Style & Principles |
| 73 | + |
| 74 | +To maintain code quality and consistency, please follow these guidelines: |
| 75 | + |
| 76 | +### General Principles |
| 77 | +- **SOLID**: Always aim for clean, maintainable, and decoupled code. |
| 78 | +- **Official SDK Consistency**: The goal of this plugin is to stay as close as possible to the official [Android](https://developers.google.com/admob/android) and [iOS](https://developers.google.com/admob/ios) AdMob SDKs. |
| 79 | +- **No Global Scope Pollution**: Avoid adding unnecessary global names or classes. |
| 80 | + |
| 81 | +### GDScript Guidelines |
| 82 | +- **Style Guide**: Follow the [official Godot GDScript style guide](https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_styleguide.html). |
| 83 | +- **Type Inference**: Use `:=` for type inference where possible to improve readability and safety. |
| 84 | +- **Internal Scripts**: Scripts located inside `internal` folders **must not** use `class_name`. They should be accessed via `preload()` to keep the global namespace clean. |
| 85 | + |
| 86 | +### C# Guidelines |
| 87 | +- **Style Guide**: Follow the [official Godot C# style guide](https://docs.godotengine.org/en/stable/tutorials/scripting/c_sharp/c_sharp_style_guide.html). |
| 88 | +- **Namespaces**: Ensure proper use of namespaces to organize code effectively. |
| 89 | + |
| 90 | +## 🚀 Pull Request Process |
| 91 | +1. Ensure your code follows the style guidelines. |
| 92 | +2. Update the documentation if you are adding or changing features. |
| 93 | +3. Link the PR to the relevant issue. |
| 94 | +4. Once submitted, a maintainer will review your changes. |
| 95 | + |
| 96 | +Thank you for helping us make this plugin better! |
0 commit comments