-
Notifications
You must be signed in to change notification settings - Fork 4
Sixteen kb pagesize #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ffc3e3f
chore: update gradle to v8.7
HashEngineering bcdf8ab
chore: update kotlin to 1.9, gradle to 8.5.1
HashEngineering e4b8f14
chore: update to sdk 35 and for jreleaser for all projects
HashEngineering d828d78
tests: add build and verify alignment
HashEngineering 62703f6
tests: fix action versions
HashEngineering 82bba26
chore: ignore .java-version
HashEngineering 7b3c1b0
tests: only check 64-bit libs for 16KB alignment
HashEngineering 065c5a8
chore: update Kotlin to 2.1.20
HashEngineering e026f2e
chore: bump dashj-bls version to 1.0.1
HashEngineering 05faf81
chore: update scm links
HashEngineering 1b9fbb2
chore: for publishing with jreleaser
HashEngineering File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,171 @@ | ||
| name: Build and Verify 16KB Page Size Alignment | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ master, main, develop ] | ||
| pull_request: | ||
| branches: [ master, main, develop ] | ||
|
|
||
| jobs: | ||
| build-and-verify: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Set up JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: '17' | ||
| distribution: 'temurin' | ||
|
|
||
| - name: Setup Android SDK | ||
| uses: android-actions/setup-android@v3 | ||
|
|
||
| - name: Cache Gradle packages | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.gradle/caches | ||
| ~/.gradle/wrapper | ||
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-gradle- | ||
|
|
||
| - name: Grant execute permission for gradlew | ||
| run: chmod +x gradlew | ||
|
|
||
| - name: Build with Gradle | ||
| run: ./gradlew build | ||
|
|
||
| - name: Verify 16KB Page Size Alignment | ||
| run: | | ||
| echo "🔍 Checking 16KB page size alignment of 64-bit native libraries..." | ||
|
|
||
| # Function to check alignment of a shared library | ||
| check_alignment() { | ||
| local lib_path="$1" | ||
| local lib_name=$(basename "$lib_path") | ||
|
|
||
| echo "Checking $lib_name..." | ||
|
|
||
| # Use llvm-readelf from NDK to check alignment | ||
| local ndk_path="$ANDROID_NDK_ROOT" | ||
| local readelf="$ndk_path/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-readelf" | ||
|
|
||
| if [ ! -f "$readelf" ]; then | ||
| echo "❌ Error: llvm-readelf not found at $readelf" | ||
| return 1 | ||
| fi | ||
|
|
||
| # Check LOAD segments alignment | ||
| local alignments=$($readelf -l "$lib_path" | grep "LOAD" | awk '{print $NF}') | ||
|
|
||
| local all_aligned=true | ||
| for alignment in $alignments; do | ||
| # Convert hex to decimal | ||
| local decimal_alignment=$((alignment)) | ||
| local kb_alignment=$((decimal_alignment / 1024)) | ||
|
|
||
| echo " Segment alignment: $alignment ($decimal_alignment bytes = ${kb_alignment}KB)" | ||
|
|
||
| if [ $decimal_alignment -ne 16384 ]; then | ||
| echo " ❌ Not 16KB aligned (expected 0x4000 = 16384 bytes)" | ||
| all_aligned=false | ||
| else | ||
| echo " ✅ 16KB aligned" | ||
| fi | ||
| done | ||
|
|
||
| if [ "$all_aligned" = true ]; then | ||
| echo "✅ $lib_name is properly 16KB aligned" | ||
| return 0 | ||
| else | ||
| echo "❌ $lib_name has incorrect alignment" | ||
| return 1 | ||
| fi | ||
| } | ||
|
|
||
| # Find all .so files in build outputs (64-bit architectures only) | ||
| echo "Finding 64-bit native libraries in build outputs..." | ||
| so_files=$(find . -path "*/build/intermediates/cxx/*/obj/*/*.so" -type f | grep -E "(Release|RelWithDebInfo)" | grep -E "(arm64-v8a|x86_64)" | head -20) | ||
|
|
||
| if [ -z "$so_files" ]; then | ||
| echo "❌ No native libraries found in build outputs" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Found native libraries:" | ||
| echo "$so_files" | ||
| echo | ||
|
|
||
| # Check alignment for each library | ||
| all_libs_aligned=true | ||
| for so_file in $so_files; do | ||
| if ! check_alignment "$so_file"; then | ||
| all_libs_aligned=false | ||
| fi | ||
| echo | ||
| done | ||
|
|
||
| # Summary | ||
| echo "📊 Alignment Verification Summary:" | ||
| if [ "$all_libs_aligned" = true ]; then | ||
| echo "🎉 All native libraries are properly 16KB aligned!" | ||
| echo "✅ This build is compatible with 16KB page size devices" | ||
| else | ||
| echo "❌ Some libraries are not properly aligned" | ||
| echo "💡 Ensure you're using Android Gradle Plugin 8.5.1+ and target SDK 35+" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Verify AAR Contents | ||
| run: | | ||
| echo "🔍 Verifying AAR files contain native libraries..." | ||
|
|
||
| # Find AAR files | ||
| aar_files=$(find . -name "*.aar" -path "*/build/outputs/aar/*" -type f) | ||
|
|
||
| if [ -z "$aar_files" ]; then | ||
| echo "❌ No AAR files found" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Found AAR files:" | ||
| for aar in $aar_files; do | ||
| echo "📦 $(basename $aar)" | ||
|
|
||
| # Check if AAR contains native libraries | ||
| native_libs=$(unzip -l "$aar" | grep -E "jni/.*\.so$" | wc -l) | ||
|
|
||
| if [ $native_libs -gt 0 ]; then | ||
| echo " ✅ Contains $native_libs native libraries" | ||
| echo " 📋 Native library details:" | ||
| unzip -l "$aar" | grep -E "jni/.*\.so$" | awk '{print " " $4}' | ||
| else | ||
| echo " ℹ️ No native libraries (library may be pure Java/Kotlin)" | ||
| fi | ||
| echo | ||
| done | ||
|
|
||
| - name: Upload build artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: build-outputs | ||
| path: | | ||
| **/build/outputs/aar/*.aar | ||
| **/build/intermediates/cxx/*/obj/*/*.so | ||
| retention-days: 7 | ||
|
|
||
| - name: Upload lint reports | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: lint-reports | ||
| path: | | ||
| **/build/reports/lint-results-*.html | ||
| retention-days: 7 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,4 +6,5 @@ | |
| /captures | ||
| /local.properties | ||
| .externalNativeBuild | ||
| .cxx | ||
| .cxx | ||
| .java-version | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reconsider the failure condition for missing AAR files.
The workflow exits with error if no AAR files are found (line 134). This will cause CI failures for Android app projects that don't produce AARs (libraries produce AARs, but apps produce APKs). The AAR verification step should be optional or conditional.
Example fix:
📝 Committable suggestion