Skip to content

Commit

Permalink
Restructure everything, native is now top level and app is written in…
Browse files Browse the repository at this point in the history
… kotlin with new Jetpack Compose ui
  • Loading branch information
Dinnerbone authored and torokati44 committed Mar 18, 2024
1 parent 454a80b commit e395c08
Show file tree
Hide file tree
Showing 75 changed files with 1,282 additions and 580 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ jobs:
- name: Build native libs
run: |
unset ANDROID_SDK_ROOT # Deprecated, will cause an error if left set.
cd native
cargo ndk --target ${{ matrix.android-abi }} --platform 26 -o ../jniLibs build --release
cargo ndk --target ${{ matrix.android-abi }} --platform 26 -o jniLibs build --release
- uses: actions/upload-artifact@v4
with:
Expand All @@ -65,8 +64,8 @@ jobs:

- name: Copy native libs
run: |
mkdir app/ruffle/src/main/jniLibs
cp -r native-libs/*/* app/ruffle/src/main/jniLibs/
mkdir app/src/main/jniLibs
cp -r native-libs/*/* app/src/main/jniLibs/
- name: Set up Java 17
uses: actions/setup-java@v4
Expand All @@ -77,21 +76,19 @@ jobs:
- name: Build debug APK
# The native libs are always built in release mode, this is left in here just so if
# something with the signing procedure below goes haywire, we still have something.
run: |
cd app
./gradlew assembleDebug # The release version doesn't work without signing
run: ./gradlew assembleDebug # The release version doesn't work without signing

- uses: actions/upload-artifact@v4
with:
name: ruffle-debug-apks
path: app/ruffle/build/outputs/apk/debug/*.apk
path: app/build/outputs/apk/debug/*.apk

- name: Decode keystore
if: ${{ !github.event.pull_request.head.repo.fork }}
env:
ENCODED_STRING: ${{ secrets.KEYSTORE }}
run: |
echo $ENCODED_STRING | base64 -di > app/ruffle/androidkey.jks
echo $ENCODED_STRING | base64 -di > app/androidkey.jks
- name: Build release APK
if: ${{ !github.event.pull_request.head.repo.fork }}
Expand All @@ -107,5 +104,5 @@ jobs:
if: ${{ !github.event.pull_request.head.repo.fork }}
with:
name: ruffle-release-apks
path: app/ruffle/build/outputs/apk/release/*.apk
path: app/build/outputs/apk/release/*.apk

12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.iml
.gradle
/local.properties
.idea
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
/target
*.jks
File renamed without changes.
File renamed without changes.
15 changes: 1 addition & 14 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,2 @@
*.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
/src/main/jniLibs
3 changes: 0 additions & 3 deletions app/.idea/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion app/.idea/.name

This file was deleted.

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

This file was deleted.

10 changes: 0 additions & 10 deletions app/.idea/deploymentTargetDropDown.xml

This file was deleted.

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

This file was deleted.

10 changes: 0 additions & 10 deletions app/.idea/migrations.xml

This file was deleted.

30 changes: 0 additions & 30 deletions app/.idea/misc.xml

This file was deleted.

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

This file was deleted.

9 changes: 0 additions & 9 deletions app/build.gradle

This file was deleted.

124 changes: 124 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsKotlinAndroid)
alias(libs.plugins.cargoNdkAndroid).apply(System.getenv("GITHUB_ACTIONS") == null)
}

android {
namespace = "rs.ruffle"
compileSdk = 34

defaultConfig {
applicationId = "rs.ruffle"
minSdk = 26
targetSdk = 34
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}

ndk {
abiFilters.addAll(listOf("arm64-v8a", "armeabi-v7a", "x86_64", "x86"))
}
}

signingConfigs {
create("release") {
storeFile = file("androidkey.jks")
storePassword = System.getenv("SIGNING_STORE_PASSWORD")
keyAlias = System.getenv("SIGNING_KEY_ALIAS")
keyPassword = System.getenv("SIGNING_KEY_PASSWORD")
}
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.findByName("release")
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = "1.8"
}

buildFeatures {
compose = true
prefab = true
}

composeOptions {
kotlinCompilerExtensionVersion = "1.5.1"
}

packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}


splits {
// Configures multiple APKs based on ABI.
abi {
// Enables building multiple APKs per ABI.
isEnable = true

// Resets the list of ABIs that Gradle should create APKs for to none.
reset()

// Specifies a list of ABIs that Gradle should create APKs for.
include("arm64-v8a", "armeabi-v7a", "x86_64", "x86")

// Specifies that we also want to generate a universal APK that includes all ABIs.
isUniversalApk = true
}
}
}

dependencies {

implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.navigation.runtime.ktx)
implementation(libs.androidx.navigation.compose)
implementation(libs.androidx.games.activity)
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.appcompat)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
}

// On GHA, we prebuild the native libs separately for fasterness,
// and this plugin doesn't recognize them, so would build them again.
if (System.getenv("GITHUB_ACTIONS") == null) {
cargoNdk {
module = "."
apiLevel = 26
buildType = "release"
}
}
File renamed without changes.
2 changes: 0 additions & 2 deletions app/ruffle/.gitignore

This file was deleted.

Loading

0 comments on commit e395c08

Please sign in to comment.