How to create your own ScriptGenerator

I’m working on a language plugin for Unreal, and I’ve been trying to figure out how does UHT pick up your own ScriptGenerator plugin. By reading the source code, I understand I should inherit from IScriptGeneratorPluginInterface and do something like IModularFeatures::Get().RegisterModularFeature(TEXT("ScriptGenerator"), this); at startup.
However, I’ve been having trouble to even get my module loaded.

By following ScriptGeneratorPlugin example, I’ve made a new plugin with the following .uplugin:

	"FileVersion" : 3,
	"FriendlyName" : "UE4Haxe Extern Generator plugin",
	"Version" : 1,
	"VersionName": "alpha",
	"FriendlyVersion" : "1.0",
	"EngineVersion" : "4.8.0",
	"Description" : "Automatically generate externs from UHT definitions",
	"Category" : "Scripting",
	"EnabledByDefault" : true,
	"IsBetaVersion" : true,
	"Modules" :
			"Name" : "HaxeExternGenerator",
			"Type" : "Program",
			"LoadingPhase" : "PostConfigInit"

Right now my implementation of the module just consists of stub calls. For example, the header is:

#pragma once

#include <IScriptGeneratorPluginInterface.h>
#include <Modules/ModuleManager.h>

class IHaxeExternGenerator : public IScriptGeneratorPluginInterface
  static inline IHaxeExternGenerator& Get() {
    return FModuleManager::LoadModuleChecked<IHaxeExternGenerator>("HaxeExternGenerator");

  static inline bool IsAvailable() {
    return FModuleManager::Get().IsModuleLoaded("HaxeExternGenerator");

And the C++ file implements all abstract functions from IScriptGeneratorPluginInterface and StartupModule/ShutdownModule. The C++ code also calls IMPLEMENT_MODULE(FHaxeExternGenerator, HaxeExternGenerator)

The strange part is that when the .uplugin is defined as a program - like it is right now - UBT won’t even build it when building the main project. When I change it to Editor, it does build, but the resulting module doesn’t get loaded in UBT in time for it to be picked up by UHT.

Am I missing something?

Any answer to this question?

It turns out you’ll need to actually change the Target.cs file of UnrealHeaderTool to make the program build, like this: GitHub - proletariatgames/UnrealHxGenerator: Automatically generate externs from UHT definitions