Merge pull request 176 from dev/make into develop
This commit is contained in:
commit
f98303d2bb
8 changed files with 65 additions and 66 deletions
9
scripts/HelloWorld.cs
Normal file
9
scripts/HelloWorld.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
using System;
|
||||
|
||||
internal class Program
|
||||
{
|
||||
private static void Main()
|
||||
{
|
||||
Console.WriteLine("Hello World!");
|
||||
}
|
||||
}
|
|
@ -130,10 +130,10 @@ dotnetlibs/api-ms-win-core-registry-l1-1-0.dll: ../src/win-dll/lib-api-ms-win-co
|
|||
nuget.exe:
|
||||
wget 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe'
|
||||
|
||||
buildtemp:
|
||||
mkdir -p buildtemp
|
||||
buildtemp dotnetlibs:
|
||||
mkdir -p $@
|
||||
|
||||
prepare: nuget.exe buildtemp
|
||||
prepare: nuget.exe buildtemp dotnetlibs
|
||||
mono nuget.exe restore -PackagesDirectory buildtemp
|
||||
|
||||
# this is the execution environment from which all managed code is run
|
||||
|
@ -152,7 +152,6 @@ APP_BASE=exec_env/app_base
|
|||
internal-prepare-exec_env: runps.sh $(POWERSHELL_RUN_TARGETS)
|
||||
rm -rf exec_env
|
||||
mkdir -p $(APP_BASE)/Modules
|
||||
mkdir -p exec_env/coreclr
|
||||
cp ../src/monad/monad/miscfiles/display/*.ps1xml $(APP_BASE)
|
||||
cp ../src/monad/monad/miscfiles/types/CoreClr/*.ps1xml $(APP_BASE)
|
||||
cp -r ../src/monad/monad/miscfiles/modules/* $(APP_BASE)/Modules
|
||||
|
@ -164,15 +163,18 @@ internal-prepare-exec_env: runps.sh $(POWERSHELL_RUN_TARGETS)
|
|||
cp runps*.sh $(APP_BASE)
|
||||
|
||||
internal-prepare-clr:
|
||||
mkdir -p exec_env/coreclr
|
||||
cp -r $(CORECLR_ASSEMBLY_BASE)/* exec_env/coreclr/
|
||||
|
||||
run: $(RUN_TARGETS) internal-prepare-exec_env internal-prepare-clr
|
||||
# execute a cmdlet, this will auto-load the utility module and print a, b and c in 3 lines
|
||||
$(APP_BASE)/runps-simple.sh '"a","b","c","a","a" | Select-Object -Unique'
|
||||
|
||||
run-interactive: $(RUN_TARGETS) internal-prepare-exec_env internal-prepare-clr
|
||||
shell: $(RUN_TARGETS) internal-prepare-exec_env internal-prepare-clr
|
||||
$(APP_BASE)/runps.sh
|
||||
|
||||
run-interactive: shell
|
||||
|
||||
run-file: $(RUN_TARGETS) internal-prepare-exec_env internal-prepare-clr
|
||||
$(APP_BASE)/runps.sh --file $(PSSCRIPT)
|
||||
|
||||
|
@ -180,6 +182,11 @@ run-file: $(RUN_TARGETS) internal-prepare-exec_env internal-prepare-clr
|
|||
%.ps1: $(RUN_TARGETS) internal-prepare-exec_env internal-prepare-clr
|
||||
TEMP=/tmp $(APP_BASE)/runps.sh --file ../../$@
|
||||
|
||||
# compiles "Hello World" like executables using .NET Core
|
||||
%.exe: %.cs prepare internal-prepare-clr
|
||||
$(CSC) -out:$@ $(CSCOPTS_BASE) -target:exe $(COREREF) $<
|
||||
@echo run with monad-tty ./exec_env/coreclr/corerun ./$@
|
||||
|
||||
run-debugclr: $(RUN_TARGETS) internal-prepare-exec_env internal-prepare-clr
|
||||
PAL_DBG_CHANNELS="+LOADER.TRACE" $(APP_BASE)/runps-simple.sh get-location
|
||||
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
CUID=$(id -u)
|
||||
CUSER=$(id -un)
|
||||
CGID=$(id -g)
|
||||
CGROUP=$(id -gn)
|
||||
DIR=/opt/monad-linux
|
||||
VOLUME=$(dirname $(pwd))/:$DIR
|
||||
|
||||
# creates new user in container matching the local user so that
|
||||
# artifacts will be owned by the local user; set IMPERSONATE to false
|
||||
# to disable and run as root, defaults to true
|
||||
if [[ ! $IMPERSONATE ]]; then IMPERSONATE=true; fi
|
||||
impersonate()
|
||||
{
|
||||
if ! $IMPERSONATE; then return; fi
|
||||
echo \
|
||||
groupadd -g $CGID $CGROUP '&&' \
|
||||
useradd -u $CUID -g $CGID -d $DIR $CUSER '&&' \
|
||||
sudo --set-home -u $CUSER -g $CGROUP
|
||||
}
|
||||
|
||||
docker run --rm \
|
||||
--volume $VOLUME \
|
||||
--workdir $DIR/scripts \
|
||||
$DOCKERFLAGS \
|
||||
andschwa/magrathea:latest \
|
||||
bash -c "$(impersonate) $*"
|
|
@ -1,5 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Runs with a pseudo tty so that interactive shells can be opened
|
||||
export DOCKERFLAGS="--interactive --tty"
|
||||
./build-run.sh "$*"
|
|
@ -1,5 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Runs by non-interactively, just attaches output
|
||||
export DOCKERFLAGS="--attach STDOUT --attach STDERR"
|
||||
./build-run.sh "$*"
|
||||
source monad-docker.sh
|
||||
monad-run $*
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
branch=$(git for-each-ref --format=$'%(objectname) %(refname:short)' refs/heads | awk "/^$(git rev-parse HEAD)/ {print \$2}")
|
||||
echo $branch
|
||||
|
42
scripts/monad-docker.sh
Executable file
42
scripts/monad-docker.sh
Executable file
|
@ -0,0 +1,42 @@
|
|||
# docker run magrathea without tty
|
||||
monad-run()
|
||||
{
|
||||
monad-docker-run "--attach STDOUT --attach STDERR" $*
|
||||
}
|
||||
|
||||
# docker run magrathea with interactive tty
|
||||
monad-tty()
|
||||
{
|
||||
monad-docker-run "--interactive --tty" $*
|
||||
}
|
||||
|
||||
# runs ephemeral andschwa/magrathea docker container with local
|
||||
# directory mounted to /opt and workdir set to /opt/scripts
|
||||
monad-docker-run()
|
||||
{
|
||||
local CONSOLE=$1
|
||||
shift 1
|
||||
docker run --rm \
|
||||
--volume $(dirname $(pwd))/:/opt \
|
||||
--workdir /opt/scripts \
|
||||
$CONSOLE \
|
||||
andschwa/magrathea:latest \
|
||||
bash -c "$(monad-impersonate) -- bash -c '$*'"
|
||||
}
|
||||
|
||||
# creates new user in container matching the local user so that
|
||||
# artifacts will be owned by the local user; set IMPERSONATE to false
|
||||
# to disable and run as root, defaults to true
|
||||
if [[ ! $IMPERSONATE ]]; then IMPERSONATE=true; fi
|
||||
monad-impersonate()
|
||||
{
|
||||
if ! $IMPERSONATE; then return; fi
|
||||
local CUID=$(id -u)
|
||||
local CUSER=$(id -un)
|
||||
local CGID=$(id -g)
|
||||
local CGROUP=$(id -gn)
|
||||
echo \
|
||||
groupadd -g $CGID $CGROUP '&&' \
|
||||
useradd -u $CUID -g $CGID -d /opt $CUSER '&&' \
|
||||
sudo --set-home -u $CUSER -g $CGROUP
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ! -d ext-src/cppunit ]; then
|
||||
echo "Please call from root folder of project"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pushd ext-src/cppunit
|
||||
./autogen.sh
|
||||
CWD=$(pwd)
|
||||
if [ -f Makefile ]; then
|
||||
make distclean
|
||||
fi
|
||||
./configure LD=clang LDFLAGS="-stdlib=libc++" CXX=clang++ CC=clang CXXFLAGS="-stdlib=libc++" --prefix=$CWD/../../externals/cppunit
|
||||
make
|
||||
make install
|
||||
|
||||
popd
|
||||
|
||||
|
Loading…
Reference in a new issue