Skip to content

Commit

Permalink
Basic content repo outline.
Browse files Browse the repository at this point in the history
Code's here, no tooling to generate content packs yet, however.
  • Loading branch information
PJB3005 committed Aug 4, 2017
1 parent e6beee3 commit 02c67c8
Show file tree
Hide file tree
Showing 23 changed files with 653 additions and 78 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
charset = utf-8-bom

[*.{csproj,xml,yml,dll.config,msbuildproj,targets}]
indent_size = 2
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @PJB3005
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,7 @@ paket-files/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
*.pyc

# Visual Studio Code workspace settings.
.vscode/
1 change: 1 addition & 0 deletions BuildChecker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
INSTALLED_HOOKS_VERSION
27 changes: 27 additions & 0 deletions BuildChecker/BuildChecker.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This is a dummy .csproj file to check things like submodules.
Better this than other errors.
If you want to create this kind of file yourself, you have to create an empty .NET application,
Then strip it of everything until you have the <Project> tags.
VS refuses to load the project if you make a bare project file and use Add -> Existing Project... for some reason.
You want to handle the Build, Clean and Rebuild tasks to prevent missing task errors on build.
If you want to learn more about these kinds of things, check out Microsoft's official documentation about MSBuild:
https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild
-->
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Python>python3</Python>
<Python Condition="'$(OS)'=='Windows_NT' Or '$(OS)'=='Windows'">py -3</Python>
</PropertyGroup>
<Target Name="Build">
<Exec Command="$(Python) git_helper.py" CustomErrorRegularExpression="^Error"/>
</Target>
<Target Name="Rebuild" DependsOnTargets="Build" />
<Target Name="Clean">
<Message Importance="low" Text="Ignoring 'Clean' target." />
</Target>
</Project>
96 changes: 96 additions & 0 deletions BuildChecker/git_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/usr/bin/env python3
# Installs git hooks, updates them, updates submodules, that kind of thing.

import subprocess
import sys
import os
import shutil
from pathlib import Path
from typing import List

SOLUTION_PATH = Path("..") / "SpaceStation14Content.sln"
CURRENT_HOOKS_VERSION = "1" # If this doesn't match the saved version we overwrite them all.
QUIET = len(sys.argv) == 2 and sys.argv[1] == "--quiet"

def run_command(command: List[str], capture: bool = False) -> subprocess.CompletedProcess:
"""
Runs a command with pretty output.
"""
text = ' '.join(command)
if not QUIET:
print("$ {}".format(text))

sys.stdout.flush()

completed = None

if capture:
completed = subprocess.run(command, cwd="..", stdout=subprocess.PIPE)
else:
completed = subprocess.run(command, cwd="..")

if completed.returncode != 0:
print("Error: command exited with code {}!".format(completed.returncode))

return completed


def update_submodules():
"""
Updates all submodules.
"""

# If the status doesn't match, force VS to reload the solution.
# status = run_command(["git", "submodule", "status"], capture=True)
run_command(["git", "submodule", "update", "--init", "--recursive"])
# status2 = run_command(["git", "submodule", "status"], capture=True)

# Something changed.
# if status.stdout != status2.stdout:
# print("Git submodules changed. Reloading solution.")
# reset_solution()

def install_hooks():
"""
Installs the necessary git hooks into .git/hooks.
"""

# Read version file.
if os.path.isfile("INSTALLED_HOOKS_VERSION"):
with open("INSTALLED_HOOKS_VERSION", "r") as f:
if f.read() == CURRENT_HOOKS_VERSION:
if not QUIET:
print("No hooks change detected.")
return

with open("INSTALLED_HOOKS_VERSION", "w") as f:
f.write(CURRENT_HOOKS_VERSION)

print("Hooks need updating.")

hooks_target_dir = Path("..")/".git"/"hooks"
hooks_source_dir = Path("hooks")

# Clear entire tree since we need to kill deleted files too.
for filename in os.listdir(str(hooks_target_dir)):
os.remove(str(hooks_target_dir/filename))

for filename in os.listdir(str(hooks_source_dir)):
print("Copying hook {}".format(filename))
shutil.copyfile(str(hooks_source_dir/filename), str(hooks_target_dir/filename))


def reset_solution():
"""
Force VS to think the solution has been changed to prompt the user to reload it, thus fixing any load errors.
"""

with SOLUTION_PATH.open("r") as f:
content = f.read()

with SOLUTION_PATH.open("w") as f:
f.write(content)

if __name__ == '__main__':
install_hooks()
update_submodules()
13 changes: 13 additions & 0 deletions BuildChecker/hooks/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

gitroot=`git rev-parse --show-toplevel`

cd "$gitroot/BuildChecker"

if [[ `uname` == MINGW* || `uname` == CYGWIN* ]]; then
# Windows
py -3 git_helper.py --quiet
else
# Not Windows, so probably some other Unix thing.
python3 git_helper.py --quiet
fi
5 changes: 5 additions & 0 deletions BuildChecker/hooks/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

# Just call post-checkout since it does the same thing.
gitroot=`git rev-parse --show-toplevel`
bash "$gitroot/.git/hooks/post-checkout"
69 changes: 69 additions & 0 deletions Content.Client/Content.Client.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A2E5F175-78AF-4DDD-8F97-E2D2552372ED}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Content.Client</RootNamespace>
<AssemblyName>Content.Client</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="EntryPoint.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Content.Shared\Content.Shared.csproj">
<Project>{26aeebb3-dde7-443a-9f43-7bc7f4acf6b5}</Project>
<Name>Content.Shared</Name>
</ProjectReference>
<ProjectReference Include="..\engine\Lidgren.Network\Lidgren.Network.csproj">
<Project>{59250baf-0000-0000-0000-000000000000}</Project>
<Name>Lidgren.Network</Name>
</ProjectReference>
<ProjectReference Include="..\engine\SS14.Client.Graphics\SS14.Client.Graphics.csproj">
<Project>{302b877e-0000-0000-0000-000000000000}</Project>
<Name>SS14.Client.Graphics</Name>
</ProjectReference>
<ProjectReference Include="..\engine\SS14.Client\SS14.Client.csproj">
<Project>{0c31dfdf-0000-0000-0000-000000000000}</Project>
<Name>SS14.Client</Name>
</ProjectReference>
<ProjectReference Include="..\engine\SS14.Shared\SS14.Shared.csproj">
<Project>{0529f740-0000-0000-0000-000000000000}</Project>
<Name>SS14.Shared</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
12 changes: 12 additions & 0 deletions Content.Client/EntryPoint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using SS14.Shared.ContentPack;

namespace Content.Client
{
public class EntryPoint : GameClient
{
public override void Init()
{
// TODO: Anything at all.
}
}
}
36 changes: 36 additions & 0 deletions Content.Client/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Content.Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Content.Client")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a2e5f175-78af-4ddd-8f97-e2d2552372ed")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
65 changes: 65 additions & 0 deletions Content.Server/Content.Server.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B38DBBD0-04C2-4D1A-84E2-B3446F6ADF2A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Content.Server</RootNamespace>
<AssemblyName>Content.Server</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="EntryPoint.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Content.Shared\Content.Shared.csproj">
<Project>{26aeebb3-dde7-443a-9f43-7bc7f4acf6b5}</Project>
<Name>Content.Shared</Name>
</ProjectReference>
<ProjectReference Include="..\engine\Lidgren.Network\Lidgren.Network.csproj">
<Project>{59250baf-0000-0000-0000-000000000000}</Project>
<Name>Lidgren.Network</Name>
</ProjectReference>
<ProjectReference Include="..\engine\SS14.Server\SS14.Server.csproj">
<Project>{b04aae71-0000-0000-0000-000000000000}</Project>
<Name>SS14.Server</Name>
</ProjectReference>
<ProjectReference Include="..\engine\SS14.Shared\SS14.Shared.csproj">
<Project>{0529f740-0000-0000-0000-000000000000}</Project>
<Name>SS14.Shared</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
12 changes: 12 additions & 0 deletions Content.Server/EntryPoint.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using SS14.Shared.ContentPack;

namespace Content.Server
{
public class EntryPoint : GameServer
{
public override void Init()
{
// TODO: Anything at all.
}
}
}
Loading

0 comments on commit 02c67c8

Please sign in to comment.