Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Contributing to Godot AdMob Plugin

Thank you for your interest in contributing to the Godot AdMob Plugin! This guide will help you get started with the development process.

## 🤝 How to Contribute

### Reporting Bugs
- Check the [existing issues](https://github.com/poingstudios/godot-mobile_plugin-plugin/issues) to see if the bug has already been reported.
- If not, open a new issue with a clear title and description.
- Provide reproduction steps and, if possible, a minimal reproduction project.
- Include information about your Godot version and target platform (Android/iOS).

### Feature Requests
- Check [existing issues](https://github.com/poingstudios/godot-mobile_plugin-plugin/issues) or [discussions](https://github.com/poingstudios/godot-mobile_plugin-plugin/discussions).
- Open a new issue to discuss the feature before starting implementation.

## 💻 Development Setup

### Requirements
- **Godot 4.2+** (Standard or .NET edition).
- **Android**: Android Studio & SDK (minimum API 24).
- **iOS**: macOS with Xcode 15+ and SCons installed (`brew install scons`).
- **Python 3.x**: Required for Godot's build system and internal scripts.

### Workflow
1. Fork the repository.
2. Clone your fork locally.
3. Create a branch for your changes (`git checkout -b feature/my-new-feature`).

---

## 🛠️ Build Process

The plugin consists of a Godot editor component and native binaries for Android and iOS.

### General Build (Auto-updating the Editor Plugin)
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).**

- **Android** binaries are built via Gradle and exported to `platforms/godot_editor/addons/mobile_plugin/android/bin/`.
- **iOS** binaries are built via SCons/SPM and extracted to `platforms/godot_editor/ios/plugins/`.

```bash
# Usage: ./scripts/build_local.sh [android|ios|all] <godot_version>
./scripts/build_local.sh all 4.6.1
```

### 🤖 Android Build Details
Located in [`platforms/android/`](./platforms/android/). Build and export are handled via Gradle.

- **Tools**: Android Studio / SDK.
- **Manual Build**:
```bash
cd platforms/android
./gradlew build
./gradlew exportFiles -PpluginExportPath=../godot_editor/addons/mobile_plugin/android/bin
```
- **Logging**: `adb logcat -s poing-godot-mobile_plugin godot`

### 🍎 iOS Build Details
Located in [`platforms/ios/`](./platforms/ios/). Build is handled via a dedicated shell script.

- **Tools**: Xcode 15+, SCons.
- **Manual Build**:
```bash
cd platforms/ios
./scripts/build.sh <godot_version>
```
- **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.

---

## 📜 Code Style & Principles

To maintain code quality and consistency, please follow these guidelines:

### General Principles
- **SOLID**: Always aim for clean, maintainable, and decoupled code.
- **Official SDK Consistency**: The goal of this plugin is to stay as close as possible to the official [Android](https://developers.google.com/mobile_plugin/android) and [iOS](https://developers.google.com/mobile_plugin/ios) AdMob SDKs.
- **No Global Scope Pollution**: Avoid adding unnecessary global names or classes.

### GDScript Guidelines
- **Style Guide**: Follow the [official Godot GDScript style guide](https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_styleguide.html).
- **Type Inference**: Use `:=` for type inference where possible to improve readability and safety.
- **Internal Scripts**: Scripts located inside `internal` folders **must not** use `class_name`. They should be accessed via `preload()` to keep the global namespace clean.

### C# Guidelines
- **Style Guide**: Follow the [official Godot C# style guide](https://docs.godotengine.org/en/stable/tutorials/scripting/c_sharp/c_sharp_style_guide.html).
- **Namespaces**: Ensure proper use of namespaces to organize code effectively.

## 🚀 Pull Request Process
1. Ensure your code follows the style guidelines.
2. Update the documentation if you are adding or changing features.
3. Link the PR to the relevant issue.
4. Once submitted, a maintainer will review your changes.

Thank you for helping us make this plugin better!
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
patreon: poingstudios
ko_fi: poingstudios
custom: ["https://www.paypal.com/donate/?hosted_button_id=EBUVPEGF4BUR8"]
59 changes: 59 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Bug report
description: Report a bug with the AdMob editor plugin
labels: bug
body:
- type: input
attributes:
label: Godot version
placeholder: '4.6'
validations:
required: true
- type: input
attributes:
label: Plugin version
placeholder: '4.0.0'
validations:
required: true
- type: dropdown
id: platform
attributes:
label: Platform / Component
description: In which environment did you find this bug?
options:
- All
- Godot (Addon / Editor)
- Android
- iOS
default: 0
validations:
required: true
- type: input
attributes:
label: System information
placeholder: 'Windows 11'
validations:
required: true
- type: input
attributes:
label: Phone information, if applicable
placeholder: 'Samsung Galaxy S23 running Android 13'
- type: textarea
attributes:
label: Issue description
description: |
What happened that was unexpected? If there was an error, include logs here.
validations:
required: true
- type: textarea
attributes:
label: Steps to reproduce
placeholder: |
1. Go to '...'
2. Click on '...'
validations:
required: true
- type: textarea
attributes:
label: Additional context
description: |
Including screenshots or a minimal reproduction project can greatly speed up your issue's resolution.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Feature request
description: Suggest an idea for this project
body:
- type: dropdown
id: platform
attributes:
label: Platform / Component
description: Which part of the plugin is this targetting?
options:
- All
- Godot (Addon / Editor)
- Android
- iOS
default: 0
validations:
required: true
- type: textarea
attributes:
label: What feature or improvement would you like to see?
validations:
required: true
- type: textarea
attributes:
label: Is your feature request related to a problem? If so, please describe.
- type: textarea
attributes:
label: Additional context
description: |
Including screenshots or example code can help describe the improvement more clearly.
34 changes: 34 additions & 0 deletions .github/ai/skills/release-manager/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: release-manager
description: Manage and execute AdMob plugin releases. Use when bumping versions, generating changelogs, or validating GitHub release assets to ensure consistency across Godot, Android, and iOS.
---

# 🚀 AdMob Release Manager Protocol

Ensure consistency across all platforms and version strings during a release.

## 📋 Pre-Release Checklist

1. **Update Plugin Version**:
- Modify `version="x.y.z"` in `platforms/godot_editor/addons/mobile_plugin/plugin.cfg`.
2. **Verify C# Constants**:
- Check if any C# version constants need updating (usually matches `plugin.cfg`).
3. **Verify Build Matrix**:
- Ensure the latest Godot versions are included in `.github/workflows/cd-build-and-release.yml`.
4. **Changelog Generation**:
- Run `git log $(git describe --tags --abbrev=0)..HEAD --oneline` to gather changes.
- Categorize into `feat`, `fix`, and `chore`.

## 🛠️ Release Execution

1. **Trigger Workflow**:
- Go to GitHub Actions -> `Build and Release` -> `Run workflow`.
2. **Validate Assets**:
- Once the workflow finishes, verify that the following assets exist:
- `poing-godot-mobile_plugin-vX.Y.Z.zip` (Godot Editor Plugin).
- `poing-godot-mobile_plugin-android-v*.zip` (Android Templates).
- `poing-godot-mobile_plugin-ios-v*.zip` (iOS Templates).

## 🚫 Critical Rules
- Never release without updating `plugin.cfg`.
- Ensure the branch is `master` before triggering the release workflow.
37 changes: 37 additions & 0 deletions .github/scripts/compress_editor_plugin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
set -e

# This script must be run from the root of the repository.

echo ">>> Compressing Godot Editor Plugin..."

cd platforms/godot_editor

RAW_VERSION=$(grep "version=" addons/mobile_plugin/plugin.cfg | cut -d'"' -f2)
CH_VERSION=${RAW_VERSION#v}
ZIP_NAME="poing-godot-mobile-plugin-v${CH_VERSION}.zip"

echo "Version detected: $CH_VERSION"

# Create a clean staging directory structure
mkdir -p build_stage/poing-godot-mobile-plugin/addons

# Copy the plugin keeping the required folder structure
cp -R addons/mobile_plugin build_stage/poing-godot-mobile-plugin/addons/

# Compress the staging directory
cd build_stage
zip -qr "$ZIP_NAME" poing-godot-mobile-plugin

# Move the zip back to platforms/godot_editor/ and clean up
mv "$ZIP_NAME" ../
cd ..
rm -rf build_stage

echo ">>> Successfully created platforms/godot_editor/$ZIP_NAME"

# Export variables if running in GitHub Actions
if [ -n "$GITHUB_ENV" ]; then
echo "ZIP_NAME=$ZIP_NAME" >> "$GITHUB_ENV"
echo "PLUGIN_TAG=v$CH_VERSION" >> "$GITHUB_ENV"
fi
38 changes: 38 additions & 0 deletions .github/scripts/push.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import requests
import json
import os

def get_asset_id():
return "0000"

login_response = requests.post("https://godotengine.org/asset-library/api/login", data={"username": os.environ["ASSET_LIB_USER"], "password": os.environ["ASSET_LIB_PASS"]})
login_response.raise_for_status()

response = json.loads(login_response.text)
token = response["token"]

# Use download URL instead of commit hash
download_url = f"https://github.com/{os.environ['GITHUB_REPOSITORY']}/releases/download/{os.environ['VERSION']}/poing-godot-mobile-plugin-{os.environ['VERSION']}.zip"

asset_data = {
"token": token,
"version_string": os.environ["VERSION"],
"download_commit": download_url,
"download_provider": "Custom"
}

print(f"Attempting to update asset {get_asset_id()}...")
print(f"Version: {os.environ['VERSION']}")
print(f"Download URL: {download_url}")

upload_response = requests.post("https://godotengine.org/asset-library/api/asset/" + get_asset_id(), data=asset_data)

if upload_response.status_code == 200:
print("Asset updated with success!")
else:
print(f"Error {upload_response.status_code} while updating the asset.")
try:
print("Response details:", json.dumps(upload_response.json(), indent=2))
except:
print("Raw response:", upload_response.text)
upload_response.raise_for_status()
Loading
Loading