Announcement

Collapse
No announcement yet.

What happend to TargetInfo.Target in 4.19?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    What happend to TargetInfo.Target in 4.19?

    I'm not sure if this is the right place to ask this (for two days tried posting it on UE4 answerhub but it won't allow me with a weird error).

    I used to do this on 4.18 and earlier versions in my Target.cs:

    Code:
            if (Target.Type == TargetRules.TargetType.Editor) {
                ExtraModuleNames.AddRange(
                    new string[] {
                        "MyProjectEditor"
                    });
            }
    Looking at the engine source, it seems that on 4.19 Type property has been removed from TargetInfo and I'm getting the following error:

    Code:
        ERROR: /path/to/MyProject.Target.cs(23,20) : error CS1061:
    Type `UnrealBuildTool.TargetInfo' does not contain a definition for
    `Type' and no extension method `Type' of type `UnrealBuildTool.TargetInfo'
    could be found. Are you missing an assembly reference?
        ERROR: UnrealBuildTool Exception: Unable to compile source files.
    What's the alternative to check target type on 4.19?


    #2
    The old Target.cs and Build.cs formats have been deprecated for several builds now - you should have had warnings when compiling in previous versions. They probably pulled the plug at last.

    Your best bet is to create a new C++ project from the launcher, and copy it's Target and Build .cs formats.

    Comment


      #3
      Originally posted by TheJamsh View Post
      The old Target.cs and Build.cs formats have been deprecated for several builds now - you should have had warnings when compiling in previous versions. They probably pulled the plug at last.

      Your best bet is to create a new C++ project from the launcher, and copy it's Target and Build .cs formats.
      In fact, I did create a new C++ project before posting here. But, there is no such a check for target type in the engine templates.

      Comment


        #4
        As TheJamsh said, they've been deprecated for awhile. You can use the following check to find out if the Target is building the Editor:

        Code:
        if (UEBuildConfiguration.bBuildEditor == true)
        {
        // Add modules....
        }
        Able Ability System - A high performance, robust ability system for UE4. Now Available!

        Comment


          #5
          ,
          Originally posted by ExtraLifeMatt View Post
          As TheJamsh said, they've been deprecated for awhile. You can use the following check to find out if the Target is building the Editor:

          Code:
          if (UEBuildConfiguration.bBuildEditor == true)
          {
          // Add modules....
          }
          Thank you so much for the solution. That solves the issue. But, wondering how to check for other build targets besides the editor. Namely, Game, Client, Server, and Program?
          Last edited by NuLL3rr0r; 02-09-2018, 03:45 PM.

          Comment


            #6
            I believe you can just do
            Code:
            Type == Editor
            now, or similar. No need to grab it from TargetInfo.

            Comment


              #7
              Originally posted by ExtraLifeMatt View Post
              As TheJamsh said, they've been deprecated for awhile. You can use the following check to find out if the Target is building the Editor:

              Code:
              if (UEBuildConfiguration.bBuildEditor == true)
              {
              // Add modules....
              }
              How do you get a reference to UEBuildConfiguration though?

              Code:
              error CS0103: The name 'UEBuildConfiguration' does not exist in the current context

              Comment


                #8
                Originally posted by ExtraLifeMatt View Post
                As TheJamsh said, they've been deprecated for awhile. You can use the following check to find out if the Target is building the Editor:

                Code:
                if (UEBuildConfiguration.bBuildEditor == true)
                {
                // Add modules....
                }
                Huh? There is no need for this. ProjectEditor.Target.cs builds with editor, Project.Target.cs without.

                Comment


                  #9
                  Originally posted by Vaei View Post

                  How do you get a reference to UEBuildConfiguration though?

                  Code:
                  error CS0103: The name 'UEBuildConfiguration' does not exist in the current context
                  Inside the your .Target.cs you can do this:

                  Code:
                      if (this.bBuildEditor) {
                          ...
                      }

                  Comment


                    #10
                    Originally posted by Zeblote View Post

                    Huh? There is no need for this. ProjectEditor.Target.cs builds with editor, Project.Target.cs without.
                    Well, from my experience it seems the build system won't work like that. It seems, you have to tell the build system to build editor module or not. I can see this in my build/package logs.

                    Although, it seems bBuildEditor does not have any effects for me. I used to do this on 4.18 and it worked perfectly:
                    Code:
                             if (Target.Type == TargetRules.TargetType.Editor) {             ExtraModuleNames.AddRange(                 new string[] {                     "MyProjectEditor"                 });         }
                    Now if I do this (on both 4.18 and 4.19):

                    Code:
                            if (this.bBuildEditor) {
                                this.ExtraModuleNames.AddRange(
                                    new string[] {
                                        "MyProjectEditor"
                                    });
                            }
                    It builds fine but, when I try to package my game I'll get the following errors:

                    Code:
                    UATHelper: Packaging (Linux):   In file included from /mnt/dev/Reminiscence/Intermediate/Build/Linux/B4D820EA/Reminiscence/Development/BlueprintGraph/Module.BlueprintGraph.1_of_5.cpp:3:
                    UATHelper: Packaging (Linux):   In file included from /opt/UnrealEngine/Engine/Source/Editor/BlueprintGraph/Private/BlueprintActionDatabase.cpp:25:
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/EdGraphSchema_K2.h:465:16: error: 'GetPinDisplayName' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           virtual FText GetPinDisplayName(const UEdGraphPin* Pin) const override;
                    UATHelper: Packaging (Linux):                         ^
                    PackagingResults: Error: 'GetPinDisplayName' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):   In file included from /mnt/dev/Reminiscence/Intermediate/Build/Linux/B4D820EA/Reminiscence/Development/BlueprintGraph/Module.BlueprintGraph.1_of_5.cpp:3:
                    UATHelper: Packaging (Linux):   In file included from /opt/UnrealEngine/Engine/Source/Editor/BlueprintGraph/Private/BlueprintActionDatabase.cpp:26:
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/K2Node.h:180:34: error: 'ReconstructNode' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           BLUEPRINTGRAPH_API virtual void ReconstructNode() override;
                    UATHelper: Packaging (Linux):                                           ^
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/K2Node.h:181:42: error: 'GetNodeTitleColor' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           BLUEPRINTGRAPH_API virtual FLinearColor GetNodeTitleColor() const override;
                    UATHelper: Packaging (Linux):                                                   ^
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/K2Node.h:182:34: error: 'AutowireNewNode' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           BLUEPRINTGRAPH_API virtual void AutowireNewNode(UEdGraphPin* FromPin) override;
                    UATHelper: Packaging (Linux):                                           ^
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/K2Node.h:183:69: error: only virtual member functions can be marked 'override'
                    UATHelper: Packaging (Linux):           BLUEPRINTGRAPH_API void PinConnectionListChanged(UEdGraphPin* Pin) override;
                    UATHelper: Packaging (Linux):                                                                              ^~~~~~~~
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/K2Node.h:184:38: error: 'GetJumpTargetForDoubleClick' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           BLUEPRINTGRAPH_API virtual UObject* GetJumpTargetForDoubleClick() const override;
                    UATHelper: Packaging (Linux):                                               ^
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/K2Node.h:185:34: error: 'CanJumpToDefinition' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           BLUEPRINTGRAPH_API virtual bool CanJumpToDefinition() const override;
                    UATHelper: Packaging (Linux):                                           ^
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/K2Node.h:186:34: error: 'JumpToDefinition' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           BLUEPRINTGRAPH_API virtual void JumpToDefinition() const override;
                    UATHelper: Packaging (Linux):                                           ^
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/K2Node.h:187:37: error: 'GetDocumentationLink' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           BLUEPRINTGRAPH_API virtual FString GetDocumentationLink() const override;
                    UATHelper: Packaging (Linux):                                              ^
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/K2Node.h:188:34: error: 'GetPinHoverText' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           BLUEPRINTGRAPH_API virtual void GetPinHoverText(const UEdGraphPin& Pin, FString& HoverTextOut) const override;
                    UATHelper: Packaging (Linux):                                           ^
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/K2Node.h:189:34: error: 'ShowPaletteIconOnNode' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           BLUEPRINTGRAPH_API virtual bool ShowPaletteIconOnNode() const override { return true; }
                    UATHelper: Packaging (Linux):                                           ^
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/K2Node.h:190:34: error: 'CanSplitPin' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           BLUEPRINTGRAPH_API virtual bool CanSplitPin(const UEdGraphPin* Pin) const override;
                    UATHelper: Packaging (Linux):                                           ^
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/K2Node.h:191:42: error: 'GetPassThroughPin' marked 'override' but does not override any member functions
                    PackagingResults: Error: 'ReconstructNode' marked 'override' but does not override any member functions
                    PackagingResults: Error: 'GetNodeTitleColor' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           BLUEPRINTGRAPH_API virtual UEdGraphPin* GetPassThroughPin(const UEdGraphPin* FromPin) const override;
                    UATHelper: Packaging (Linux):                                                   ^
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/K2Node.h:193:34: error: 'ValidateNodeDuringCompilation' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           BLUEPRINTGRAPH_API virtual void ValidateNodeDuringCompilation(class FCompilerResultsLog& MessageLog) const override;
                    UATHelper: Packaging (Linux):                                           ^
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/K2Node.h:194:37: error: 'GetPinMetaData' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           BLUEPRINTGRAPH_API virtual FString GetPinMetaData(FName InPinName, FName InKey) override;
                    UATHelper: Packaging (Linux):                                              ^
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/K2Node.h:306:34: error: 'CanCreateUnderSpecifiedSchema' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           BLUEPRINTGRAPH_API virtual bool CanCreateUnderSpecifiedSchema(const UEdGraphSchema* DesiredSchema) const override;
                    UATHelper: Packaging (Linux):                                           ^
                    PackagingResults: Error: 'AutowireNewNode' marked 'override' but does not override any member functions
                    PackagingResults: Error: only virtual member functions can be marked 'override'
                    PackagingResults: Error: 'GetJumpTargetForDoubleClick' marked 'override' but does not override any member functions
                    PackagingResults: Error: 'CanJumpToDefinition' marked 'override' but does not override any member functions
                    PackagingResults: Error: 'JumpToDefinition' marked 'override' but does not override any member functions
                    PackagingResults: Error: 'GetDocumentationLink' marked 'override' but does not override any member functions
                    PackagingResults: Error: 'GetPinHoverText' marked 'override' but does not override any member functions
                    PackagingResults: Error: 'ShowPaletteIconOnNode' marked 'override' but does not override any member functions
                    PackagingResults: Error: 'CanSplitPin' marked 'override' but does not override any member functions
                    PackagingResults: Error: 'GetPassThroughPin' marked 'override' but does not override any member functions
                    PackagingResults: Error: 'ValidateNodeDuringCompilation' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/K2Node.h:231:53: error: use of undeclared identifier 'GetNodeTitle'
                    UATHelper: Packaging (Linux):           virtual FText GetCompactNodeTitle() const { return GetNodeTitle(ENodeTitleType::FullTitle); }
                    UATHelper: Packaging (Linux):                                                              ^
                    PackagingResults: Error: 'GetPinMetaData' marked 'override' but does not override any member functions
                    PackagingResults: Error: 'CanCreateUnderSpecifiedSchema' marked 'override' but does not override any member functions
                    PackagingResults: Error: use of undeclared identifier 'GetNodeTitle'
                    UATHelper: Packaging (Linux):   In file included from /mnt/dev/Reminiscence/Intermediate/Build/Linux/B4D820EA/Reminiscence/Development/BlueprintGraph/Module.BlueprintGraph.1_of_5.cpp:3:
                    UATHelper: Packaging (Linux):   In file included from /opt/UnrealEngine/Engine/Source/Editor/BlueprintGraph/Private/BlueprintActionDatabase.cpp:27:
                    UATHelper: Packaging (Linux):   In file included from Editor/BlueprintGraph/Classes/K2Node_Event.h:11:
                    UATHelper: Packaging (Linux):   Runtime/Engine/Public/EdGraph/EdGraphNodeUtils.h:31:65: error: no member named 'GetGraph' in 'UEdGraphNode'
                    UATHelper: Packaging (Linux):                   return CachedText.IsEmpty() || (InOwningNode && InOwningNode->GetGraph() && InOwningNode->GetSchema()->IsCacheVisualizationOutOfDate(CacheRefreshID));
                    UATHelper: Packaging (Linux):                                                                   ~~~~~~~~~~~~  ^
                    UATHelper: Packaging (Linux):   Runtime/Engine/Public/EdGraph/EdGraphNodeUtils.h:31:93: error: no member named 'GetSchema' in 'UEdGraphNode'
                    UATHelper: Packaging (Linux):                   return CachedText.IsEmpty() || (InOwningNode && InOwningNode->GetGraph() && InOwningNode->GetSchema()->IsCacheVisualizationOutOfDate(CacheRefreshID));
                    UATHelper: Packaging (Linux):                                                                                               ~~~~~~~~~~~~  ^
                    UATHelper: Packaging (Linux):   fatal error: too many errors emitted, stopping now [-ferror-limit=]
                    PackagingResults: Error: no member named 'GetGraph' in 'UEdGraphNode'
                    PackagingResults: Error: no member named 'GetSchema' in 'UEdGraphNode'
                    PackagingResults: Error: too many errors emitted, stopping now [-ferror-limit=]
                    UATHelper: Packaging (Linux):   In file included from /mnt/dev/Reminiscence/Intermediate/Build/Linux/B4D820EA/Reminiscence/Development/BlueprintGraph/Module.BlueprintGraph.2_of_5.cpp:2:
                    UATHelper: Packaging (Linux):   In file included from /opt/UnrealEngine/Engine/Source/Editor/BlueprintGraph/Private/EdGraphSchema_K2_Actions.cpp:7:
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/EdGraphSchema_K2.h:465:16: error: 'GetPinDisplayName' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           virtual FText GetPinDisplayName(const UEdGraphPin* Pin) const override;
                    UATHelper: Packaging (Linux):                         ^
                    PackagingResults: Error: 'GetPinDisplayName' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):   In file included from /mnt/dev/Reminiscence/Intermediate/Build/Linux/B4D820EA/Reminiscence/Development/AnimGraph/Module.AnimGraph.cpp:2:
                    UATHelper: Packaging (Linux):   In file included from /opt/UnrealEngine/Engine/Source/Editor/AnimGraph/Private/AnimationConduitGraphSchema.cpp:3:
                    UATHelper: Packaging (Linux):   In file included from Editor/AnimGraph/Classes/AnimationConduitGraphSchema.h:7:
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/EdGraphSchema_K2.h:465:16: error: 'GetPinDisplayName' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           virtual FText GetPinDisplayName(const UEdGraphPin* Pin) const override;
                    UATHelper: Packaging (Linux):                         ^
                    PackagingResults: Error: 'GetPinDisplayName' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):   In file included from /mnt/dev/Reminiscence/Intermediate/Build/Linux/B4D820EA/Reminiscence/Development/AnimGraph/Module.AnimGraph.gen.cpp:2:
                    UATHelper: Packaging (Linux):   In file included from /mnt/dev/Reminiscence/Intermediate/Build/Linux/B4D820EA/Reminiscence/Inc/AnimGraph/AnimationConduitGraphSchema.gen.cpp:8:
                    UATHelper: Packaging (Linux):   In file included from Editor/AnimGraph/Classes/AnimationConduitGraphSchema.h:7:
                    UATHelper: Packaging (Linux):   Editor/BlueprintGraph/Classes/EdGraphSchema_K2.h:465:16: error: 'GetPinDisplayName' marked 'override' but does not override any member functions
                    UATHelper: Packaging (Linux):           virtual FText GetPinDisplayName(const UEdGraphPin* Pin) const override;
                    UATHelper: Packaging (Linux):                         ^
                    PackagingResults: Error: 'GetPinDisplayName' marked 'override' but does not override any member functions
                    .
                    .
                    .
                    And many more errors like that. Those methods should exist on editor builds. Even on Visual Studio I'll get those errors, too. If I do just this:

                    Code:
                            this.ExtraModuleNames.AddRange(
                                new string[] {
                                    "MyProjectEditor"
                                });
                    I won't get those errors. But it packages the editor module inside my packaged game which obviously is not necessary.
                    Last edited by NuLL3rr0r; 02-25-2018, 06:46 AM.

                    Comment


                      #11
                      Well, to my surprise it seems Zeblote is right. I'm not sure what changed in the recent versions but I did this in my . Target.cs files and it worked perfectly fine:

                      Code:
                          public MyProjectTarget(TargetInfo Target) : base(Target)
                          {
                              this.Type = TargetType.Game;
                      
                              this.ExtraModuleNames.AddRange(
                                  new string[] {
                                      "MyProject"
                                  });
                      
                              this.bEnforceIWYU = true;
                              this.bCompileLeanAndMeanUE = true;
                              this.bForceEnableRTTI = true;
                              this.bForceEnableExceptions = true;
                          }
                      And

                      Code:
                          public MyProjectEditorTarget(TargetInfo Target) : base(Target)
                          {
                              this.Type = TargetType.Editor;
                      
                              this.ExtraModuleNames.AddRange(
                                  new string[] {
                                      "MyProject",
                                      "MyProjectEditor"
                                  });
                      
                              this.bEnforceIWYU = true;
                              this.bCompileLeanAndMeanUE = true;
                              this.bForceEnableRTTI = true;
                          }
                      Adding editor module to the game module's ExtraModuleNames is not necessary anymore. Thus, no check if we are building an editor build.

                      Now my editor module works inside the editor and it won't get build for non-editor builds.

                      Comment

                      Working...
                      X