Skip to content

Commit

Permalink
Feat: Implements support for Pyro's remote imports (#196)
Browse files Browse the repository at this point in the history
The documentation of Pyro's original feature can be found
[here](https://wiki.fireundubh.com/pyro/remotes).

This PR will let the Language Server and Extension find and import the
files22. None of the files will be found until Pyro gets a repository
key and downloads them, but hopefully, the users will figure that out.
I've included tests for much of this functionality. Will close #195.

Additionally, the Project Explorer now includes the name of each import:

![image](https://github.com/user-attachments/assets/c807a68b-61f6-4b11-bd66-8889bbd4a481)

I've also adjusted various settings to get this code to compile locally
and build through GitHub Actions.
  • Loading branch information
joelday authored Sep 29, 2024
2 parents 495b412 + 1ad9235 commit 384c751
Show file tree
Hide file tree
Showing 62 changed files with 2,143 additions and 311 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: git credentials
uses: oleksiyrudenko/gha-git-credentials@v2-latest
with:
token: '${{ secrets.GH_TOKEN }}'
token: '${{ secrets.GITHUB_TOKEN }}'
global: true

- name: Checkout
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
run: |
dotnet cake
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
# TODO: Rename this stuff for clarity once release build artifacts are being created
# TODO: Cleanup workflows for various event types in general
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*.user
*.userosscache
*.sln.docstates
.secrets

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
9 changes: 7 additions & 2 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"configurations": [
{
"name": "Skyrim",
"compilerArgs": [
"/utf-8"
],
"includePath": [
"${workspaceFolder}/dependencies/MetaStuff/include",
"${workspaceFolder}/dependencies",
Expand All @@ -19,7 +22,9 @@
"DARKID_PAPYRUS_DEBUGSERVER_EXPORTS",
"SKSE_SUPPORT_XBYAK"
],
"forcedInclude": ["pdsPCH.h"],
"forcedInclude": [
"pdsPCH.h"
],
"windowsSdkVersion": "10.0.18362.0",
"compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
Expand Down Expand Up @@ -51,7 +56,7 @@
"windowsSdkVersion": "10.0.18362.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.22.27905/bin/Hostx64/x64/cl.exe",
"cStandard": "c11",
"cppStandard": "c++20",
"cppStandard": "c++23",
"intelliSenseMode": "windows-msvc-x64"
}
],
Expand Down
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"omnisharp.disableMSBuildDiagnosticWarning": true,
"editor.formatOnSave": true,
"papyrus.fallout4.ignoreDebuggerVersion": true
}
"papyrus.fallout4.ignoreDebuggerVersion": true,
"C_Cpp.default.cppStandard": "c++23"
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ Updated frequently with new features and improvements.
- rjstone
- fireundubh (for Pyro)
- Nyo (Pyro fixes)
- [Git](https://icons8.com/icon/0HyDNss5DL1B/git) and [Folder](https://icons8.com/icon/5nzoHCbP0E0i/folder) icons by [Icons8](https://icons8.com)
57 changes: 36 additions & 21 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public void UpdatePyroCli()
}).Wait();
}

public void DownloadCompilers() {
public void DownloadCompilers()
{
if (!ShouldContinueWithDownload(Directory("dependencies/compilers")))
{
return;
Expand All @@ -93,20 +94,21 @@ public void NpmScript(string scriptName)

// As much as the idea of a task with side effects grosses me out, meh...
Task("get-version")
.Does(() => {
.Does(() =>
{
if (isPrerelease)
{
// Generate a correctly sortable and valid semver based on the current date and time.
var now = DateTime.UtcNow;
var secondOfDay = (((now.Hour * 60) + now.Minute) * 60) + now.Second;
// Adding 200 due to the previous incorrect versioning scheme that, while invalid, may still be sorted by
// something (VS marketplace, maybe? Don't really feel like finding out.)
version = $"{now.Year}.{now.DayOfYear + 200}.{secondOfDay}";
return;
}
Information("Getting version from semantic-release...");
var done = false;
Expand All @@ -131,23 +133,26 @@ Task("get-version")
});

Task("npm-install")
.Does(() => {
.Does(() =>
{
NpmInstall(new NpmInstallSettings()
{
WorkingDirectory = "src/papyrus-lang-vscode",
});
});

Task("npm-ci")
.Does(() => {
.Does(() =>
{
NpmCi(new NpmCiSettings()
{
WorkingDirectory = "src/papyrus-lang-vscode",
});
});

Task("npm-copy-bin")
.Does(() => {
.Does(() =>
{
NpmRunScript(new NpmRunScriptSettings()
{
ScriptName = "copy-bin",
Expand All @@ -156,7 +161,8 @@ Task("npm-copy-bin")
});

Task("npm-copy-debug-bin")
.Does(() => {
.Does(() =>
{
NpmRunScript(new NpmRunScriptSettings()
{
ScriptName = "copy-debug-bin",
Expand All @@ -165,7 +171,8 @@ Task("npm-copy-debug-bin")
});

Task("npm-clean")
.Does(() => {
.Does(() =>
{
NpmRunScript(new NpmRunScriptSettings()
{
ScriptName = "clean",
Expand All @@ -174,7 +181,8 @@ Task("npm-clean")
});

Task("npm-build")
.Does(() => {
.Does(() =>
{
NpmRunScript(new NpmRunScriptSettings()
{
ScriptName = isRelease ? "compile:release" : "compile",
Expand All @@ -183,12 +191,13 @@ Task("npm-build")
});

Task("npm-publish")
.Does(() => {
.Does(() =>
{
NpmRunScript(new NpmRunScriptSettings()
{
ScriptName = "semantic-release",
WorkingDirectory = "src/papyrus-lang-vscode",
EnvironmentVariables =
EnvironmentVariables =
{
// TODO: Something not terrible.
{ "PRERELEASE_FLAG", isPrerelease ? "--pre-release" : " " },
Expand All @@ -199,12 +208,14 @@ Task("npm-publish")
});

Task("download-compilers")
.Does(() => {
.Does(() =>
{
DownloadCompilers();
});

Task("copy-debug-plugin")
.Does(() => {
.Does(() =>
{
try
{
CreateDirectory("./src/papyrus-lang-vscode/debug-plugin");
Expand All @@ -231,17 +242,20 @@ Task("copy-debug-plugin")
});

Task("download-pyro-cli")
.Does(() => {
.Does(() =>
{
UpdatePyroCli();
});

Task("restore")
.Does(() => {
.Does(() =>
{
NuGetRestore(solution);
});

Task("build-debugger")
.Does(() => {
.Does(() =>
{
var parsedVersion = System.Version.Parse(version);
var patch = parsedVersion.Build & 0xFFFF0000;
Expand All @@ -251,12 +265,12 @@ Task("build-debugger")
{
PlatformTarget = PlatformTarget.x64,
Configuration = isRelease ? "Release" : "Debug",
Properties =
Properties =
{
{ "VersionMajor", new List<string>(){ parsedVersion.Major.ToString() } },
{ "VersionMinor", new List<string>(){ parsedVersion.Minor.ToString() } },
{ "VersionPatch", new List<string>(){ patch.ToString() } },
{ "VersionBuild", new List<string>(){ build.ToString() } },
{ "VersionBuild", new List<string>(){ build.ToString() } }
}
});
Expand Down Expand Up @@ -293,7 +307,8 @@ Task("test")
});

Task("clean")
.Does(() => {
.Does(() =>
{
CleanDirectories("./src/*/bin");
CleanDirectories("./src/*/bin-debug");
CleanDirectories("./src/*/obj");
Expand Down
10 changes: 3 additions & 7 deletions dependencies/ports/commonlibf4/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO powerof3/CommonLibF4
REF d3e9231e796eb5dd4b7dd3d1d778e8c1807ffc18
SHA512 e1ddb0cc04ee9eecba3a8e69d56bb0e6190fbe92db12f51cc1aff5c7400e4ff980cf365dfca2d3bebe5681a85925639dc33ce769bc6e6ee4da83b2b400a78476
REPO shad0wshayd3-FO4/CommonLibF4
REF 739a2ed87d28f4aac1d50527fae104a5eed91f69
SHA512 1e49e6a7a5b58181a12882f86428af68f630ad4e4349cbcc2af105082fa22f9459711ef883d4269097a3998e9bac7c2bec8fde79217d924969a399a4fe33c18d
HEAD_REF master
)

Expand All @@ -26,10 +26,6 @@ vcpkg_configure_cmake(
SOURCE_PATH "${SOURCE_PATH}"
PREFER_NINJA
OPTIONS
-DVCPKG_OVERLAY_PORTS="${SOURCE_PATH}/cmake/ports/"
-DBoost_USE_STATIC_LIBS=ON
-DBoost_USE_STATIC_RUNTIME=OFF
-DBoost_USE_STATIC_LIBS=ON
-DF4SE_SUPPORT_XBYAK=ON
-DCMAKE_EXE_LINKER_FLAGS_RELEASE="/DEBUG:FASTLINK"
${MSVC_RUNTIME_VCPKG_CONFIG_ARG}
Expand Down
11 changes: 2 additions & 9 deletions dependencies/ports/commonlibf4/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
{
"name": "commonlibf4",
"version-string": "2023.1.5",
"version-string": "2024.7.2",
"description": "A reverse engineered resource for developing F4SE plugins for Fallout 4",
"homepage": "https://github.com/Ryan-rsm-McKenzie/CommonLibF4",
"license": "MIT",
"supports": "windows & x64",
"port-version": 0,
"dependencies": [
"args",
"boost-stl-interfaces",
"catch2",
"fmt",
"frozen",
"nowide",
"robin-hood-hashing",
"rsm-mmio",
"srell",
"spdlog",
"xbyak",
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<TargetFrameworks>net472</TargetFrameworks>
<PlatformTarget>x86</PlatformTarget>
<Configurations>Debug</Configurations>
<OutputPath>bin\$(Configuration)\$(TargetFramework)\$(MSBuildProjectName)</OutputPath>
<DefaultItemExcludes>$(DefaultItemExcludes);obj\**</DefaultItemExcludes>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RuntimeIdentifiers>win7-x86</RuntimeIdentifiers>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<TargetFrameworks>net472</TargetFrameworks>
<PlatformTarget>x86</PlatformTarget>
<Configurations>Debug</Configurations>
<OutputPath>bin\$(Configuration)\$(TargetFramework)\$(MSBuildProjectName)</OutputPath>
<DefaultItemExcludes>$(DefaultItemExcludes);obj\**</DefaultItemExcludes>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RuntimeIdentifiers>win7-x86</RuntimeIdentifiers>
</PropertyGroup>

<PropertyGroup>
Expand Down
7 changes: 6 additions & 1 deletion src/DarkId.Papyrus.DebugAdapterProxy/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public class Options

[Option("clientProcessId")]
public int ClientProcessId { get; set; }
[Option("remotesInstallPath")]
public string RemotesInstallPath { get; set; }
}

class Program
Expand Down Expand Up @@ -126,7 +128,10 @@ static async Task<Dictionary<ObjectIdentifier, string>> ResolveSources(Options o
var projectLoader = new FileSystemXmlProjectLoader(fileSystem, projectDeserializer);
var project = await projectLoader.LoadProject(options.ProjectPath);

var programOptions = new ProgramOptionsBuilder().WithProject(project).Build();
var programOptions = new ProgramOptionsBuilder()
.WithRemotesInstallPath(options.RemotesInstallPath)
.WithProject(project)
.Build();
var includes = await fileSystem.ResolveSourceFileIncludes(programOptions.Sources);
return includes.FlattenIncludes();
}
Expand Down
Loading

0 comments on commit 384c751

Please sign in to comment.