bmx-ng / bcc

A next-generation bcc parser for BlitzMax
zlib License
33 stars 13 forks source link

Is calling @bmk within a comment still valid? #610

Closed braxtonrivers closed 1 year ago

braxtonrivers commented 1 year ago

Bug Report

Is this method of calling bmk still valid as it is not currently working with a new checkout and build of BlitzMax-NG. If there is something I am missing then please feel free to let me know as it was working, any alternatives are appreciated.

The date and time remain the same. eg. mine were as follows

builddate.txt 01 Jan 2023 buildtime.txt 08:15 pm

BuildDateTime-Test.bmx

Superstrict

Import brl.filesystem
Import brl.ramstream

' @bmk Include getdate.bmk
' @bmk GetDate
' @bmk GetTime

Incbin "builddate.txt"
Incbin "buildtime.txt"

GetDate.bmk

@define GetDate
    version=os.date("%d %b %Y")
    file=io.open("builddate.txt","w")
    file:write(version)
    file:close()
@end

@define GetTime
    version=os.date("%I:%M %p")
    file=io.open("buildtime.txt","w")
    file:write(version)
    file:close()
@end

Environment

GWRon commented 1 year ago

Can you remove the space before the @ char?

Am not at home but I was using a bcc/bmk of some days before ...and there it still worked .

braxtonrivers commented 1 year ago

Sorry GWRon, I should have mentioned that was with and without a space after the comment ' and between the @

I thought it was still working on Windows, and then I noticed that the time stamps and data have remained the same.

braxtonrivers commented 1 year ago

Thanks for your stable release checkout script by the way, I use it before submitting any issues :)

@echo off
set Curl_EXE=""
set SevenZip_EXE=""

set Version=0.129.3.45
set BlitzMax=BlitzMax
set BlitzMaxNG=%BlitzMax%NG
set BlitzMax_Tools_Folder=Tools
set BlitzMax_Bin_Folder=%BlitzMax%\bin
set BlitzMax_Stable_Release=%BlitzMax%_win32_x64_%Version%.7z
set BlitzMax_Download_Folder=%BlitzMaxNG%-v%Version%.Download

set BlitzMax_Git=https://github.com/bmx-ng
set BlitzMax_URL=%BlitzMax_Git%/bmx-ng/releases/download/v%Version%.win32.x64/%BlitzMax_Stable_Release%
set Curl_URL="https://curl.se/windows/"
set SevenZip_URL="https://7-zip.org"

echo Checking for required files ...
echo.

if not exist "%SevenZip_EXE%" (
    echo Please install 7-Zip!
    start "" "%SevenZip_URL%"
    exit
) else (
    echo ... Using 7z @ %SevenZip_EXE%
)

if not exist "%Curl_EXE%" (
    echo Please download Curl!
    start "" "%Curl_URL%"
    exit
) else (
    echo ... Using curl @ %Curl_EXE%
)

echo.

if not exist "%BlitzMax_Download_Folder%\" (
    echo Creating Download folder - %BlitzMax_Download_Folder% ...
    mkdir "%BlitzMax_Download_Folder%"
)

cd "%BlitzMax_Download_Folder%"

echo.
echo Downloading %BlitzMax%NG ...
echo.

rem the -k param is used to allow certificate errors
rem the -L param is used to follow redirections
%Curl_EXE% -k -L "%BlitzMax_URL%" -o "%BlitzMax_Stable_Release%"

if not exist "bcc.zip" %Curl_EXE% -k -L "%BlitzMax_Git%/bcc/archive/refs/heads/master.zip" -o "bcc.zip"
if not exist "bmk.zip"  %Curl_EXE% -k -L "%BlitzMax_Git%/bmk/archive/refs/heads/master.zip" -o "bmk.zip"

if not exist "brl.mod.zip" %Curl_EXE% -k -L "%BlitzMax_Git%/brl.mod/archive/refs/heads/master.zip" -o "brl.mod.zip"
if not exist "pub.mod.zip" %Curl_EXE% -k -L "%BlitzMax_Git%/pub.mod/archive/refs/heads/master.zip" -o "pub.mod.zip"
if not exist "audio.mod.zip" %Curl_EXE% -k -L "%BlitzMax_Git%/audio.mod/archive/refs/heads/master.zip" -o "audio.mod.zip"
if not exist "text.mod.zip" %Curl_EXE% -k -L "%BlitzMax_Git%/text.mod/archive/refs/heads/master.zip" -o "text.mod.zip"
if not exist "random.mod.zip" %Curl_EXE% -k -L "%BlitzMax_Git%/random.mod/archive/refs/heads/master.zip" -o "random.mod.zip"
if not exist "sdl.mod.zip" %Curl_EXE% -k -L "%BlitzMax_Git%/sdl.mod/archive/refs/heads/master.zip" -o "sdl.mod.zip"
if not exist "net.mod.zip" %Curl_EXE% -k -L "%BlitzMax_Git%/net.mod/archive/refs/heads/master.zip" -o "net.mod.zip"
if not exist "image.mod.zip" %Curl_EXE% -k -L "%BlitzMax_Git%/image.mod/archive/refs/heads/master.zip" -o "image.mod.zip"
if not exist "maxgui.mod.zip" %Curl_EXE% -k -L "%BlitzMax_Git%/maxgui.mod/archive/refs/heads/master.zip" -o "maxgui.mod.zip"
if not exist "database.mod.zip" %Curl_EXE% -k -L "%BlitzMax_Git%/database.mod/archive/refs/heads/master.zip" -o "database.mod.zip"

echo.
echo Unpacking - %BlitzMaxNG% ...
echo.
if exist "%BlitzMax%" (
    echo %BlitzMax% already unpacked ...
) else (
    %SevenZip_EXE% x "%BlitzMax_Stable_Release%" -r -y
)

echo.
echo Unpacking module updates ...
echo.
if exist "mod\brl.mod" (
    echo module updates already unpacked ...
) else (
    %SevenZip_EXE% x "brl.mod.zip" -o"mod" -r -y
    %SevenZip_EXE% x "pub.mod.zip" -o"mod" -r -y
    %SevenZip_EXE% x "audio.mod.zip" -o"mod" -r -y
    %SevenZip_EXE% x "text.mod.zip" -o"mod" -r -y
    %SevenZip_EXE% x "random.mod.zip" -o"mod" -r -y
    %SevenZip_EXE% x "sdl.mod.zip" -o"mod" -r -y
    %SevenZip_EXE% x "net.mod.zip" -o"mod" -r -y
    %SevenZip_EXE% x "image.mod.zip" -o"mod" -r -y
    %SevenZip_EXE% x "maxgui.mod.zip" -o"mod" -r -y
    %SevenZip_EXE% x "database.mod.zip" -o"mod" -r -y

    cd mod
    ren "brl.mod-master" "brl.mod"
    ren "pub.mod-master" "pub.mod"
    ren "audio.mod-master" "audio.mod"
    ren "text.mod-master" "text.mod"
    ren "random.mod-master" "random.mod"
    ren "sdl.mod-master" "sdl.mod"
    ren "net.mod-master" "net.mod"
    ren "image.mod-master" "image.mod"
    ren "maxgui.mod-master" "maxgui.mod"
    ren "database.mod-master" "database.mod"
    cd ..
)

%SevenZip_EXE% x "bcc.zip" -o"%BlitzMax_Tools_Folder%" -r -y
%SevenZip_EXE% x "bmk.zip" -o"%BlitzMax_Tools_Folder%" -r -y

echo.
echo Compiling - bcc ...
echo.
cd "%BlitzMax_Bin_Folder%"
bmk.exe makeapp -r -t console "..\..\%BlitzMax_Tools_Folder%\bcc-master\bcc.bmx"
cd ..\..

echo.
echo Updating - bcc ...
echo.
cd "%BlitzMax_Tools_Folder%\bcc-master"
copy /Y "bcc.exe" "..\..\%BlitzMax_Bin_Folder%\bcc.exe"
cd ..\..

echo.
echo Updating modules - so we can update bmk
echo.
cd "%BlitzMax%"
ren "mod" "mod.old"
cd ..
move /Y "mod" "%BlitzMax%\mod"

echo.
echo Compiling - bmk ...
echo.
cd "%BlitzMax_Bin_Folder%"
bmk.exe makeapp -r -t console "..\..\%BlitzMax_Tools_Folder%\bmk-master\bmk.bmx"
cd ..\..

echo.
echo Updating - bmk ...
echo.
cd "%BlitzMax_Tools_Folder%\bmk-master"
copy /Y "bmk.exe" "..\..\%BlitzMax_Bin_Folder%\bmk.exe"
copy /Y "core.bmk" "..\..\%BlitzMax_Bin_Folder%\core.bmk"
copy /Y "custom.bmk" "..\..\%BlitzMax_Bin_Folder%\core.bmk"
copy /Y "make.bmk" "..\..\%BlitzMax_Bin_Folder%\make.bmk"
cd ..\..

cd ..
echo.
echo %BlitzMaxNG% - Setup Complete.
echo.
pause
GWRon commented 1 year ago

Just tried to replicate the issue: and the files are getting created (the two txt files) which means the commands are executed.

If the time/date does not change, then this is a matter of whatever you do in the .bmk script.

GWRon commented 1 year ago

I meanwhile am using "pre.bmk" (as this is run by bmk automatically) and the content of the file is:

@define CreateVersionFile
    bmk.Sys("echo \"\" > ".. %BUILDPATH% .."/source/version.txt")
@end

@define doVersion
    version = os.date('%d.%m.%y %H:%M')

    file = io.open(%BUILDPATH% .. "/source/version.txt","w")
    if file ~= nil then
        #try to write with lua
        file:write(version)
        file:close()
    else
        #try the OS route
        bmk.Sys("echo \"" .. version .. "\" > " .. %BUILDPATH% .. "/source/version.txt")
    end
@end

# run the pre compile step install
#CreateVersionFile
doVersion
braxtonrivers commented 1 year ago

After updating my intel management engine firmware to the latest available on my ancient ASUS Z370 motherboard this and other compilation issues have suddenly disappeared and everything is working as expected again, so it appears to be an isolated incident, apologies as it was working without issue and then suddenly it was not.