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
|
Nibriboard/ClientFiles/NibriClient.js
|
||||||
|
|
||||||
|
# ....or ghostwriter backup files
|
||||||
|
*.backup
|
||||||
|
|
||||||
|
# ...or saved ripplespaces
|
||||||
|
*.zip
|
||||||
|
|
||||||
# We don't want temporary files created by ...browserify?
|
# 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
|
# # I'm not sure where in npm they come from, but we don't want them anyhow :P
|
||||||
*.tmp
|
*.tmp
|
||||||
|
|
|
@ -182,6 +182,6 @@
|
||||||
<!---------------->
|
<!---------------->
|
||||||
<link rel="stylesheet" href="Nibri.css" />
|
<link rel="stylesheet" href="Nibri.css" />
|
||||||
|
|
||||||
<script src="NibriClient.js" charset="utf-8"></script>
|
<script src="nibriclient.bundle.js" charset="utf-8"></script>
|
||||||
</head>
|
</head>
|
||||||
</html>
|
</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": {
|
"devDependencies": {
|
||||||
"acorn": "^4.0.11",
|
"acorn": "^4.0.11",
|
||||||
"esprima": "^3.1.3",
|
"webpack": "^3.8.1"
|
||||||
"rollupify": "^0.3.8"
|
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"bundle_file": "NibriClient.js"
|
"bundle_file": "NibriClient.js"
|
||||||
|
@ -25,7 +24,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo There aren\\'t any tests yet!",
|
"test": "echo There aren\\'t any tests yet!",
|
||||||
"prebuild": "./validate.sh",
|
"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": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -1,21 +1,33 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
counter_filename=$(mktemp -p /dev/shm/ -t bash.XXXXXXXXX.tmp);
|
function validate_file {
|
||||||
echo 0 >${counter_filename};
|
filename=$1;
|
||||||
find . -name "*.js" -not -path "./node_modules/*" | while read filename;
|
|
||||||
do
|
|
||||||
validate_result=$(node_modules/.bin/acorn --module --silent $filename 2>&1);
|
validate_result=$(node_modules/.bin/acorn --module --silent $filename 2>&1);
|
||||||
validate_exit_code=$?;
|
validate_exit_code=$?;
|
||||||
validate_output=$([[ ${validate_exit_code} -eq 0 ]] && echo ok || echo ${validate_result});
|
validate_output=$([[ ${validate_exit_code} -eq 0 ]] && echo ok || echo ${validate_result});
|
||||||
echo ${filename}: ${validate_output}
|
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
|
if ! [ ${validate_exit_code} -eq 0 ]; then
|
||||||
error_count=$(cat ${counter_filename});
|
error_count=$(cat ${counter_filename});
|
||||||
echo incrementing ${error_count} \($(expr ${error_count} + 1)\);
|
echo incrementing ${error_count} \($(expr ${error_count} + 1)\);
|
||||||
echo $(expr ${error_count} + 1) >${counter_filename};
|
echo $(expr ${error_count} + 1) >${counter_filename};
|
||||||
fi
|
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
|
done
|
||||||
|
|
||||||
|
wait
|
||||||
|
|
||||||
error_count=$(cat ${counter_filename});
|
error_count=$(cat ${counter_filename});
|
||||||
|
|
||||||
echo
|
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"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="BeforeBuild;Build" ToolsVersion="4.0">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||||
|
@ -19,20 +19,6 @@
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<ExternalConsole>true</ExternalConsole>
|
<ExternalConsole>true</ExternalConsole>
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
<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>
|
<Externalconsole>true</Externalconsole>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||||
|
@ -43,6 +29,7 @@
|
||||||
<ExternalConsole>true</ExternalConsole>
|
<ExternalConsole>true</ExternalConsole>
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<!-- References -->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System"/>
|
<Reference Include="System"/>
|
||||||
<Reference Include="MimeSharp">
|
<Reference Include="MimeSharp">
|
||||||
|
@ -67,6 +54,33 @@
|
||||||
<IncludeInPackage>false</IncludeInPackage>
|
<IncludeInPackage>false</IncludeInPackage>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</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>
|
<ItemGroup>
|
||||||
<Compile Include="Program.cs"/>
|
<Compile Include="Program.cs"/>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs"/>
|
<Compile Include="Properties\AssemblyInfo.cs"/>
|
||||||
|
@ -121,6 +135,7 @@
|
||||||
<Compile Include="NibriboardApp.cs"/>
|
<Compile Include="NibriboardApp.cs"/>
|
||||||
<Compile Include="Utilities\LineSimplifier.cs"/>
|
<Compile Include="Utilities\LineSimplifier.cs"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<!--
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="ClientFiles\index.html" />
|
<EmbeddedResource Include="ClientFiles\index.html" />
|
||||||
<EmbeddedResource Include="ClientFiles\NibriClient.js" />
|
<EmbeddedResource Include="ClientFiles\NibriClient.js" />
|
||||||
|
@ -132,6 +147,7 @@
|
||||||
<EmbeddedResource Include="ClientFiles\images\icons\pan.png" />
|
<EmbeddedResource Include="ClientFiles\images\icons\pan.png" />
|
||||||
<EmbeddedResource Include="ClientFiles\images\icons\point.png" />
|
<EmbeddedResource Include="ClientFiles\images\icons\point.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
-->
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="RippleSpace\"/>
|
<Folder Include="RippleSpace\"/>
|
||||||
<Folder Include="Utilities\"/>
|
<Folder Include="Utilities\"/>
|
||||||
|
@ -143,7 +159,8 @@
|
||||||
<None Include="packages.config"/>
|
<None Include="packages.config"/>
|
||||||
<None Include="ClientFiles\index.js"/>
|
<None Include="ClientFiles\index.js"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
|
||||||
|
<!-- MonoDevelop settings -->
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<MonoDevelop>
|
<MonoDevelop>
|
||||||
<Properties>
|
<Properties>
|
||||||
|
|
|
@ -108,7 +108,7 @@ namespace Nibriboard
|
||||||
{
|
{
|
||||||
response.ResponseCode = HttpResponseCode.NotFound;
|
response.ResponseCode = HttpResponseCode.NotFound;
|
||||||
response.ContentType = "text/plain";
|
response.ContentType = "text/plain";
|
||||||
await response.SetBody($"Can't find expandedFilePath.");
|
await response.SetBody($"Can't find '{expandedFilePath}'.");
|
||||||
logRequest(request, response);
|
logRequest(request, response);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace Nibriboard
|
||||||
|
|
||||||
// HTTP Server setup
|
// HTTP Server setup
|
||||||
appServer = new NibriboardApp(new NibriboardAppStartInfo() {
|
appServer = new NibriboardApp(new NibriboardAppStartInfo() {
|
||||||
FilePrefix = "Nibriboard.ClientFiles",
|
FilePrefix = "Nibriboard.obj.client_dist",
|
||||||
ClientSettings = clientSettings,
|
ClientSettings = clientSettings,
|
||||||
SpaceManager = planeManager
|
SpaceManager = planeManager
|
||||||
}, IPAddress.Any, Port);
|
}, IPAddress.Any, Port);
|
||||||
|
|
|
@ -22,3 +22,9 @@ An infinite whiteboard for recording those big ideas.
|
||||||
- Future reference: Libraries I am considering
|
- Future reference: Libraries I am considering
|
||||||
- [Paper.js](http://paperjs.org/) - Client-side rendering
|
- [Paper.js](http://paperjs.org/) - Client-side rendering
|
||||||
- [IotWeb](http://sensaura.org/pages/tools/iotweb/) - Underlying HTTP / WebSocket server
|
- [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