Skip to content

Commit

Permalink
[Build] Clean-up win32/build.bat and fix its argument processing
Browse files Browse the repository at this point in the history
The argument processing was fixed by removing an superfluous
'shift'-command.
This allows to use the win32/build.bat in the GH-workflow which in turn
makes it possible to remove the explicit specification of environment
variables which are set in the build.bat.

Also remove obsolete variables and machine specific paths, update
defaults listed in the explanations of the optional switches and remove
trivial labels+jumps.
Also remove specification of environment variable PROCESSOR_ARCHITECTURE
that is set by the hosting computer.
  • Loading branch information
HannesWell committed Apr 1, 2024
1 parent bb23002 commit d3ba811
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 41 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ jobs:
path: '**/target/*-reports/*.xml'
build-launcher-win64:
runs-on: windows-2019
env:
PROGRAM_OUTPUT: eclipse.exe
PROGRAM_LIBRARY: eclipse.dll
DEFAULT_OS: win32
DEFAULT_OS_ARCH: x86_64
DEFAULT_WS: win32
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -83,7 +77,7 @@ jobs:
arch: x64
- name: Build
working-directory: features/org.eclipse.equinox.executable.feature/library/win32
run: nmake -f make_win64.mak test
run: .\build.bat test
shell: pwsh
- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
@rem Kevin Cornell (Rational Software Corporation)
@rem **********************************************************************
@rem
@rem Usage: sh build.sh [<optional switches>] [clean]
@rem Usage: .\build.bat [<optional switches>] [clean]
@rem
@rem where the optional switches are:
@rem -output <PROGRAM_OUTPUT> - executable filename ("eclipse")
@rem -output <PROGRAM_OUTPUT> - executable filename ("eclipse.exe")
@rem -library <PROGRAM_LIBRARY>- dll filename (eclipse.dll)
@rem -os <DEFAULT_OS> - default Eclipse "-os" value (qnx)
@rem -arch <DEFAULT_OS_ARCH> - default Eclipse "-arch" value (x86)
@rem -ws <DEFAULT_WS> - default Eclipse "-ws" value (photon)
@rem -java <JAVA_HOME> - location of a Java SDK for JNI headers
@rem -os <DEFAULT_OS> - default Eclipse "-os" value (win32)
@rem -arch <DEFAULT_OS_ARCH> - default Eclipse "-arch" value (x86_64)
@rem -ws <DEFAULT_WS> - default Eclipse "-ws" value (win32)
@rem -java <JAVA_HOME> - location of a Java SDK for JNI headers and libraries
@rem
@rem
@rem This script can also be invoked with the "clean" argument.
Expand All @@ -36,22 +36,13 @@
@rem ******
@echo off

IF EXIST C:\BUILD\swt-builddir set LAUNCHER_BUILDDIR=C:\BUILD\swt-builddir
IF x.%LAUNCHER_BUILDDIR%==x. set LAUNCHER_BUILDDIR=S:\swt-builddir
echo LAUNCHER build dir: %LAUNCHER_BUILDDIR%

@rem Specify VisualStudio Edition: 'Community', 'Enterprise', 'Professional' etc.
IF "x.%MSVC_EDITION%"=="x." set "MSVC_EDITION=Community"

@rem Specify VisualStudio Version: '2017' or newer '2019'
IF "x.%MSVC_VERSION%"=="x." set "MSVC_VERSION=2019"

GOTO X86_64

:X86_64
shift
set defaultOSArch=x86_64
set PROCESSOR_ARCHITECTURE=AMD64
IF NOT EXIST "%MSVC_HOME%" set "MSVC_HOME=%ProgramFiles(x86)%\Microsoft Visual Studio\%MSVC_VERSION%\BuildTools"
IF NOT EXIST "%MSVC_HOME%" set "MSVC_HOME=%ProgramFiles(x86)%\Microsoft Visual Studio\%MSVC_VERSION%\%MSVC_EDITION%"
IF EXIST "%MSVC_HOME%" (
Expand All @@ -60,7 +51,6 @@ IF EXIST "%MSVC_HOME%" (
echo "WARNING: Microsoft Visual Studio %MSVC_VERSION% was not found."
echo " Refer steps for SWT Windows native setup: https://www.eclipse.org/swt/swt_win_native.php"
)
IF NOT EXIST "%JAVA_HOME%" set "JAVA_HOME=%ProgramFiles%\AdoptOpenJDK\jdk-8.0.292.10-hotspot"
IF EXIST "%JAVA_HOME%" (
echo "JAVA_HOME x64: %JAVA_HOME%"
) ELSE (
Expand All @@ -70,26 +60,24 @@ IF EXIST "%JAVA_HOME%" (
set javaHome=%JAVA_HOME%
set makefile=make_win64.mak
call "%MSVC_HOME%\VC\Auxiliary\Build\vcvarsall.bat" x64
GOTO MAKE

:MAKE
rem --------------------------
rem Define default values for environment variables used in the makefiles.
rem --------------------------
set programOutput=eclipse.exe
set programLibrary=eclipse.dll
set defaultOS=win32
set defaultWS=win32
set OS=Windows

rem --------------------------
rem Parse the command line arguments and override the default values.
rem --------------------------
set extraArgs=

:WHILE
if "%1" == "" goto WHILE_END
if "%2" == "" goto LAST_ARG

if "%2" == "" (
goto LAST_ARG )
if "%1" == "-os" (
set defaultOS=%2
shift
Expand Down Expand Up @@ -138,16 +126,10 @@ set JAVA_HOME=%javaHome%
rem --------------------------
rem Run nmake to build the executable.
rem --------------------------
if "%extraArgs%" == "" goto MAKE_ALL

nmake -f %makefile% %extraArgs%
goto DONE

:MAKE_ALL
echo Building %OS% launcher. Defaults: -os %DEFAULT_OS% -arch %DEFAULT_OS_ARCH% -ws %DEFAULT_WS%
nmake -f %makefile% clean
nmake -f %makefile% %1 %2 %3 %4
goto DONE


:DONE
IF NOT "%extraArgs%"=="" (
nmake -f %makefile% %extraArgs%
) ELSE (
echo Building Windows launcher. Defaults: -ws %DEFAULT_WS% -os %DEFAULT_OS% -arch %DEFAULT_OS_ARCH%
nmake -f %makefile% clean
nmake -f %makefile% %1 %2 %3 %4
)

0 comments on commit d3ba811

Please sign in to comment.