Project migration to new model with Android support#337
Project migration to new model with Android support#337Shivansps wants to merge 68 commits intoKnossosNET:mainfrom
Conversation
|
@notimaginative sorry to bother you, but you could check my CI changes of the last 4 commits? i did used claude to do these changes and explain it to me how it worked. The idea is:
In my tests, it did generated all files with the correct names on a draft release |
|
I can't tell from a quick look so I'll have to give this a proper test and see how it works. I should be able to do that sometime tomorrow. |
thanks |
|
I think those CI changes can be simplified quite a bit. Plus it would be nice to use the same setup and scripts for both desktop and android builds. Let me work on it a little and I'll send you a patch tomorrow. |
|
Couple of questions...
|
|
|
Here is the patch of my CI changes against this PR. Along with unifying the setup I also bumped the GitHub action versions to get rid of the node20 deprecation warnings and disabled the net6.0 end-of-life warnings when built via the scripts. Scripts verified to work locally, workflow verified to complete a full set of builds and create a new draft release. |
|
@notimaginative everything seems to be working, thanks. |
The intention of this PR is to upgrade the project/solution to the newer model allowing for both Desktop and Android builds.
And while an android build can now be compiled, it is not completely usable. This is intended to create the base for a future android build while testing everything still works as expected with the desktop versions, not to produce a working android build.
Android specific work can start after this one is merged.
Changes:
With the change to the new model, now to compile a desktop build, the Knossos.NET.Desktop project must be used. The idea is to keep using NET 6 for desktop builds.
The resulting executable file is now called "Knossos.NET.Desktop.exe" i dont really want to use that, so they have to be renamed to "Knossos.NET.exe" changing the assembly name creates lots of problems and even then the compiled still did not changed the name. SO it will be better to either accept the new name or to rename the executable.
The second issue is, as android is single view and can not create windows, i had to take petty much everything away from the main window view and model and move it into "MainView" and "MainViewModel", this could create significant issues so everything that runs on the main view need to be tested again. And thats include custom mode.
All dialogs that created new windows, like MessageBox and everything on Views/Windows with the exception of MainWindow and SapiVoices(Windows specific), were moved to a new type called "KnossosWindow", now these dialogs were changed from Window to KnossosWindow, that extend UserControl, this new system add stuff we used from Window that was missing on UserControl, and on a Desktop OS will create a new Window as normal, but on Android it will display the view in a overlay over the MainView.
No need to say this means all dialogs that created new window could have potential issues, altrought i havent found anything so far.
Auto update need to be tested again with both executable names, ill figure a way to do that.
The integrated github build will need to be adjusted to this model too.
Compiling:
To compile a desktop version as before, you must use the Knossos.NET.Desktop project, to compile the Android version, choose the Knossos.NET.Android (only from cmdline, not from VS)
Build and publish the desktop version for windows x64 in net 6:
dotnet build Knossos.NET.Desktop -c Release -r win-x64 -f net6.0
dotnet publish Knossos.NET.Desktop -c Release -r win-x64 -f net6.0 --self-contained
Build the Android version:
dotnet build Knossos.NET.Android -c Release -f net10.0-Android -p:BuildAndroid=true
That creates a signed apk for all cpu archs ready to install in any device that is android 9+, no need to use publish for this.
Compile and upload to phone directly for development:
dotnet run -c Debug -f net10.0-Android -p:BuildAndroid=true
Run from inside the Knossos.NET.Android folder, not the solution folder as before, phone needs to be on developer mode, with usb debugging enabled and adb daemon needs to be already running on your pc, so make sure to start it manually first.
"-p:BuildAndroid=true" is used to enable the project for android and the net10.0-Android target framework.
When working with android apps i also recommend to use "scrcpy"
https://github.com/Genymobile/scrcpy/releases/tag/v3.3.3
scrcpy will connect to the phone using adb and it will start the daemon too, so you can see and use everything directly on your pc without having to pickup the phone or do anything with it
NOTES:
To compile for android you will need the net 10 sdk installed and then install the android workload with
"dotnet workload install android" on a console.
If you only want to compile for desktop on VS, the android proyect will still be compiled as a dll even after selecting the "Knossos.NET.Desktop" as your starting project and will need the android workload installed, a workaround for this is just to unload the "Knossos.NET.Android" project (right click->unload proyect)