Skip to content

Make Android port (client / embedded) work inside apps #7469

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 17 commits into from
Feb 17, 2023
Merged
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
110 changes: 110 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -670,3 +670,113 @@ jobs:
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
files: |
gen/Firebird-*-android-${{ matrix.arch }}*.tar.gz

build-android-aar:
needs: build-android-final
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 10

- name: Download final build (x86)
uses: actions/download-artifact@v3
with:
name: firebird-android-x86
path: android/temp

- name: Download final build (x64)
uses: actions/download-artifact@v3
with:
name: firebird-android-x64
path: android/temp

- name: Download final build (arm32)
uses: actions/download-artifact@v3
with:
name: firebird-android-arm32
path: android/temp

- name: Download final build (arm64)
uses: actions/download-artifact@v3
with:
name: firebird-android-arm64
path: android/temp

- name: Extract final builds
working-directory: android
run: |
mkdir -p embedded/src/main/jniLibs/{x86,x86_64,armeabi-v7a,arm64-v8a}
tar xzvf temp/Firebird-*-android-x86.tar.gz -C embedded/src/main/jniLibs/x86 --strip-components=1
tar xzvf temp/Firebird-*-android-x64.tar.gz -C embedded/src/main/jniLibs/x86_64 --strip-components=1
tar xzvf temp/Firebird-*-android-arm32.tar.gz -C embedded/src/main/jniLibs/armeabi-v7a --strip-components=1
tar xzvf temp/Firebird-*-android-arm64.tar.gz -C embedded/src/main/jniLibs/arm64-v8a --strip-components=1

mkdir -p embedded/src/main/assets/firebird
mv embedded/src/main/jniLibs/x86/{*.conf,*.msg,*.dat,*.res} embedded/src/main/assets/firebird/
find embedded/src/main/jniLibs -type f ! -iname "*.so" -delete

- name: Assemble AAR
working-directory: android
run: |
./gradlew assembleRelease
FB_VERSION=`cd ../src/misc/ && . writeBuildNum.sh && echo $PRODUCT_VER_STRING`
mv embedded/build/outputs/aar/firebird-embedded-release.aar \
embedded/build/outputs/aar/Firebird-$FB_VERSION-android-embedded.aar

- name: Upload installer
uses: actions/upload-artifact@main
with:
name: firebird-android-aar
path: android/embedded/build/outputs/aar/Firebird-*-android-embedded.aar

- name: Snapshot - prepare
id: snapshot_prepare
if: |
github.repository == 'FirebirdSQL/firebird' &&
github.event.head_commit.message == 'increment build number' &&
github.ref_name == 'master'
run: |
echo "snapshot_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT

- name: Snapshot - delete old assets
uses: mknejp/delete-release-assets@v1
if: steps.snapshot_prepare.outputs.snapshot_name
with:
repository: FirebirdSQL/snapshots
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
tag: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
fail-if-no-release: false
fail-if-no-assets: false
assets: |
Firebird-*-android-embedded.aar

- name: Snapshot - release
id: snapshot_release_try1
uses: softprops/action-gh-release@v1
if: steps.snapshot_prepare.outputs.snapshot_name
continue-on-error: true
with:
repository: FirebirdSQL/snapshots
name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
prerelease: true
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
files: |
android/embedded/build/outputs/aar/Firebird-*-android-embedded.aar

- name: Snapshot - release (retry)
uses: softprops/action-gh-release@v1
if: |
steps.snapshot_prepare.outputs.snapshot_name &&
steps.snapshot_release_try1.outcome == 'failure'
with:
repository: FirebirdSQL/snapshots
name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
prerelease: true
token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
files: |
android/embedded/build/outputs/aar/Firebird-*-android-embedded.aar
15 changes: 15 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
3 changes: 3 additions & 0 deletions android/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions android/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

125 changes: 125 additions & 0 deletions android/.idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions android/.idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions android/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions android/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions android/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions android/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}

task clean(type: Delete) {
delete rootProject.buildDir
}
1 change: 1 addition & 0 deletions android/embedded/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
43 changes: 43 additions & 0 deletions android/embedded/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}

android {
compileSdk 32

defaultConfig {
minSdk 24
targetSdk 32

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
libraryVariants.all { variant ->
variant.outputs.all {
outputFileName = "firebird-embedded-${variant.name}.aar"
}
}
}

dependencies {

implementation 'androidx.core:core-ktx:1.7.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
Empty file.
Loading