def get_package_root(ctx):
    """
    Get the full path to the package output directory, relative to workspace root.

    Args:
        ctx: The Bazel rule execution context object.

    Returns:
        The full path.

    """
    package_root = ctx.bin_dir.path
    if ctx.label.workspace_root:
        package_root += "/" + ctx.label.workspace_root
    if ctx.label.package:
        package_root += "/" + ctx.label.package

    return package_root