Skip to content

Commit

Permalink
Merge pull request #34 from OSVR/core-1-update
Browse files Browse the repository at this point in the history
CoreCLR RTM update
  • Loading branch information
JeroMiya authored Sep 7, 2016
2 parents 01933c7 + e91d1a2 commit e05e4a4
Show file tree
Hide file tree
Showing 24 changed files with 171 additions and 144 deletions.
36 changes: 17 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ Download the latest OSVR-Config build [here](http://access.osvr.com/binary/osvr_
# Build instructions
## Prerequisites
* OS Notes:
* Ubuntu users may want to stick to the long-term support release (14.04). You may see errors running the latest 15.* version.
* Install ASP.NET 5.0 (ASP.NET Core 1.0) tools
* ASP.NET 5.0 is in the process of being renamed ASP.NET Core 1.0 by Microsoft, and in addition the .NET command line tools are being reworked and simplified. For now, however, we are still using the ASP.NET 5.0 version with the DNX command line tools. This is a temporary situation as everything migrates over.
* Click [here](https://docs.asp.net/en/latest/getting-started/index.html) for instructions on installing ASP.NET for your platform. We are using CoreCLR exclusively, so when the instructions give you the option to use CoreCLR or the full .NET CLR (on windows), choose CoreCLR by running `dnvm upgrade -r coreclr`. (For Windows, there's a script in `devtools` that will do this for you.)
* (Linux) Don't forget to install libuv according to the instructions in the above guide, if you don't already have libuv available.
* If you already have ASP.NET installed (via Visual Studio/etc..), we are specifically using version `1.0.0-rc1-update1` (`x86` or `x64` is your choice) and the `coreclr` runtime. So, for example, you can set the default runtime by running `dnvm use 1.0.0-rc1-update1 -r coreclr -p` and then `dnvm upgrade`. This will add the command line tools to your `PATH`.
* Ubuntu users may want to stick to the long-term support release (14.04). You may see errors running the latest 15.* or 16.* versions.
* Install CoreCLR tools
* We are now using the CoreCLR RTM version, including the new dotnet command line tools.
* Click [here](https://www.microsoft.com/net/core) for instructions on installing CoreCLR for your platform.
* (Linux) Don't forget to run the script provided to uninstall previous versions of dotnet command line tools (dnvm/dnx).
* If you are using Visual Studio, you will need Visual Studio 2015 Update 3 with [.NET Core 1.0.0 - VS 2015 Tooling Preview 2](https://go.microsoft.com/fwlink/?LinkId=817245) installed.
* See [this](https://docs.microsoft.com/en-us/dotnet/articles/core/windows-prerequisites#issues) note about installation issues with this version.
* Note: you don't need VS 2015 or the extension if you're going to be building from the command line and using another editor like VS Code or Atom.
* Install NodeJS from [here](https://nodejs.org/)
* We're currently running with the `4.4.1 LTS` version. The `5.5.1 Stable` version may also work, but this is untested.
* NOTE: Depending on where you have NodeJS installed in Linux, you may need to prepend `sudo` to some of the npm commands with '-g'. If you get a permission denied error, try running with `sudo`.
Expand All @@ -30,7 +32,7 @@ Download the latest OSVR-Config build [here](http://access.osvr.com/binary/osvr_
## IDE support
If you'd like to help with development, and not just build the project:

* Visual Studio 2015, with the latest updates, and with the latest RC1-update1 version of the ASP.NET and web tool extensions.
* Visual Studio 2015 Update 3, and with [.NET Core 1.0.0 - VS 2015 Tooling Preview 2](https://go.microsoft.com/fwlink/?LinkId=817245) installed.
* Visual Studio Code (with C# extension installed). You may need to build from the command line.
* Atom.io (with C# and TypeScript extensions installed). You may need to build from the command line.

Expand All @@ -41,27 +43,23 @@ If you'd like to help with development, and not just build the project:

### Command Line - Manually
* Set your working directory to the `src/ConfigUtil` directory in this project.
* Run the following to download backend NuGet packages: `dnu restore`.
* Run the following: `dnu publish --runtime active --no-source -o ../../artifacts --configuration Release`
* Run the following to download backend NuGet packages: `dotnet restore`.
* Run the following: `dotnet publish -o artifacts --configuration Release`
* This will install frontend dependencies and build the frontend prior to publishing.

### Visual Studio
* Visual Studio's CoreCLR/ASP.NET 5.0 and Web tools extensions are all integrated into the IDE.
* In the Run button dropdown, ensure that `web` is selected. This makes the backend run as a standalone server. Avoid using IIS Express.
* Also in the Run button dropdown, ensure that the .NET Runtime Type is set to Core CLR.
* Visual Studio's CoreCLR/ASP.NET and Web tools extensions are all integrated into the IDE.
* In the Run button dropdown, ensure that `OSVRConfig` is selected. This makes the backend run as a standalone server. Avoid using IIS Express.
* The build, debug, and clean commands in Visual Studio will build both the frontend and the backend.
* There is a publish profile called `filesystem` that builds the frontend and backend into `artifacts/bin/ConfigUtil/PublishOutput` within this repository's root directory. Run the `Publish ConfigUtil` menu item from the `Build` menu. Keep in mind this is not the `Release` build that is published - currently you must use the command line to build the standalone release binary (see instructions above).

# Running OSVR-Config
* Once you've published the application with `dnu`, you should have a `web.cmd` (for Windows) and/or a `web` shell script (for Mac/Linux) located in the `artifacts/approot` directory within this repository's root directory. Run this to start the backend.
* Once you've published the application with `dotnet`, you should have a `OSVRConfig.exe` (for Windows) and/or a `OSVRConfig` binary (for Mac/Linux) located in the `artifacts/bin` directory within this repository's root directory. Run this to start the backend.
* Once the backend is running, go to [http://localhost:5000](http://localhost:5000) in a browser to start the application.
* There is a github issue to make this a one-click process. See https://github.com/OSVR/OSVR-Config/issues/9.
*

#Branding
# Branding

At present, this utility is branded "OSVR by Sensics". If custom versions are desired, feel free to change the branding
At present, this utility is branded "OSVR by Sensics". If custom versions are desired, feel free to change the branding.

#Help wanted
# Help wanted

The creation of this utility focused on functionality, not GUI. Suggestions or improvements to the look and feel are very much welcome.
5 changes: 3 additions & 2 deletions build_release.cmd
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
pushd "%~dp0"
cd src\ConfigUtil
@rem DNU is a batch file, so have to use call or we never return from this
call dnu restore
call dnu publish --runtime active --no-source -o ../../artifacts --configuration Release
call dotnet restore
call dotnet publish -o artifacts\bin --configuration Release
xcopy artifacts\bin ..\..\artifacts\bin\ /Y /E
call "%VS140COMNTOOLS%vsvars32.bat"
msbuild ..\Launcher\Launcher.csproj /p:Configuration=Release
xcopy ..\Launcher\bin\Release\OSVR-Config.exe ..\..\artifacts\ /y
Expand Down
4 changes: 2 additions & 2 deletions build_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
(
cd $(dirname $0)
cd src/ConfigUtil
dnu restore
dnu publish --runtime active --no-source -o ../../artifacts --configuration Release
dotnet restore
dotnet publish --runtime active --no-source -o ../../artifacts --configuration Release
)
6 changes: 3 additions & 3 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
{
"projects": [
"src",
"test"
],
"sdk": {
"version": "1.0.0-rc1-update1",
"version": "1.0.0-preview2-003121",
"runtime": "coreclr",
"architecture": "x86"
}
}
}
2 changes: 1 addition & 1 deletion src/ConfigUtil/Common/ConfigExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static class ConfigExtensions
{
public static string GetOSVRServerDirectory(this IConfiguration config)
{
var envValue = config.Get<string>("OSVR_SERVER_ROOT", null);
var envValue = config.GetValue<string>("OSVR_SERVER_ROOT", null);
return OSVRServer.ParseServerPath(envValue);
}
}
Expand Down
14 changes: 5 additions & 9 deletions src/ConfigUtil/ConfigUtil.xproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>b2d61055-0bb3-46de-80f2-17ef716b8746</ProjectGuid>
<RootNamespace>ConfigUtil</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<ItemGroup>
<DnxInvisibleContent Include="bower.json" />
<DnxInvisibleContent Include=".bowerrc" />
<DnxInvisibleContent Include="package.json" />
</ItemGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
2 changes: 1 addition & 1 deletion src/ConfigUtil/Controllers/AvailableDisplaysController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
using System.Linq;
using System.Threading.Tasks;
using System.IO;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using ConfigUtil.Models;
using ConfigUtil.Common;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNetCore.Mvc;
using ConfigUtil.Models;
using Microsoft.Extensions.Configuration;
using ConfigUtil.Common;
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigUtil/Controllers/CurrentConfigController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNetCore.Mvc;
using ConfigUtil.Models;
using Microsoft.Extensions.Configuration;
using System.IO;
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigUtil/Controllers/DisableDirectModeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/// limitations under the License.
/// </copyright>
///
using Microsoft.AspNet.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using ConfigUtil.Common;
using ConfigUtil.Models;
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigUtil/Controllers/EnableDirectModeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/// limitations under the License.
/// </copyright>
///
using Microsoft.AspNet.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using ConfigUtil.Common;
using ConfigUtil.Models;
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigUtil/Controllers/KeepAliveController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/// limitations under the License.
/// </copyright>
///
using Microsoft.AspNet.Mvc;
using Microsoft.AspNetCore.Mvc;
using ConfigUtil.Common;

namespace ConfigUtil.Controllers
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigUtil/Controllers/SampleConfigsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/// </copyright>
///
using System.Collections.Generic;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNetCore.Mvc;
using ConfigUtil.Models;
using Microsoft.Extensions.Configuration;
using ConfigUtil.Common;
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigUtil/Controllers/ServerRootController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/// limitations under the License.
/// </copyright>
///
using Microsoft.AspNet.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using ConfigUtil.Common;

Expand Down
2 changes: 1 addition & 1 deletion src/ConfigUtil/Controllers/StartServerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/// limitations under the License.
/// </copyright>
///
using Microsoft.AspNet.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using ConfigUtil.Common;
using ConfigUtil.Models;
Expand Down
2 changes: 1 addition & 1 deletion src/ConfigUtil/Controllers/StartTrackerViewerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/// </copyright>
///
using System.Collections.Generic;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using ConfigUtil.Common;
using ConfigUtil.Models;
Expand Down
4 changes: 4 additions & 0 deletions src/ConfigUtil/Models/OSVRConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public static OSVRConfig Read(string filePath, string serverRoot)
using (var jr = new JsonTextReader(configReader))
{
JToken token = JObject.ReadFrom(jr);
if(!(token is JObject))
{
return null;
}
ret.Body = (JObject)token;

// Display
Expand Down
30 changes: 23 additions & 7 deletions src/ConfigUtil/Models/ServerConfigSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,29 @@ public static IEnumerable<ServerConfigSample> GetAvailableSamples(string serverP
{
var displaysPath = System.IO.Path.Combine(serverPath, "sample-configs");

return from displayFile in System.IO.Directory.EnumerateFiles(displaysPath)
where displayFile.Contains("osvr_server_config")
select new ServerConfigSample()
{
FileName = System.IO.Path.GetFileName(displayFile),
Body = OSVRConfig.Read(displayFile, serverPath),
};
var displayFiles =
from displayFile in System.IO.Directory.EnumerateFiles(displaysPath)
where displayFile.Contains("osvr_server_config")
select new ServerConfigSample()
{
FileName = System.IO.Path.GetFileName(displayFile),
Body = OSVRConfig.Read(displayFile, serverPath),
};

// These will be filtered out for the client, but log something
// to let us know of badly formed sample configs.
foreach(var errorDisplayFile in
from displayFile in displayFiles
where displayFile.Body == null && displayFile.FileName != null
select displayFile)
{
Console.WriteLine("Could not parse sample {0}", errorDisplayFile.FileName);
}

// filter the sample configs to only those that parse correctly.
return from displayFile in displayFiles
where displayFile.Body != null && displayFile.FileName != null
select displayFile;
}
}
}
42 changes: 42 additions & 0 deletions src/ConfigUtil/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/// OSVR-Config
///
/// <copyright>
/// Copyright 2016 Sensics, Inc.
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
/// </copyright>
///
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;

namespace ConfigUtil
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.Build();

host.Run();
}
}
}
13 changes: 7 additions & 6 deletions src/ConfigUtil/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"Hosting:Environment": "Development"
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"web": {
"commandName": "web",
"OSVRConfig": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "http://localhost:5000",
"environmentVariables": {
"Hosting:Environment": "Development"
},
"sdkVersion": "dnx-coreclr-win-x86.1.0.0-rc1-update1"
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
Loading

0 comments on commit e05e4a4

Please sign in to comment.