You've already forked SpaghettiKart
mirror of
https://github.com/izzy2lost/SpaghettiKart.git
synced 2026-03-26 16:57:37 -07:00
116 lines
3.0 KiB
Groovy
116 lines
3.0 KiB
Groovy
def buildAsLibrary = project.hasProperty('BUILD_AS_LIBRARY');
|
|
def buildAsApplication = !buildAsLibrary
|
|
if (buildAsApplication) {
|
|
apply plugin: 'com.android.application'
|
|
}
|
|
else {
|
|
apply plugin: 'com.android.library'
|
|
}
|
|
|
|
android {
|
|
namespace("com.izzy.kart")
|
|
buildFeatures {
|
|
buildConfig true
|
|
}
|
|
ndkVersion "26.0.10792818"
|
|
compileSdkVersion 33
|
|
defaultConfig {
|
|
if (buildAsApplication) {
|
|
applicationId "com.izzy.kart"
|
|
}
|
|
minSdkVersion 24
|
|
targetSdkVersion 33
|
|
versionCode 5
|
|
versionName "1.0.0"
|
|
externalNativeBuild {
|
|
cmake {
|
|
arguments "-DSDL_SHARED=ON", "-DANDROID_STL=c++_static", "-DHAVE_LD_VERSION_SCRIPT=OFF",'-DUSE_OPENGLES=ON'
|
|
// abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
|
abiFilters 'arm64-v8a'
|
|
}
|
|
}
|
|
}
|
|
|
|
// ✅ Universal APK: disables split APKs per ABI
|
|
//splits {
|
|
//abi {
|
|
//enable false
|
|
//}
|
|
//}
|
|
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled false
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
}
|
|
}
|
|
applicationVariants.all { variant ->
|
|
tasks["merge${variant.name.capitalize()}Assets"]
|
|
.dependsOn("externalNativeBuild${variant.name.capitalize()}")
|
|
}
|
|
if (!project.hasProperty('EXCLUDE_NATIVE_LIBS')) {
|
|
sourceSets.main {
|
|
jniLibs.srcDir 'libs'
|
|
}
|
|
externalNativeBuild {
|
|
cmake {
|
|
path '../../CMakeLists.txt'
|
|
version "3.31.5"
|
|
}
|
|
}
|
|
}
|
|
lintOptions {
|
|
abortOnError false
|
|
}
|
|
|
|
if (buildAsLibrary) {
|
|
libraryVariants.all { variant ->
|
|
variant.outputs.each { output ->
|
|
def outputFile = output.outputFile
|
|
if (outputFile != null && outputFile.name.endsWith(".aar")) {
|
|
def fileName = "org.libsdl.app.aar";
|
|
output.outputFile = new File(outputFile.parent, fileName);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
|
implementation 'androidx.core:core:1.7.0' // Use the latest version
|
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
|
}
|
|
|
|
task wrapper(type: Wrapper) {
|
|
gradleVersion = '8.3.2'
|
|
}
|
|
|
|
task prepareKotlinBuildScriptModel {
|
|
}
|
|
|
|
// Task to copy YAML and asset files from root to assets
|
|
task copyAssetFiles(type: Copy) {
|
|
// Copy YAML files
|
|
from('../../yamls') {
|
|
into 'yamls'
|
|
include '**/*.yml'
|
|
include '**/*.yaml'
|
|
}
|
|
|
|
// Copy other assets
|
|
from('../../assets') {
|
|
into 'assets'
|
|
include '**/*' // Include all files in assets
|
|
}
|
|
|
|
into 'src/main/assets' // Base destination directory
|
|
}
|
|
|
|
// Ensure the copy task runs before mergeAssets
|
|
tasks.whenTaskAdded { task ->
|
|
if (task.name == 'mergeDebugAssets' || task.name == 'mergeReleaseAssets') {
|
|
task.dependsOn copyAssetFiles
|
|
}
|
|
}
|