Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3816288
feat: first approach - fails at not calling bundleRelaseAar for TPL
hurali97 Jan 13, 2026
93f742d
feat: second approach by exposing custom tasks - WIP
hurali97 Jan 19, 2026
b44fea1
feat: migrate manifest-merger and move others to explode-aar task
hurali97 Jan 21, 2026
3fd0526
feat: migrate processResources and processAssets
hurali97 Jan 27, 2026
fe2bbc1
feat: migrate jni libs processor
hurali97 Jan 28, 2026
25fb981
feat: migrate proguard processor
hurali97 Jan 28, 2026
22f7e93
feat: migrate data binding and cleanup
hurali97 Jan 28, 2026
f1b5497
refactor: cleanup
hurali97 Jan 28, 2026
925e8ee
refactor: cleanup
hurali97 Jan 28, 2026
c8fa281
fix: library namespace resolution
hurali97 Feb 2, 2026
9cd0328
perf: optimize explodeAarTask
hurali97 Feb 3, 2026
dbdde63
feat: improvements
hurali97 Feb 3, 2026
9b4e476
fix: add task dependency for JSBundle
hurali97 Apr 24, 2026
d75ceb7
refactor: cleanup
hurali97 Apr 24, 2026
c9027ef
refactor: remove duplicates
hurali97 Apr 24, 2026
ad03e5d
refactor: early return
hurali97 Apr 24, 2026
3626a34
Merge branch 'main' of github.com:callstack/react-native-brownfield i…
hurali97 Apr 24, 2026
c46e96c
fix: add explode as task dependency on preBuild
hurali97 Apr 24, 2026
196f381
feat: remove resolve during config phase OR needing another task
hurali97 Apr 27, 2026
7d0f302
fix: right place for evaluation dependency
hurali97 Apr 27, 2026
7689721
fix: expo published projects are now added in exploded aar
hurali97 Apr 28, 2026
9f81e85
fix: reduce duplication and fixed namespace resolution
hurali97 Apr 28, 2026
edbc789
refactor: cleanup
hurali97 Apr 28, 2026
1d6c47b
refactor: cleanup
hurali97 Apr 28, 2026
71a422c
refactor: cleanup
hurali97 Apr 28, 2026
4fd1297
perf: add gradle-profiler benchmarks and docs
hurali97 Apr 29, 2026
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
4 changes: 4 additions & 0 deletions apps/RNApp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,7 @@ yarn-error.log
# Brownfield
android/BrownfieldLib/libsDebug/
android/BrownfieldLib/libsRelease/

# Benchmarks
android/gradle-user-home/
android/profile-out/
25 changes: 25 additions & 0 deletions apps/RNApp/android/gradle-profiler/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
### Gradle Profiler

Repo: https://github.com/gradle/gradle-profiler
Android docs: https://developer.android.com/build/profile-your-build

### Pre-Requisites
- Ensure gradle-profiler is installed, (instructions)[https://github.com/gradle/gradle-profiler#installing]
- Change your working directory to `RNApp/android/gradle-profiler`

### Steps:
- Checkout to main or baseline branch
- Adjust the scenarios to suit your use-case OR create a new scenarios file
- Run the following command:
```bash
gradle-profiler --benchmark --project-dir ../ --scenario-file ./scenarios.txt
```
- Once the run finishes, copy the items in `profile-out/benchmark.csv` to `benchmarks/old.txt` OR create a new file
- Checkout to the current branch
- Use the same scenarios from above and run the benchmark command
- Once the run finishes, copy the items in `profile-out/benchmark.csv` to `benchmarks/new.txt` OR create a new file

> [NOTE]
> Clear the `profile-out` folder before a next run, otherwise a new folder `profile-out2` will be created.
> The changes to scenarios.txt or new file creation, similarly under benchmarks folder, will required to be
> tracked to version control.
5 changes: 5 additions & 0 deletions apps/RNApp/android/gradle-profiler/benchmarks/new.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
measured build #1,77705.66
measured build #2,73437.54
measured build #3,82706.11
measured build #4,75284.93
measured build #5,75479.56
11 changes: 11 additions & 0 deletions apps/RNApp/android/gradle-profiler/benchmarks/old.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
scenario,on_clean_build
version,Gradle 9.3.1
tasks,:brownfield:assembleRelease
value,total execution time
warm-up build #1,162130.94
warm-up build #2,94060.00
measured build #1,104519.90
measured build #2,104545.84
measured build #3,90355.22
measured build #4,90874.80
measured build #5,104207.60
91 changes: 91 additions & 0 deletions apps/RNApp/android/gradle-profiler/print.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/bin/bash

# --- Colors for Output ---
RED='\033[0;31m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
YELLOW='\033[1;33m'
BOLD='\033[1m'
NC='\033[0m' # No Color

# --- Configuration & Args ---
OLD_FILE=${1:-"benchmarks/old.txt"}
NEW_FILE=${2:-"benchmarks/new.txt"}

# Validation
if [[ ! -f "$OLD_FILE" || ! -f "$NEW_FILE" ]]; then
echo "${RED}${BOLD}Error:${NC} Files not found."
echo "Usage: $0 [old_file] [new_file]"
exit 1
fi

# --- Extraction Logic ---
# Extract metadata from the first file (assuming they are for the same scenario)
SCENARIO=$(grep "^scenario," "$OLD_FILE" | cut -d',' -f2)
TASKS=$(grep "^tasks," "$OLD_FILE" | cut -d',' -f2)

# Calculation Function via AWK
# Returns: avg|count
process_data() {
awk -F',' '/^measured build/ { sum += $2; count++ } END { if (count > 0) print sum/count "|" count; else print "0|0" }' "$1"
}

OLD_DATA=$(process_data "$OLD_FILE")
NEW_DATA=$(process_data "$NEW_FILE")

OLD_AVG=$(echo "$OLD_DATA" | cut -d'|' -f1)
OLD_CNT=$(echo "$OLD_DATA" | cut -d'|' -f2)
NEW_AVG=$(echo "$NEW_DATA" | cut -d'|' -f1)
NEW_CNT=$(echo "$NEW_DATA" | cut -d'|' -f2)

# --- Verbose Pretty Print ---
echo "${CYAN}${BOLD}=============================================================="
echo " GRADLE BENCHMARK COMPARISON"
echo "==============================================================${NC}"
printf "${BOLD}%-12s${NC} %s\n" "Scenario:" "$SCENARIO"
printf "${BOLD}%-12s${NC} %s\n" "Tasks:" "$TASKS"
echo "--------------------------------------------------------------"

# Table Header
printf "${BOLD}%-15s | %-12s | %-15s | %-10s${NC}\n" "Target" "Builds" "Average (ms)" "Minutes"
echo "----------------|--------------|-----------------|------------"

# Row function for reuse
print_row() {
local label=$1
local cnt=$2
local avg=$3
# Calculate minutes/seconds inside AWK for the row
local min_fmt=$(awk -v ms="$avg" 'BEGIN { printf "%dm %05.2fs", int(ms/60000), (ms%60000)/1000 }')
printf "%-15s | %-12s | %-15.2f | %-10s\n" "$label" "$cnt" "$avg" "$min_fmt"
}

print_row "Main" "$OLD_CNT" "$OLD_AVG"
print_row "Optimized" "$NEW_CNT" "$NEW_AVG"

echo "----------------|--------------|-----------------|------------"

# Final Comparison Logic
awk -v old="$OLD_AVG" -v new="$NEW_AVG" \
-v red="$RED" -v grn="$GREEN" -v yel="$YELLOW" -v bld="$BOLD" -v nc="$NC" '
BEGIN {
diff = new - old
pct = (old > 0) ? (diff / old) * 100 : 0
abs_diff = (diff < 0) ? -diff : diff

# Format diff to minutes
diff_min = sprintf("%dm %05.2fs", int(abs_diff/60000), (abs_diff%60000)/1000)

if (diff < -1) {
printf "\n%sRESULT: IMPROVEMENT%s\n\n", grn bld, nc
printf "The new build is %s%.2f ms (%s) faster%s\n", grn, abs_diff, diff_min, nc
printf "Speedup: %s%.2f%%%s\n", grn, -pct, nc
} else if (diff > 1) {
printf "\n%sRESULT: REGRESSION%s\n", red bld, nc
printf "The new build is %s%.2f ms (%s) slower%s\n", red, diff, diff_min, nc
printf "Slowdown: %s+%.2f%%%s\n", red, pct, nc
} else {
printf "\n%sRESULT: NEGLIGIBLE CHANGE%s\n", yel, nc
}
print ""
}'
8 changes: 8 additions & 0 deletions apps/RNApp/android/gradle-profiler/scenarios.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
on_clean_build {
tasks = [":brownfield:assembleRelease"] // Replace with your task
cleanup-tasks = ["clean"]
# Disables caching to ensure an "absolute" clean run
gradle-args = ["--no-build-cache", "--no-configuration-cache"]
warm-ups = 2
iterations = 5
}
13 changes: 1 addition & 12 deletions gradle-plugins/react/brownfield/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
alias(libs.plugins.detekt)
`maven-publish`
signing
kotlin("plugin.serialization") version "1.9.24"
}

ktlint {
Expand Down Expand Up @@ -69,18 +70,6 @@ publishing {
distribution.set("repo")
}
}
developers {
developer {
id.set("callstack")
name.set("Callstack Team")
email.set("it-admin@callstack.com")
}
}
scm {
connection.set(property("SCM_CONNECTION").toString())
developerConnection.set(property("SCM_DEV_CONNECTION").toString())
url.set(property("GITHUB_URL").toString())
}
}
}
}
Expand Down
Loading
Loading