summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x.ci/scripts/format/script.sh3
-rw-r--r--.github/workflows/verify.yml8
-rw-r--r--src/android/app/build.gradle.kts83
-rw-r--r--src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt4
-rw-r--r--src/android/app/src/main/res/layout-w600dp/fragment_about.xml4
-rw-r--r--src/android/app/src/main/res/layout/fragment_about.xml4
-rw-r--r--src/core/hle/service/server_manager.cpp9
7 files changed, 47 insertions, 68 deletions
diff --git a/.ci/scripts/format/script.sh b/.ci/scripts/format/script.sh
index c22398de0..f9c63dbfa 100755
--- a/.ci/scripts/format/script.sh
+++ b/.ci/scripts/format/script.sh
@@ -32,3 +32,6 @@ if [ ! -z "$DIFF" ]; then
echo "$DIFF"
exit 1
fi
+
+cd src/android
+./gradlew ktlintCheck
diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml
index c073f3f3f..62eb69aeb 100644
--- a/.github/workflows/verify.yml
+++ b/.github/workflows/verify.yml
@@ -13,13 +13,15 @@ jobs:
format:
name: 'verify format'
runs-on: ubuntu-latest
- container:
- image: yuzuemu/build-environments:linux-clang-format
- options: -u 1001
steps:
- uses: actions/checkout@v3
with:
submodules: false
+ - name: set up JDK 17
+ uses: actions/setup-java@v3
+ with:
+ java-version: '17'
+ distribution: 'temurin'
- name: 'Verify Formatting'
run: bash -ex ./.ci/scripts/format/script.sh
build:
diff --git a/src/android/app/build.gradle.kts b/src/android/app/build.gradle.kts
index 53aafa08c..06e59d1ac 100644
--- a/src/android/app/build.gradle.kts
+++ b/src/android/app/build.gradle.kts
@@ -188,8 +188,15 @@ tasks.create<Delete>("ktlintReset") {
delete(File(buildDir.path + File.separator + "intermediates/ktLint"))
}
+val showFormatHelp = {
+ logger.lifecycle(
+ "If this check fails, please try running \"gradlew ktlintFormat\" for automatic " +
+ "codestyle fixes"
+ )
+}
+tasks.getByPath("ktlintKotlinScriptCheck").doFirst { showFormatHelp.invoke() }
+tasks.getByPath("ktlintMainSourceSetCheck").doFirst { showFormatHelp.invoke() }
tasks.getByPath("loadKtlintReporters").dependsOn("ktlintReset")
-tasks.getByPath("preBuild").dependsOn("ktlintCheck")
ktlint {
version.set("0.47.1")
@@ -228,71 +235,33 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0")
}
-fun getGitVersion(): String {
- var versionName = "0.0"
-
- try {
- versionName = ProcessBuilder("git", "describe", "--always", "--long")
+fun runGitCommand(command: List<String>): String {
+ return try {
+ ProcessBuilder(command)
.directory(project.rootDir)
.redirectOutput(ProcessBuilder.Redirect.PIPE)
.redirectError(ProcessBuilder.Redirect.PIPE)
.start().inputStream.bufferedReader().use { it.readText() }
.trim()
- .replace(Regex("(-0)?-[^-]+$"), "")
} catch (e: Exception) {
- logger.error("Cannot find git, defaulting to dummy version number")
+ logger.error("Cannot find git")
+ ""
}
-
- if (System.getenv("GITHUB_ACTIONS") != null) {
- val gitTag = System.getenv("GIT_TAG_NAME")
- versionName = gitTag ?: versionName
- }
-
- return versionName
}
-fun getGitHash(): String {
- try {
- val processBuilder = ProcessBuilder("git", "rev-parse", "--short", "HEAD")
- processBuilder.directory(project.rootDir)
- val process = processBuilder.start()
- val inputStream = process.inputStream
- val errorStream = process.errorStream
- process.waitFor()
-
- return if (process.exitValue() == 0) {
- inputStream.bufferedReader()
- .use { it.readText().trim() } // return the value of gitHash
- } else {
- val errorMessage = errorStream.bufferedReader().use { it.readText().trim() }
- logger.error("Error running git command: $errorMessage")
- "dummy-hash" // return a dummy hash value in case of an error
- }
- } catch (e: Exception) {
- logger.error("$e: Cannot find git, defaulting to dummy build hash")
- return "dummy-hash" // return a dummy hash value in case of an error
+fun getGitVersion(): String {
+ val versionName = if (System.getenv("GITHUB_ACTIONS") != null) {
+ val gitTag = System.getenv("GIT_TAG_NAME") ?: ""
+ gitTag
+ } else {
+ runGitCommand(listOf("git", "describe", "--always", "--long"))
+ .replace(Regex("(-0)?-[^-]+$"), "")
}
+ return versionName.ifEmpty { "0.0" }
}
-fun getBranch(): String {
- try {
- val processBuilder = ProcessBuilder("git", "rev-parse", "--abbrev-ref", "HEAD")
- processBuilder.directory(project.rootDir)
- val process = processBuilder.start()
- val inputStream = process.inputStream
- val errorStream = process.errorStream
- process.waitFor()
-
- return if (process.exitValue() == 0) {
- inputStream.bufferedReader()
- .use { it.readText().trim() } // return the value of gitHash
- } else {
- val errorMessage = errorStream.bufferedReader().use { it.readText().trim() }
- logger.error("Error running git command: $errorMessage")
- "dummy-hash" // return a dummy hash value in case of an error
- }
- } catch (e: Exception) {
- logger.error("$e: Cannot find git, defaulting to dummy build hash")
- return "dummy-hash" // return a dummy hash value in case of an error
- }
-}
+fun getGitHash(): String =
+ runGitCommand(listOf("git", "rev-parse", "--short", "HEAD")).ifEmpty { "dummy-hash" }
+
+fun getBranch(): String =
+ runGitCommand(listOf("git", "rev-parse", "--abbrev-ref", "HEAD")).ifEmpty { "dummy-hash" }
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt
index a1620fbb7..5b5f800c1 100644
--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt
+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/AboutFragment.kt
@@ -76,8 +76,8 @@ class AboutFragment : Fragment() {
binding.root.findNavController().navigate(R.id.action_aboutFragment_to_licensesFragment)
}
- binding.textBuildHash.text = BuildConfig.GIT_HASH
- binding.buttonBuildHash.setOnClickListener {
+ binding.textVersionName.text = BuildConfig.VERSION_NAME
+ binding.textVersionName.setOnClickListener {
val clipBoard =
requireContext().getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clip = ClipData.newPlainText(getString(R.string.build), BuildConfig.GIT_HASH)
diff --git a/src/android/app/src/main/res/layout-w600dp/fragment_about.xml b/src/android/app/src/main/res/layout-w600dp/fragment_about.xml
index a26ffbc73..655e49219 100644
--- a/src/android/app/src/main/res/layout-w600dp/fragment_about.xml
+++ b/src/android/app/src/main/res/layout-w600dp/fragment_about.xml
@@ -147,7 +147,7 @@
android:layout_marginHorizontal="20dp" />
<LinearLayout
- android:id="@+id/button_build_hash"
+ android:id="@+id/button_version_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
@@ -164,7 +164,7 @@
android:textAlignment="viewStart" />
<com.google.android.material.textview.MaterialTextView
- android:id="@+id/text_build_hash"
+ android:id="@+id/text_version_name"
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/src/android/app/src/main/res/layout/fragment_about.xml b/src/android/app/src/main/res/layout/fragment_about.xml
index a24f5230e..38090fa50 100644
--- a/src/android/app/src/main/res/layout/fragment_about.xml
+++ b/src/android/app/src/main/res/layout/fragment_about.xml
@@ -148,7 +148,7 @@
android:layout_marginHorizontal="20dp" />
<LinearLayout
- android:id="@+id/button_build_hash"
+ android:id="@+id/button_version_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingVertical="16dp"
@@ -165,7 +165,7 @@
android:text="@string/build" />
<com.google.android.material.textview.MaterialTextView
- android:id="@+id/text_build_hash"
+ android:id="@+id/text_version_name"
style="@style/TextAppearance.Material3.BodyMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/src/core/hle/service/server_manager.cpp b/src/core/hle/service/server_manager.cpp
index 15edb23e0..8ef49387d 100644
--- a/src/core/hle/service/server_manager.cpp
+++ b/src/core/hle/service/server_manager.cpp
@@ -256,8 +256,13 @@ Result ServerManager::WaitAndProcessImpl() {
// Wait for a signal.
s32 out_index{-1};
- R_TRY(Kernel::KSynchronizationObject::Wait(m_system.Kernel(), &out_index, wait_objs.data(),
- num_objs, -1));
+ R_TRY_CATCH(Kernel::KSynchronizationObject::Wait(m_system.Kernel(), &out_index,
+ wait_objs.data(), num_objs, -1)) {
+ R_CATCH(Kernel::ResultSessionClosed) {
+ // On session closed, index is updated and we don't want to return an error.
+ }
+ }
+ R_END_TRY_CATCH;
ASSERT(out_index >= 0 && out_index < num_objs);
// Set the output index.