Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified AddIn/External/ICSharpCode.NRefactory.dll
Binary file not shown.
Binary file added AddIn/External/Mono.Addins.dll
Binary file not shown.
Binary file added AddIn/External/Mono.Debugger.Soft.dll
Binary file not shown.
Binary file modified AddIn/External/Mono.Debugging.Soft.dll
Binary file not shown.
Binary file modified AddIn/External/Mono.Debugging.dll
Binary file not shown.
Binary file modified AddIn/External/MonoDevelop.Core.dll
Binary file not shown.
Binary file modified AddIn/External/MonoDevelop.Debugger.Soft.dll
Binary file not shown.
Binary file modified AddIn/External/MonoDevelop.Debugger.dll
Binary file not shown.
Binary file modified AddIn/External/MonoDevelop.Ide.dll
Binary file not shown.
21 changes: 13 additions & 8 deletions AddIn/MonoBrickAddin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
<AssemblyName>MonoBrickAddin</AssemblyName>
<SynchReleaseVersion>false</SynchReleaseVersion>
<Description>MonoBrick addin for EV3 development.</Description>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -77,6 +75,9 @@
<Reference Include="Renci.SshNet">
<HintPath>External\Renci.SshNet.dll</HintPath>
</Reference>
<Reference Include="Mono.Addins">
<HintPath>External\Mono.Addins.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="gtk-gui\generated.cs" />
Expand All @@ -95,6 +96,8 @@
<Compile Include="Source\MonoBrickAddinUtility.cs" />
<Compile Include="Source\MonoBrickAddinSshExecute.cs" />
<Compile Include="Source\MonoBrickAddinSettings.cs" />
<Compile Include="Source\MonoBrickAddinExecutionModeSet.cs" />
<Compile Include="Source\MonoBrickAddinInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Templates\MonoBrickProject.xpt.xml">
Expand Down Expand Up @@ -128,6 +131,14 @@
<DeployService-UseProjectRelativePath>True</DeployService-UseProjectRelativePath>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="External\ICSharpCode.NRefactory.dll" />
<None Include="External\Mono.Debugging.dll" />
<None Include="External\Mono.Debugging.Soft.dll" />
<None Include="External\MonoDevelop.Core.dll" />
<None Include="External\MonoDevelop.Debugger.dll" />
<None Include="External\MonoDevelop.Debugger.Soft.dll" />
<None Include="External\MonoDevelop.Ide.dll" />
<None Include="External\Renci.SshNet.dll" />
</ItemGroup>
<ProjectExtensions>
<MonoDevelop>
Expand All @@ -136,10 +147,4 @@
</Properties>
</MonoDevelop>
</ProjectExtensions>
<ItemGroup>
<ProjectReference Include="..\MonoBrickFirmware\MonoBrickFirmware.csproj">
<Project>{67261E03-D263-4C42-A5AD-2A4820231B28}</Project>
<Name>MonoBrickFirmware</Name>
</ProjectReference>
</ItemGroup>
</Project>
11 changes: 5 additions & 6 deletions AddIn/Source/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("MonoBrickAddin")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyDescription ("MonoBrick solution and debugging")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("Bernhard Straub")]
[assembly: AssemblyProduct ("MonoBrickAddin")]
[assembly: AssemblyCopyright ("MIT X11")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("0.1.*")]
[assembly: AssemblyVersion ("0.3")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

//[assembly: AssemblyKeyFile("")]
22 changes: 8 additions & 14 deletions AddIn/Source/MonoBrickAddin.addin.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<Addin
namespace="MonoBrickAddin"
id="MonoBrickAddin"
<Addin>
name="MonoBrickAddin"
author="Bernhard Straub"
copyright="MIT X11"
description="MonoBrick solution and debugging"
category="Mindstorms"
version="0.1">

<Dependencies>
<Addin id="::MonoDevelop.Core" version="4.2" />
<Addin id="::MonoDevelop.Ide" version="4.2" />
<Addin id="::MonoDevelop.Debugger" version="4.2" />
<Addin id="::MonoDevelop.Debugger.Soft" version="4.2" />
</Dependencies>
version="0.3">

<Runtime>
<Import assembly = "MonoBrickAddin.dll" />
<Import assembly = "MonoBrickFirmware.dll" />
<Import assembly = "Renci.SshNet.dll" />
<Import file="License/License.txt" />
<Import file= "License/License.txt" />
</Runtime>

<Extension path = "/MonoDevelop/ProjectModel/MSBuildItemTypes">
Expand All @@ -39,6 +29,10 @@
<Extension path = "/MonoDevelop/ProjectModel/ProjectBindings">
<ProjectBinding id = "MonoBrick" class = "MonoBrickAddin.MonoBrickProjectBinding" />
</Extension>

<Extension path = "/MonoDevelop/Core/ExecutionModes">
<ModeSetType class="MonoBrickAddin.MonoBrickExecutionModeSet"/>
</Extension>

<Extension path = "/MonoDevelop/ProjectModel/SerializableClasses">
<DataType class = "MonoBrickAddin.MonoBrickProject" />
Expand Down
4 changes: 3 additions & 1 deletion AddIn/Source/MonoBrickAddinDebuggerSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ void StartProcess(MonoBrickSoftDebuggerStartInfo dsi)
string debugOptions = string.Format("transport=dt_socket,address=0.0.0.0:{0},server=y", args.DebugPort);
bool EV3Verbose = UserSettings.Instance.Verbose;

process = MonoBrickUtility.ExecuteCommand(EV3IPAddress, dsi.ExecutionCommand, debugOptions, dsi.ExecutionCommand.Console, EV3Verbose);
dsi.ExecutionCommand.Console.Log.WriteLine("Debugging on brick ...");

process = MonoBrickUtility.ExecuteCommand(EV3IPAddress, dsi.ExecutionCommand, debugOptions, EV3Verbose);
process.Execute();
process.WaitForExecuted();
}
Expand Down
10 changes: 8 additions & 2 deletions AddIn/Source/MonoBrickAddinExecutionCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,23 @@ public class MonoBrickExecutionCommand: ExecutionCommand
{
public IConsole Console { get; set; }
public IList<string> UserAssemblyPaths { get; set; }
public bool AOT { get; set; }
public int LastError { get; set; }

public MonoBrickExecutionCommand()
{
this.Config = null;
Console = null;
AOT = false;
LastError = 0;
}

public MonoBrickExecutionCommand(MonoBrickProjectConfiguration config)// : base(config.CompiledOutputName)
public MonoBrickExecutionCommand(MonoBrickProjectConfiguration config)
{
this.Config = config;
Console = null;
AOT = false;
LastError = 0;
}

public MonoBrickProjectConfiguration Config { get; private set; }
Expand All @@ -64,7 +70,7 @@ public string CommandString
public string DeviceDirectory
{
get {
return "./apps/" + Path.GetFileNameWithoutExtension(Config.OutputAssembly) + "/";
return "/home/root/apps/" + Path.GetFileNameWithoutExtension(Config.OutputAssembly) + "/";
}
}

Expand Down
29 changes: 26 additions & 3 deletions AddIn/Source/MonoBrickAddinExecutionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,41 @@ namespace MonoBrickAddin
{
class MonoBrickExecutionHandler : IExecutionHandler
{
public bool AOT { get; private set; }

public MonoBrickExecutionHandler()
{
AOT = false;
}

public MonoBrickExecutionHandler(bool _aot)
{
AOT = _aot;
}

public bool CanExecute(ExecutionCommand command)
{
return command is MonoBrickExecutionCommand;
MonoBrickExecutionCommand cmd = command as MonoBrickExecutionCommand;
if (cmd == null)
return false;

if (AOT && cmd.Config.Name != "Release")
return false;

return true;
}

public IProcessAsyncOperation Execute(ExecutionCommand command, IConsole console)
{
var cmd = (MonoBrickExecutionCommand)command;
var cmd = command as MonoBrickExecutionCommand;
cmd.AOT = AOT;

string EV3IPAddress = UserSettings.Instance.IPAddress;
bool EV3Verbose = UserSettings.Instance.Verbose;

var proc = MonoBrickUtility.ExecuteCommand(EV3IPAddress, cmd, null, console, EV3Verbose);
console.Log.WriteLine(cmd.AOT ? "Running on brick in AOT mode ..." : "Running on brick ...");

var proc = MonoBrickUtility.ExecuteCommand(EV3IPAddress, cmd, null, EV3Verbose);
proc.Execute();
return proc;
}
Expand Down
62 changes: 62 additions & 0 deletions AddIn/Source/MonoBrickAddinExecutionModeSet.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// MonoBrickAddinExecutionModeSet.cs
//
// Author:
// Bernhard Straub
//
// Copyright (c) 2014 Bernhard Straub
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

using System;
using MonoDevelop.Core.Execution;
using System.Collections.Generic;

namespace MonoBrickAddin
{
public class MonoBrickExecutionModeSet : IExecutionModeSet
{
MonoBrickExecutionMode mode;

public string Name { get { return "MonoBrick"; } }

public IEnumerable<IExecutionMode> ExecutionModes
{
get {
yield return mode ?? (mode = new MonoBrickExecutionMode());
}
}
}

class MonoBrickExecutionMode : IExecutionMode
{
MonoBrickExecutionHandler handler;

public string Name { get { return "MonoBrick AOT"; } }

public string Id { get { return "MonoBrickExecutionMode"; } }

public IExecutionHandler ExecutionHandler
{
get {
return handler ?? (handler = new MonoBrickExecutionHandler(true));
}
}
}
}

20 changes: 20 additions & 0 deletions AddIn/Source/MonoBrickAddinInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using Mono.Addins;
using Mono.Addins.Description;

[assembly:Addin (
"MonoBrickAddin",
Namespace = "MonoBrickAddin",
Version = "0.3",
Url = "http://github.com/Larsjep/monoev3"
)]

[assembly:AddinName ("MonoBrickAddin")]
[assembly:AddinCategory ("Mindstorms")]
[assembly:AddinDescription ("MonoBrick solution and debugging")]
[assembly:AddinAuthor ("Bernhard Straub")]

[assembly:AddinDependency ("::MonoDevelop.Core", MonoDevelop.BuildInfo.Version)]
[assembly:AddinDependency ("::MonoDevelop.Ide", MonoDevelop.BuildInfo.Version)]
[assembly:AddinDependency ("::MonoDevelop.Debugger", MonoDevelop.BuildInfo.Version)]
[assembly:AddinDependency ("::MonoDevelop.Debugger.Soft", MonoDevelop.BuildInfo.Version)]
64 changes: 33 additions & 31 deletions AddIn/Source/MonoBrickAddinProjects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public MonoBrickProject(string languageName, ProjectCreateInformation info, XmlE
void Init()
{
if (!referencePath.IsEmpty)
CreateReference(referencePath);
CreateReference(referencePath, "MonoBrickFirmware.dll");
}

public override SolutionItemConfiguration CreateConfiguration(string name)
Expand Down Expand Up @@ -90,20 +90,15 @@ protected override ExecutionCommand CreateExecutionCommand(ConfigurationSelector
};
}

protected void CreateReference(FilePath sPath)
protected void CreateReference(FilePath sPath, string sName)
{
// Get the resource and write it out?
FilePath sFileName = sPath.Combine("MonoBrickFirmware.dll");
// Get the assembly file and write it out
FilePath sFileNameOut = sPath.Combine(sName);

FileStream OutputStream = new FileStream(sFileName, FileMode.Create);
Assembly ass = Assembly.GetExecutingAssembly();

Stream DBStream = ass.GetManifestResourceStream("MonoBrick.MonoBrickFirmware.dll");
for (int l = 0; l < DBStream.Length; l++)
{
OutputStream.WriteByte((byte)DBStream.ReadByte());
}
OutputStream.Close();
FilePath assemblyPath = Assembly.GetExecutingAssembly().Location;
FilePath assemblyDirectory = Path.GetDirectoryName(assemblyPath);
FilePath sFileNameIn = assemblyDirectory.Combine(sName);
File.Copy(sFileNameIn, sFileNameOut, true);
}

protected override void OnExecute(IProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configSel)
Expand Down Expand Up @@ -142,30 +137,37 @@ protected override void OnExecute(IProgressMonitor monitor, ExecutionContext con
return;
}

console.Log.WriteLine("Upload to brick...");

string EV3IPAddress = UserSettings.Instance.IPAddress;

var uploadOp = MonoBrickUtility.Upload(EV3IPAddress, cmd);
opMon.AddOperation(uploadOp);

uploadOp.WaitForCompleted();

if (!uploadOp.Success)
for (int pass = 0; pass < 2; ++pass)
{
console.Log.WriteLine(uploadOp.ErrorMessage);
monitor.ReportError(uploadOp.ErrorMessage, null);
return;
}
console.Log.WriteLine(pass == 0 ? "Upload to brick..." : "Forcing upload to brick...");

var uploadOp = MonoBrickUtility.Upload(EV3IPAddress, cmd);
opMon.AddOperation(uploadOp);

console.Log.WriteLine("Running on brick...");
uploadOp.WaitForCompleted();

if (!uploadOp.Success)
{
console.Log.WriteLine(uploadOp.ErrorMessage);
monitor.ReportError(uploadOp.ErrorMessage, null);
return;
}

var ex = context.ExecutionHandler.Execute(cmd, console);
opMon.AddOperation(ex);
ex.WaitForCompleted();
var ex = context.ExecutionHandler.Execute(cmd, console);
opMon.AddOperation(ex);
ex.WaitForCompleted();

if (pass == 1 || cmd.LastError == 0)
break;

// force upload
console.Log.WriteLine("First attempt to run failed!");
UserSettings.Instance.LastUploadHash = "";
}

console.Log.WriteLine("");
console.Log.WriteLine("Finished!");
console.Log.WriteLine("Finished with exit code {0}", cmd.LastError);
}
finally
{
Expand Down
Loading