Skip to content

Commit

Permalink
Merge for release. (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
joelday authored Feb 4, 2023
2 parents b7e5d0d + 440a228 commit 1dbaadf
Show file tree
Hide file tree
Showing 158 changed files with 24,602 additions and 2,282 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
14 changes: 0 additions & 14 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,15 +1 @@
(Make sure the title has the format `<type>: <subject>` where type is one of: feat, fix, docs, style, refactor, perf, test, or chore. Example: "fix: kill nasty bug". Then delete this paragraph.)

(Use one of the following and delete the others:)
Bug #xxx fixed! (Mention the issue#)
New feature #xxx added: (Mention the issue# and describe new feature briefly.)
Code refactoring for issue #xxx (Mention the issue# and describe reason briefly.)
Update (For docs ention the docs updated.)

Testing: (instructions for testing that needs to pass before commit if applicable)

Checklist before doing the merge commit:
- [ ] Review code in PR
- [ ] Testing
- [ ] Check format of title for CI (make sure it has valid `<type>: <subject>` format)
- [ ] **Use Squash and Commit**
80 changes: 63 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,89 @@ jobs:
CAKE_SETTINGS_ENABLESCRIPTCACHE: true

steps:
- name: git credentials
uses: oleksiyrudenko/gha-git-credentials@v2-latest
with:
token: '${{ secrets.GH_TOKEN }}'
global: true

- name: Checkout
uses: actions/checkout@v3
working-directory: c:/
run: |
git clone --single-branch --branch $("${{ github.ref }}".Replace('refs/heads/', '')) ${{ github.server_url }}/${{ github.repository }}.git repo
- name: Setup vcpkg
working-directory: c:/
run: |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
bootstrap-vcpkg.bat
vcpkg.exe integrate install
- name: Cache vcpkg packages
uses: actions/cache@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN != '' && secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
path: c:/repo/vcpkg_installed
key: ${{ runner.os }}-vcpkg-${{ hashFiles('c:/repo/vcpkg.json') }}
restore-keys: |
${{ runner.os }}-vcpkg-
- name: Cache nuget packages
uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('src/*/*.csproj') }}
key: ${{ runner.os }}-nuget-${{ hashFiles('c:/repo/src/*/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Cache dotnet tools
uses: actions/cache@v3
with:
path: tools
key: ${{ runner.os }}-dotnet-tools-${{ hashFiles('build.cake', '.config/dotnet-tools.json') }}
path: c:/repo/tools
key: ${{ runner.os }}-dotnet-tools-${{ hashFiles('build.cake', 'c:/repo/.config/dotnet-tools.json') }}
restore-keys: |
${{ runner.os }}-dotnet-tools-
- name: Restore dotnet tools
working-directory: c:/repo
run: |
dotnet tool restore
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Get npm cache directory
id: npm-cache-dir
shell: pwsh
run: echo "dir=$(npm config get cache)" >> ${env:GITHUB_OUTPUT}

- name: Cache npm packages
uses: actions/cache@v3
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('c:/repo/src/papyrus-lang-vscode/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Setup Nuget.exe
if: success()
uses: nuget/setup-nuget@v1

- name: Build
if: success()
uses: ecampidoglio/cake-action@v1
with:
target: default
- name: Install vcpkg packages
working-directory: c:/repo
run: |
../vcpkg/vcpkg.exe install --x-wait-for-lock --triplet x64-windows-static --x-install-root=c:/repo/vcpkg_installed/skyrim --x-feature=skyrim
../vcpkg/vcpkg.exe install --x-wait-for-lock --triplet x64-windows-static --x-install-root=c:/repo/vcpkg_installed/fallout4 --x-feature=fallout4
- name: Publish Extension
if: success() && (github.ref == 'refs/heads/main')
- name: Build and Publish
if: success()
working-directory: c:/repo
run: |
dotnet cake
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
VSCE_PAT: ${{ secrets.VSCE_TOKEN }}
uses: ecampidoglio/cake-action@v1
with:
target: publish
# TODO: Rename this stuff for clarity once release build artifacts are being created
# TODO: Cleanup workflows for various event types in general
RELEASE: ${{( github.ref == 'refs/heads/main' || github.ref == 'refs/heads/prerelease') && github.event_name != 'pull_request' && github.event_name != 'pull_request_target' }}
PRERELEASE: ${{ github.ref == 'refs/heads/prerelease' && github.event_name != 'pull_request' && github.event_name != 'pull_request_target' }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -333,3 +333,5 @@ ASALocalRun/
tools

send.ps1

vcpkg_installed
55 changes: 55 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"configurations": [
{
"name": "Skyrim",
"includePath": [
"${workspaceFolder}/dependencies/MetaStuff/include",
"${workspaceFolder}/dependencies",
"${workspaceFolder}/src/DarkId.Papyrus.DebugServer",
"${workspaceFolder}/vcpkg_installed/skyrim/x64-windows-static/include"
],
"defines": [
"WIN32",
"SKYRIM",
"_DEBUG",
"_WINDOWS",
"_USRDLL",
"DARKID_PAPYRUS_DEBUGSERVER_EXPORTS",
"SKSE_SUPPORT_XBYAK"
],
"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",
"cppStandard": "c++20",
"intelliSenseMode": "msvc-x64"
},
{
"name": "Fallout",
"includePath": [
"${workspaceFolder}/dependencies/MetaStuff/include",
"${workspaceFolder}/dependencies",
"${workspaceFolder}/src/DarkId.Papyrus.DebugServer",
"${workspaceFolder}/vcpkg_installed/fallout4/x64-windows-static/include"
],
"defines": [
"WIN32",
"FALLOUT",
"_DEBUG",
"_WINDOWS",
"_USRDLL",
"DARKID_PAPYRUS_DEBUGSERVER_EXPORTS",
"F4SE_SUPPORT_XBYAK"
],
"forcedInclude": [
"${workspaceFolder}/src/DarkId.Papyrus.DebugServer/pdsPCH.h"
],
"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",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}
18 changes: 5 additions & 13 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/src/papyrus-lang-vscode"
],
"outFiles": [
"${workspaceFolder}/src/papyrus-lang-vscode/out/**/*.js"
]
"outFiles": ["${workspaceFolder}/src/papyrus-lang-vscode/out/**/*.js"]
},
{
"name": "Launch (Build and copy binaries only)",
Expand All @@ -26,9 +24,7 @@
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/src/papyrus-lang-vscode"
],
"outFiles": [
"${workspaceFolder}/src/papyrus-lang-vscode/out/**/*.js"
]
"outFiles": ["${workspaceFolder}/src/papyrus-lang-vscode/out/**/*.js"]
},
{
"name": "Launch (Build extension only)",
Expand All @@ -39,9 +35,7 @@
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/src/papyrus-lang-vscode"
],
"outFiles": [
"${workspaceFolder}/src/papyrus-lang-vscode/out/**/*.js"
]
"outFiles": ["${workspaceFolder}/src/papyrus-lang-vscode/out/**/*.js"]
},
{
"name": "Launch (No build)",
Expand All @@ -51,9 +45,7 @@
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/src/papyrus-lang-vscode"
],
"outFiles": [
"${workspaceFolder}/src/papyrus-lang-vscode/out/**/*.js"
]
"outFiles": ["${workspaceFolder}/src/papyrus-lang-vscode/out/**/*.js"]
}
]
}
}
130 changes: 2 additions & 128 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,129 +1,3 @@
## Table of Contents
## TODO

1. [About the Project](#about-the-project)
1. [Questions and Help](#questions-and-help)
1. [Getting Started](#getting-started)
1. [Modules and Patterns](#modules-and-patterns)
1. [Useful Resources](#useful-resources)

# About the Project

The VSCode extension is written in TypeScript with C# being used for the language server and debug proxy.

Uses the **[Papyrus Debug Adapter](https://github.com/joelday/papyrus-debug-server) xSE plugin** for live debugging.

Also uses [this fork of **Pyro**](https://github.com/rjstone/pyro) for PPJ builds.

# Questions and Help

Do you have questions or need help? Please come visit the....

[![Discord](https://img.shields.io/discord/558746231665328139.svg?color=%23738ADB) Papyrus Language Tools Discord](https://discord.gg/E4dWujQ)

Even if you don't plan to contribute code, it would be good to hear how you are using the extension and get your feedback.

# Getting Started

## Building

First, you will need Windows with the following installed on your system:

- VSCode [Download and install](https://code.visualstudio.com/)
- Node.js [Download and install](https://nodejs.org/)
- Git for Windows [Download and install](https://git-scm.com/download/win)
- One of the following:
- Minimum: .NET Core 2.1 SDK [Download and install](https://dotnet.microsoft.com/download/dotnet-core)
- Recommended: Microsoft Visual Studio 2019 [Download and install](https://visualstudio.microsoft.com/vs/)

Also, building from the shell will be much easier if you use a **Powershell** (powershell.exe) console because the main build script is written in PS, but if you have Visual Studio installed you should be able to build from the solution file.

### 1

First, Fork the `joelday/papyrus-lang` repo on github. Then clone it:

```powershell
git clone https://github.com/<yourusername>/papyrus-lang.git
cd papyrus-lang
```

### 2

Create a branch for your new development:

```powershell
git checkout -b mynewfeature
```

### 3

Set your upstream remote to help you pull changes from main when needed:

```powershell
git remote add upstream https://github.com/joelday/papyrus-lang.git
```

### 4

Make sure your script execution policy allows running unsigned scripts as long as they're already on disk and not executed from the internet:

```powershell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Get-ExecutionPolicy -List
```

### 5

Run the build script with default targets:

```powershell
.\build.ps1
```

In the same directory, run this to update the bundled third-party packages (which are provided by separate repos):

```powershell
.\build.ps1 -Script build.cake -Target update-debug-plugin
.\build.ps1 -Script build.cake -Target update-pyro-cli
```

### 6

Run VSCode to open the papyrus-lang directory as a folder. If this is still your current directory then just run:

```powershell
code .
```

Hit **Ctrl-Shift-D** to open the Debug panel. At the top select **Launch (Build Extension Only)**.

Hit **F5** to build and launch the extension with debugging. After a little while you will see another VSCode window open. This is the Extension Development Host version of VSCode running the extension that was just built. Any changes you made to the code would be reflected in the debug/test install of the extension running in this window.

### 7

It is not required that you squash your commits before submitting a pull request, so just commit and push your changes to your fork, then submit the pull request for your branch. Please merge from `upstream/master` to your branch before submitting the pull request though to make sure your changes will merge.

```powershell
git merge upstream/main
```

# Modules and Patterns

This is a brief set of links to more info on modules and patterns used in the code.

- [decoration-ioc](https://github.com/joelday/decoration-ioc) is why `InstantiationService` is used to instantiate services and command handlers based on the Service Locator design pattern. It makes it easy to add references to services in the constructor of a class. For example just put `@IExtensionConfigProvider infoProvider: IExtensionConfigProvider` in the argument list of a constructor and it will magically get called with a reference.
- For a simple example of how to add a command, see `src\papyrus-lang-vscode\src\features\commands\ViewAssemblyCommand.ts`
- [rxjs](https://www.npmjs.com/package/rxjs) is used in many places for the reactive Observer/Observable asynchronous pattern.
- [async/await](https://javascript.info/async-await) is used frequently. If possible try to use async functions and `await` on them because this allows other things to happen while a function is blocked on IO etc.
- [deepmerge](https://www.npmjs.com/package/deepmerge) is used in some places.
- Otherwise most of the code is similar to other vscode extensions.

# Useful Resources

- See the [Project Wiki](https://github.com/joelday/papyrus-lang/wiki)
- [The Typescript Programming Language Documentation](https://www.typescriptlang.org/docs/home.html)
- [VSCode Extension Anatomy](https://code.visualstudio.com/api/get-started/extension-anatomy)
- [VSCode Extension Samples](https://github.com/microsoft/vscode-extension-samples) are useful for learning specific APIs
- [Learn RxJS](https://www.learnrxjs.io/) (Reactive eXtensions for Javascript)
- [JavaScript Promises](https://javascript.info/async)
- The [Pro Git](https://git-scm.com/book/en/v2/) book
- The [Contributing](https://github.com/joelday/papyrus-lang/wiki/Contributing) wiki page
Removing for now since the previous version was very out of date.
Loading

0 comments on commit 1dbaadf

Please sign in to comment.