1
0
Fork 0

Pull the whole build system apart and put it back together again. It's a lot more flexible now :P

master
Starbeamrainbowlabs 5 years ago
parent d0b0b7c775
commit 9ce8f70be0
  1. 8
      .gitignore
  2. 2
      Nibriboard/ClientFiles/index.html
  3. 3365
      Nibriboard/ClientFiles/package-lock.json
  4. 5
      Nibriboard/ClientFiles/package.json
  5. 22
      Nibriboard/ClientFiles/validate.sh
  6. 13
      Nibriboard/ClientFiles/webpack.config.js
  7. 327
      Nibriboard/Nibriboard.csproj
  8. 2
      Nibriboard/NibriboardApp.cs
  9. 2
      Nibriboard/NibriboardServer.cs
  10. 6
      README.md
  11. 3
      package-lock.json

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>

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

@ -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,156 +1,173 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{B7F806D9-9C50-4BA8-A803-0FC2EC5F5932}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Nibriboard</RootNamespace>
<AssemblyName>Nibriboard</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<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' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ExternalConsole>true</ExternalConsole>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="MimeSharp">
<HintPath>..\packages\MimeSharp.1.0.0\lib\MimeSharp.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Package>monodevelop</Package>
</Reference>
<Reference Include="SharpCompress">
<HintPath>..\packages\SharpCompress.0.18.2\lib\net45\SharpCompress.dll</HintPath>
</Reference>
<Reference Include="NCuid">
<HintPath>..\packages\NCuid.1.0.0\lib\net40\NCuid.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="lib\GlidingSquirrel\GlidingSquirrel\GlidingSquirrel.csproj">
<Project>{476D3588-4FEE-4C75-874F-214E26B8AC1A}</Project>
<Name>GlidingSquirrel</Name>
<IncludeInPackage>false</IncludeInPackage>
</ProjectReference>
</ItemGroup>
<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" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ClientFiles\index.html" />
<EmbeddedResource Include="ClientFiles\NibriClient.js" />
<EmbeddedResource Include="ClientFiles\Nibri.css" />
<EmbeddedResource Include="ClientFiles\favicon.ico" />
<EmbeddedResource Include="ClientFiles\nibriboard.svg" />
<EmbeddedResource Include="ClientFiles\images\transparent-square-tiles.png" />
<EmbeddedResource Include="ClientFiles\images\icons\brush.png" />
<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\" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="ClientFiles\index.js" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>
<Properties>
<Policies>
<DotNetNamingPolicy ResourceNamePolicy="FileFormatDefault" DirectoryNamespaceAssociation="PrefixedHierarchical" />
</Policies>
</Properties>
</MonoDevelop>
</ProjectExtensions>
<?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>
<ProjectGuid>{B7F806D9-9C50-4BA8-A803-0FC2EC5F5932}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Nibriboard</RootNamespace>
<AssemblyName>Nibriboard</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ExternalConsole>true</ExternalConsole>
<PlatformTarget>x86</PlatformTarget>
<Externalconsole>true</Externalconsole>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ExternalConsole>true</ExternalConsole>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<!-- References -->
<ItemGroup>
<Reference Include="System"/>
<Reference Include="MimeSharp">
<HintPath>..\packages\MimeSharp.1.0.0\lib\MimeSharp.dll</HintPath>
</Reference>
<Reference Include="System.Drawing"/>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Package>monodevelop</Package>
</Reference>
<Reference Include="SharpCompress">
<HintPath>..\packages\SharpCompress.0.18.2\lib\net45\SharpCompress.dll</HintPath>
</Reference>
<Reference Include="NCuid">
<HintPath>..\packages\NCuid.1.0.0\lib\net40\NCuid.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="lib\GlidingSquirrel\GlidingSquirrel\GlidingSquirrel.csproj">
<Project>{476D3588-4FEE-4C75-874F-214E26B8AC1A}</Project>
<Name>GlidingSquirrel</Name>
<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"/>
</ItemGroup>
<!--
<ItemGroup>
<EmbeddedResource Include="ClientFiles\index.html" />
<EmbeddedResource Include="ClientFiles\NibriClient.js" />
<EmbeddedResource Include="ClientFiles\Nibri.css" />
<EmbeddedResource Include="ClientFiles\favicon.ico" />
<EmbeddedResource Include="ClientFiles\nibriboard.svg" />
<EmbeddedResource Include="ClientFiles\images\transparent-square-tiles.png" />
<EmbeddedResource Include="ClientFiles\images\icons\brush.png" />
<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\"/>
</ItemGroup>
<ItemGroup>
<None Include="packages.config"/>
<None Include="ClientFiles\index.js"/>
</ItemGroup>
<!-- MonoDevelop settings -->
<ProjectExtensions>
<MonoDevelop>
<Properties>
<Policies>
<DotNetNamingPolicy ResourceNamePolicy="FileFormatDefault" DirectoryNamespaceAssociation="PrefixedHierarchical"/>
</Policies>
</Properties>
</MonoDevelop>
</ProjectExtensions>
</Project>

@ -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

@ -0,0 +1,3 @@
{
"lockfileVersion": 1
}
Loading…
Cancel
Save