Skip to content

Commit 340466e

Browse files
authored
Merge pull request #7469 from FirebirdSQL/work/android
Make Android port (client / embedded) work inside apps
2 parents 4adfc90 + e782f06 commit 340466e

Some content is hidden

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

59 files changed

+1293
-338
lines changed

.github/workflows/main.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,3 +670,113 @@ jobs:
670670
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
671671
files: |
672672
gen/Firebird-*-android-${{ matrix.arch }}*.tar.gz
673+
674+
build-android-aar:
675+
needs: build-android-final
676+
runs-on: ubuntu-22.04
677+
678+
steps:
679+
- name: Checkout
680+
uses: actions/checkout@v3
681+
with:
682+
fetch-depth: 10
683+
684+
- name: Download final build (x86)
685+
uses: actions/download-artifact@v3
686+
with:
687+
name: firebird-android-x86
688+
path: android/temp
689+
690+
- name: Download final build (x64)
691+
uses: actions/download-artifact@v3
692+
with:
693+
name: firebird-android-x64
694+
path: android/temp
695+
696+
- name: Download final build (arm32)
697+
uses: actions/download-artifact@v3
698+
with:
699+
name: firebird-android-arm32
700+
path: android/temp
701+
702+
- name: Download final build (arm64)
703+
uses: actions/download-artifact@v3
704+
with:
705+
name: firebird-android-arm64
706+
path: android/temp
707+
708+
- name: Extract final builds
709+
working-directory: android
710+
run: |
711+
mkdir -p embedded/src/main/jniLibs/{x86,x86_64,armeabi-v7a,arm64-v8a}
712+
tar xzvf temp/Firebird-*-android-x86.tar.gz -C embedded/src/main/jniLibs/x86 --strip-components=1
713+
tar xzvf temp/Firebird-*-android-x64.tar.gz -C embedded/src/main/jniLibs/x86_64 --strip-components=1
714+
tar xzvf temp/Firebird-*-android-arm32.tar.gz -C embedded/src/main/jniLibs/armeabi-v7a --strip-components=1
715+
tar xzvf temp/Firebird-*-android-arm64.tar.gz -C embedded/src/main/jniLibs/arm64-v8a --strip-components=1
716+
717+
mkdir -p embedded/src/main/assets/firebird
718+
mv embedded/src/main/jniLibs/x86/{*.conf,*.msg,*.dat,*.res} embedded/src/main/assets/firebird/
719+
find embedded/src/main/jniLibs -type f ! -iname "*.so" -delete
720+
721+
- name: Assemble AAR
722+
working-directory: android
723+
run: |
724+
./gradlew assembleRelease
725+
FB_VERSION=`cd ../src/misc/ && . writeBuildNum.sh && echo $PRODUCT_VER_STRING`
726+
mv embedded/build/outputs/aar/firebird-embedded-release.aar \
727+
embedded/build/outputs/aar/Firebird-$FB_VERSION-android-embedded.aar
728+
729+
- name: Upload installer
730+
uses: actions/upload-artifact@main
731+
with:
732+
name: firebird-android-aar
733+
path: android/embedded/build/outputs/aar/Firebird-*-android-embedded.aar
734+
735+
- name: Snapshot - prepare
736+
id: snapshot_prepare
737+
if: |
738+
github.repository == 'FirebirdSQL/firebird' &&
739+
github.event.head_commit.message == 'increment build number' &&
740+
github.ref_name == 'master'
741+
run: |
742+
echo "snapshot_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
743+
744+
- name: Snapshot - delete old assets
745+
uses: mknejp/delete-release-assets@v1
746+
if: steps.snapshot_prepare.outputs.snapshot_name
747+
with:
748+
repository: FirebirdSQL/snapshots
749+
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
750+
tag: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
751+
fail-if-no-release: false
752+
fail-if-no-assets: false
753+
assets: |
754+
Firebird-*-android-embedded.aar
755+
756+
- name: Snapshot - release
757+
id: snapshot_release_try1
758+
uses: softprops/action-gh-release@v1
759+
if: steps.snapshot_prepare.outputs.snapshot_name
760+
continue-on-error: true
761+
with:
762+
repository: FirebirdSQL/snapshots
763+
name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
764+
tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
765+
prerelease: true
766+
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
767+
files: |
768+
android/embedded/build/outputs/aar/Firebird-*-android-embedded.aar
769+
770+
- name: Snapshot - release (retry)
771+
uses: softprops/action-gh-release@v1
772+
if: |
773+
steps.snapshot_prepare.outputs.snapshot_name &&
774+
steps.snapshot_release_try1.outcome == 'failure'
775+
with:
776+
repository: FirebirdSQL/snapshots
777+
name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
778+
tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
779+
prerelease: true
780+
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
781+
files: |
782+
android/embedded/build/outputs/aar/Firebird-*-android-embedded.aar

android/.gitignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties

android/.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/.idea/.name

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/.idea/codeStyles/Project.xml

Lines changed: 125 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/.idea/codeStyles/codeStyleConfig.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/.idea/compiler.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/.idea/gradle.xml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/.idea/misc.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
plugins {
3+
id 'com.android.application' version '7.2.2' apply false
4+
id 'com.android.library' version '7.2.2' apply false
5+
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
6+
}
7+
8+
task clean(type: Delete) {
9+
delete rootProject.buildDir
10+
}

android/embedded/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

android/embedded/build.gradle

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
plugins {
2+
id 'com.android.library'
3+
id 'org.jetbrains.kotlin.android'
4+
}
5+
6+
android {
7+
compileSdk 32
8+
9+
defaultConfig {
10+
minSdk 24
11+
targetSdk 32
12+
13+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
14+
consumerProguardFiles "consumer-rules.pro"
15+
}
16+
17+
buildTypes {
18+
release {
19+
minifyEnabled false
20+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
21+
}
22+
}
23+
compileOptions {
24+
sourceCompatibility JavaVersion.VERSION_1_8
25+
targetCompatibility JavaVersion.VERSION_1_8
26+
}
27+
kotlinOptions {
28+
jvmTarget = '1.8'
29+
}
30+
libraryVariants.all { variant ->
31+
variant.outputs.all {
32+
outputFileName = "firebird-embedded-${variant.name}.aar"
33+
}
34+
}
35+
}
36+
37+
dependencies {
38+
39+
implementation 'androidx.core:core-ktx:1.7.0'
40+
testImplementation 'junit:junit:4.13.2'
41+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
42+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
43+
}

android/embedded/consumer-rules.pro

Whitespace-only changes.

0 commit comments

Comments
 (0)