Skip to content

Commit 07e99df

Browse files
Merge branch 'master' into LOC_1340_fix_local_isRunning
2 parents d07c348 + e096c8a commit 07e99df

File tree

5 files changed

+87
-10
lines changed

5 files changed

+87
-10
lines changed

.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,27 @@ jobs:
3333
run: dotnet test BrowserStackLocalIntegrationTests --no-build -p:Configuration=Release
3434
- name: Pack NuGet Package
3535
run: msbuild BrowserStackLocal -t:pack -p:Configuration=Release
36+
- name: Setup nuget
37+
uses: nuget/setup-nuget@v1
38+
with:
39+
nuget-api-key: ${{ secrets.NUGET_API_KEY }}
40+
nuget-version: '5.x'
41+
- name: Create PFX certificate
42+
id: createPfx
43+
shell: pwsh
44+
env:
45+
PFX_CONTENT: ${{ secrets.BASE64_PFX_CONTENT }}
46+
run: |
47+
$pfxPath = Join-Path -Path $env:RUNNER_TEMP -ChildPath "cert.pfx";
48+
$encodedBytes = [System.Convert]::FromBase64String($env:PFX_CONTENT);
49+
Set-Content $pfxPath -Value $encodedBytes -AsByteStream;
50+
Write-Output "::set-output name=PFX_PATH::$pfxPath";
51+
- name: Sign Nuget Package
52+
run: nuget sign .\BrowserStackLocal\bin\Release\*.nupkg -certificatePath "${{ steps.createPfx.outputs.PFX_PATH }}" -certificatePassword "${{secrets.CERT_PASSWORD}}" -Timestamper "http://timestamp.comodoca.com"
3653
- name: Save artifact
3754
uses: actions/upload-artifact@v2
3855
with:
3956
name: BrowserStackLocal.nupkg
4057
path: .\BrowserStackLocal\BrowserStackLocal\bin\Release\*.nupkg
58+
- name: Push package to Nuget Repository
59+
run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}

BrowserStackLocal/BrowserStackLocal.sln

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.23107.0
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.1.32414.318
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrowserStackLocal", "BrowserStackLocal\BrowserStackLocal.csproj", "{F58E1C9A-5910-4DA8-B531-9F4A6B0AE8C8}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BrowserStackLocal", "BrowserStackLocal\BrowserStackLocal.csproj", "{F58E1C9A-5910-4DA8-B531-9F4A6B0AE8C8}"
77
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrowserStackLocal Unit Tests", "BrowserStackLocal Unit Tests\BrowserStackLocal Unit Tests.csproj", "{FF1ABB6F-4A2C-48F4-B4DB-47DAD566D2F9}"
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BrowserStackLocal Unit Tests", "BrowserStackLocal Unit Tests\BrowserStackLocal Unit Tests.csproj", "{FF1ABB6F-4A2C-48F4-B4DB-47DAD566D2F9}"
99
EndProject
10-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BrowserStackLocalIntegrationTests", "BrowserStackLocalIntegrationTests\BrowserStackLocalIntegrationTests.csproj", "{01FFB287-C79A-4476-AEDB-EE8DE80EB3B3}"
10+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BrowserStackLocalIntegrationTests", "BrowserStackLocalIntegrationTests\BrowserStackLocalIntegrationTests.csproj", "{01FFB287-C79A-4476-AEDB-EE8DE80EB3B3}"
11+
ProjectSection(ProjectDependencies) = postProject
12+
{F58E1C9A-5910-4DA8-B531-9F4A6B0AE8C8} = {F58E1C9A-5910-4DA8-B531-9F4A6B0AE8C8}
13+
EndProjectSection
1114
EndProject
1215
Global
1316
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -31,4 +34,7 @@ Global
3134
GlobalSection(SolutionProperties) = preSolution
3235
HideSolutionNode = FALSE
3336
EndGlobalSection
37+
GlobalSection(ExtensibilityGlobals) = postSolution
38+
SolutionGuid = {3019DB30-CCF5-4543-B787-FCBBD97B21C8}
39+
EndGlobalSection
3440
EndGlobal

BrowserStackLocal/BrowserStackLocal/BrowserStackLocal.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
<Title>BrowserStackLocal</Title>
88
<Product>BrowserStackLocal</Product>
99
<Description>C# Bindings for BrowserStack Local</Description>
10-
<Version>2.0.0.0</Version>
11-
<FileVersion>2.0.0.0</FileVersion>
10+
<Version>2.1.0</Version>
11+
<AssemblyVersion>2.1.0</AssemblyVersion>
12+
<FileVersion>2.1.0</FileVersion>
1213
<Authors>BrowserStack</Authors>
1314
<Company>BrowserStack</Company>
1415
<Copyright>Copyright © 2016</Copyright>

BrowserStackLocal/BrowserStackLocal/BrowserStackTunnel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class BrowserStackTunnel : IDisposable
2121
Directory.GetCurrentDirectory(),
2222
Path.GetTempPath() };
2323

24-
int basePathsIndex = -1;
24+
public int basePathsIndex = -1;
2525
protected string binaryAbsolute = "";
2626
protected string binaryArguments = "";
2727

BrowserStackLocal/BrowserStackLocal/Local.cs

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Text.RegularExpressions;
5+
using System.Reflection;
56

67
namespace BrowserStack
78
{
@@ -12,6 +13,8 @@ public class Local
1213
private string customLogPath = "";
1314
private string argumentString = "";
1415
private string customBinaryPath = "";
16+
private string bindingVersion = "";
17+
1518
protected BrowserStackTunnel tunnel = null;
1619
private static KeyValuePair<string, string> emptyStringPair = new KeyValuePair<string, string>();
1720

@@ -63,7 +66,11 @@ private void addArgs(string key, string value)
6366
{
6467

6568
}
66-
else
69+
else if (key.Equals("source"))
70+
{
71+
72+
}
73+
else
6774
{
6875
result = valueCommands.Find(pair => pair.Key == key);
6976
if (!result.Equals(emptyStringPair))
@@ -93,12 +100,55 @@ private void addArgs(string key, string value)
93100
}
94101
}
95102

103+
public static string GetVersionString(string pVersionString)
104+
{
105+
string tVersion = "Unknown";
106+
string[] aVersion;
107+
108+
if (string.IsNullOrEmpty(pVersionString)) { return tVersion; }
109+
aVersion = pVersionString.Split('.');
110+
if (aVersion.Length > 0) { tVersion = aVersion[0]; }
111+
if (aVersion.Length > 1) { tVersion += "." + aVersion[1]; }
112+
if (aVersion.Length > 2) { tVersion += "." + aVersion[2].PadLeft(4, '0'); }
113+
if (aVersion.Length > 3) { tVersion += "." + aVersion[3].PadLeft(4, '0'); }
114+
115+
return tVersion;
116+
}
117+
public static Assembly GetAssemblyEmbedded(string pAssemblyDisplayName)
118+
{
119+
Assembly tMyAssembly = null;
120+
121+
if (string.IsNullOrEmpty(pAssemblyDisplayName)) { return tMyAssembly; }
122+
try
123+
{
124+
tMyAssembly = Assembly.Load(pAssemblyDisplayName);
125+
}
126+
catch (Exception ex)
127+
{
128+
string m = ex.Message;
129+
Console.Error.WriteLine(m);
130+
}
131+
return tMyAssembly;
132+
}
133+
public static string GetVersionStringFromAssemblyEmbedded(string pAssemblyDisplayName)
134+
{
135+
string tVersion = "Unknown";
136+
Assembly tMyAssembly = null;
137+
138+
tMyAssembly = GetAssemblyEmbedded(pAssemblyDisplayName);
139+
if (tMyAssembly == null) { return tVersion; }
140+
tVersion = GetVersionString(tMyAssembly.GetName().Version.ToString());
141+
return tVersion;
142+
}
143+
96144
public Local()
97145
{
98-
tunnel = new BrowserStackTunnel();
146+
bindingVersion = GetVersionStringFromAssemblyEmbedded("BrowserStackLocal");
147+
tunnel = new BrowserStackTunnel();
99148
}
100149
public void start(List<KeyValuePair<string, string>> options)
101150
{
151+
tunnel.basePathsIndex = -1;
102152
foreach (KeyValuePair<string, string> pair in options)
103153
{
104154
string key = pair.Key;
@@ -123,6 +173,7 @@ public void start(List<KeyValuePair<string, string>> options)
123173
}
124174

125175
argumentString += "-logFile \"" + customLogPath + "\" ";
176+
argumentString += "--source \"c-sharp:" + bindingVersion + "\" ";
126177
tunnel.addBinaryPath(customBinaryPath);
127178
tunnel.addBinaryArguments(argumentString);
128179
while (true)

0 commit comments

Comments
 (0)