Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • bazel/ape
1 result
Show changes
Commits on Source (4)
# [1.0.0-beta.9](https://git.gitlab.arm.com/bazel/ape/compare/v1.0.0-beta.8...v1.0.0-beta.9) (2024-06-17)
### Bug Fixes
- **assimilate:** symlink on Windows ([21c70a3](https://git.gitlab.arm.com/bazel/ape/commit/21c70a35358847fb6452f1b086d5ae208b0f9b33))
- **assimilate:** use ELF on Apple Silicon ([85084d3](https://git.gitlab.arm.com/bazel/ape/commit/85084d326695d94c033e9458ebad84cabb83455d))
# [1.0.0-beta.8](https://git.gitlab.arm.com/bazel/ape/compare/v1.0.0-beta.7...v1.0.0-beta.8) (2024-06-17)
### Bug Fixes
......
module(
name = "ape",
version = "1.0.0-beta.8",
version = "1.0.0-beta.9",
bazel_compatibility = [
">=7.0.0",
],
......
......@@ -40,23 +40,41 @@ ATTRS = {
def implementation(ctx):
windows = ctx.attr._windows[platform_common.ConstraintValueInfo]
macos = ctx.attr._macos[platform_common.ConstraintValueInfo]
arm64 = ctx.attr._arm64[platform_common.ConstraintValueInfo]
amd64 = ctx.attr._amd64[platform_common.ConstraintValueInfo]
basename = ctx.attr.basename or ctx.label.name
executable = ctx.actions.declare_file("{}.ape/{}".format(ctx.label.name, basename))
if ctx.target_platform_has_constraint(windows):
_symlink(ctx, executable)
else:
_assimilate(ctx, executable)
files = depset([executable])
runfiles = ctx.runfiles([executable])
return DefaultInfo(
executable = executable,
files = files,
runfiles = runfiles,
)
def _assimilate(ctx, executable):
ape = ctx.toolchains["//ape/toolchain/ape:type"]
executable = ctx.actions.declare_file("{}.ape/{}".format(ctx.label.name, basename))
windows = ctx.attr._windows[platform_common.ConstraintValueInfo]
macos = ctx.attr._macos[platform_common.ConstraintValueInfo]
arm64 = ctx.attr._arm64[platform_common.ConstraintValueInfo]
amd64 = ctx.attr._amd64[platform_common.ConstraintValueInfo]
args = ctx.actions.args()
args.add(ctx.file._assimilate)
# Executable format
if ctx.target_platform_has_constraint(windows):
pass # PE
elif ctx.target_platform_has_constraint(macos):
fail("Cannot assimilate on Windows, APE are already PE format. Symlink instead.")
elif ctx.target_platform_has_constraint(macos) and not ctx.target_platform_has_constraint(arm64):
args.add("-m") # MachO
else:
args.add("-e") # ELF
......@@ -83,14 +101,11 @@ def implementation(ctx):
toolchain = "//ape/toolchain/assimilate:type",
)
files = depset([executable])
runfiles = ctx.runfiles([executable])
return DefaultInfo(
executable = executable,
files = files,
runfiles = runfiles,
def _symlink(ctx, executable):
ctx.actions.symlink(
output = executable,
target_file = ctx.file.src,
is_executable = True,
)
ape_assimilate = rule(
......