Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Commit

Permalink
removed windows build on makefile (#288)
Browse files Browse the repository at this point in the history
Signed-off-by: JoaoDanielRufino <joaodaniel0405@gmail.com>
  • Loading branch information
JoaoDanielRufino authored Oct 26, 2020
1 parent ab9e1bc commit 3f4bc09
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 37 deletions.
24 changes: 8 additions & 16 deletions templates/create_formula/languages/csharp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,29 @@
SOURCE_FILE=src/src.csproj
BIN_FOLDER=bin
BIN_FOLDER_LINUX=linux
BIN_FOLDER_WINDOWS=windows
BIN_FOLDER_DARWIN=darwin
BIN_UNIX=src
BIN_WINDOWS=src.exe
BIN_UNIX=src.dll
SH=$(BIN_FOLDER)/run.sh
BAT=$(BIN_FOLDER)/run.bat

build: linux-build windows-build macOS-build sh-unix bat-windows docker
build: linux-build macOS-build sh-unix docker

linux-build:
mkdir -p $(BIN_FOLDER)/$(BIN_FOLDER_LINUX)
dotnet build $(SOURCE_FILE) -o $(BIN_FOLDER)/$(BIN_FOLDER_LINUX) --configuration Release --runtime linux-x64
windows-build:
mkdir -p $(BIN_FOLDER)/$(BIN_FOLDER_WINDOWS)
dotnet build $(SOURCE_FILE) -o $(BIN_FOLDER)/$(BIN_FOLDER_WINDOWS) --configuration Release --runtime win10-x64
mkdir -p $(BIN_FOLDER)
cp -r src/* $(BIN_FOLDER)
dotnet build $(SOURCE_FILE) -o $(BIN_FOLDER)/$(BIN_FOLDER_LINUX) --configuration Release

macOS-build:
mkdir -p $(BIN_FOLDER)/$(BIN_FOLDER_DARWIN)
dotnet build $(SOURCE_FILE) -o $(BIN_FOLDER)/$(BIN_FOLDER_DARWIN) --configuration Release --runtime osx-x64

sh-unix:
echo '#!/bin/sh' > $(SH)
echo 'if [ $$(uname) = "Darwin" ]; then' >> $(SH)
echo ' "$$(dirname "$$0")"/$(BIN_FOLDER_DARWIN)/$(BIN_UNIX)' >> $(SH)
echo ' dotnet "$$(dirname "$$0")"/$(BIN_FOLDER_DARWIN)/$(BIN_UNIX)' >> $(SH)
echo 'else' >> $(SH)
echo ' "$$(dirname "$$0")"/$(BIN_FOLDER_LINUX)/$(BIN_UNIX)' >> $(SH)
echo ' dotnet "$$(dirname "$$0")"/$(BIN_FOLDER_LINUX)/$(BIN_UNIX)' >> $(SH)
echo 'fi' >> $(SH)
chmod +x $(SH)

bat-windows:
echo '@ECHO OFF' > $(BAT)
echo '%~dp0$(BIN_FOLDER_WINDOWS)/$(BIN_WINDOWS)' >> $(BAT)

docker:
cp Dockerfile set_umask.sh $(BIN_FOLDER)
25 changes: 4 additions & 21 deletions templates/create_formula/languages/csharp/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,21 @@ echo off
SETLOCAL
SET SOURCE_FILE=src/src.csproj
SET BIN_FOLDER=bin
SET BIN_FOLDER_LINUX=linux
SET BIN_FOLDER_WINDOWS=windows
SET BIN_FOLDER_DARWIN=darwin
SET BIN_UNIX=src
SET BIN_WINDOWs=src.exe
SET SH_FILE=%BIN_FOLDER%\run.sh
SET BAT_FILE=%BIN_FOLDER%\run.bat


:build
mkdir %BIN_FOLDER%/%BIN_FOLDER_LINUX%
dotnet build %SOURCE_FILE% -o %BIN_FOLDER%/%BIN_FOLDER_LINUX% --configuration Release --runtime linux-x64
mkdir %BIN_FOLDER%/%BIN_FOLDER_WINDOWS%
dotnet build %SOURCE_FILE% -o %BIN_FOLDER%/%BIN_FOLDER_WINDOWS% --configuration Release --runtime win10-x64
mkdir %BIN_FOLDER%
xcopy /E /I src %BIN_FOLDER%
dotnet build %SOURCE_FILE% -o %BIN_FOLDER%/%BIN_FOLDER_WINDOWS% --configuration Release
CALL :BAT_WINDOWS
CALL :SH_LINUX
CALL :CP_DOCKER
GOTO DONE

:BAT_WINDOWS
echo @ECHO OFF > %BAT_FILE%
echo %%~dp0%BIN_FOLDER_WINDOWS%/%BIN_WINDOWS% >> %BAT_FILE%
GOTO DONE

:SH_LINUX
echo #!/bin/sh > %SH_FILE%
echo if [ $(uname) = "Darwin" ]; then >> %SH_FILE%
echo $(dirname $0)/%BIN_FOLDER_DARWIN%/%BIN_UNIX% >> %SH_FILE%
echo else >> %SH_FILE%
echo $(dirname $0)/%BIN_FOLDER_LINUX%/%BIN_UNIX% >> %SH_FILE%
echo fi >> %SH_FILE%
chmod +x %SH_FILE%
echo %%~dp0%BIN_FOLDER%/src.exe >> %BAT_FILE%
GOTO DONE

:CP_DOCKER
Expand Down

0 comments on commit 3f4bc09

Please sign in to comment.