diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f7896d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +target/ diff --git a/EmptyUMap b/assets/EmptyUMap similarity index 100% rename from EmptyUMap rename to assets/EmptyUMap diff --git a/XCOM2.targets b/assets/XCOM2.targets similarity index 82% rename from XCOM2.targets rename to assets/XCOM2.targets index 5c3f0bd..9eff353 100644 --- a/XCOM2.targets +++ b/assets/XCOM2.targets @@ -76,17 +76,5 @@ - - - - - - - - - - - - - - \ No newline at end of file + + diff --git a/junction.exe b/junction.exe deleted file mode 100644 index 29e42c8..0000000 Binary files a/junction.exe and /dev/null differ diff --git a/package.ps1 b/package.ps1 new file mode 100644 index 0000000..0491711 --- /dev/null +++ b/package.ps1 @@ -0,0 +1,51 @@ +$ErrorActionPreference = "Stop" +Set-StrictMode -Version 3.0 +Add-Type -Assembly 'System.IO.Compression.FileSystem' + +$junctionVersion = "v1.0.0" +$junctionLink = "https://github.com/robojumper/free-junc/releases/download/$junctionVersion/free-junc.exe.zip" + +$myDirectory = Split-Path $MyInvocation.MyCommand.Path +$targetDir = Join-Path -Path $myDirectory "target" +$packageDir = Join-Path -Path $targetDir "package" +$cacheDir = Join-Path -Path $targetDir "cache" + +function Ensure-Directory { + [CmdletBinding()] + param ([Parameter(ValueFromPipeline)] [string] $dir) + process { + if (-not (Test-Path $dir)) { + New-Item -Path $dir -ItemType Directory + } + } +} + +Ensure-Directory $targetDir +Ensure-Directory $packageDir +Ensure-Directory $cacheDir + +$junctionCacheDir = "$cacheDir\free-junc-$($junctionVersion)\" +$junctionZip = "$($junctionCacheDir)free-junc.exe.zip" +$junctionExe = "$($junctionCacheDir)free-junc.exe" + +if (-not (Test-Path -Path $junctionZip)) { + Ensure-Directory $junctionCacheDir + Invoke-WebRequest -UseBasicParsing -Uri $junctionLink -OutFile $junctionZip +} + +if (-not (Test-Path -Path $junctionExe)) { + [System.IO.Compression.ZipFile]::ExtractToDirectory($junctionZip, $junctionCacheDir) +} + +& "MSBuild.exe" ".\src\cs\X2ModBuildCommon.csproj" + +if (Test-Path -Path "$packageDir\*") { + Remove-Item -Force -Recurse -Path "$packageDir\*" -WarningAction SilentlyContinue -ErrorAction SilentlyContinue +} + +Copy-Item -Force "$myDirectory\LICENSE" "$packageDir\" -WarningAction SilentlyContinue +Copy-Item -Force "$myDirectory\README.md" "$packageDir\" -WarningAction SilentlyContinue +Copy-Item -Force "$junctionExe" "$packageDir\junction.exe" -WarningAction SilentlyContinue +Copy-Item -Force "$cacheDir\X2ModBuildCommon\X2ModBuildCommon.dll" "$packageDir\" -WarningAction SilentlyContinue +Copy-Item -Force "$myDirectory\src\ps\*.ps1" "$packageDir\" -WarningAction SilentlyContinue +Copy-Item -Force "$myDirectory\assets\*" "$packageDir\" -WarningAction SilentlyContinue diff --git a/InvokePowershellTask.cs b/src/cs/InvokePowershellTask.cs similarity index 100% rename from InvokePowershellTask.cs rename to src/cs/InvokePowershellTask.cs diff --git a/src/cs/X2ModBuildCommon.csproj b/src/cs/X2ModBuildCommon.csproj new file mode 100644 index 0000000..3e93f0e --- /dev/null +++ b/src/cs/X2ModBuildCommon.csproj @@ -0,0 +1,32 @@ + + + X2ModBuildCommon + ..\..\target\cache\X2ModBuildCommon\ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build_common.ps1 b/src/ps/build_common.ps1 similarity index 100% rename from build_common.ps1 rename to src/ps/build_common.ps1 diff --git a/clean.ps1 b/src/ps/clean.ps1 similarity index 100% rename from clean.ps1 rename to src/ps/clean.ps1