Skip to content

Commit 8a75d8e

Browse files
authored
Merge pull request #6 from matthid/1.0.0-alpha004
1.0.0 alpha004
2 parents f108987 + 53839a6 commit 8a75d8e

File tree

9 files changed

+112
-5
lines changed

9 files changed

+112
-5
lines changed

.paket/Paket.Restore.targets

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
<PaketExePath Condition=" '$(PaketExePath)' == '' ">$(PaketToolsPath)paket.exe</PaketExePath>
1919
<PaketCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketExePath)"</PaketCommand>
2020
<PaketCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</PaketCommand>
21+
22+
<!-- .net core fdd -->
23+
<_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)"))</_PaketExeExtension>
24+
<PaketCommand Condition=" '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)"</PaketCommand>
25+
26+
<!-- no extension is a shell script -->
27+
<PaketCommand Condition=" '$(_PaketExeExtension)' == '' ">"$(PaketExePath)"</PaketCommand>
28+
2129
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' AND Exists('$(PaketRootPath)paket.bootstrapper.exe')">$(PaketRootPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
2230
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' ">$(PaketToolsPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
2331
<PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
@@ -45,10 +53,10 @@
4553
</PropertyGroup>
4654

4755
<!-- If shasum and awk exist get the hashes -->
48-
<Exec Condition=" '$(PaketRestoreCachedHasher)' != '' " Command="$(PaketRestoreCachedHasher)" ConsoleToMSBuild='true'>
56+
<Exec StandardOutputImportance="Low" Condition=" '$(PaketRestoreCachedHasher)' != '' " Command="$(PaketRestoreCachedHasher)" ConsoleToMSBuild='true'>
4957
<Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreCachedHash" />
5058
</Exec>
51-
<Exec Condition=" '$(PaketRestoreLockFileHasher)' != '' " Command="$(PaketRestoreLockFileHasher)" ConsoleToMSBuild='true'>
59+
<Exec StandardOutputImportance="Low" Condition=" '$(PaketRestoreLockFileHasher)' != '' " Command="$(PaketRestoreLockFileHasher)" ConsoleToMSBuild='true'>
5260
<Output TaskParameter="ConsoleOutput" PropertyName="PaketRestoreLockFileHash" />
5361
</Exec>
5462

@@ -114,9 +122,11 @@
114122
<PaketReferencesFileLinesInfo Include="@(PaketReferencesFileLines)" >
115123
<PackageName>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[0])</PackageName>
116124
<PackageVersion>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[1])</PackageVersion>
125+
<AllPrivateAssets>$([System.String]::Copy('%(PaketReferencesFileLines.Identity)').Split(',')[4])</AllPrivateAssets>
117126
</PaketReferencesFileLinesInfo>
118127
<PackageReference Include="%(PaketReferencesFileLinesInfo.PackageName)">
119128
<Version>%(PaketReferencesFileLinesInfo.PackageVersion)</Version>
129+
<PrivateAssets Condition="%(PaketReferencesFileLinesInfo.AllPrivateAssets) == 'true'">All</PrivateAssets>
120130
</PackageReference>
121131
</ItemGroup>
122132

@@ -138,9 +148,10 @@
138148
</DotNetCliToolReference>
139149
</ItemGroup>
140150

151+
<!-- Disabled for now until we know what to do with runtime deps - https://github.com/fsprojects/Paket/issues/2964
141152
<PropertyGroup>
142153
<RestoreConfigFile>$(MSBuildProjectDirectory)/obj/$(MSBuildProjectFile).NuGet.Config</RestoreConfigFile>
143-
</PropertyGroup>
154+
</PropertyGroup> -->
144155

145156
</Target>
146157

.travis.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
language: csharp
2+
sudo: required
3+
dist: trusty # Ubuntu 14.04
4+
dotnet : 2.1.4
5+
env:
6+
- HOME=/home/travis APPDATA=/home/travis LocalAppData=/home/travis
7+
8+
9+
before install:
10+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
11+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install openssl ; fi
12+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link --force openssl ; fi
13+
14+
mono:
15+
- 5.0.1
16+
17+
script:
18+
- dotnet build build.proj
19+
20+
branches:
21+
except:
22+
- gh-pages

appveyor.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
image: Visual Studio 2017
2+
install:
3+
- cinst fake -pre
4+
build_script:
5+
# See https://stackoverflow.com/a/12866669/1269722
6+
# Problem is that colors are lost
7+
# Don't blame me but powershell is the bigest crap on earth
8+
- cmd: fake.exe -v run build.fsx
9+
10+
#on_failure:
11+
# - appveyor PushArtifact FAKE.svclog
12+
test: off
13+
environment:
14+
PAKET_BOOTSTRAPPER_TRACE: true
15+
16+
artifacts:
17+
- path: 'release\nuget\*.nupkg'
18+
type: NuGetPackage

build.proj

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<Project>
2+
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
3+
4+
<PropertyGroup>
5+
<TargetFramework>netstandard2.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<DotNetCliToolReference Include="dotnet-fake" Version="5.0.0-*" />
10+
</ItemGroup>
11+
12+
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
13+
14+
<PropertyGroup>
15+
<RepoRootDir>$([System.IO.Path]::GetFullPath("$(MSBuildThisFileDirectory)"))</RepoRootDir>
16+
<BuildDependsOn></BuildDependsOn>
17+
<CoreBuildDependsOn></CoreBuildDependsOn>
18+
</PropertyGroup>
19+
20+
<Target Name="Build">
21+
<Exec IgnoreStandardErrorWarningFormat="true" Command='dotnet fake build' WorkingDirectory="$(RepoRootDir)" />
22+
</Target>
23+
24+
<Target Name="Pack">
25+
</Target>
26+
27+
<Target Name="Test">
28+
</Target>
29+
30+
<Target Name="VSTest" DependsOnTargets="Test" />
31+
</Project>

docs/RELEASE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#### 1.0.0-alpha004 - 2018-03-11
2+
* Static GameInfo data can now be accessed from the GameState - https://github.com/matthid/s2client-dotnet/pull/5
3+
14
#### 1.0.0-alpha003 - 2017-11-07
25
* Fix release script
36

paket.dependencies

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version 5.122.0
1+
version 5.148.0
22
source https://api.nuget.org/v3/index.json
33
storage:none
44

src/s2client-fsharp/Instance.fs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ module Instance =
175175

176176
return playerId
177177
}
178+
let getGameInfo (instance:Sc2Instance) = async {
179+
// Do the join command
180+
let! gameInfo, status = ProtbufConnection.getGameInfo instance.Connection
181+
assert (status = Status.InGame)
182+
return gameInfo }
183+
178184
let getObservation disableFog (instance:Sc2Instance) = async {
179185
// Do the join command
180186
let! responseObs, status = ProtbufConnection.getObservation disableFog instance.Connection

src/s2client-fsharp/ProtobufConnection.fs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,14 @@ module ProtbufConnection =
219219
checkError joinGameResponse.Error joinGameResponse.ErrorDetails
220220
return joinGameResponse.PlayerId, response.Status }
221221

222+
let getGameInfo (cl : Sc2Connection) = async {
223+
let request = new SC2APIProtocol.Request()
224+
request.GameInfo <- new RequestGameInfo()
225+
let! response = sendRequest cl request
226+
let gameInfoResponse = response.GameInfo
227+
checkNullAndWarnings response gameInfoResponse
228+
return gameInfoResponse, response.Status }
229+
222230
let getObservation disableFog (cl : Sc2Connection) = async {
223231
let request = new SC2APIProtocol.Request()
224232
request.Observation <- new RequestObservation()

src/s2client-fsharp/Sc2Game.fs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ type GameState =
99
NewObservation : SC2APIProtocol.ResponseObservation
1010
// more global state
1111
PlayerId : PlayerId
12+
GameInfo : SC2APIProtocol.ResponseGameInfo
1213
}
1314
static member Empty playerId =
1415
{ LastObservation = None
1516
LastActions = []
1617
NewObservation = null
17-
PlayerId = playerId }
18+
PlayerId = playerId
19+
GameInfo = null }
1820

1921
type Sc2Bot = GameState -> SC2APIProtocol.Action list
2022
type Sc2Observer = GameState -> unit
@@ -142,6 +144,12 @@ module Sc2Game =
142144
| _ -> failwithf "Expected playerId when participant or observer but not when computer. %A" (part,playerId)
143145
)
144146

147+
// Get the static gameInfo
148+
for (playerId, instance, bot) in relevantPlayers do
149+
let! gameInfo = Instance.getGameInfo instance
150+
let state = getState playerId
151+
updateState playerId { state with GameInfo = gameInfo }
152+
145153
// Game loop
146154
while true do
147155
for (playerId, instance, bot) in relevantPlayers do

0 commit comments

Comments
 (0)