Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit e61025b

Browse files
Merge branch 'enhancements/using-cache-invalidated-events' into enhancements/git-client-cache
2 parents 9643fb8 + 9c95f34 commit e61025b

File tree

6 files changed

+68
-37
lines changed

6 files changed

+68
-37
lines changed

docs/contributing/how-to-build.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This repository is LFS-enabled. To clone it, you should use a git client that su
66

77
### Windows
88

9-
- Visual Studio 2015+ or Mono 4.x + bash shell (git bash).
9+
- Visual Studio 2015+ or [Mono 4.x](https://download.mono-project.com/archive/4.8.1/windows-installer/) + bash shell (git bash).
1010
- Mono 5.x will not work
1111
- `UnityEngine.dll` and `UnityEditor.dll`.
1212
- If you've installed Unity in the default location of `C:\Program Files\Unity` or `C:\Program Files (x86)\Unity`, the build will be able to reference these DLLs automatically. Otherwise, you'll need to copy these DLLs from `[Unity installation path]\Unity\Editor\Data\Managed` into the `lib` directory in order for the build to work
@@ -48,7 +48,7 @@ To build with Visual Studio 2015+, open the solution file `GitHub.Unity.sln`. Se
4848

4949
### Mono and Bash (windows and mac)
5050

51-
To build with Mono 4.x and Bash execute `build.sh` in a bash shell.
51+
To build with Mono 4.x and Bash, first ensure Mono is added to PATH. Mono installs to `C:\Program Files\Mono\bin\` by default. Then execute `build.sh` in a bash shell.
5252

5353
## Build Output
5454

src/GitHub.Api/Helpers/Constants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ static class Constants
99
public const string UsageFile = "usage.json";
1010
public const string GitInstallPathKey = "GitInstallPath";
1111
public const string TraceLoggingKey = "EnableTraceLogging";
12+
public const string Iso8601Format = "o";
1213

1314
public static readonly Version MinimumGitVersion = new Version(2, 11, 0);
1415
public static readonly Version MinimumGitLfsVersion = new Version(2, 3, 4);

src/GitHub.Api/OutputProcessors/LogEntryOutputProcessor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ private void ReturnGitLogEntry()
329329
Summary = summary,
330330
Description = description,
331331
CommitID = commitId,
332-
TimeString = time.Value.ToString(DateTimeFormatInfo.CurrentInfo),
333-
CommitTimeString = committerTime.Value.ToString(DateTimeFormatInfo.CurrentInfo)
332+
TimeString = time.Value.ToString(Constants.Iso8601Format),
333+
CommitTimeString = committerTime.Value.ToString(Constants.Iso8601Format)
334334
});
335335
}
336336

src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs

Lines changed: 55 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Globalization;
34
using System.Linq;
4-
using Octokit;
55
using UnityEditor;
66
using UnityEngine;
77
using Application = UnityEngine.Application;
@@ -19,18 +19,7 @@ public bool FirstRun
1919
{
2020
get
2121
{
22-
if (!firstRunValue.HasValue)
23-
{
24-
firstRunValue = firstRun;
25-
}
26-
27-
if (firstRun)
28-
{
29-
firstRun = false;
30-
FirstRunAt = DateTimeOffset.Now;
31-
Save(true);
32-
}
33-
22+
EnsureFirstRun();
3423
return firstRunValue.Value;
3524
}
3625
}
@@ -39,17 +28,34 @@ public DateTimeOffset FirstRunAt
3928
{
4029
get
4130
{
31+
EnsureFirstRun();
32+
4233
if (!firstRunAtValue.HasValue)
4334
{
44-
firstRunAtValue = DateTimeOffset.Parse(firstRunAtString);
35+
firstRunAtValue = DateTimeOffset.ParseExact(firstRunAtString, Constants.Iso8601Format, CultureInfo.InvariantCulture);
4536
}
4637

4738
return firstRunAtValue.Value;
4839
}
4940
private set
5041
{
51-
firstRunAtString = value.ToString();
52-
firstRunAtValue = null;
42+
firstRunAtString = value.ToString(Constants.Iso8601Format);
43+
firstRunAtValue = value;
44+
}
45+
}
46+
47+
private void EnsureFirstRun()
48+
{
49+
if (!firstRunValue.HasValue)
50+
{
51+
firstRunValue = firstRun;
52+
}
53+
54+
if (firstRun)
55+
{
56+
firstRun = false;
57+
FirstRunAt = DateTimeOffset.Now;
58+
Save(true);
5359
}
5460
}
5561
}
@@ -183,15 +189,23 @@ public DateTimeOffset LastUpdatedAt
183189
{
184190
if (!lastUpdatedAtValue.HasValue)
185191
{
186-
lastUpdatedAtValue = DateTimeOffset.Parse(LastUpdatedAtString);
192+
DateTimeOffset result;
193+
if (DateTimeOffset.TryParseExact(LastUpdatedAtString, Constants.Iso8601Format, CultureInfo.InvariantCulture, DateTimeStyles.None, out result))
194+
{
195+
lastUpdatedAtValue = result;
196+
}
197+
else
198+
{
199+
lastUpdatedAtValue = DateTimeOffset.MinValue;
200+
}
187201
}
188202

189203
return lastUpdatedAtValue.Value;
190204
}
191205
set
192206
{
193-
LastUpdatedAtString = value.ToString();
194-
lastUpdatedAtValue = null;
207+
LastUpdatedAtString = value.ToString(Constants.Iso8601Format);
208+
lastUpdatedAtValue = value;
195209
}
196210
}
197211

@@ -201,15 +215,23 @@ public DateTimeOffset LastVerifiedAt
201215
{
202216
if (!lastVerifiedAtValue.HasValue)
203217
{
204-
lastVerifiedAtValue = DateTimeOffset.Parse(LastVerifiedAtString);
218+
DateTimeOffset result;
219+
if (DateTimeOffset.TryParseExact(LastVerifiedAtString, Constants.Iso8601Format, CultureInfo.InvariantCulture, DateTimeStyles.None, out result))
220+
{
221+
lastVerifiedAtValue = result;
222+
}
223+
else
224+
{
225+
lastVerifiedAtValue = DateTimeOffset.MinValue;
226+
}
205227
}
206228

207229
return lastVerifiedAtValue.Value;
208230
}
209231
set
210232
{
211-
LastVerifiedAtString = value.ToString();
212-
lastVerifiedAtValue = null;
233+
LastVerifiedAtString = value.ToString(Constants.Iso8601Format);
234+
lastVerifiedAtValue = value;
213235
}
214236
}
215237

@@ -219,15 +241,23 @@ public DateTimeOffset InitializedAt
219241
{
220242
if (!initializedAtValue.HasValue)
221243
{
222-
initializedAtValue = DateTimeOffset.Parse(InitializedAtString);
244+
DateTimeOffset result;
245+
if (DateTimeOffset.TryParseExact(InitializedAtString, Constants.Iso8601Format, CultureInfo.InvariantCulture, DateTimeStyles.None, out result))
246+
{
247+
initializedAtValue = result;
248+
}
249+
else
250+
{
251+
initializedAtValue = DateTimeOffset.MinValue;
252+
}
223253
}
224254

225255
return initializedAtValue.Value;
226256
}
227257
set
228258
{
229-
InitializedAtString = value.ToString();
230-
initializedAtValue = null;
259+
InitializedAtString = value.ToString(Constants.Iso8601Format);
260+
initializedAtValue = value;
231261
}
232262
}
233263

src/tests/IntegrationTests/Process/ProcessManagerIntegrationTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public async Task LogEntriesTest()
5757
CommitID = "018997938335742f8be694240a7c2b352ec0835f",
5858
Description = "Moving project files where they should be kept",
5959
Summary = "Moving project files where they should be kept",
60-
TimeString = firstCommitTime.ToString(DateTimeFormatInfo.CurrentInfo),
61-
CommitTimeString = firstCommitTime.ToString(DateTimeFormatInfo.CurrentInfo),
60+
TimeString = firstCommitTime.ToString(Constants.Iso8601Format),
61+
CommitTimeString = firstCommitTime.ToString(Constants.Iso8601Format),
6262
},
6363
new GitLogEntry
6464
{
@@ -75,8 +75,8 @@ public async Task LogEntriesTest()
7575
CommitID = "03939ffb3eb8486dba0259b43db00842bbe6eca1",
7676
Description = "Initial Commit",
7777
Summary = "Initial Commit",
78-
TimeString = secondCommitTime.ToString(DateTimeFormatInfo.CurrentInfo),
79-
CommitTimeString = secondCommitTime.ToString(DateTimeFormatInfo.CurrentInfo),
78+
TimeString = secondCommitTime.ToString(Constants.Iso8601Format),
79+
CommitTimeString = secondCommitTime.ToString(Constants.Iso8601Format),
8080
},
8181
});
8282
}
@@ -110,8 +110,8 @@ public async Task RussianLogEntriesTest()
110110
CommitID = "06d6451d351626894a30e9134f551db12c74254b",
111111
Description = "Я люблю github",
112112
Summary = "Я люблю github",
113-
TimeString = commitTime.ToString(DateTimeFormatInfo.CurrentInfo),
114-
CommitTimeString = commitTime.ToString(DateTimeFormatInfo.CurrentInfo),
113+
TimeString = commitTime.ToString(Constants.Iso8601Format),
114+
CommitTimeString = commitTime.ToString(Constants.Iso8601Format),
115115
}
116116
});
117117
}

src/tests/UnitTests/IO/LogEntryOutputProcessorTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public void ShouldParseSingleCommit()
5858
},
5959
Summary = "Rename RepositoryModelBase to RepositoryModel",
6060
Description = "Rename RepositoryModelBase to RepositoryModel",
61-
TimeString = commitTime.ToString(DateTimeFormatInfo.CurrentInfo),
62-
CommitTimeString = commitTime.ToString(DateTimeFormatInfo.CurrentInfo),
61+
TimeString = commitTime.ToString(Constants.Iso8601Format),
62+
CommitTimeString = commitTime.ToString(Constants.Iso8601Format),
6363
},
6464
};
6565

0 commit comments

Comments
 (0)