MJSU.Plugin.Merge 1.0.8

dotnet tool install --global MJSU.Plugin.Merge --version 1.0.8
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local MJSU.Plugin.Merge --version 1.0.8
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=MJSU.Plugin.Merge&version=1.0.8
nuke :add-package MJSU.Plugin.Merge --version 1.0.8

Plugin Merge

NuGet version (MJSU.Plugin.Merge) Main Branch status Develop Branch status

Plugin Merge is a .net 6 CLI tool that allows merging multiple .cs files into a single Oxide / uMod plugin file.

Examples

Plugins

Discord Sign Logger

Frameworks

Rust UI Framework

Installation

dotnet tool install --global MJSU.Plugin.Merge from the shell/command line.

Init Command

Create config in current directory:
plugin.merge init -f merge.json -p ./
Create config in specified directory:
plugin.merge init -f merge.json -p C:\Users\USERNAME\Source\Repos\MyFirstMergePlugin

-p, --path (Default: ./) Path to create the merge.json configuration file in
-f, --filename (Default: merge.yml) Name of the outputted configuration file
-d, --debug Enable debug log output
--help Display this help screen.
--version Display version information.

Merge Command (Default Command)

Merge and Compile:
plugin.merge -c -m -p ./merge.json
Merge Only:
plugin.merge -m -p C:\Users\USERNAME\Source\Repos\MyFirstMergePlugin\merge.json
Merge Additional Output Paths:
plugin.merge -c -m -o ./additional/output/path -p ./merge.json
Compile Only:
plugin.merge -c -p ./merge.json

-p, --path(Default: ./merge.yml) Path to the merge.json configuration file
-m, --merge (Group: Mode) (Default: false) Enables merge mode to merge files into a single plugin/framework file
-c, --compile (Group: Mode) (Default: false) Enables compile mode. Will attempt to compile merged file and display any errors if it fails.
-o, --output Additional output paths for the generated code file
-d, --debug Enable debug log output
--help Display this help screen.
--version Display version information.

Getting Started

To get started using plugin merge open a command prompt / terminal and type plugin.merge init. This will created the default configuration file named merge.yml in the directory that is currently open. Plugin Merge also supports JSON. You can use plugin.merge init -f merge.json Place your config file a directory near your plugin .cs files. Update the config paths to point to the input and output paths you would like to use. The configuration supports relative pathing and all paths use the configuration files directory as it's staring point.

Once your configuration file is setup it's time to merge the files together. You can run the merge by typing plugin.merge -m -p ./merge.yml. This will merge all the .cs files together and create a final file in the output paths specified. You can also enable compilation to compile your plugin to check for any issues before loading it onto your server. To enable compilation add the -c argument while merging Ex: plugin.merge -m -c -p ./merge.yml

File Settings

You can control certain settings about imported .cs files by adding specific comments into the file before the class declaration
//Define:FileOrder=100 - This will control which order the file is added into final output file. Default value is 100

//Define:ExcludeFile - This will prevent a file from being processed

//Define:Framework - This defines a file as a framework. Framework files are added at the very bottom in separate partial classes (Note: This should not be added manually and is already added by the Plugin Merge Tool)

Configuration

Creator Modes

There are 3 types of merge options when using Plugin Merge.
Plugin - will merge all files into a final Plugin to be used.
Framework - Will output a framework file that can be copied into another plugin that isn't a merge framework plugin
MergeFramework - Will output a framework file that can be used with a plugin that is a merge framework plugin

YAML Configuration File

# What platform to write the code file for (Oxide, uMod)
Platform: Oxide
Merge Settings:
# Outputted plugin name
  Plugin Name: MyPluginName
  # Outputted plugin base class
  Plugin Base Class: CovalencePlugin
  # Which type of file to output (Plugin, Framework, or MergeFramework)
  Creator Mode: Plugin
  # Paths to use when reading in source code relative to the merge config
  Plugin Input Paths:
  - ./
  # Paths to use when writing the plugin file relative to the merge config
  Plugin Output Paths:
  - ./build
  # Oxide //References: definitions
  Reference Definitions: []
  # #define definitions
  Define Definitions:
  - DEBUG
  # Paths to be ignored when searching for source code relative to merge config
  Ignore Paths:
  - ./IgnoreThisPath
  # Files to be ignored when searching for source code relative to merge config
  Ignore Files:
  - ./IgnoreThisFile.cs
  # Namespaces to ignore when processing output file
  Ignore Namespaces:
  - IgnoreThisNameSpace
  Code Style:
  # Character to use for code indents
    Indent Character: ' '
    # The amount of characters to use when indenting once
    Indent Char Amount: 4
    # Indent value will increase / decrease by this number
    Indent Multiplier: 1
    # String to use for new lines in code
    New Line String: "\r\n"
    # Adds the code file path in a region
    Write The Relative File Path In Region: true
    # Adds the code file path in a region
    Keep Code Comments: true
Compile Settings:
  AssemblyPaths:
  - ./Assemblies
  # Ignores the following paths relative to the merge config
  Ignore Paths:
  - ./Assemblies/x86
  - ./Assemblies/x64
  # Ignores the following files relative to the merge config
  Ignore Files:
  - ./Assemblies/Newtonsoft.Json.dll
  Compile Log Level (Hidden, Info, Warning, Error): Error

JSON Configuration File

{
  "Platform": "Oxide",
  "Merge Settings": {
    "Plugin Name": "MyPluginName",
    "Plugin Base Class": "CovalencePlugin",
    "Creator Mode": "Plugin",
    "Plugin Input Paths": [
      "./"
    ],
    "Plugin Output Paths": [
      "./build"
    ],
    "Reference Definitions": [],
    "Define Definitions": [
      "DEBUG"
    ],
    "Ignore Paths": [
      "./IgnoreThisPath"
    ],
    "Ignore Files": [
      "./IgnoreThisFile.cs"
    ],
    "Ignore Namespaces": [
      "IgnoreThisNameSpace"
    ],
    "Code Style": {
      "Indent Character": " ",
      "Indent Char Amount": 4,
      "Indent Multiplier": 1,
      "New Line String": "\r\n",
      "Write The Relative File Path In Region": true,
      "Keep Comments": true
    }
  },
  "Compile Settings": {
    "Assembly Paths": [
      "./Assemblies"
    ],
    "Ignore Paths": [
      "./Assemblies/x86",
      "./Assemblies/x64"
    ],
    "Ignore Files": [
      "./Assemblies/Newtonsoft.Json.dll"
    ],
    "Compile Log Level (Hidden, Info, Warning, Error)": "Error"
  }
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
1.0.8 173 3/15/2024
1.0.7 182 1/17/2024
1.0.6 172 12/25/2023
1.0.5 294 10/18/2023
1.0.4 556 3/11/2022
1.0.3 393 3/11/2022
1.0.2 482 2/3/2022
1.0.1 466 1/29/2022
1.0.0 442 1/29/2022