Attached. The script wraps the build command.

Notice that find_root is project-specific. You can use $BASH_SOURCE if the
script is in the project repo.

On Wed, Aug 23, 2023 at 10:10 AM Knut Petter Svendsen <
knutpett+qtcrea...@pvv.org> wrote:

> > Can you explain why you need to patch the paths?
>
> The build system exports (copies) the header files to another directory
> before compiling. The "-I" options refer to that directory. So compiler
> errors in header files points to that location. When clicking on them the
> "wrong" file is opened. My plugin knows where the "real" source is, i just
> need to update the task.
>
> > If you build remotely, I have a script that translates paths on stderr,
> > which I can share if it helps you.
>
> Yes, please share the script. Does it wrap the build command?
>
> Knut
>
>
#!/bin/bash

set -o pipefail

normalize()
{
  if [ "x$WINDOWS" = "x1" ]; then
    sed "s|/usr/src/boost/[^/ ]*|C:/boost/|g; s|/|\\\\|g"
  else
    cat
  fi
}

find_root()
{
  while [ ! -d Project.pro ]; do
    cd ..
    if [ "$PWD" = "/" ]; then
      echo "$0 must be executed inside Project" 1>&2
      return
    fi
  done
  echo $PWD
}

# Runs $2 (e.g. ./buildAll.sh), and translates paths in stderr from local to remote (given by $1) path

if [ $# -lt 2 ]; then
    echo "usage: $0 <local_path> <build_script> [arguments]"
	exit 1
fi

# current directory's parent (should be run from inside TrunkPackRam)
LOCAL=$(find_root)
[ -n "$LOCAL" ] || exit 1

# Windows -> convert backslashes
if echo $1 | grep -q '^.:'; then
  WINDOWS=1
  REMOTE="$(echo "$1" | sed 's|\\|/|g')"
else
  REMOTE="$1"
fi
shift
RUN="$1"
shift
exec 3>&1
# redirect stderr to stdout and stdout to 3, then restore stdout to stderr
$RUN "$@" 2>&1 1>&3 | sed "s|/build/Project|$REMOTE|g;
s|$LOCAL|$REMOTE|g;
s|/build/include/|/src/include/|" | normalize 1>&2
-- 
Qt-creator mailing list
Qt-creator@qt-project.org
https://lists.qt-project.org/listinfo/qt-creator

Reply via email to