Skip to content

Commit

Permalink
Merge pull request #301 from hrntsm/feature/add-design-explorer-submo…
Browse files Browse the repository at this point in the history
…dule

Feature/add design explorer submodule
  • Loading branch information
hrntsm authored Jun 9, 2024
2 parents e9c637b + 9304ed9 commit 8232d3e
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 5 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/build-component.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ jobs:
runs-on: windows-latest # For a list of available runner types, refer to

env:
Solution_Name: Tunny.sln
Main_Solution_Name: Tunny.sln
DE_Solution_Name: TT-DesignExplorer/DesignExplorer.sln
Plugin_File_Name: Tunny

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- name: Download python & wheel zip
shell: powershell
Expand All @@ -37,13 +39,23 @@ jobs:
- name: Setup NuGet
uses: NuGet/setup-nuget@v2

- name: Restore the application
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
- name: Restore the Tunny application
run: msbuild $env:Main_Solution_Name /t:Restore /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}

- name: Build the application
run: msbuild $env:Solution_Name /p:Configuration=$env:Configuration
- name: Build the Tunny application
run: msbuild $env:Main_Solution_Name /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}

- name: Restore the design explorer application
run: msbuild $env:DE_Solution_Name /t:Restore /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}

- name: Build the design explorer application
run: msbuild $env:DE_Solution_Name /p:Configuration=$env:Configuration
env:
Configuration: ${{ matrix.configuration }}

Expand All @@ -54,6 +66,7 @@ jobs:
cp ./LICENSE ./Release/LICENSE.txt
cp ./PYTHON_PACKAGE_LICENSES ./Release/PYTHON_PACKAGE_LICENSES.txt
cp ./Tunny/bin/Debug/net48 ./Release/Tunny -recurse
cp ./TT-DesignExplorer/server/bin/Debug/net48/TT-DesignExplorer.zip ./Release/Tunny/Lib/TT-DesignExplorer.zip
- name: Upload release build of plugin as artefact
uses: actions/upload-artifact@v4
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "TT-DesignExplorer"]
path = TT-DesignExplorer
url = https://github.com/hrntsm/DesignExplorer.git
1 change: 1 addition & 0 deletions TT-DesignExplorer
Submodule TT-DesignExplorer added at 013df2
20 changes: 20 additions & 0 deletions Tunny.Core/Handler/DesignExplorer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Net;
using System.Net.NetworkInformation;

Expand All @@ -22,6 +23,12 @@ public DesignExplorer(string targetStudyName, Settings.Storage storage)
TLog.MethodStart();
_targetStudyName = targetStudyName;
_storage = storage;

string envPath = TEnvVariables.TunnyEnvPath;
if (!Directory.Exists(envPath + "/TT-DesignExplorer"))
{
SetupTTDesignExplorer();
}
}

public void Run()
Expand Down Expand Up @@ -185,5 +192,18 @@ private static bool IsPortInUse(int port)

return false;
}

public static void SetupTTDesignExplorer()
{
TLog.MethodStart();
string envPath = TEnvVariables.TunnyEnvPath;
string componentFolderPath = TEnvVariables.ComponentFolder;
TLog.Info("Unzip TT-DesignExplorer libraries: " + envPath);
if (Directory.Exists(envPath + "/TT-DesignExplorer"))
{
Directory.Delete(envPath + "/TT-DesignExplorer", true);
}
ZipFile.ExtractToDirectory(componentFolderPath + "/Lib/TT-DesignExplorer.zip", envPath + "/TT-DesignExplorer");
}
}
}
8 changes: 8 additions & 0 deletions Tunny/UI/OptimizationWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Serilog.Events;

using Tunny.Component.Optimizer;
using Tunny.Core.Handler;
using Tunny.Core.Input;
using Tunny.Core.Settings;
using Tunny.Core.TEnum;
Expand Down Expand Up @@ -36,10 +37,17 @@ public OptimizationWindow(FishingComponent component)
_settings = TSettings.LoadFromJson();
SetUIValues();
RunPythonInstaller();
SetupTTDesignExplorer();
SetOptimizeBackgroundWorker();
SetOutputResultBackgroundWorker();
}

private static void SetupTTDesignExplorer()
{
TLog.MethodStart();
DesignExplorer.SetupTTDesignExplorer();
}

private void RunPythonInstaller()
{
TLog.MethodStart();
Expand Down

0 comments on commit 8232d3e

Please sign in to comment.