Comments (6)
Ohhh I like this, where you actually go from publish.cmd -> publish.sh so that way you get the shebang.
Do you want to make a PR for this, or should I?
from modernuo.
I think this is still valid since zsh
throws errors with publish.cmd directly. Workaround is to use publish.sh, or maybe someone can help update publish.cmd to be more broadly usable.
from modernuo.
Ok, errors with CMD file:
$ ./publish.cmd release linux x64
./publish.cmd: 10: [[: not found
./publish.cmd: 12: [[: not found
./publish.cmd: 19: Syntax error: redirection unexpected
There should be an issue with if [[ ... ]]
, maybe if [ ... ]
should be used. To be POSIX compliant, change:
if [[ -n $os ]]; then
os="-r $os"
elif [[ $(uname) = "Darwin" ]]; then
os="-r osx"
To:
if [ -n $os ]; then
os="-r $os"
elif [ $(uname) = "Darwin" ]; then
os="-r osx"
Or to:
if [ -n $os ]; then
os="-r $os"
elif [[ $(uname) == "Darwin" ]]; then
os="-r osx"
The last one:
config="$(tr '[:lower:]' '[:upper:]' <<< ${1:0:1})${1:1}"
I don't know what it is supposed to do, but i can't see the end of the command $(command here)
. Don't know what to do here.
But with the two fixes above:
$ ./publish.cmd release linux x64
./publish.cmd: 19: Syntax error: redirection unexpected
And it still works with publish.sh
. Check if it works on Windows.
from modernuo.
Uh ok, i got it: Stack Overflow - uppercase first character in a variable with bash
config="$(tr '[:lower:]' '[:upper:]' <<< ${1:0:1})${1:1}"
is to uppercase 1st letter
from modernuo.
One way is to move the entire ::SHELLSCRIPT
(up to exit $?
inclusive) to publish.sh
. It worked for me, i run publish.cmd
successfully in ZSH / Linux Mint.
publish.cmd
:<<"::SHELLSCRIPT"
@ECHO OFF
GOTO :CMDSCRIPT
::SHELLSCRIPT
path=$(dirname "$0")
cd $path
./publish.sh
exit 1
:CMDSCRIPT
IF "%~1" == "" (
SET config=-c Release
) ELSE (
IF "%~1" == "release" (
SET config=-c Release
) ELSE (
SET config=-c Debug
)
)
IF "%~2" == "" (
SET os=-r win
) ELSE (
SET os=-r %~2
)
IF "%~3" == "" (
SET arch=x64
) ELSE (
SET arch=%~3
)
echo dotnet tool restore
dotnet tool restore
echo dotnet clean --verbosity quiet
dotnet clean --verbosity quiet
echo dotnet restore --force-evaluate --source https://api.nuget.org/v3/index.json
dotnet restore --force-evaluate --source https://api.nuget.org/v3/index.json
echo dotnet publish %config% %os%-%arch% --no-restore --self-contained=false -o Distribution\Assemblies Projects\UOContent\UOContent.csproj
dotnet publish %config% %os%-%arch% --no-restore --self-contained=false -o Distribution\Assemblies Projects\UOContent\UOContent.csproj
echo Generating serialization migration schema...
dotnet tool run ModernUOSchemaGenerator -- ModernUO.sln
publish.sh
#!/bin/bash
config=$1
os=$2
arch=${3:-$(uname -m)}
if [[ -n $os ]]; then
os="-r $os"
elif [[ $(uname) = "Darwin" ]]; then
os="-r osx"
else
os="-r linux"
fi
if [[ $config ]]; then
config="$(tr '[:lower:]' '[:upper:]' <<< ${1:0:1})${1:1}"
config="-c $config"
else
config="-c Release"
fi
if [[ $arch == *'aarch'* || $arch == *'arm'* ]]; then
arch="arm64"
else
arch="x64"
fi
if [[ $os == *'centos'* || $os == *'rhel'* ]]; then
export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1
fi
echo dotnet tool restore
dotnet tool restore
echo dotnet clean --verbosity quiet
dotnet clean --verbosity quiet
echo dotnet restore --force-evaluate --source https://api.nuget.org/v3/index.json
dotnet restore --force-evaluate --source https://api.nuget.org/v3/index.json
echo dotnet publish ${config} ${os}-${arch} --no-restore --self-contained=false -o Distribution/Assemblies Projects/UOContent/UOContent.csproj
dotnet publish ${config} ${os}-${arch} --no-restore --self-contained=false -o Distribution/Assemblies Projects/UOContent/UOContent.csproj
echo Generating serialization migration schema...
dotnet tool run ModernUOSchemaGenerator -- ModernUO.sln
exit $?
from modernuo.
Yes, i dit it.
ERRATA
In publish.cmd, this:
::SHELLSCRIPT
./publish.sh
exit 1
Would be better to be:
::SHELLSCRIPT
path=$(dirname "$0")
cd $path
./publish.sh
exit 1
Just in case you call publish.cmd from another directory.
from modernuo.
Related Issues (20)
- Remove IPAddress Intern
- Remove duplicate commands from HelpInfo
- Upgrade Ethics system to use Codegen
- Break up large codegenned files to improve IDE performance
- BloodOath timing is inaccurate
- Boats run into each other causes stuck entities
- Placing Houses next to each other causes z level issues
- Fix seeding/UOG HOT 1
- Make Travel Restrictions configurable
- New loot system HOT 1
- Update TextDefinition to support new Gump API HOT 1
- Libdeflate as drop-in replacement for Zlib compression HOT 4
- Move DisarmRequest/StunRequest to UOContent HOT 1
- Remove unneeded EventSinks
- Add missing animal form abilities
- Add [DupeIgnore] attribute for duping.
- Create code generated EventSinks
- Clear Commands
- Implement Ethics Powers
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modernuo.