dakanji / RefindPlusUDK

RefindPlus UEFI Development Kit
BSD 2-Clause "Simplified" License
7 stars 39 forks source link

Build script changes #11

Closed joevt closed 3 years ago

joevt commented 3 years ago

Some changes for the build script to make building faster (because I've been making many changes which you'll see in the next pull request for RefindPlus).

CLAassistant commented 3 years ago

CLA assistant check
All committers have signed the CLA.

dakanji commented 3 years ago

Cheers ... will have a look with the RefindPlus PR when it comes in.

dakanji commented 3 years ago

Got round to looking at this and since the RP changes are not yet ready, this actually looks like it could go by itself and doesn't seem particularly linked.

However, while noting the intent, not inclined to merge this in for a few reasons:

Can see what it's doing and will cherry pick some stuff later but would rather leave the script as is for now.

Curious about the colours thing though. Couldn't quite get what it was doing. Seems to somehow make using the colours conditional. Can you shed more light?

Also, the change in gitignore makes it filter files as well as the previous directory. Is there a specific file being targeted that is not currently covered?

joevt commented 3 years ago

sleep commands - if you need to see the text then scroll up.

basetools - add a -buildtools option to turn on build of base tools instead of making it random. building should never be random.

build named branch - this is done rarely, maybe add a -branch parameter if you like.

colors - I use a BBEdit.app worksheet for most of my command line work. It keeps track of commands and there output better. The build script output is easier to read because the huge command lines don't wrap like they do in Terminal.app. To run a command or commands, I can just select a bunch of lines and press enter. I can select an error from the build script output and type Command-D to go to the file/line/column. BBEdit doesn't support terminal colors. Colors are removed if the test command determines that the current stdout doesn't support color.

.gitignore - instead of copying RefindPlusPkg to edk2, I just use a symbolic link. That way there's only one copy of the source. So in the .gitignore, the RefindPlusPkg is a file (the symbolic link) instead of a folder. I suppose you can .gitignore both a file and folder.

dakanji commented 3 years ago

Get the points made but current setup works better for my workflow (I usually run it several times a day) and does the job for others as well. Would consider changes at some point when I can update other related local scripts at the same time.

On the colours, if having them in is a real issue for BBEdit, then this will be fine to go for now. Only request would be that, for consistency, please use all caps for such global variables (declared outside function) and use "COLOURS".

The symlink is also immediately fine if within the existing setup leaving the branch checkout in place. Actually, again for workflow reasons, need to keep copying the code across.

Using one function is great but not set up locally to adopt that yet.

Cheers

PS: Basically only ready for the colours change at this time. Thanks again.

joevt commented 3 years ago

Ok, how about this: the build script reads a config file from the same directory with settings that default to all the things that existed before:

DOCOLOR=1 # automatically set to 0 if not running in a terminal DOCLEAR=1 # automatically set to 0 if not running in a terminal DOSLEEP=1 # set to zero if you don't want pauses DORANDOMBUILDTOOLS=20 # a percantage between 0% and 100%; use 0 if you would like to build it only when necessary. DOSYMLINK=0 # set to one if you would rather use a symlink to the RefindPlus source DOCHECKOUT=1 # does a checkout from default (GopFix) or specified branch

In the config we can also move all the constants from the build script:

BASE_DIR="$(cd "${BASH_SOURCE%/*}/../../"; pwd)" WORK_DIR="${BASE_DIR}/Working" EDK2_DIR="${BASE_DIR}/edk2" XCODE_DIR_REL="${EDK2_DIR}/Build/RefindPlus/RELEASE_XCODE5" XCODE_DIR_DBG="${EDK2_DIR}/Build/RefindPlus/DEBUG_XCODE5" BINARY_DIR_REL="${XCODE_DIR_REL}/X64" BINARY_DIR_DBG="${XCODE_DIR_DBG}/X64" OUTPUT_DIR="${EDK2_DIR}/000-BOOTx64-Files" GLOBAL_FILE="${EDK2_DIR}/RefindPlusPkg/BootMaster/globalExtra.h" GLOBAL_FILE_TMP_REL="${EDK2_DIR}/RefindPlusPkg/BootMaster/globalExtra-REL.txt" GLOBAL_FILE_TMP_DBG="${EDK2_DIR}/RefindPlusPkg/BootMaster/globalExtra-DBG.txt" BUILD_DSC="${EDK2_DIR}/RefindPlusPkg/RefindPlusPkg.dsc" BUILD_DSC_REL="${EDK2_DIR}/RefindPlusPkg/RefindPlusPkg-REL.dsc" BUILD_DSC_DBG="${EDK2_DIR}/RefindPlusPkg/RefindPlusPkg-DBG.dsc"

DEFAULT_COLOUR_BASE="\033[0;36m" DEFAULT_COLOUR_INFO="\033[0;33m" DEFAULT_COLOUR_STATUS="\033[0;32m" DEFAULT_COLOUR_ERROR="\033[0;31m" DEFAULT_COLOUR_NORMAL="\033[0m"

dakanji commented 3 years ago

Doable but actually prefer to keep it simple (not that this is particularly complex).

I see the positives and know this is more more of a "proper" way to get to the end of getting the build but as the current does actually deliver the required build and fits in with my stuff, I prefer to leave it alone for now as not yet ready to change a few things on my machine for now.

I have actually done the changes for the colours and I can push these to your branch and merge this.

First version is cool as said and will adopt this down the line. You can always use this for yourself in the interim.

dakanji commented 3 years ago

Btw, making changes for a PR on your default branch always leaves your fork out of sync whichever way the PR goes and better to create a separate branch. You can run 000-BuildScript/RepoUpdater.sh to realign things. NB: Make sure any edits to your RefindPlus repo are not on the default branch as would be lost on running that script otherwise.