@uepm/dependency-plugin 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"FileVersion": 3,
|
|
3
|
+
"Version": 1,
|
|
4
|
+
"VersionName": "1.0.0",
|
|
5
|
+
"FriendlyName": "Dependency Plugin",
|
|
6
|
+
"Description": "A plugin demonstrating dependencies on other NPM-distributed plugins",
|
|
7
|
+
"Category": "Other",
|
|
8
|
+
"CreatedBy": "UEPM",
|
|
9
|
+
"CreatedByURL": "https://github.com/uepm/uepm",
|
|
10
|
+
"DocsURL": "",
|
|
11
|
+
"MarketplaceURL": "",
|
|
12
|
+
"SupportURL": "",
|
|
13
|
+
"CanContainContent": false,
|
|
14
|
+
"IsBetaVersion": false,
|
|
15
|
+
"IsExperimentalVersion": false,
|
|
16
|
+
"Installed": false,
|
|
17
|
+
"Modules": [
|
|
18
|
+
{
|
|
19
|
+
"Name": "DependencyPlugin",
|
|
20
|
+
"Type": "Runtime",
|
|
21
|
+
"LoadingPhase": "Default"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"Plugins": [
|
|
25
|
+
{
|
|
26
|
+
"Name": "ExamplePlugin",
|
|
27
|
+
"Enabled": true
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# @uepm/dependency-plugin
|
|
2
|
+
|
|
3
|
+
Unreal Engine plugin demonstrating dependencies on other NPM-distributed plugins.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @uepm/dependency-plugin
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This will automatically install the required dependency:
|
|
12
|
+
- `@uepm/example-plugin` - The plugin this one depends on
|
|
13
|
+
|
|
14
|
+
## Prerequisites
|
|
15
|
+
|
|
16
|
+
Your Unreal Engine project must be initialized for UEPM:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx @uepm/init
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## What's Included
|
|
23
|
+
|
|
24
|
+
This plugin demonstrates:
|
|
25
|
+
|
|
26
|
+
- **Plugin dependencies** - How to depend on other NPM plugins
|
|
27
|
+
- **Dependency resolution** - Automatic installation of required plugins
|
|
28
|
+
- **Cross-plugin communication** - Using functionality from other plugins
|
|
29
|
+
- **Proper dependency declaration** - Both in package.json and .uplugin
|
|
30
|
+
|
|
31
|
+
## Plugin Dependencies
|
|
32
|
+
|
|
33
|
+
### NPM Dependencies (package.json)
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@uepm/example-plugin": "^1.0.0"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Unreal Engine Dependencies (.uplugin)
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"Plugins": [
|
|
46
|
+
{
|
|
47
|
+
"Name": "ExamplePlugin",
|
|
48
|
+
"Enabled": true
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Plugin Structure
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
@uepm/dependency-plugin/
|
|
58
|
+
├── DependencyPlugin.uplugin # Plugin descriptor with dependencies
|
|
59
|
+
├── package.json # NPM package with dependencies
|
|
60
|
+
├── Source/ # C++ source code
|
|
61
|
+
│ └── DependencyPlugin/
|
|
62
|
+
│ ├── Private/
|
|
63
|
+
│ │ ├── DependencyPlugin.cpp
|
|
64
|
+
│ │ └── DependencyPluginModule.cpp
|
|
65
|
+
│ ├── Public/
|
|
66
|
+
│ │ ├── DependencyPlugin.h
|
|
67
|
+
│ │ └── DependencyPluginModule.h
|
|
68
|
+
│ └── DependencyPlugin.Build.cs
|
|
69
|
+
└── README.md
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Engine Compatibility
|
|
73
|
+
|
|
74
|
+
- **Unreal Engine**: 5.0.0 or later (< 6.0.0)
|
|
75
|
+
- **Platforms**: All platforms supported by Unreal Engine
|
|
76
|
+
- **Dependencies**: Requires ExamplePlugin to be available
|
|
77
|
+
|
|
78
|
+
## Usage in Unreal Engine
|
|
79
|
+
|
|
80
|
+
1. Install the plugin via NPM (dependencies install automatically)
|
|
81
|
+
2. Open your project in Unreal Engine
|
|
82
|
+
3. Go to **Edit > Plugins**
|
|
83
|
+
4. Find "Dependency Plugin" in the list
|
|
84
|
+
5. Enable the plugin (ExamplePlugin will be enabled automatically)
|
|
85
|
+
6. Restart the editor when prompted
|
|
86
|
+
|
|
87
|
+
The plugin will log messages showing the dependency relationship:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
LogExamplePlugin: Example Plugin has been loaded!
|
|
91
|
+
LogDependencyPlugin: Dependency Plugin has been loaded!
|
|
92
|
+
LogDependencyPlugin: Successfully found and using ExamplePlugin functionality
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Dependency Management
|
|
96
|
+
|
|
97
|
+
This plugin shows how UEPM handles plugin dependencies:
|
|
98
|
+
|
|
99
|
+
1. **NPM-level dependencies** - Ensures required plugins are downloaded
|
|
100
|
+
2. **Unreal Engine dependencies** - Declares plugin dependencies in .uplugin
|
|
101
|
+
3. **Build system integration** - Links against dependency modules
|
|
102
|
+
4. **Runtime dependency checking** - Verifies dependencies are available
|
|
103
|
+
|
|
104
|
+
## Creating Dependent Plugins
|
|
105
|
+
|
|
106
|
+
To create your own plugin with dependencies:
|
|
107
|
+
|
|
108
|
+
1. **Add NPM dependency** in package.json
|
|
109
|
+
2. **Declare Unreal dependency** in .uplugin file
|
|
110
|
+
3. **Add module dependency** in Build.cs file
|
|
111
|
+
4. **Include headers** from dependency plugin
|
|
112
|
+
5. **Test dependency resolution** during development
|
|
113
|
+
|
|
114
|
+
## Best Practices
|
|
115
|
+
|
|
116
|
+
- Always specify compatible version ranges for dependencies
|
|
117
|
+
- Test with and without dependencies to ensure proper error handling
|
|
118
|
+
- Document dependency requirements clearly
|
|
119
|
+
- Use semantic versioning for your plugin releases
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
MIT
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
using UnrealBuildTool;
|
|
2
|
+
|
|
3
|
+
public class DependencyPlugin : ModuleRules
|
|
4
|
+
{
|
|
5
|
+
public DependencyPlugin(ReadOnlyTargetRules Target) : base(Target)
|
|
6
|
+
{
|
|
7
|
+
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
|
|
8
|
+
|
|
9
|
+
PublicIncludePaths.AddRange(
|
|
10
|
+
new string[] {
|
|
11
|
+
}
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
PrivateIncludePaths.AddRange(
|
|
15
|
+
new string[] {
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
PublicDependencyModuleNames.AddRange(
|
|
20
|
+
new string[]
|
|
21
|
+
{
|
|
22
|
+
"Core",
|
|
23
|
+
"ExamplePlugin",
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
PrivateDependencyModuleNames.AddRange(
|
|
28
|
+
new string[]
|
|
29
|
+
{
|
|
30
|
+
"CoreUObject",
|
|
31
|
+
"Engine",
|
|
32
|
+
"Slate",
|
|
33
|
+
"SlateCore",
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
DynamicallyLoadedModuleNames.AddRange(
|
|
38
|
+
new string[]
|
|
39
|
+
{
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#include "DependencyPlugin.h"
|
|
2
|
+
#include "ExamplePlugin.h"
|
|
3
|
+
|
|
4
|
+
#define LOCTEXT_NAMESPACE "FDependencyPluginModule"
|
|
5
|
+
|
|
6
|
+
void FDependencyPluginModule::StartupModule()
|
|
7
|
+
{
|
|
8
|
+
// This code will execute after your module is loaded into memory; the exact timing is specified in the .uplugin file per-module
|
|
9
|
+
UE_LOG(LogTemp, Warning, TEXT("DependencyPlugin module has been loaded"));
|
|
10
|
+
|
|
11
|
+
// Demonstrate using functionality from ExamplePlugin
|
|
12
|
+
UseExamplePluginFunctionality();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
void FDependencyPluginModule::ShutdownModule()
|
|
16
|
+
{
|
|
17
|
+
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
|
|
18
|
+
// we call this function before unloading the module.
|
|
19
|
+
UE_LOG(LogTemp, Warning, TEXT("DependencyPlugin module has been unloaded"));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
void FDependencyPluginModule::UseExamplePluginFunctionality()
|
|
23
|
+
{
|
|
24
|
+
// Check if ExamplePlugin module is loaded
|
|
25
|
+
if (FModuleManager::Get().IsModuleLoaded("ExamplePlugin"))
|
|
26
|
+
{
|
|
27
|
+
UE_LOG(LogTemp, Warning, TEXT("DependencyPlugin: ExamplePlugin is loaded and available"));
|
|
28
|
+
|
|
29
|
+
// In a real implementation, you would call specific functions from ExamplePlugin
|
|
30
|
+
// For this example, we just log that the dependency is available
|
|
31
|
+
UE_LOG(LogTemp, Warning, TEXT("DependencyPlugin: Successfully using ExamplePlugin functionality"));
|
|
32
|
+
}
|
|
33
|
+
else
|
|
34
|
+
{
|
|
35
|
+
UE_LOG(LogTemp, Error, TEXT("DependencyPlugin: ExamplePlugin is not loaded - dependency not satisfied"));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
#undef LOCTEXT_NAMESPACE
|
|
40
|
+
|
|
41
|
+
IMPLEMENT_MODULE(FDependencyPluginModule, DependencyPlugin)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "CoreMinimal.h"
|
|
4
|
+
#include "Modules/ModuleManager.h"
|
|
5
|
+
|
|
6
|
+
class FDependencyPluginModule : public IModuleInterface
|
|
7
|
+
{
|
|
8
|
+
public:
|
|
9
|
+
|
|
10
|
+
/** IModuleInterface implementation */
|
|
11
|
+
virtual void StartupModule() override;
|
|
12
|
+
virtual void ShutdownModule() override;
|
|
13
|
+
|
|
14
|
+
private:
|
|
15
|
+
/** Demonstrates using functionality from ExamplePlugin */
|
|
16
|
+
void UseExamplePluginFunctionality();
|
|
17
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@uepm/dependency-plugin",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Plugin demonstrating dependencies on other NPM plugins",
|
|
5
|
+
"main": "DependencyPlugin.uplugin",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "vitest --run",
|
|
8
|
+
"test:watch": "vitest"
|
|
9
|
+
},
|
|
10
|
+
"unreal": {
|
|
11
|
+
"engineVersion": ">=5.0.0 <6.0.0",
|
|
12
|
+
"pluginName": "DependencyPlugin"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@uepm/example-plugin": "^1.0.1"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"DependencyPlugin.uplugin",
|
|
19
|
+
"Source/**/*"
|
|
20
|
+
],
|
|
21
|
+
"keywords": [
|
|
22
|
+
"unreal",
|
|
23
|
+
"unreal-engine",
|
|
24
|
+
"plugin",
|
|
25
|
+
"uepm",
|
|
26
|
+
"dependency"
|
|
27
|
+
],
|
|
28
|
+
"author": "",
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=18.0.0"
|
|
32
|
+
}
|
|
33
|
+
}
|