Moving from Groovy build script to Kotlin DSL

This commit is contained in:
Gabriel Correia 2023-10-02 11:41:27 -07:00
parent 52716db902
commit 3c13fd5fdd
9 changed files with 106 additions and 113 deletions

View File

@ -1,94 +0,0 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'emu.zenith'
compileSdk 34
defaultConfig {
applicationId 'emu.zenith'
minSdk 30
targetSdk 34
versionCode 111
versionName '1.1.1'
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
ndk {
//noinspection ChromeOsAbiSupport
abiFilters 'arm64-v8a'
}
}
buildTypes {
release {
debuggable false
minifyEnabled true
shrinkResources true
externalNativeBuild {
cmake {
arguments += ['-DCMAKE_BUILD_TYPE=Release', '-DANDROID_STL=c++_shared']
}
}
proguardFiles (getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro')
signingConfig = signingConfigs.debug
}
relwdbg {
debuggable true
minifyEnabled true
shrinkResources true
externalNativeBuild {
cmake {
arguments += ['-DCMAKE_BUILD_TYPE=Debug', '-DANDROID_STL=c++_shared']
}
}
signingConfig = signingConfigs.debug
}
debug {
debuggable true
minifyEnabled false
shrinkResources false
externalNativeBuild {
cmake {
arguments += ['-DCMAKE_BUILD_TYPE=Debug', '-DANDROID_STL=c++_shared']
}
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
ndkVersion '25.1.8937393'
externalNativeBuild {
cmake {
path file('src/main/CMakeLists.txt')
version '3.22.1'
}
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.preference:preference-ktx:1.2.1'
implementation("androidx.datastore:datastore-preferences:1.0.0")
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.material:material:1.9.0'
testImplementation 'junit:junit:4.13.2'
}

92
app/build.gradle.kts Normal file
View File

@ -0,0 +1,92 @@
@file:Suppress("UnstableApiUsage")
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
}
android {
namespace = "emu.zenith"
compileSdk = 34
defaultConfig {
applicationId = "emu.zenith"
minSdk = 31
targetSdk = 34
versionCode = 111
versionName = "1.1.1"
ndk {
abiFilters.clear()
abiFilters.add("arm64-v8a")
}
}
buildTypes {
getByName("release") {
isDebuggable = false
isMinifyEnabled = true
isShrinkResources = true
externalNativeBuild {
cmake {
arguments += listOf("-DCMAKE_BUILD_TYPE=Release", "-DANDROID_STL=c++_shared")
}
}
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
signingConfig = signingConfigs.findByName("debug")
}
register("relwdbg") {
isDebuggable = true
isMinifyEnabled = true
isShrinkResources = true
externalNativeBuild {
cmake {
arguments += listOf("-DCMAKE_BUILD_TYPE=Debug", "-DANDROID_STL=c++_shared")
}
}
signingConfig = signingConfigs.findByName("debug")
}
getByName("debug") {
isDebuggable = true
isMinifyEnabled = false
isShrinkResources = false
externalNativeBuild {
cmake {
arguments += listOf("-DCMAKE_BUILD_TYPE=Debug", "-DANDROID_STL=c++_shared")
}
}
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
ndkVersion = "25.1.8937393"
externalNativeBuild {
cmake {
path = file("src/main/CMakeLists.txt")
version = "3.22.1"
}
}
buildFeatures {
viewBinding = true
}
}
dependencies {
implementation("androidx.core:core-ktx:1.12.0")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.preference:preference-ktx:1.2.1")
implementation("androidx.datastore:datastore-preferences:1.0.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("com.google.android.material:material:1.9.0")
}

View File

@ -41,6 +41,4 @@ target_sources(addons PRIVATE
${ADDONS_DIR}/compile_this.cpp)
target_compile_options(zenith PRIVATE -Wreorder -Wconversion -Wformat-security -Wshadow)
target_link_libraries(zenith PRIVATE addons)

View File

@ -29,9 +29,7 @@ namespace zenith::eeiv {
std::shared_ptr<console::GlobalMemory> glbRDRAM;
union eeRegister {
eeRegister()
: dw{0, 0}
{}
eeRegister() {}
struct {
os::machVec128 qw{0, 0};
u64 dw[2];

View File

@ -7,7 +7,7 @@ namespace zenith::eeiv {
class EEExecutor {
public:
EEExecutor(EEMipsCore& intCpu)
: rtIntCpu(intCpu) {}
: rtIntCpu(intCpu) {}
virtual u32 execCode() = 0;
virtual ~EEExecutor() = default;

View File

@ -27,13 +27,11 @@ namespace zenith::eeiv {
// directly to the table entries
for (auto segmentPage{kUnmapStart}; segmentPage != kUnmapEnd; segmentPage += 4096) {
auto kVTable{segmentPage / 4096};
if (kVTable >= 1024 * 1024) {
throw exception("Kernel TLB table is outside the specified range");
}
kernelVTLB[kVTable] = choiceMemSrc(segmentPage & (0x20000000 - 1));
if (segmentPage < 0xa0000000)
tlbInfo[kVTable].ccMode0 = TLBCacheMode::Cached;
else

View File

@ -1,10 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.1.1' apply false
id 'com.android.library' version '8.1.1' apply false
id 'org.jetbrains.kotlin.android' version '1.8.20' apply false
}
tasks.register('clean') {
delete rootProject.buildDir
}

10
build.gradle.kts Normal file
View File

@ -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 "8.1.2" apply false
id("com.android.library") version "8.1.2" apply false
id("org.jetbrains.kotlin.android") version "1.8.20" apply false
}
tasks.register("clean") {
delete(rootProject.buildDir)
}

View File

@ -20,4 +20,5 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonTransitiveRClass=true
org.gradle.unsafe.configuration-cache=true