Skip to content

Commit

Permalink
refactor(structure): Reorganise files to better reflect project struc…
Browse files Browse the repository at this point in the history
…ture (#309)

* chore(solution): move solution to root directory and tidy up

Part 1 of reorganising

* Gitkeeping

* Remove Spike Folder

* refactor(structure): split src files by project

File structure better represents the project structure, gives us a chance to modify the build system
later

* refactor(structure): Move testing utils

* refactor(structure): Move utils test

* Updater Test

* refactor(structure): Move loader test

* Remove Old Msvc Folder

* refactor(structure): Main Tests Run

* build(tests): Run the tests properly on actions

* Remove Old Test Folder

* Remove Old Tools

* build(projects): Fix googlemock output

* Rename Header

* chore(projects): Remove unused paths

* More Tidying

* Targets Tidy

* Solution Tidyup

* Retarget Project SDK Versions

* More Tidy

* Rename Build

* Remove Unused Include Path

* Remove More Includes

* Cmake Builds

* Start Cmaking

* Lots Of Cmaking

* Remove File

* Get All The Tests Running

* More Things

* More Fixes

* Tidyup

* Nugetting

* Fix Config

* Fix Nuget Path

* Nuget Config

* Fix Config

* Remove Build Line

* Add Nuget Sources

* More Nuget

* More

* Update Package Sources

* Set v3 Feed

* More

* Plugin Version Fix

* Fix Curl Things

* Make Tests Fail Delibarately

* Bring In Resources

* Linting

* Make Lint Its Own Job

* Update build.yml

* Fix Connection Accepting
  • Loading branch information
AndyTWF authored Aug 3, 2021
1 parent 75b0c16 commit b7f775e
Show file tree
Hide file tree
Showing 1,071 changed files with 4,132 additions and 7,069 deletions.
42 changes: 28 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@ jobs:
echo "CURL_INCLUDEDIR=C:\\hostedtoolcache\\windows\\libcurl\\curl-${env:CURL_VERSION}\\builds\\libcurl-vc-x86-release-static-ipv6-sspi-schannel\\include" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "CURL_LIBRARYDIR=C:\\hostedtoolcache\\windows\\libcurl\\curl-${env:CURL_VERSION}\\builds\\libcurl-vc-x86-release-static-ipv6-sspi-schannel\\lib" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Setup Nuget
uses: nuget/setup-nuget@v1
with:
nuget-version: '5.10'

- name: Restore Nuget Packages
run: |
cd msvc
nuget restore
cd ..
nuget restore test/googlemock/packages.config -OutputDirectory packages
# Setup all the yarn things and node modules
- name: Setup Yarn
Expand Down Expand Up @@ -99,17 +102,12 @@ jobs:

# Run the build and tests
- name: Run Build
run: msbuild msvc/UKControllerPlugin.sln /verbosity:minimal /property:Configuration=Release -m /warnaserror
run: |
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_DEPENDS_USE_COMPILER=FALSE -G "NMake Makefiles"
nmake
- name: Run Tests
run: ".\\bin\\Release\\UKControllerPluginTest.exe"

# Run the linter
- name: Install Cpplint
run: pip install cpplint

- name: Run Lint
run: cpplint --quiet --recursive src/ test/
run: ctest -C Release --output-on-failure

# Upload artifacts
- name: Upload Core Binary As Artifact
Expand All @@ -129,12 +127,28 @@ jobs:
with:
name: UKControllerPlugin.dll
path: ".\\bin\\Release\\UKControllerPlugin.dll"


lint:
name: Lint
runs-on: ubuntu-latest
concurrency:
group: ukcp-build-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Install Cpplint
run: pip install cpplint

- name: Run Lint
run: cpplint --quiet --recursive src/ test/

release:
name: Release
runs-on: windows-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [build]
needs: [build, lint]
concurrency:
group: ukcp-release
cancel-in-progress: false
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/plugin_version.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ Function Build-Version {

$buildVersion = Build-Version;
echo "Building version $buildVersion"
$versionFile = ".\\src\update\\PluginVersion.cpp"
$versionFile = ".\\src\\utils\\update\\PluginVersion.cpp"
(Get-Content $versionFile).replace("#VERSION_STRING#", "$buildVersion") | Set-Content $versionFile
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,18 @@ __pycache__/
*.btm.cs
*.odx.cs
*.xsd.cs

# Cmake things
CMakeLists.txt.user
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
build
UKControllerPlugin.cbp
65 changes: 65 additions & 0 deletions CMake/Default.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
################################################################################
# Command for variable_watch. This command issues error message, if a variable
# is changed. If variable PROPERTY_READER_GUARD_DISABLED is TRUE nothing happens
# variable_watch(<variable> property_reader_guard)
################################################################################
function(property_reader_guard VARIABLE ACCESS VALUE CURRENT_LIST_FILE STACK)
if("${PROPERTY_READER_GUARD_DISABLED}")
return()
endif()

if("${ACCESS}" STREQUAL "MODIFIED_ACCESS")
message(FATAL_ERROR
" Variable ${VARIABLE} is not supposed to be changed.\n"
" It is used only for reading target property ${VARIABLE}.\n"
" Use\n"
" set_target_properties(\"<target>\" PROPERTIES \"${VARIABLE}\" \"<value>\")\n"
" or\n"
" set_target_properties(\"<target>\" PROPERTIES \"${VARIABLE}_<CONFIG>\" \"<value>\")\n"
" instead.\n")
endif()
endfunction()

################################################################################
# Create variable <name> with generator expression that expands to value of
# target property <name>_<CONFIG>. If property is empty or not set then property
# <name> is used instead. Variable <name> has watcher property_reader_guard that
# doesn't allow to edit it.
# create_property_reader(<name>)
# Input:
# name - Name of watched property and output variable
################################################################################
function(create_property_reader NAME)
set(PROPERTY_READER_GUARD_DISABLED TRUE)
set(CONFIG_VALUE "$<TARGET_GENEX_EVAL:${PROPS_TARGET},$<TARGET_PROPERTY:${PROPS_TARGET},${NAME}_$<UPPER_CASE:$<CONFIG>>>>")
set(IS_CONFIG_VALUE_EMPTY "$<STREQUAL:${CONFIG_VALUE},>")
set(GENERAL_VALUE "$<TARGET_GENEX_EVAL:${PROPS_TARGET},$<TARGET_PROPERTY:${PROPS_TARGET},${NAME}>>")
set("${NAME}" "$<IF:${IS_CONFIG_VALUE_EMPTY},${GENERAL_VALUE},${CONFIG_VALUE}>" PARENT_SCOPE)
variable_watch("${NAME}" property_reader_guard)
endfunction()

################################################################################
# Set property $<name>_${PROPS_CONFIG_U} of ${PROPS_TARGET} to <value>
# set_config_specific_property(<name> <value>)
# Input:
# name - Prefix of property name
# value - New value
################################################################################
function(set_config_specific_property NAME VALUE)
set_target_properties("${PROPS_TARGET}" PROPERTIES "${NAME}_${PROPS_CONFIG_U}" "${VALUE}")
endfunction()

################################################################################

create_property_reader("TARGET_NAME")
create_property_reader("OUTPUT_DIRECTORY")

set_config_specific_property("TARGET_NAME" "${PROPS_TARGET}")
set_config_specific_property("OUTPUT_NAME" "${TARGET_NAME}")
set_config_specific_property("ARCHIVE_OUTPUT_NAME" "${TARGET_NAME}")
set_config_specific_property("LIBRARY_OUTPUT_NAME" "${TARGET_NAME}")
set_config_specific_property("RUNTIME_OUTPUT_NAME" "${TARGET_NAME}")

set_config_specific_property("ARCHIVE_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}")
set_config_specific_property("LIBRARY_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}")
set_config_specific_property("RUNTIME_OUTPUT_DIRECTORY" "${OUTPUT_DIRECTORY}")
12 changes: 12 additions & 0 deletions CMake/DefaultCXX.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
include("${CMAKE_CURRENT_LIST_DIR}/Default.cmake")

set_config_specific_property("OUTPUT_DIRECTORY" "${CMAKE_SOURCE_DIR}$<$<NOT:$<STREQUAL:${CMAKE_VS_PLATFORM_NAME},Win32>>:/${CMAKE_VS_PLATFORM_NAME}>/${PROPS_CONFIG}")

if(MSVC)
create_property_reader("DEFAULT_CXX_EXCEPTION_HANDLING")
create_property_reader("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT")

set_target_properties("${PROPS_TARGET}" PROPERTIES MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
set_config_specific_property("DEFAULT_CXX_EXCEPTION_HANDLING" "/EHsc")
set_config_specific_property("DEFAULT_CXX_DEBUG_INFORMATION_FORMAT" "/Zi")
endif()
File renamed without changes.
Loading

0 comments on commit b7f775e

Please sign in to comment.