Saturday, July 15, 2023

Month 4-Week 3 of Gateware: The Build Process is Finally Complete!

)    Well, we’re finally here. The GSource UWP branch has been merged into main and the GCompiler UWP branch will be merged into the main here in the next few days. Gateware’s UWP implementation is finally being released into the world, and while it may not be the prettiest, it still feels good. 

    Last week, we had an issue with the Unit Tests weren't being waited on by the yml, and the yml could tell whether or not Unit Tests. Well since then, the unit test yml has grown considerably. 


    That top block of code will first check to see if the application is already installed (from a previous test or elsewhere), and if it is, then uninstall the app. It then goes through the normal steps that we have from last time, except now, if we find a certain file (I'll talk about the importance of this file later), and if it exists, then delete it. Once we've then got the application launched and running, we then startup a while loop that will look for that file from earlier, and if it can find the file in time, then it will pass; if not, then it fails.

    Now, you may be asking, "What's up with this file?". Well, since UWP applications aren't able to write out to the console, we instead have it write out to a file. If all of the Unit Tests pass, then the file will be created; if any of the tests fail, then the file is not created. Simple as that. At the time being, the output file, unfortunately, does not have any real information.  We would be able to one day redirect what would normally go to the console to go to an output file, and then we could just have the yml print out the file. But that will just take longer to do than the amount of time I have left here.
    
    And with that, the GSource UWP branch was pretty much ready to get merged into main. We still had a little bit of tidying to do, but once that was taken care of, we had the pipeline run one more time and then merged the branches, and the merge passed all the tests!

    Not, it was GCompiler's turn. GCompiler's whole process went much faster than GSource since the vast majority of the changes we had to make we stuff we had already done in GScource. For the build step, all we did just copy over the build step from Win32 and then add a few lines so that it would run the CMake to build the UWP version of the SinglerHeaderTestMain project. And speaking of which, we needed an actual CMake to create the UWP version of the project, but because of how similar it is to the GSource test project, I was pretty much able to just copy it over, get rid of the Dummy project, and then change a few names. 

    The test step is exactly like the test step from GSource, just with some slightly different pathing and project name. And since the test step was also looking for a success file, we just needed to add it to the main of the test project to create the file once all the Unit Tests pass. And with that done, GCompiler is ready to be merged into main. The pull request has been submitted, and it passes all the tests, so it will be merged anytime now.

    And with that, Gateware-UWP is gonna be launched to the public and will be ready to be used at any time. There are still some improvements that can be made, but for now, it is working; just could be working a little nicer. But that's it! There's just a tiny bit more cleaning I'm going to do, but those shouldn't really have any functionality changes and will be really quick to do. So other than that, I'm pretty much done with Gateware as far as my time as a student goes. For my final week, I'm going to be trying to add some more functionality to my showcase project to hopefully have it be more than just a spinning cube with some music.

Friday, July 7, 2023

Month 4-Week 2 of Gateware: The Build Process is (Almost) Done

     We are so close to having the build process finished. It has presented a fair share of issues and has forced me to learn a lot of new things that I didn't think I would have to when I first began this journey. While we do have the vast majority of the build and unit test process finished for the GSource branch, we're still missing what is arguably the most important part.

    We got the whole build and process set up so that we now have to project being created, built, deployed, installed, and launched. 


    The meat of what's going on is happening here. The creation of the project in the build phase is pretty standard. compared to the platforms, but the main differences are here in the testing portion. Firstly, we are navigating into the build folder so that we have access to the solution file. We then use Push-Location to save the directory that we are currently in. We do this because the next line of code opens up the Visual Studio Developer Powershell, and doing so changes our working directory to some other random directory. But we are then able to use Pop-Location to get us back into the directory we had saved. We then use the devenv command to deploy the project (it also rebuilds the project), which will generate the AppX folder. After this point, we thought we would then have to take the AppX folder and compress it into a .appx package and then use the package to install the application onto the machine. But through some testing, I discovered that the deploy command actually goes ahead and installs the application onto your machine. And so then we were able to skip those two other steps, which I'm very happy about since that install step was giving me a lot of trouble. Finally, the bottom command then goes ahead and launches the application.

    The problem we are having is that after the application is launched, the yml just ends there. On the other platforms, the Unit Test is a console application, so when it launches the executable, it opens in the command line, and it can't continue until the unit test completes. It is also then able to see whether or not all the unit tests have passed. But UWP isn't able to run as a console application, so the yml doesn't wait for it to finish. So right now, the unit tests only pass and fail based on whether or not the application is able to be launched, not on the individual unit tests. 

    So now we have to find a way to not only get the yml to wait for the application to go through all the unit tests but also be able to read the unit tests and determine when and which unit test fails. The Start-Process has several commands that are actually perfect for what we are looking for it to do, but unfortunately, they all seem to be incompatible with UWP applications. We are so close to the end; I can taste it. But this is looking to be one of the more major issues and could potentially take some time to complete.