Skip to content

Commit bc1879a

Browse files
committed
Fixes Mono Deploy to actually work.
Will need to upload the zip file, but otherwise it's good.
1 parent 9124e2c commit bc1879a

File tree

8 files changed

+36
-20
lines changed

8 files changed

+36
-20
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*.sln.docstates
88

99
#Upload user file only for the extension
10-
!FRC Extension.csproj.user
10+
!FRC-Extension.csproj.user
1111

1212
# Build results
1313
[Dd]ebug/

FRC-Extension/Buttons/DownloadMonoButton.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,7 @@ public override async void ButtonCallback(object sender, EventArgs e)
4444
return;
4545
}
4646

47-
string monoFolder = WPILibFolderStructure.CreateMonoFolder();
48-
49-
string monoFile = monoFolder + Path.DirectorySeparatorChar + DeployProperties.MonoVersion;
50-
51-
m_monoFile.FileName = monoFile;
47+
m_monoFile.ResetToDefaultDirectory();
5248

5349
bool downloadNew = !m_monoFile.CheckFileValid();
5450

FRC-Extension/Buttons/InstallMonoButton.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public override async void ButtonCallback(object sender, EventArgs e)
3131
{
3232
try
3333
{
34+
m_monoFile.ResetToDefaultDirectory();
3435
bool properFileExists = true;
3536

3637
properFileExists = m_monoFile.CheckFileValid();
@@ -51,6 +52,7 @@ public override async void ButtonCallback(object sender, EventArgs e)
5152

5253
if (!string.IsNullOrEmpty(retVal))
5354
{
55+
m_monoFile.FileName = retVal;
5456
//Check for valid file.
5557
properFileExists = m_monoFile.CheckFileValid();
5658

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
4+
<StartAction>Program</StartAction>
5+
<StartProgram>C:\Program Files %28x86%29\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe</StartProgram>
6+
<StartArguments>/rootsuffix Exp</StartArguments>
7+
</PropertyGroup>
8+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
9+
<StartAction>Program</StartAction>
10+
<StartProgram>C:\Program Files %28x86%29\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe</StartProgram>
11+
<StartArguments>/rootsuffix Exp</StartArguments>
12+
</PropertyGroup>
13+
</Project>

FRC-Extension/MonoCode/MonoDeploy.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ internal async Task DeployMono()
5353

5454
await RoboRIOConnection.RunCommand($"mkdir -p {DeployProperties.RoboRioOpgkLocation}", ConnectionUser.Admin);
5555

56-
writer.WriteLine("m_deploying Mono Files");
56+
writer.WriteLine("Deploying Mono Files");
5757

5858
success = await RoboRIOConnection.DeployFiles(deployFiles, DeployProperties.RoboRioOpgkLocation, ConnectionUser.Admin);
5959

@@ -67,8 +67,9 @@ internal async Task DeployMono()
6767
var monoRet = await RoboRIOConnection.RunCommand(DeployProperties.OpkgInstallCommand, ConnectionUser.Admin);
6868

6969
//Check for success.
70+
bool monoSuccess = await m_deployManager.CheckMonoInstall();
7071

71-
if (await m_deployManager.CheckMonoInstall())
72+
if (monoSuccess)
7273
{
7374
writer.WriteLine("Mono Installed Successfully");
7475
}
@@ -77,9 +78,10 @@ internal async Task DeployMono()
7778
writer.WriteLine("Mono not installed successfully");
7879
}
7980

80-
//TODO : Cleanup files on RIO
81-
81+
//Removing ipk files from the RoboRIO
8282
await RoboRIOConnection.RunCommand($"rm -rf {DeployProperties.RoboRioOpgkLocation}", ConnectionUser.Admin);
83+
84+
writer.WriteLine("Done. You may now deploy code to your robot.");
8385
}
8486
else
8587
{

FRC-Extension/MonoCode/MonoFile.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ public MonoFile(string fileName)
2727
m_extractPath = monoFolder + Path.DirectorySeparatorChar + "temp";
2828
}
2929

30+
public void ResetToDefaultDirectory()
31+
{
32+
string monoFolder = WPILibFolderStructure.CreateMonoFolder();
33+
FileName = monoFolder + Path.DirectorySeparatorChar + DeployProperties.MonoVersion;
34+
}
35+
3036
private string Md5Sum()
3137
{
3238
byte[] fileMd5Sum = null;
@@ -72,6 +78,7 @@ public static string SelectMonoFile()
7278
public bool CheckFileValid()
7379
{
7480
string fileSum = Md5Sum();
81+
OutputWriter.Instance.WriteLine(fileSum);
7582

7683
return fileSum != null && fileSum.Equals(DeployProperties.MonoMd5);
7784
}

FRC-Extension/RoboRIOCode/DeployManager.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,7 @@ public async Task UploadCode(string robotName, SettingsPageGrid page, bool debug
294294
}
295295

296296
//Must be run as admin, so is seperate
297-
//Check to see if the thing below is in the official extension.
298-
//await RoboRIOConnection.RunCommand("killall netconsole-host", ConnectionUser.Admin);
297+
await RoboRIOConnection.RunCommand("killall netconsole-host", ConnectionUser.Admin);
299298

300299
//Combining all other commands, since they should be safe running together.
301300
List<string> commands = new List<string>();

FRC-Extension/RoboRIOCode/DeployProperties.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,23 @@ public static class DeployProperties
4949

5050
public const string CommandDir = "/home/lvuser";
5151

52-
public static readonly string RobotCommandDebug =
53-
"env LD_LIBRARY_PATH=/usr/local/frc/rpath-lib/ /usr/local/frc/bin/netconsole-host mono --debug \"" + DeployDir + "/{0}\"";
52+
public const string RobotCommandDebug = "env LD_LIBRARY_PATH=/usr/local/frc/rpath-lib/ /usr/local/frc/bin/netconsole-host mono --debug \"" + DeployDir + "/{0}\"";
5453

5554
public const string RobotCommandDebugFileName = "robotDebugCommand";
5655

57-
public static readonly string RobotCommand =
58-
"env LD_LIBRARY_PATH=/usr/local/frc/rpath-lib/ /usr/local/frc/bin/netconsole-host mono \"" + DeployDir + "/{0}\"";
56+
public const string RobotCommand = "env LD_LIBRARY_PATH=/usr/local/frc/rpath-lib/ /usr/local/frc/bin/netconsole-host mono \"" + DeployDir + "/{0}\"";
5957

6058
public const string RobotCommandFileName = "robotCommand";
6159

62-
public const string MonoMd5 = "145126881924420175520132501465663102223";
60+
public const string MonoMd5 = "1852022171552091945152452461853193134197150";
6361

64-
public const string MonoVersion = "Mono4.0.1.zip";
62+
public const string MonoVersion = "Mono4.2.1.zip";
6563

6664
public const string MonoUrl = "https://dl.bintray.com/robotdotnet-admin/Mono/";
6765

68-
6966
public const string RoboRioOpgkLocation = "/home/admin/opkg";
7067

71-
public const string OpkgInstallCommand = "opgk install *.ipk";
68+
public static readonly string OpkgInstallCommand = $"opkg install {RoboRioOpgkLocation}/*.ipk";
7269

7370
}
7471
}

0 commit comments

Comments
 (0)