mirror of
https://github.com/sbrl/Nibriboard.git
synced 2018-01-10 21:33:49 +00:00
Pull the whole build system apart and put it back together again. It's a lot more flexible now :P
This commit is contained in:
parent
d0b0b7c775
commit
9ce8f70be0
11 changed files with 3472 additions and 203 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -1,6 +1,12 @@
|
|||
# Don't include the project of the client's javascript build process
|
||||
# Don't include the product of the client's javascript build process
|
||||
Nibriboard/ClientFiles/NibriClient.js
|
||||
|
||||
# ....or ghostwriter backup files
|
||||
*.backup
|
||||
|
||||
# ...or saved ripplespaces
|
||||
*.zip
|
||||
|
||||
# We don't want temporary files created by ...browserify?
|
||||
# # I'm not sure where in npm they come from, but we don't want them anyhow :P
|
||||
*.tmp
|
||||
|
|
|
@ -182,6 +182,6 @@
|
|||
<!---------------->
|
||||
<link rel="stylesheet" href="Nibri.css" />
|
||||
|
||||
<script src="NibriClient.js" charset="utf-8"></script>
|
||||
<script src="nibriclient.bundle.js" charset="utf-8"></script>
|
||||
</head>
|
||||
</html>
|
||||
|
|
3285
Nibriboard/ClientFiles/package-lock.json
generated
3285
Nibriboard/ClientFiles/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -16,8 +16,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"acorn": "^4.0.11",
|
||||
"esprima": "^3.1.3",
|
||||
"rollupify": "^0.3.8"
|
||||
"webpack": "^3.8.1"
|
||||
},
|
||||
"config": {
|
||||
"bundle_file": "NibriClient.js"
|
||||
|
@ -25,7 +24,7 @@
|
|||
"scripts": {
|
||||
"test": "echo There aren\\'t any tests yet!",
|
||||
"prebuild": "./validate.sh",
|
||||
"build": "browserify $npm_package_main -t rollupify -o $npm_package_config_bundle_file"
|
||||
"build": "node_modules/webpack/bin/webpack.js --config webpack.config.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -1,21 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
counter_filename=$(mktemp -p /dev/shm/ -t bash.XXXXXXXXX.tmp);
|
||||
echo 0 >${counter_filename};
|
||||
find . -name "*.js" -not -path "./node_modules/*" | while read filename;
|
||||
do
|
||||
function validate_file {
|
||||
filename=$1;
|
||||
|
||||
validate_result=$(node_modules/.bin/acorn --module --silent $filename 2>&1);
|
||||
validate_exit_code=$?;
|
||||
validate_output=$([[ ${validate_exit_code} -eq 0 ]] && echo ok || echo ${validate_result});
|
||||
echo ${filename}: ${validate_output}
|
||||
# TODO: Use /dev/shm here since apparently while is in a subshell, so it can't modify variables in the main program O.o
|
||||
# Use /dev/shm here since apparently while is in a subshell, so it can't modify variables in the main program O.o
|
||||
if ! [ ${validate_exit_code} -eq 0 ]; then
|
||||
error_count=$(cat ${counter_filename});
|
||||
echo incrementing ${error_count} \($(expr ${error_count} + 1)\);
|
||||
echo $(expr ${error_count} + 1) >${counter_filename};
|
||||
fi
|
||||
}
|
||||
|
||||
counter_filename=$(mktemp -p /dev/shm/ -t bash.XXXXXXXXX.tmp);
|
||||
echo 0 >${counter_filename};
|
||||
# Parallelisation trick from https://stackoverflow.com/a/33058618/1460422
|
||||
find . -name "*.js" -not -path "./node_modules/*" | while read filename;
|
||||
do
|
||||
validate_file "${filename}" &
|
||||
|
||||
# Run at most the number of CPU cores jobs at once
|
||||
[ $( jobs | wc -l ) -ge $( nproc ) ] && wait
|
||||
done
|
||||
|
||||
wait
|
||||
|
||||
error_count=$(cat ${counter_filename});
|
||||
|
||||
echo
|
||||
|
|
13
Nibriboard/ClientFiles/webpack.config.js
Normal file
13
Nibriboard/ClientFiles/webpack.config.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
var output_dir = "../obj/client_dist";
|
||||
|
||||
var fs = require("fs"),
|
||||
path = require("path");
|
||||
|
||||
module.exports = {
|
||||
entry: "./index.js",
|
||||
devtool: "source-map",
|
||||
output: {
|
||||
path: path.resolve(__dirname, output_dir),
|
||||
filename: "nibriclient.bundle.js"
|
||||
}
|
||||
};
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="BeforeBuild;Build" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
|
@ -19,20 +19,6 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
<ExternalConsole>true</ExternalConsole>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<CustomCommands>
|
||||
<CustomCommands>
|
||||
<Command>
|
||||
<type>BeforeBuild</type>
|
||||
<command>npm run build</command>
|
||||
<workingdir>${ProjectDir}/ClientFiles</workingdir>
|
||||
</Command>
|
||||
<Command>
|
||||
<type>BeforeBuild</type>
|
||||
<command>msbuild</command>
|
||||
<workingdir>${ProjectDir}/lib/GlidingSquirrel/GlidingSquirrel</workingdir>
|
||||
</Command>
|
||||
</CustomCommands>
|
||||
</CustomCommands>
|
||||
<Externalconsole>true</Externalconsole>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
|
@ -43,12 +29,13 @@
|
|||
<ExternalConsole>true</ExternalConsole>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<!-- References -->
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System"/>
|
||||
<Reference Include="MimeSharp">
|
||||
<HintPath>..\packages\MimeSharp.1.0.0\lib\MimeSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Drawing"/>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<Package>monodevelop</Package>
|
||||
|
@ -67,60 +54,88 @@
|
|||
<IncludeInPackage>false</IncludeInPackage>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets"/>
|
||||
|
||||
<Target Name="BeforeBuild">
|
||||
<Exec IgnoreExitCode="true" WorkingDirectory="$(SolutionDir)" Command="git submodule update --init"/>
|
||||
<MakeDir Directories="$(ProjectDir)/obj/client_dist" />
|
||||
|
||||
<Message Importance="high" Text="------[ Gliding Squirrel ]------"/>
|
||||
<MSBuild Projects="$(ProjectDir)/lib/GlidingSquirrel/GlidingSquirrel/GlidingSquirrel.csproj" Properties="Configuration=$(Configuration)"/>
|
||||
<Message Importance="high" Text="----------[ npm build ]----------"/>
|
||||
<Exec WorkingDirectory="$(ProjectDir)/ClientFiles" Command="npm run build"/>
|
||||
|
||||
<Message Importance="high" Text="---[ additional client files ]---"/>
|
||||
|
||||
<CreateItem Include="$(ProjectDir)/ClientFiles/**/*.html;$(ProjectDir)/ClientFiles/**/*.css;$(ProjectDir)/ClientFiles/**/*.svg;$(ProjectDir)/ClientFiles/**/*.png;$(ProjectDir)/ClientFiles/**/*.ico" Exclude="$(ProjectDir)/ClientFiles/node_modules/**/*.*">
|
||||
<Output TaskParameter="Include" ItemName="StaticClientFiles" />
|
||||
</CreateItem>
|
||||
|
||||
<Copy SourceFiles="@(StaticClientFiles)" DestinationFolder="$(ProjectDir)/obj/client_dist/%(RecursiveDir)" />
|
||||
|
||||
<Message Importance="high" Text="Generating embedded resource directives"/>
|
||||
<CreateItem Include="$(ProjectDir)/obj/client_dist/**/*.*">
|
||||
<Output ItemName="EmbeddedResource" TaskParameter="Include"/>
|
||||
</CreateItem>
|
||||
</Target>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RippleSpace\Plane.cs" />
|
||||
<Compile Include="RippleSpace\Chunk.cs" />
|
||||
<Compile Include="RippleSpace\LocationReference.cs" />
|
||||
<Compile Include="RippleSpace\ChunkReference.cs" />
|
||||
<Compile Include="RippleSpace\DrawnLine.cs" />
|
||||
<Compile Include="RippleSpace\Reference.cs" />
|
||||
<Compile Include="NibriboardServer.cs" />
|
||||
<Compile Include="Log.cs" />
|
||||
<Compile Include="Utilities\EmbeddedFiles.cs" />
|
||||
<Compile Include="Env.cs" />
|
||||
<Compile Include="RippleSpace\RippleSpaceManager.cs" />
|
||||
<Compile Include="Client\NibriClient.cs" />
|
||||
<Compile Include="Client\ClientSettings.cs" />
|
||||
<Compile Include="Utilities\PointExtensions.cs" />
|
||||
<Compile Include="Utilities\JsonUtilities.cs" />
|
||||
<Compile Include="Client\Messages\Message.cs" />
|
||||
<Compile Include="Client\Messages\HandshakeRequestMessage.cs" />
|
||||
<Compile Include="Client\Messages\CursorPositionMessage.cs" />
|
||||
<Compile Include="RippleSpace\ClientState.cs" />
|
||||
<Compile Include="Utilities\Rectangle.cs" />
|
||||
<Compile Include="Utilities\Vector2.cs" />
|
||||
<Compile Include="Client\Messages\ClientStatesMessage.cs" />
|
||||
<Compile Include="Utilities\ColourHSL.cs" />
|
||||
<Compile Include="Utilities\ToStringJsonConverter.cs" />
|
||||
<Compile Include="Client\Messages\HandshakeResponseMessage.cs" />
|
||||
<Compile Include="Client\Messages\ShutdownMessage.cs" />
|
||||
<Compile Include="Client\Messages\IdleDisconnectMessage.cs" />
|
||||
<Compile Include="Client\Messages\HeartbeatMessage.cs" />
|
||||
<Compile Include="Client\Messages\ChunkUpdateMessage.cs" />
|
||||
<Compile Include="Client\Messages\PlaneChangeMessage.cs" />
|
||||
<Compile Include="Client\Messages\ExceptionMessage.cs" />
|
||||
<Compile Include="Utilities\ChunkTools.cs" />
|
||||
<Compile Include="Client\Messages\ChunkUpdateRequestMessage.cs" />
|
||||
<Compile Include="Client\ChunkCache.cs" />
|
||||
<Compile Include="Client\Messages\LinePartMessage.cs" />
|
||||
<Compile Include="Client\LineIncubator.cs" />
|
||||
<Compile Include="Client\Messages\LineCompleteMessage.cs" />
|
||||
<Compile Include="Client\Messages\ErrorMessage.cs" />
|
||||
<Compile Include="Client\Messages\PlaneChangeOkMessage.cs" />
|
||||
<Compile Include="Client\RawChunkReference.cs" />
|
||||
<Compile Include="Client\Messages\LinePartReflectionMessage.cs" />
|
||||
<Compile Include="Client\Messages\LineCompleteReflectionMessage.cs" />
|
||||
<Compile Include="Client\Messages\LineStartMessage.cs" />
|
||||
<Compile Include="Client\Messages\LineStartReflectionMessage.cs" />
|
||||
<Compile Include="Utilities\CalcPaths.cs" />
|
||||
<Compile Include="RippleSpace\PlaneInfo.cs" />
|
||||
<Compile Include="Utilities\BinaryIO.cs" />
|
||||
<Compile Include="Client\Messages\ViewportUpdateMessage.cs" />
|
||||
<Compile Include="NibriboardApp.cs" />
|
||||
<Compile Include="Utilities\LineSimplifier.cs" />
|
||||
<Compile Include="Program.cs"/>
|
||||
<Compile Include="Properties\AssemblyInfo.cs"/>
|
||||
<Compile Include="RippleSpace\Plane.cs"/>
|
||||
<Compile Include="RippleSpace\Chunk.cs"/>
|
||||
<Compile Include="RippleSpace\LocationReference.cs"/>
|
||||
<Compile Include="RippleSpace\ChunkReference.cs"/>
|
||||
<Compile Include="RippleSpace\DrawnLine.cs"/>
|
||||
<Compile Include="RippleSpace\Reference.cs"/>
|
||||
<Compile Include="NibriboardServer.cs"/>
|
||||
<Compile Include="Log.cs"/>
|
||||
<Compile Include="Utilities\EmbeddedFiles.cs"/>
|
||||
<Compile Include="Env.cs"/>
|
||||
<Compile Include="RippleSpace\RippleSpaceManager.cs"/>
|
||||
<Compile Include="Client\NibriClient.cs"/>
|
||||
<Compile Include="Client\ClientSettings.cs"/>
|
||||
<Compile Include="Utilities\PointExtensions.cs"/>
|
||||
<Compile Include="Utilities\JsonUtilities.cs"/>
|
||||
<Compile Include="Client\Messages\Message.cs"/>
|
||||
<Compile Include="Client\Messages\HandshakeRequestMessage.cs"/>
|
||||
<Compile Include="Client\Messages\CursorPositionMessage.cs"/>
|
||||
<Compile Include="RippleSpace\ClientState.cs"/>
|
||||
<Compile Include="Utilities\Rectangle.cs"/>
|
||||
<Compile Include="Utilities\Vector2.cs"/>
|
||||
<Compile Include="Client\Messages\ClientStatesMessage.cs"/>
|
||||
<Compile Include="Utilities\ColourHSL.cs"/>
|
||||
<Compile Include="Utilities\ToStringJsonConverter.cs"/>
|
||||
<Compile Include="Client\Messages\HandshakeResponseMessage.cs"/>
|
||||
<Compile Include="Client\Messages\ShutdownMessage.cs"/>
|
||||
<Compile Include="Client\Messages\IdleDisconnectMessage.cs"/>
|
||||
<Compile Include="Client\Messages\HeartbeatMessage.cs"/>
|
||||
<Compile Include="Client\Messages\ChunkUpdateMessage.cs"/>
|
||||
<Compile Include="Client\Messages\PlaneChangeMessage.cs"/>
|
||||
<Compile Include="Client\Messages\ExceptionMessage.cs"/>
|
||||
<Compile Include="Utilities\ChunkTools.cs"/>
|
||||
<Compile Include="Client\Messages\ChunkUpdateRequestMessage.cs"/>
|
||||
<Compile Include="Client\ChunkCache.cs"/>
|
||||
<Compile Include="Client\Messages\LinePartMessage.cs"/>
|
||||
<Compile Include="Client\LineIncubator.cs"/>
|
||||
<Compile Include="Client\Messages\LineCompleteMessage.cs"/>
|
||||
<Compile Include="Client\Messages\ErrorMessage.cs"/>
|
||||
<Compile Include="Client\Messages\PlaneChangeOkMessage.cs"/>
|
||||
<Compile Include="Client\RawChunkReference.cs"/>
|
||||
<Compile Include="Client\Messages\LinePartReflectionMessage.cs"/>
|
||||
<Compile Include="Client\Messages\LineCompleteReflectionMessage.cs"/>
|
||||
<Compile Include="Client\Messages\LineStartMessage.cs"/>
|
||||
<Compile Include="Client\Messages\LineStartReflectionMessage.cs"/>
|
||||
<Compile Include="Utilities\CalcPaths.cs"/>
|
||||
<Compile Include="RippleSpace\PlaneInfo.cs"/>
|
||||
<Compile Include="Utilities\BinaryIO.cs"/>
|
||||
<Compile Include="Client\Messages\ViewportUpdateMessage.cs"/>
|
||||
<Compile Include="NibriboardApp.cs"/>
|
||||
<Compile Include="Utilities\LineSimplifier.cs"/>
|
||||
</ItemGroup>
|
||||
<!--
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="ClientFiles\index.html" />
|
||||
<EmbeddedResource Include="ClientFiles\NibriClient.js" />
|
||||
|
@ -132,23 +147,25 @@
|
|||
<EmbeddedResource Include="ClientFiles\images\icons\pan.png" />
|
||||
<EmbeddedResource Include="ClientFiles\images\icons\point.png" />
|
||||
</ItemGroup>
|
||||
-->
|
||||
<ItemGroup>
|
||||
<Folder Include="RippleSpace\" />
|
||||
<Folder Include="Utilities\" />
|
||||
<Folder Include="ClientFiles\" />
|
||||
<Folder Include="Client\" />
|
||||
<Folder Include="Client\Messages\" />
|
||||
<Folder Include="RippleSpace\"/>
|
||||
<Folder Include="Utilities\"/>
|
||||
<Folder Include="ClientFiles\"/>
|
||||
<Folder Include="Client\"/>
|
||||
<Folder Include="Client\Messages\"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
<None Include="ClientFiles\index.js" />
|
||||
<None Include="packages.config"/>
|
||||
<None Include="ClientFiles\index.js"/>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
<!-- MonoDevelop settings -->
|
||||
<ProjectExtensions>
|
||||
<MonoDevelop>
|
||||
<Properties>
|
||||
<Policies>
|
||||
<DotNetNamingPolicy ResourceNamePolicy="FileFormatDefault" DirectoryNamespaceAssociation="PrefixedHierarchical" />
|
||||
<DotNetNamingPolicy ResourceNamePolicy="FileFormatDefault" DirectoryNamespaceAssociation="PrefixedHierarchical"/>
|
||||
</Policies>
|
||||
</Properties>
|
||||
</MonoDevelop>
|
||||
|
|
|
@ -108,7 +108,7 @@ namespace Nibriboard
|
|||
{
|
||||
response.ResponseCode = HttpResponseCode.NotFound;
|
||||
response.ContentType = "text/plain";
|
||||
await response.SetBody($"Can't find expandedFilePath.");
|
||||
await response.SetBody($"Can't find '{expandedFilePath}'.");
|
||||
logRequest(request, response);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace Nibriboard
|
|||
|
||||
// HTTP Server setup
|
||||
appServer = new NibriboardApp(new NibriboardAppStartInfo() {
|
||||
FilePrefix = "Nibriboard.ClientFiles",
|
||||
FilePrefix = "Nibriboard.obj.client_dist",
|
||||
ClientSettings = clientSettings,
|
||||
SpaceManager = planeManager
|
||||
}, IPAddress.Any, Port);
|
||||
|
|
|
@ -22,3 +22,9 @@ An infinite whiteboard for recording those big ideas.
|
|||
- Future reference: Libraries I am considering
|
||||
- [Paper.js](http://paperjs.org/) - Client-side rendering
|
||||
- [IotWeb](http://sensaura.org/pages/tools/iotweb/) - Underlying HTTP / WebSocket server
|
||||
|
||||
|
||||
## Useful Links
|
||||
- MSBuild:
|
||||
- [`Exec` task](https://docs.microsoft.com/en-gb/visualstudio/msbuild/exec-task)
|
||||
- [Dynamic wildcarded embedded resources](https://ayende.com/blog/4446/how-to-setup-dynamic-groups-in-msbuild-without-visual-studio-ruining-them)
|
3
package-lock.json
generated
Normal file
3
package-lock.json
generated
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"lockfileVersion": 1
|
||||
}
|
Loading…
Reference in a new issue