Skip to content

Commit 60cb204

Browse files
committed
WIP3
1 parent 1144e9c commit 60cb204

File tree

5 files changed

+94
-25
lines changed

5 files changed

+94
-25
lines changed

.github/workflows/CI.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch --version
3939
ls -l /Library/Frameworks/Xamarin.Android.framework/Versions/
4040
- name: run
41-
run: make run
41+
run: ./configure.sh && make run
4242

4343
macOS--mono-only:
4444
runs-on: macOS-13
@@ -60,7 +60,7 @@ jobs:
6060
/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch --version
6161
ls -l /Library/Frameworks/Xamarin.Android.framework/Versions/
6262
- name: run
63-
run: make run
63+
run: ./configure.sh && make run
6464

6565
macOS--dotnet6-only:
6666
runs-on: macOS-13
@@ -75,7 +75,7 @@ jobs:
7575
- name: HACK to emulate mono uninstall
7676
run: sudo rm -f `which mono` && sudo rm -f `which msbuild`
7777
- name: run
78-
run: make run
78+
run: configure.sh && make run
7979

8080
windows--dotnet6-and-legacyFramework:
8181
runs-on: windows-latest
@@ -88,7 +88,7 @@ jobs:
8888
with:
8989
dotnet-version: '6.0.113'
9090
- name: run
91-
run: .\make.bat run
91+
run: .\configure.bat && .\make.bat run
9292

9393
windows--legacyFramework-only:
9494
runs-on: windows-2022
@@ -99,7 +99,7 @@ jobs:
9999
- name: HACK to emulate dotnet uninstall
100100
run: del $(where.exe dotnet)
101101
- name: run
102-
run: .\make.bat run
102+
run: .\configure.bat && .\make.bat run
103103

104104
windows--dotnet6-only:
105105
runs-on: windows-latest
@@ -114,7 +114,7 @@ jobs:
114114
- name: HACK to emulate legacy .NETFramework uninstall
115115
run: del $(& "${Env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -find MSBuild\\**\\Bin\\MSBuild.exe)
116116
- name: run
117-
run: .\make.bat run
117+
run: .\configure.bat && .\make.bat run
118118

119119
linux22-github--dotnet-and-mono:
120120
runs-on: ubuntu-22.04
@@ -127,7 +127,7 @@ jobs:
127127
- name: check mono version
128128
run: mono --version
129129
- name: run
130-
run: make run
130+
run: ./configure.sh && make run
131131

132132
linux22-github--dotnet-and-newmono:
133133
runs-on: ubuntu-22.04
@@ -142,7 +142,7 @@ jobs:
142142
- name: check mono version
143143
run: mono --version
144144
- name: run
145-
run: make run
145+
run: ./configure.sh && make run
146146

147147
linux22-vanilla--stockmono-only:
148148
runs-on: ubuntu-22.04
@@ -166,7 +166,7 @@ jobs:
166166
- name: check mono version
167167
run: mono --version
168168
- name: run
169-
run: make run
169+
run: ./configure.sh && make run
170170

171171
linux22-vanilla--stockdotnet6-only:
172172
runs-on: ubuntu-22.04
@@ -188,7 +188,7 @@ jobs:
188188
run: git config --global --add safe.directory '*'
189189

190190
- name: run
191-
run: make run
191+
run: ./configure.sh && make run
192192

193193
linux22-vanilla--stockdotnet6-and-newmono:
194194
runs-on: ubuntu-22.04
@@ -212,7 +212,7 @@ jobs:
212212
run: git config --global --add safe.directory '*'
213213

214214
- name: run
215-
run: make run
215+
run: ./configure.sh && make run
216216

217217
linux22-vanilla--stockdotnet6-and-stockmono:
218218
runs-on: ubuntu-22.04
@@ -234,7 +234,7 @@ jobs:
234234
run: git config --global --add safe.directory '*'
235235

236236
- name: run
237-
run: make run
237+
run: ./configure.sh && make run
238238

239239
linux22-vanilla--newmono-only:
240240
runs-on: ubuntu-22.04
@@ -260,4 +260,4 @@ jobs:
260260
- name: check mono version
261261
run: mono --version
262262
- name: run
263-
run: make run
263+
run: ./configure.sh && make run

make.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
@ECHO OFF
22

3+
IF NOT EXIST "scripts\build.config" (
4+
echo "ERROR: configure hasn't been run yet, run .\configure.bat first" && EXIT /b 1
5+
)
6+
37
where /q dotnet
48
IF ERRORLEVEL 1 (
59
CALL scripts\fsx\Tools\fsi.bat scripts\make.fsx %*

scripts/make.fsx

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,77 @@ let rec private GatherTarget (args: string list, targetSet: Option<string>): Opt
4848
failwith "only one target can be passed to make"
4949
GatherTarget (tail, Some (head))
5050

51+
let buildConfigFileName = "build.config"
52+
let buildConfigContents =
53+
let buildConfig =
54+
Path.Combine (FsxHelper.ScriptsDir.FullName, buildConfigFileName)
55+
|> FileInfo
56+
if not (buildConfig.Exists) then
57+
let configureLaunch =
58+
match Misc.GuessPlatform() with
59+
| Misc.Platform.Windows -> ".\\configure.bat"
60+
| _ -> "./configure.sh"
61+
Console.Error.WriteLine (sprintf "ERROR: configure hasn't been run yet, run %s first"
62+
configureLaunch)
63+
Environment.Exit 1
64+
65+
let configFileLines = File.ReadAllLines buildConfig.FullName
66+
let skipBlankLines line = not <| String.IsNullOrWhiteSpace line
67+
let splitLineIntoKeyValueTuple (line:string) =
68+
let pair = line.Split([|'='|], StringSplitOptions.RemoveEmptyEntries)
69+
if pair.Length <> 2 then
70+
failwithf "All lines in '%s' must conform to key=value format, but got: '%s'. All lines: \n%s"
71+
buildConfigFileName
72+
line
73+
(File.ReadAllText buildConfig.FullName)
74+
pair.[0], pair.[1]
75+
76+
let buildConfigContents =
77+
configFileLines
78+
|> Array.filter skipBlankLines
79+
|> Array.map splitLineIntoKeyValueTuple
80+
|> Map.ofArray
81+
buildConfigContents
82+
83+
let GetOrExplain key map =
84+
match map |> Map.tryFind key with
85+
| Some k -> k
86+
| None -> failwithf "No entry exists in %s with a key '%s'."
87+
buildConfigFileName key
88+
89+
let prefix = buildConfigContents |> GetOrExplain "Prefix"
90+
let libPrefixDir = DirectoryInfo (Path.Combine (prefix, "lib", UNIX_NAME))
91+
let binPrefixDir = DirectoryInfo (Path.Combine (prefix, "bin"))
92+
93+
let launcherScriptFile =
94+
Path.Combine (FsxHelper.ScriptsDir.FullName, "bin", UNIX_NAME)
95+
|> FileInfo
96+
let mainBinariesDir binaryConfig =
97+
Path.Combine (
98+
FsxHelper.RootDir.FullName,
99+
"src",
100+
DEFAULT_FRONTEND,
101+
"bin",
102+
binaryConfig.ToString())
103+
|> DirectoryInfo
104+
105+
let wrapperScript = """#!/usr/bin/env bash
106+
set -eo pipefail
107+
108+
if [[ $SNAP ]]; then
109+
PKG_DIR=$SNAP/usr
110+
export MONO_PATH=$PKG_DIR/lib/mono/4.5
111+
export MONO_CONFIG=$SNAP/etc/mono/config
112+
export MONO_CFG_DIR=$SNAP/etc
113+
export MONO_REGISTRY_PATH=~/.mono/registry
114+
export MONO_GAC_PREFIX=$PKG_DIR/lib/mono/gac/
115+
fi
116+
117+
DIR_OF_THIS_SCRIPT=$(dirname "$(realpath "$0")")
118+
FRONTEND_PATH="$DIR_OF_THIS_SCRIPT/../lib/$UNIX_NAME/$GWALLET_PROJECT.exe"
119+
exec mono "$FRONTEND_PATH" "$@"
120+
"""
121+
51122
#if LEGACY_FRAMEWORK
52123
let PrintNugetVersion () =
53124
if not (FsxHelper.NugetExe.Exists) then

scripts/make.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
#!/usr/bin/env bash
22
set -exo pipefail
33

4+
BUILD_CONFIG="./scripts/build.config"
5+
if [ ! -f "$BUILD_CONFIG" ]; then
6+
echo "ERROR: configure hasn't been run yet, run ./configure.sh first" >&2 && exit 1
7+
fi
8+
source "$BUILD_CONFIG"
49
FsxRunnerBin=$FsxRunnerBin FsxRunnerArg=$FsxRunnerArg $FsxRunnerBin $FsxRunnerArg ./scripts/make.fsx "$@"

src/GWallet.Frontend.Console/Program.fs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -510,15 +510,4 @@ let UpdateServersStats () =
510510

511511
[<EntryPoint>]
512512
let main argv =
513-
match argv.Length with
514-
| 0 ->
515-
NormalStartWithNoParameters()
516-
| 1 when argv.[0] = "--version" ->
517-
Console.WriteLine (sprintf "geewallet v%s" VersionHelper.CURRENT_VERSION)
518-
0
519-
| 1 when argv.[0] = "--update-servers-file" ->
520-
UpdateServersFile()
521-
| 1 when argv.[0] = "--update-servers-stats" ->
522-
UpdateServersStats()
523-
| _ ->
524-
failwith "Arguments not recognized"
513+
Console.WriteLine "hello"

0 commit comments

Comments
 (0)