Skip to content

Commit b40e87f

Browse files
author
committed
Feat: Fixed Android Build and made it more minimalistic. Added some warnings, Added new AUTO SETUP UI and more dependencies downloader
1 parent 8395847 commit b40e87f

18 files changed

Lines changed: 619 additions & 219 deletions

‎app/build.gradle.kts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ android {
1818
targetSdk = 37
1919

2020
// versioning
21-
versionCode = 103
22-
versionName = "4.0.4"
21+
versionCode = 105
22+
versionName = "4.0.6"
2323
vectorDrawables { useSupportLibrary = true }
2424
}
2525

‎changelog-4.0.5.txt‎

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
Xed-Editor PRO — Changelog
2+
Version 4.0.5 (versionCode 104)
3+
4+
Android workflow + dependency manager overhaul.
5+
6+
================================================================================
7+
0. Note on the recurring "utils: No such file or directory" log
8+
================================================================================
9+
That log is from a build BEFORE the 4.0.4 fix. The background run path (RunService) bypassed
10+
MkSession, so the helper scripts the run script sources weren't installed. 4.0.4 added
11+
`setupTerminalFiles()` to ProjectRunner.run()/sync(); this build keeps that fix. Once you build
12+
4.0.4/4.0.5, Run/Sync no longer fail with "utils not found".
13+
14+
================================================================================
15+
1. Minimal Android template (only MainActivity.kt)
16+
================================================================================
17+
- core/main/.../projects/ProjectScaffolder.kt — the Android (Compose) template now generates a
18+
single Kotlin file, MainActivity.kt, which is self-contained (uses MaterialTheme directly). The
19+
ui/theme/{Color,Theme,Type}.kt package and the ExampleUnitTest/ExampleInstrumentedTest files were
20+
removed, so a new empty project has exactly one .kt file like you expected.
21+
22+
================================================================================
23+
2. Android Run/Sync behave like Android Studio
24+
================================================================================
25+
- core/main/.../runner/ProjectRunner.kt — Android projects must have a successful Gradle **Sync**
26+
once per session before Run will build. If you press Run first, you get a clear, detailed warning
27+
explaining to Sync first (and to install the SDK/NDK from Dependencies if Sync fails). A
28+
successful Sync (or build) marks the project synced for the session and unblocks Run.
29+
- core/main/.../runner/RunService.kt — marks the project synced on a successful gradle run, and
30+
still installs the APK on a successful build.
31+
- Gradle prints BUILD SUCCESSFUL / BUILD FAILED, which now shows clearly in the build output and
32+
the collapsed bar's status line.
33+
34+
================================================================================
35+
3. Build output reads as proper log lines
36+
================================================================================
37+
- core/main/.../runner/RunOutputView.kt — the expanded output no longer soft-wraps; it scrolls
38+
horizontally so each log line stays on one line (no more words spread across lines). Compact
39+
monospace styling kept. The latest line in the collapsed bar slides up like a streaming log, and
40+
the expand/collapse uses a smooth spring.
41+
42+
================================================================================
43+
4. Dependencies dialog overhaul (Android)
44+
================================================================================
45+
- core/main/.../projects/DependenciesDialog.kt —
46+
* Fuller Android SDK install: cmdline-tools + platform-tools + platforms android-35 & android-34
47+
+ build-tools 35 & 34.
48+
* New **Android NDK** entry with a **version dropdown** (27/26/25/23 lines) — pick/switch the NDK
49+
version and it installs `ndk;<version>` via sdkmanager.
50+
* New **CMake** entry (cmake;3.22.1) for native builds.
51+
* Real-time, single-line output of the running install, an overall progress bar, and clear
52+
per-item Installed / Failed status.
53+
- core/main/.../projects/DependencyInstallService.kt — installs now stream output line-by-line
54+
(via ubuntuProcess) into the dialog instead of buffering, and report overall progress. (No longer
55+
uses the buffered ShellUtils.runUbuntu for installs.)
56+
57+
================================================================================
58+
5. Version
59+
================================================================================
60+
- app/build.gradle.kts — versionName 4.0.4 -> 4.0.5, versionCode 103 -> 104.
61+
62+
================================================================================
63+
Android end-to-end flow now
64+
================================================================================
65+
1. Create/open an Android project.
66+
2. Dependencies dialog → install Android SDK, NDK (pick version), CMake, a JDK.
67+
3. Tap Sync (next to Run) → wait for BUILD SUCCESSFUL.
68+
4. Tap Run → builds assembleDebug and installs the APK (system prompt).
69+
70+
Local build wasn't possible in the dev environment; verification is via GitHub Actions CI.

‎changelog-4.0.6.txt‎

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
Xed-Editor PRO — Changelog
2+
Version 4.0.6 (versionCode 105)
3+
4+
The real Android build fix + dependency/version flexibility + UX.
5+
6+
================================================================================
7+
1. FIX: Android template now builds on first try (illegal Kotlin escape)
8+
================================================================================
9+
The actual Gradle failure ("Illegal escape: '\.'" in settings.gradle.kts) was caused by the
10+
template emitting `includeGroupByRegex("com\.android.*")` — `\.` is an illegal escape in Kotlin
11+
DSL. Fixed to `com\\.android.*` / `com\\.google.*` (valid escaped dot), matching Android Studio.
12+
- core/main/.../projects/ProjectScaffolder.kt. Scanned the rest of the template; no other illegal
13+
Kotlin escapes (the gradle-wrapper.properties `https\://` is correct for a .properties file).
14+
15+
================================================================================
16+
2. NDK / SDK versions are no longer hard-locked (always resolve latest)
17+
================================================================================
18+
- core/main/.../projects/DependenciesDialog.kt —
19+
* Android SDK install now resolves and installs the **latest** platform + build-tools live from
20+
sdkmanager (in addition to android-34/build-tools 34 for the template), so it won't go stale.
21+
* NDK dropdown now includes a **"Latest"** option (default) that resolves the newest NDK at
22+
install time, plus pinned versions if you want a specific one.
23+
* CMake install resolves the latest available version too.
24+
25+
================================================================================
26+
3. Build output: scroll lock (auto-scroll) toggle
27+
================================================================================
28+
- core/main/.../runner/RunOutputState.kt + RunOutputView.kt — the expanded output auto-scrolls to
29+
the newest line as it streams; a toggle button in the output footer turns auto-scroll on/off
30+
(highlighted when on). Output stays horizontally scrollable (one line per line).
31+
32+
================================================================================
33+
4. Open-directory warning
34+
================================================================================
35+
- core/main/.../drawer/OpenDirectoryWarningDialog.kt (new) — before the system folder picker, a
36+
caution explains that Android 11+ manually-opened directories hit terminal permission errors and
37+
that such issues aren't supported. The OK button is **locked for 30 s with a live countdown**;
38+
there's a Cancel button and a **"Never show this again"** toggle (Settings.open_dir_warning_dismissed).
39+
- Wired through AddProjectSheet (onOpenDirectory) → Drawer.
40+
41+
================================================================================
42+
5. Auto Setup: full-screen UI + full toolchain, for everyone
43+
================================================================================
44+
- core/main/.../activities/main/AutoSetupDialog.kt — the consent is now a **full-screen** screen
45+
(fullscreen Dialog + Surface) instead of a small dialog: big title, message, live storage/data/
46+
time estimate, and Agree / Not now actions.
47+
- core/main/.../terminal/AutoSetupOverlay.kt — the progress screen is now opaque/full-screen, so
48+
the terminal runs silently behind it while you watch live progress.
49+
- core/main/.../assets/terminal/auto_setup.sh — now installs the full toolchain: apt update/upgrade,
50+
curl/git/wget/tar/unzip/zip/nano, build-essential + pkg-config, python3 + pip + venv,
51+
Node.js + npm, and OpenJDK 17 — with verification of each. Errors still route to a prefilled
52+
GitHub issue.
53+
54+
================================================================================
55+
6. Version
56+
================================================================================
57+
- app/build.gradle.kts — versionName 4.0.5 -> 4.0.6, versionCode 104 -> 105.
58+
59+
Local build wasn't possible in the dev environment; verification is via GitHub Actions CI.

‎core/main/src/main/assets/terminal/auto_setup.sh‎

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,33 @@ command -v apt-get >/dev/null 2>&1 || APT="apt"
2727
emit_progress 3 "Preparing setup"
2828
echo "Starting Xed-Editor auto setup..."
2929

30-
emit_progress 10 "Updating package lists"
30+
emit_progress 8 "Updating package lists"
3131
$APT update -y 2>&1 || fail "Failed to update package lists (apt update)."
3232

33-
emit_progress 45 "Upgrading installed packages"
33+
emit_progress 22 "Upgrading installed packages"
3434
$APT upgrade -y 2>&1 || fail "Failed to upgrade packages (apt upgrade)."
3535

36-
emit_progress 75 "Installing core tools (curl, git, wget)"
37-
$APT install -y curl git wget tar unzip nano ca-certificates 2>&1 || fail "Failed to install core tools."
36+
emit_progress 38 "Installing core tools (curl, git, wget)"
37+
$APT install -y curl git wget tar unzip zip nano ca-certificates 2>&1 || fail "Failed to install core tools."
3838

39-
emit_progress 92 "Verifying tools"
40-
for tool in curl git wget; do
39+
emit_progress 52 "Installing build tools (compiler, make)"
40+
$APT install -y build-essential pkg-config 2>&1 || fail "Failed to install build tools (build-essential)."
41+
42+
emit_progress 66 "Installing Python (python3, pip, venv)"
43+
$APT install -y python3 python3-pip python3-venv 2>&1 || fail "Failed to install Python."
44+
45+
emit_progress 80 "Installing Node.js & npm"
46+
$APT install -y nodejs npm 2>&1 || fail "Failed to install Node.js/npm."
47+
48+
emit_progress 90 "Installing JDK (OpenJDK 17)"
49+
$APT install -y openjdk-17-jdk 2>&1 || fail "Failed to install OpenJDK 17."
50+
51+
emit_progress 95 "Verifying tools"
52+
for tool in curl git wget python3 node npm javac; do
4153
command -v "$tool" >/dev/null 2>&1 || fail "Tool '$tool' is missing after installation."
4254
done
4355

44-
emit_progress 96 "Cleaning up"
56+
emit_progress 98 "Cleaning up"
4557
$APT clean 2>&1 || true
4658

4759
emit_progress 100 "Setup finished"

‎core/main/src/main/java/com/rk/activities/main/AutoSetupDialog.kt‎

Lines changed: 75 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,21 @@ import androidx.compose.foundation.layout.Arrangement
55
import androidx.compose.foundation.layout.Column
66
import androidx.compose.foundation.layout.Row
77
import androidx.compose.foundation.layout.Spacer
8+
import androidx.compose.foundation.layout.fillMaxSize
89
import androidx.compose.foundation.layout.fillMaxWidth
910
import androidx.compose.foundation.layout.height
11+
import androidx.compose.foundation.layout.padding
12+
import androidx.compose.foundation.layout.safeContentPadding
1013
import androidx.compose.foundation.layout.size
1114
import androidx.compose.foundation.layout.width
15+
import androidx.compose.foundation.rememberScrollState
16+
import androidx.compose.foundation.verticalScroll
1217
import androidx.compose.material3.AlertDialog
1318
import androidx.compose.material3.Button
1419
import androidx.compose.material3.CircularProgressIndicator
1520
import androidx.compose.material3.MaterialTheme
21+
import androidx.compose.material3.OutlinedButton
22+
import androidx.compose.material3.Surface
1623
import androidx.compose.material3.Text
1724
import androidx.compose.material3.TextButton
1825
import androidx.compose.runtime.Composable
@@ -26,17 +33,19 @@ import androidx.compose.ui.Modifier
2633
import androidx.compose.ui.res.stringResource
2734
import androidx.compose.ui.text.font.FontWeight
2835
import androidx.compose.ui.unit.dp
36+
import androidx.compose.ui.window.Dialog
37+
import androidx.compose.ui.window.DialogProperties
2938
import com.rk.resources.strings
3039
import com.rk.terminal.AutoSetup
3140
import com.rk.terminal.SetupEstimate
3241

3342
/**
34-
* First-launch consent dialog for Auto Setup.
43+
* First-launch Auto Setup consent — a full-screen screen (not a small dialog).
3544
*
36-
* Shows an estimate of the storage/download required and (after a quick internet speed probe) an
37-
* estimated time. The user can agree ([onLaunch] starts the setup terminal) or skip — skipping
38-
* first shows a warning that the IDE may break later with no support for manual fixes, and on
39-
* confirmation calls [onDismissForever].
45+
* Shows the storage/download estimate and (after a quick internet speed probe) an estimated time.
46+
* The user can agree ([onLaunch] starts the background setup) or skip — skipping first warns that
47+
* the IDE may break later with no support for manual fixes, and on confirmation calls
48+
* [onDismissForever].
4049
*/
4150
@Composable
4251
fun AutoSetupDialog(onLaunch: () -> Unit, onDismissForever: () -> Unit) {
@@ -71,49 +80,73 @@ fun AutoSetupDialog(onLaunch: () -> Unit, onDismissForever: () -> Unit) {
7180
return
7281
}
7382

74-
AlertDialog(
83+
Dialog(
7584
onDismissRequest = {},
76-
title = { Text(stringResource(strings.auto_setup_title)) },
77-
text = {
78-
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
79-
Text(stringResource(strings.auto_setup_message), style = MaterialTheme.typography.bodyMedium)
80-
Spacer(modifier = Modifier.height(4.dp))
81-
val est = estimate
82-
if (est == null) {
83-
Row(verticalAlignment = Alignment.CenterVertically) {
84-
CircularProgressIndicator(modifier = Modifier.size(18.dp), strokeWidth = 2.dp)
85-
Spacer(modifier = Modifier.width(10.dp))
86-
Text(
87-
stringResource(strings.auto_setup_checking_speed),
88-
style = MaterialTheme.typography.bodyMedium,
85+
properties =
86+
DialogProperties(
87+
usePlatformDefaultWidth = false,
88+
dismissOnBackPress = false,
89+
dismissOnClickOutside = false,
90+
),
91+
) {
92+
Surface(modifier = Modifier.fillMaxSize()) {
93+
Column(modifier = Modifier.fillMaxSize().safeContentPadding().padding(24.dp)) {
94+
Column(
95+
modifier = Modifier.weight(1f).fillMaxWidth().verticalScroll(rememberScrollState()),
96+
verticalArrangement = Arrangement.spacedBy(16.dp),
97+
) {
98+
Text(
99+
text = stringResource(strings.auto_setup_title),
100+
style = MaterialTheme.typography.headlineMedium,
101+
fontWeight = FontWeight.Bold,
102+
)
103+
Text(
104+
text = stringResource(strings.auto_setup_message),
105+
style = MaterialTheme.typography.bodyLarge,
106+
)
107+
Spacer(modifier = Modifier.height(4.dp))
108+
val est = estimate
109+
if (est == null) {
110+
Row(verticalAlignment = Alignment.CenterVertically) {
111+
CircularProgressIndicator(modifier = Modifier.size(18.dp), strokeWidth = 2.dp)
112+
Spacer(modifier = Modifier.width(10.dp))
113+
Text(
114+
stringResource(strings.auto_setup_checking_speed),
115+
style = MaterialTheme.typography.bodyMedium,
116+
)
117+
}
118+
} else {
119+
InfoRow(stringResource(strings.auto_setup_storage), est.storageText)
120+
InfoRow(stringResource(strings.auto_setup_data), est.dataText)
121+
InfoRow(
122+
stringResource(strings.auto_setup_eta),
123+
est.etaText ?: stringResource(strings.auto_setup_eta_unknown),
89124
)
90125
}
91-
} else {
92-
InfoRow(stringResource(strings.auto_setup_storage), est.storageText)
93-
InfoRow(stringResource(strings.auto_setup_data), est.dataText)
94-
InfoRow(
95-
stringResource(strings.auto_setup_eta),
96-
est.etaText ?: stringResource(strings.auto_setup_eta_unknown),
97-
)
98126
}
99-
}
100-
},
101-
confirmButton = {
102-
Button(
103-
onClick = {
104-
activity?.let { AutoSetup.launch(it) }
105-
onLaunch()
127+
128+
Spacer(modifier = Modifier.height(16.dp))
129+
130+
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(12.dp)) {
131+
OutlinedButton(
132+
modifier = Modifier.weight(1f),
133+
onClick = { showDeclineWarning = true },
134+
) {
135+
Text(stringResource(strings.auto_setup_skip), maxLines = 1)
136+
}
137+
Button(
138+
modifier = Modifier.weight(1f),
139+
onClick = {
140+
activity?.let { AutoSetup.launch(it) }
141+
onLaunch()
142+
},
143+
) {
144+
Text(stringResource(strings.auto_setup_start), maxLines = 1)
145+
}
106146
}
107-
) {
108-
Text(stringResource(strings.auto_setup_start))
109147
}
110-
},
111-
dismissButton = {
112-
TextButton(onClick = { showDeclineWarning = true }) {
113-
Text(stringResource(strings.auto_setup_skip))
114-
}
115-
},
116-
)
148+
}
149+
}
117150
}
118151

119152
@Composable

‎core/main/src/main/java/com/rk/drawer/AddProjectSheet.kt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ fun AddProjectSheet(
3737
onDismiss: () -> Unit,
3838
onAddProject: (FileObject) -> Unit,
3939
openFolder: ManagedActivityResultLauncher<Uri?, Uri?>,
40+
onOpenDirectory: () -> Unit,
4041
showPrivateFileWarning: (onOK: () -> Unit) -> Unit,
4142
showGitCloneDialog: () -> Unit,
4243
showCreateProject: () -> Unit,
@@ -64,7 +65,7 @@ fun AddProjectSheet(
6465
title = stringResource(strings.open_directory),
6566
description = stringResource(strings.open_dir_desc),
6667
onClick = {
67-
openFolder.launch(null)
68+
onOpenDirectory()
6869
onDismiss()
6970
},
7071
)

0 commit comments

Comments
 (0)