Skip to content

Commit 5268c3e

Browse files
authored
fixed bug in #34 & set the right date time format in ide log & set back official runners & set timeout for actions (#35)
* 更新 QuickRunWithCancellationAction.kt * set the right date time format in ide log * set the right date time format * set a shorter package name for new project * set back official runners & set timeout for actions * set back official runners & set timeout for actions * set timeout for actions * set back official runners & set timeout for actions
1 parent 748af5f commit 5268c3e

8 files changed

Lines changed: 39 additions & 15 deletions

File tree

.github/workflows/_build-apk-reusable.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ env:
6464
jobs:
6565
build:
6666
name: Build APK (${{ inputs.abi_type }},${{ inputs.build_type }})
67-
#runs-on: ubuntu-latest
68-
runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
67+
timeout-minutes: 30 # Force timeout after this
68+
runs-on: ubuntu-latest
69+
6970
outputs:
7071
ver_name: ${{ steps.params.outputs.ver_name }}
7172
short_sha: ${{ steps.params.outputs.short_sha }}

.github/workflows/build.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ concurrency:
1717

1818
jobs:
1919
read_info:
20-
#runs-on: ubuntu-latest
21-
runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
20+
timeout-minutes: 10 # Force timeout after this
21+
runs-on: ubuntu-latest
22+
2223
outputs:
2324
ver_name: ${{ steps.info.outputs.ver_name }}
2425
steps:

.github/workflows/delete_branch.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010

1111
jobs:
1212
delete:
13+
timeout-minutes: 5 # Force timeout after this
1314
runs-on: ubuntu-latest
1415
permissions:
1516
contents: write

.github/workflows/release.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ concurrency:
1010

1111
jobs:
1212
check:
13-
#runs-on: ubuntu-latest
14-
runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
13+
timeout-minutes: 20 # Force timeout after this
14+
runs-on: ubuntu-latest
15+
1516
outputs:
1617
final_tag: ${{ steps.final_tag.outputs.final_tag }}
1718
ver_name: ${{ steps.info.outputs.ver_name }}
@@ -116,8 +117,9 @@ jobs:
116117

117118
create_tag:
118119
needs: [check, build_all_abi]
119-
#runs-on: ubuntu-latest
120-
runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
120+
timeout-minutes: 10 # Force timeout after this
121+
runs-on: ubuntu-latest
122+
121123
steps:
122124

123125
- name: Checkout
@@ -135,8 +137,9 @@ jobs:
135137
136138
publish_release:
137139
needs: [check, build_all_abi, create_tag]
138-
#runs-on: ubuntu-latest
139-
runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }}
140+
timeout-minutes: 10 # Force timeout after this
141+
runs-on: ubuntu-latest
142+
140143
steps:
141144

142145
- name: Checkout

core/app/src/main/java/com/itsaky/androidide/actions/build/QuickRunWithCancellationAction.kt

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,25 @@ class QuickRunWithCancellationAction(context: Context, override val order: Int)
169169

170170
handleResult(data, result, module, variant)
171171
}.invokeOnCompletion { error ->
172-
if (error != null) {
172+
173+
when {
174+
error == null -> return@invokeOnCompletion
175+
error is java.util.concurrent.CancellationException -> {
176+
// 1. when cancel -> debug
177+
log.debug(
178+
"QuickRun cancelled. type: {}, Message: {}",
179+
error?.javaClass?.name ?: "Unknown error type",
180+
error?.message ?: "No error message",
181+
//error.javaClass.simpleName,
182+
//error.message ?: "No message"
183+
)
184+
return@invokeOnCompletion
185+
}
186+
// 2. else -> continue
187+
else -> Unit
188+
}
189+
190+
//if (error != null) {
173191
//log.error("Failed to run '{}'", taskName, error)
174192
log.error(
175193
"Failed to run task '{}'. Error type: {}, Message: {}",
@@ -178,7 +196,7 @@ class QuickRunWithCancellationAction(context: Context, override val order: Int)
178196
error?.message ?: "No error message",
179197
error
180198
)
181-
}
199+
//}
182200
}
183201
}
184202

logging/logger/src/main/java/com/itsaky/androidide/logging/encoder/IDELogFormatLayout.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public boolean isOmitMessage() {
4545

4646
@Override
4747
public String doLayout(ILoggingEvent event) {
48-
final SimpleDateFormat format = new SimpleDateFormat("dd-MM HH:mm:ss.SSS", Locale.ROOT);
48+
final SimpleDateFormat format = new SimpleDateFormat("MM-dd HH:mm:ss.SSS", Locale.ROOT);
4949
final var date = format.format(new Date(event.getTimeStamp()));
5050

5151
final var builder = new StringBuilder();

logging/logger/src/main/java/com/itsaky/androidide/logging/encoder/ThreadTimeEncoder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public byte[] headerBytes() {
4040
@Override
4141
public byte[] encode(ILoggingEvent event) {
4242
final var sb = new StringBuilder();
43-
final var date = new SimpleDateFormat("dd-MM HH:mm:ss.SSS", Locale.ROOT).format(
43+
final var date = new SimpleDateFormat("MM-dd HH:mm:ss.SSS", Locale.ROOT).format(
4444
new Date(event.getTimeStamp()));
4545
var tag = event.getLoggerName();
4646
if (tag.length() > LogUtils.MAX_TAG_LENGTH) {

utilities/templates-api/src/main/java/com/itsaky/androidide/templates/parameters.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ inline fun projectNameParameter(crossinline configure: StringParameterBuilder.()
374374
inline fun packageNameParameter(crossinline configure: StringParameterBuilder.() -> Unit = {}) =
375375
stringParameter {
376376
name = string.package_name
377-
default = "com.example.myapplication"
377+
default = "com.ide.app"
378378
startIcon = { R.drawable.ic_package }
379379
constraints = listOf(NONEMPTY, PACKAGE)
380380

0 commit comments

Comments
 (0)