Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolves #313 restore ue4-engine image #332

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions docs/ue4-docker-build.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ Monitor resource usage during builds (useful for debugging)
*--no-cache*::
Disable Docker build cache

*--no-full*::
Don't build the ue4-full image (deprecated, use *--target* _target_ instead)

*--no-minimal*::
Don't build the ue4-minimal image (deprecated, use *--target* _target_ instead)

*--opt* _opt_::
Set an advanced configuration option (can be specified multiple times to specify multiple options)

Expand All @@ -111,9 +105,11 @@ Add a suffix to the tags of the built images
*--target* _target_::
Tells ue4-docker to build specific image (including its dependencies).
+
Supported values: `all`, `build-prerequisites`, `full`, `minimal`, `source`.
Supported values: `all`, `build-prerequisites`, `full`, `minimal`, `source`, `engine`.
+
You can specify the `--target` option multiple times.
+
Defaults to `minimal`.

*-ue4cli* _ue4cli_::
Override the default version of ue4cli installed in the ue4-full image
Expand Down
11 changes: 10 additions & 1 deletion src/ue4docker/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,12 +439,21 @@ def build():
else:
logger.info("Skipping ue4-source image build.")

if config.buildTargets["minimal"]:
if config.buildTargets["minimal"] or config.buildTargets["engine"]:
ue4BuildArgs = prereqConsumerArgs + [
"--build-arg",
"TAG={}".format(mainTags[1]),
]

# Build the UE4 Engine source build image, unless requested otherwise by the user
if config.buildTargets["engine"]:
builder.build_builtin_image(
"ue4-engine",
mainTags,
commonArgs + config.platformArgs + ue4BuildArgs,
)
builtImages.append("ue4-engine")

# Build the minimal UE4 CI image, unless requested otherwise by the user
if config.buildTargets["minimal"]:
minimalArgs = (
Expand Down
18 changes: 14 additions & 4 deletions src/ue4docker/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def clean():
"-tag", default=None, help="Only clean images with the specified tag"
)
parser.add_argument("--source", action="store_true", help="Clean ue4-source images")
parser.add_argument("--engine", action="store_true", help="Clean ue4-engine images")
parser.add_argument(
"--all", action="store_true", help="Clean all ue4-docker images"
)
Expand All @@ -52,25 +53,34 @@ def clean():
cleaner.cleanMultiple(dangling, args.dry_run)

# If requested, remove ue4-source images
if args.source == True:
if args.source:
_cleanMatching(
cleaner,
GlobalConfiguration.resolveTag("ue4-source"),
args.tag,
args.dry_run,
)

# If requested, remove ue4-engine images
if args.engine:
_cleanMatching(
cleaner,
GlobalConfiguration.resolveTag("ue4-engine"),
args.tag,
args.dry_run,
)

# If requested, remove everything
if args.all == True:
if args.all:
_cleanMatching(
cleaner, GlobalConfiguration.resolveTag("ue4-*"), args.tag, args.dry_run
)

# If requested, run `docker system prune`
if args.prune == True:
if args.prune:
logger.action("Running `docker system prune`...")
pruneCommand = ["docker", "system", "prune", "-f"]
if args.dry_run == True:
if args.dry_run:
print(pruneCommand)
else:
subprocess.call(pruneCommand)
15 changes: 15 additions & 0 deletions src/ue4docker/dockerfiles/ue4-engine/linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% if combine %}
FROM source as engine
{% else %}
ARG NAMESPACE
ARG TAG
ARG PREREQS_TAG
FROM ${NAMESPACE}/ue4-source:${TAG}-${PREREQS_TAG}
{% endif %}

# Build UBT and build the Engine
# TODO: Fix UE4 compatibility
# RUN ./Engine/Build/BatchFiles/Linux/Build.sh UE4Editor Linux Development -WaitMutex
RUN ./Engine/Build/BatchFiles/Linux/Build.sh UnrealEditor Linux Development -WaitMutex
RUN ./Engine/Build/BatchFiles/Linux/Build.sh ShaderCompileWorker Linux Development -WaitMutex
RUN ./Engine/Build/BatchFiles/Linux/Build.sh UnrealPak Linux Development -WaitMutex
17 changes: 17 additions & 0 deletions src/ue4docker/dockerfiles/ue4-engine/windows/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# escape=`
{% if combine %}
FROM source as engine
{% else %}
ARG NAMESPACE
ARG TAG
ARG PREREQS_TAG
FROM ${NAMESPACE}/ue4-source:${TAG}-${PREREQS_TAG}
{% endif %}

# Build UBT and build the Engine
RUN GenerateProjectFiles.bat
# TODO: Fix UE4 compatibility
# RUN .\Engine\Build\BatchFiles\Build.bat UE4Editor Win64 Development -WaitMutex
RUN .\Engine\Build\BatchFiles\Build.bat UnrealEditor Win64 Development -WaitMutex
RUN .\Engine\Build\BatchFiles\Build.bat ShaderCompileWorker Win64 Development -WaitMutex
RUN .\Engine\Build\BatchFiles\Build.bat UnrealPak Win64 Development -WaitMutex
61 changes: 11 additions & 50 deletions src/ue4docker/infrastructure/BuildConfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,14 @@ def addArguments(parser):
action="store_true",
help="Print `docker build` commands instead of running them",
)
parser.add_argument(
"--no-minimal",
action="store_true",
help="Don't build the ue4-minimal image (deprecated, use --target instead)",
)
parser.add_argument(
"--no-full",
action="store_true",
help="Don't build the ue4-full image (deprecated, use --target instead)",
)
parser.add_argument(
"--no-cache", action="store_true", help="Disable Docker build cache"
)
parser.add_argument(
"--target",
action="append",
help="Add a target to the build list. Valid targets are `build-prerequisites`, `source`, `engine`, `minimal`, `full`, and `all`. May be specified multiple times or comma-separated. Defaults to `all`.",
default=[],
help="Add a target to the build list. Valid targets are `build-prerequisites`, `source`, `engine`, `minimal`, `full`, and `all`. May be specified multiple times or comma-separated. Defaults to `minimal`.",
)
parser.add_argument(
"--random-memory",
Expand Down Expand Up @@ -282,47 +273,12 @@ def __init__(self, parser, argv, logger):
self.args = parser.parse_args(argv)
self.changelist = self.args.changelist

# Figure out what targets we have; this is needed to find out if we need --ue-version.
using_target_specifier_old = self.args.no_minimal or self.args.no_full
using_target_specifier_new = self.args.target is not None

# If we specified nothing, it's the same as specifying `minimal`
if not using_target_specifier_old and not using_target_specifier_new:
if len(self.args.target) <= 0:
self.args.target = ["minimal"]
elif using_target_specifier_old and not using_target_specifier_new:
# Convert these to the new style
logger.warning(
"Using deprecated `--no-*` target specifiers; recommend changing to `--target`",
False,
)

# no-minimal implies no-full
if self.args.no_minimal:
self.args.no_full = True

# Change into target descriptors
self.args.target = []

if not self.args.no_full:
self.args.target += ["full"]

if not self.args.no_minimal:
self.args.target += ["minimal"]

# disabling these was never supported
self.args.target += ["source"]
self.args.target += ["build-prerequisites"]

elif using_target_specifier_new and not using_target_specifier_old:
# these can be token-delimited, so let's just split them apart and then remerge them into one list
split = [item.split(",") for item in self.args.target]
self.args.target = [item for sublist in split for item in sublist]

elif using_target_specifier_old and using_target_specifier_new:
# uhoh
raise RuntimeError(
"specified both `--target` and the old `--no-*` options; please use only `--target`!"
)
# these can be token-delimited, so let's just split them apart and then remerge them into one list
split_target = [item.split(",") for item in self.args.target]
self.args.target = [item for sublist in split_target for item in sublist]

# Now that we have our options in `self.args.target`, evaluate our dependencies
# In a theoretical ideal world this should be code-driven; if you find yourself adding a lot more code to this, consider a redesign!
Expand All @@ -336,6 +292,7 @@ def __init__(self, parser, argv, logger):
self.buildTargets = {
"build-prerequisites": False,
"source": False,
"engine": False,
"minimal": False,
"full": False,
}
Expand All @@ -355,6 +312,10 @@ def __init__(self, parser, argv, logger):
self.buildTargets["minimal"] = True
active_targets.add("source")

if "engine" in active_targets or "all" in active_targets:
self.buildTargets["engine"] = True
active_targets.add("source")

if "source" in active_targets or "all" in active_targets:
self.buildTargets["source"] = True
active_targets.add("build-prerequisites")
Expand Down