BuildGraph スクリプトのタスク

BuildGraph を使って、カスタム タスクを作成する方法を学習します。

Windows
MacOS
Linux

通常、プロジェクト固有のユーティリティ スクリプトが AutomationTool BuildCommand クラスとして実装されます。しかし、場合によっては プロジェクト用にカスタム タスクを自動化する必要があるでしょう。そんなとき、BuildGraph が役立ちます。BuildGraph は、任意の数のタスクで拡張可能であり、 各自の特定のニーズに合うようなやりかたでビルド自動化タスクをカスタマイズすることができます。以下のセクションでは、BuildGraph を使ってカスタム タスクを作成する方法を説明します。 カスタム タスク作成の優れた開始点となる定義済みタスクの一覧も示します。

カスタム タスク

新しいカスタム タスクを作成するには、CustomTask クラスから派生したクラスを実装し、それに [TaskElement] 属性を適用します。 TaskElement コンストラクタには、2 つの引数があります。それが表される XML エレメントの名前と そのパラメータを含むクラスの型 (ロード時にコンストラクタに渡されます) の 2 つです。

XML ファイルからパラメータのクラス フィールドを読み出す場合は、タスクに [TaskParameter] 属性をアタッチします。TaskParameter 属性をアタッチするということは、 パラメータが必須であるか任意であるかを示します。 これには、引数に適用すべき追加のバリデーションが含まれます。

定義済みタスク

タスク作成の開始点として、テンプレートに多様な定義済みタスクがあります。 単純な定義済みタスクを求めている場合は、LogTask から始めることをお勧めします。BuildGraph の最新の改善情報が必要な場合は、 このページをブックマークしてください。以下の定義済みタスクの一覧が定期的に更新されます。

AgeStore

Task which strips symbols from a set of files. This task is named after the AGESTORE utility that comes with the Microsoft debugger tools SDK, but is actually a separate implementation. The main difference is that it uses the last modified time rather than last access time to determine which files to delete.

Attribute

Type

Usage

Description

Platform

UnrealTargetPlatform

Required

The target platform to age symbols for.

StoreDir

String

Required

The symbol server directory.

Days

Int32

Required

Number of days worth of symbols to keep.

BuildDir

String

Optional

The root of the build dir to check for existing buildversion named directories.

Filter

String

Optional

A substring to match in directory file names before deleting symbols. This allows the "age store" task to avoid deleting symbols from other builds in the case where multiple builds share the same symbol server. Specific use of the filter value is determined by the symbol server structure defined by the platform tool chain.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Command

Invokes an AutomationTool child process to run the given command.

Attribute

Type

Usage

Description

Name

String

Required

The command name to execute.

Arguments

String

Optional

Arguments to be passed to the command.

MergeTelemetryWithPrefix

String

Optional

If non-null, instructs telemetry from the command to be merged into the telemetry for this UAT instance with the given prefix. May be an empty (non-null) string.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Commandlet

Spawns the editor to run a commandlet.

Attribute

Type

Usage

Description

Name

String

Required

The commandlet name to execute.

Project

File Spec

Optional

The project to run the editor with.

Arguments

String

Optional

Arguments to be passed to the commandlet.

EditorExe

FileReference

Optional

The editor executable to use. Defaults to the development UE4Editor executable for the current platform.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Compile

Compiles a target with UnrealBuildTool.

Attribute

Type

Usage

Description

Target

String

Required

The target to compile.

Configuration

UnrealTargetConfiguration

Required

The configuration to compile.

Platform

UnrealTargetPlatform

Required

The platform to compile for.

Arguments

String

Optional

Additional arguments for UnrealBuildTool.

AllowXGE

Boolean

Optional

Whether to allow using XGE for compilation.

AllowParallelExecutor

Boolean

Optional

Whether to allow using the parallel executor for this compile.

Clean

Nullable`1

Optional

Whether to allow cleaning this target. If unspecified, targets are cleaned if the -Clean argument passed on the command line.

Tag

Tag List

Optional

Tag to be applied to build products of this task.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Cook

Cook a selection of maps for a certain platform

Attribute

Type

Usage

Description

Project

String

Required

Project file to be cooked.

Platform

String

Required

The cook platform to target (eg. WindowsNoEditor).

Maps

String

Optional

List of maps to be cooked, separated by '+' characters.

Versioned

Boolean

Optional

Additional arguments to be passed to the cooker.

Arguments

String

Optional

Additional arguments to be passed to the cooker.

Tag

Tag List

Optional

Tag to be applied to build products of this task.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Copy

Copies files from one directory to another.

Attribute

Type

Usage

Description

Files

File Spec

Optional

Filter to be applied to the list of input files. Optional.

From

File Spec

Required

The pattern(s) to copy from (such as Engine/*.txt).

To

File Spec

Required

The directory or to copy to.

Overwrite

Boolean

Optional

Whether or not to overwrite existing files.

Tag

Tag List

Optional

Tag to be applied to build products of this task.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

CsCompile

Compiles C# project files, and their dependencies.

Attribute

Type

Usage

Description

Project

String

Required

The C# project file to be compile. More than one project file can be specified by separating with semicolons.

Configuration

String

Optional

The configuration to compile.

Platform

String

Optional

The platform to compile.

Target

String

Required

The target to build.

Arguments

String

Optional

Additional arguments to be passed to the compiler.

EnumerateOnly

Boolean

Optional

Only enumerate build products; do not actually compile the projects.

Tag

Tag List

Optional

Tag to be applied to build products of this task.

TagReferences

Tag List

Optional

Tag to be applied to any non-private references the projects have (such as those that are external and not copied into the output dir).

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Delete

Delete a set of files.

Attribute

Type

Usage

Description

Files

File Spec

Required

List of file specifications separated by semicolons (for example .cpp;Engine/.../.bat), or the name of a tag set.

DeleteEmptyDirectories

Boolean

Optional

Whether to delete empty directories after deleting the files. Defaults to true.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Log

Print a message (and other optional diagnostic information) to the output log.

Attribute

Type

Usage

Description

Message

String

Optional

Message to print out.

Files

File Spec

Optional

If specified, causes the given list of files to be printed after the given message.

IncludeContents

Boolean

Optional

If specified, causes the contents of the given files to be printed out.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Move

This moves files from one directory to another.

Attribute

Type

Usage

Description

Files

File Spec

Optional

Filter to be applied to the list of input files. Optional.

From

File Spec

Required

The pattern(s) to copy from (such as Engine/*.txt).

To

File Spec

Required

The directory or to copy to.

Tag

Tag List

Optional

Tag to be applied to build products of this task.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

MsBuild

This executes MsBuild.

Attribute

Type

Usage

Description

Project

String

Required

The C# project file to be compile. More than one project file can be specified by separating with semicolons.

Configuration

String

Optional

The configuration to compile.

Platform

String

Optional

The platform to compile.

Arguments

String

Optional

Additional options to pass to the compiler.

Verbosity

String

Optional

The MSBuild output verbosity.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

PakFile

This creates a PAK file from a given set of files.

Attribute

Type

Usage

Description

Files

File Spec

Required

List of files, wildcards and tag sets to add to the pak file, separated by ';' characters.

Output

FileReference

Required

PAK file to output.

ResponseFile

FileReference

Optional

Path to a Response File that contains a list of files to add to the pak file, instead of specifying them individually.

RebaseDir

HashSet`1

Optional

Directories to rebase the files relative to. If specified, the shortest path under a listed directory will be used for each file.

Order

FileReference

Optional

Script which gives the order of files.

Sign

FileReference

Optional

Encryption keys for this pak file.

Compress

Boolean

Optional

Whether or not to compress files.

Arguments

String

Optional

Additional arguments to be passed to UnrealPak.

Tag

Tag List

Optional

Tag to be applied to build products of this task.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Rename

This renames a file, or group of files.

Attribute

Type

Usage

Description

Files

File Spec

Required

The file or files to rename.

From

String

Optional

The current file name, or pattern to match (eg. *.txt). Should not include any path separators.

To

String

Required

The new name for the file(s). Should not include any path separators.

Tag

Tag List

Optional

Tag to be applied to the renamed files.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

SanitizeReceipt

This task tags build products and/or runtime dependencies by reading from *.target files.

Attribute

Type

Usage

Description

Files

File Spec

Required

Set of receipt files (*.target) to read, including wildcards and tag names, separated by semicolons.

EngineDir

DirectoryReference

Optional

Path to the Engine folder, used to expand $(EngineDir) properties in receipt files. Defaults to the Engine directory for the current workspace.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

SetVersion

Update the local version files (Engine/Source/Runtime/Launch/Resources/Version.h, Engine/Build/Build.version, and Engine/Source/Programs/DotNETCommon/Metadata.cs) with the given version information.

Attribute

Type

Usage

Description

Change

Int32

Required

The changelist to set in the version files.

CompatibleChange

Int32

Optional

The engine compatible changelist to set in the version files.

Branch

String

Required

The branch string.

Build

String

Optional

The build version string.

Licensee

Boolean

Optional

Whether to set the IS_LICENSEE_VERSION flag to true.

Promoted

Boolean

Optional

Whether to set the ENGINE_IS_PROMOTED_BUILD flag to true.

SkipWrite

Boolean

Optional

If set, don't actually write to the files - just return the version files that would be updated. Useful for local builds.

Tag

Tag List

Optional

Tag to be applied to build products of this task.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Sign

Sign a set of executable files with an installed certificate.

Attribute

Type

Usage

Description

Files

File Spec

Required

List of file specifications separated by semicolons (eg. .cpp;Engine/.../.bat), or the name of a tag set.

Tag

Tag List

Optional

Tag to be applied to build products of this task.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Spawn

This spawns an external executable and waits for it to complete.

Attribute

Type

Usage

Description

Exe

String

Required

Executable to spawn.

Arguments

String

Optional

Arguments for the newly created process.

ErrorLevel

Int32

Optional

The minimum exit code which is treated as an error.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Stage

This stages files listed in a build receipt to an output directory.

Attribute

Type

Usage

Description

Project

FileReference

Optional

The project that this target belongs to.

Target

String

Required

Name of the target to stage.

Platform

UnrealTargetPlatform

Required

Platform to stage.

Configuration

UnrealTargetConfiguration

Required

Configuration to be staged.

Architecture

String

Optional

Architecture to be staged.

ToDir

DirectoryReference

Required

Directory the receipt files should be staged to.

Overwrite

Boolean

Optional

Whether to overwrite existing files.

Tag

Tag List

Optional

Tag to be applied to build products of this task.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Strip

This strips debugging information from a set of files.

Attribute

Type

Usage

Description

Platform

UnrealTargetPlatform

Required

The platform toolchain to strip binaries.

BaseDir

DirectoryReference

Optional

The directory to find files in.

Files

File Spec

Required

List of file specifications separated by semicolons (eg. Engine/.../*.pdb), or the name of a tag set.

OutputDir

DirectoryReference

Optional

Output directory for the stripped files. Defaults to the input path (overwriting the input files).

Tag

Tag List

Optional

Tag to be applied to build products of this task.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Submit

Creates a new changelist and submits a set of files to a Perforce stream.

Attribute

Type

Usage

Description

Description

String

Required

The description for the submitted changelist.

Files

File Spec

Required

The files to submit.

FileType

String

Optional

The Perforce file type for the submitted files (eg. binary+FS32).

Workspace

String

Optional

The workspace name. If specified, a new workspace will be created using the given stream and root directory to submit the files. If not, the current workspace will be used.

Stream

String

Optional

The stream for the workspace; defaults to the current stream. Ignored unless the Workspace attribute is also specified.

RootDir

DirectoryReference

Optional

Root directory for the stream. If not specified, defaults to the current root directory.

RevertUnchanged

Boolean

Optional

Whether to revert unchanged files before attempting to submit.

Force

Boolean

Optional

Force the submit to happen, even if a resolve is needed (always accept current version).

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

SymStore

Task which strips symbols from a set of files

Attribute

Type

Usage

Description

Platform

UnrealTargetPlatform

Required

The platform toolchain required to handle symbol files.

Files

String

Required

List of output files. PDBs will be extracted from this list.

StoreDir

String

Required

Output directory for the compressed symbols.

Product

String

Required

Name of the product for the symbol store records.

BuildVersion

String

Optional

BuildVersion associated with these symbols. Used for cleanup in AgeStore by matching this version against a directory name in a build share.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Tag

Applies a tag to a given set of files. The list of files is found by enumerating the tags and file specifications given by the 'Files' parameter. From this list, any files not matched by the 'Filter' parameter are removed, followed by any files matched by the 'Except' parameter.

Attribute

Type

Usage

Description

BaseDir

DirectoryReference

Optional

Set the base directory to resolve relative paths and patterns against. If set, any absolute patterns (for example, /Engine/Build/...) are taken to be relative to this path. If not, they are taken to be truly absolute.

Files

File Spec

Optional

Set of files to work from, including wildcards and tag names, separated by semicolons. Resolved relative to BaseDir if set, otherwise to the branch root directory.

FileLists

File Spec

Optional

Set of text files to add additional files from. Each file list should have on file per line.

Filter

File Spec

Optional

Patterns to filter the list of files by, including tag names or wildcards. May include patterns that apply to the base directory if set. Defaults to all files if not specified.

Except

File Spec

Optional

Set of patterns to exclude from the matched list. May include tag names of patterns that apply to the base directory.

With

Tag List

Required

Name of the tag to apply.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

TagReceipt

This task tags build products and/or runtime dependencies by reading from *.target files.

Attribute

Type

Usage

Description

Files

File Spec

Required

Set of receipt files (*.target) to read, including wildcards and tag names, separated by semicolons.

EngineDir

DirectoryReference

Optional

Path to the Engine folder, used to expand $(EngineDir) properties in receipt files. Defaults to the Engine directory for the current workspace.

ProjectDir

DirectoryReference

Optional

Path to the project folder, used to expand $(ProjectDir) properties in receipt files. Defaults to the Engine directory for the current workspace. DEPRECATED.

BuildProducts

Boolean

Optional

Whether to tag the Build Products listed in receipts.

BuildProductType

String

Optional

Which type of Build Products to tag (See TargetReceipt.cs - UnrealBuildTool.BuildProductType for valid values).

RuntimeDependencies

Boolean

Optional

Whether to tag the Runtime Dependencies listed in receipts.

StagedFileType

String

Optional

Which type of Runtime Dependencies to tag (See TargetReceipt.cs - UnrealBuildTool.StagedFileType for valid values).

With

Tag List

Required

Name of the tag to apply.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Unzip

Extract files from a zip archive.

Attribute

Type

Usage

Description

ZipFile

File Spec

Required

Path to the zip file to extract.

ToDir

DirectoryReference

Required

Output directory for the extracted files.

Tag

Tag List

Optional

Tag to be applied to the extracted files.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Zip

This compresses files into a zip archive.

Attribute

Type

Usage

Description

FromDir

DirectoryReference

Required

The directory to read compressed files from.

Files

File Spec

Optional

List of file specifications separated by semicolons (eg. .cpp;Engine/.../.bat), or the name of a tag set. Relative paths are taken from FromDir.

ZipFile

FileReference

Required

The zip file to create.

Tag

Tag List

Optional

Tag to be applied to the created zip file.

If

Condition

Optional

Whether to execute this task. It is ignored if this condition evaluates to false.

Select Skin
Light
Dark

新しい Unreal Engine 4 ドキュメントサイトへようこそ!

あなたの声を私たちに伝えるフィードバックシステムを含め、様々な新機能について開発をおこなっています。まだ広く使える状態にはなっていないので、準備ができるまでは、ドキュメントフィードバックフォーラムで、このページについて、もしくは遭遇した問題について教えていただけると助かります。

新しいシステムが稼働した際にお知らせします。

フィードバックを送信