Skip to content

Conversation

@hysw
Copy link
Collaborator

@hysw hysw commented Nov 27, 2025

No description provided.

@hysw hysw marked this pull request as draft November 27, 2025 23:00
@hysw hysw force-pushed the dpkg branch 4 times, most recently from 85bd214 to ccee0ab Compare November 28, 2025 01:01
@hysw hysw force-pushed the dpkg branch 2 times, most recently from eae670e to 27bf71f Compare December 12, 2025 00:00
@hysw hysw marked this pull request as ready for review December 12, 2025 00:01
@hysw
Copy link
Collaborator Author

hysw commented Dec 12, 2025

This is a partial solution to automated linux packaging.

wangra-google
wangra-google previously approved these changes Dec 12, 2025
@@ -0,0 +1,56 @@
#!/bin/bash
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider marking this script as executable

mkdir -p build/package_linux/host
# /home/runner/work/dive/Qt
pushd build/package_linux/device
cmake -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DRY. consider invoking build_android.sh instead to reduce the number of copies and improve maintainability

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build_android.sh script is quite a bit different than the scripts here. They overlap in CMake options, and that's about it.

We probably should have a cmake preset.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea

java-version: '17'
distribution: 'temurin'
- name: Check out code
uses: actions/checkout@v3
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update github action pinned version.


readonly DIVE_ROOT="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd )"

mkdir -p build/package_linux/device
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be explicitly prefixed with DIVE_ROOT for consistent behavior or did you want to allow the user to change this based on their current working directory?

-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=NEVER \
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=NEVER \
-DDIVE_GFXR_GRADLE_CONSOLE=plain \
${DIVE_ROOT} || exit 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the exits are redundant given the set -e at the top

# See the License for the specific language governing permissions and
# limitations under the License.

set -ex
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: set -u will halt for undefined variables. This can catch if e.g. ANDROID_NDK_HOME is not set

Suggested change
set -ex
set -eux

pushd "${DIVE_BUILD_ROOT}/package_linux/device"
cmake -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
-G "Ninja" \
-DCMAKE_MAKE_PROGRAM="ninja" \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Given that the generator is Ninja, I don't think we need to explicitly set the make program as well

Suggested change
-DCMAKE_MAKE_PROGRAM="ninja" \

-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=NEVER \
-DDIVE_GFXR_GRADLE_CONSOLE=plain \
${DIVE_ROOT}
cmake --build . --config=Debug -j
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is -j necessary with ninja? I think "all the jobs!" is the ninja default

Also since we're not using a multi-config generator, do we need --config?

Suggested change
cmake --build . --config=Debug -j
cmake --build .

Comment on lines +50 to +51
cmake --build . --config Release
cmake --install . --prefix ../dive_linux --config Release
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we're not using the multi-config generator, do we need --config?

Suggested change
cmake --build . --config Release
cmake --install . --prefix ../dive_linux --config Release
cmake --build .
cmake --install . --prefix ../dive_linux

if(EXISTS "${DIVE_ANDROID_PREBUILT}")
install(
DIRECTORY "${DIVE_ANDROID_PREBUILT}/"
# TODO: fix device resources location.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer TODO with bugs so that future readers have more context

cat build/.ninja_log
- name: Produce install artifacts
run: |
cmake --install build --prefix build/install_artifact --config Release
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: since we're not using the multi-config genreator, do we need --config? Also, this is a debug build

Suggested change
cmake --install build --prefix build/install_artifact --config Release
cmake --install build --prefix build/install_artifact

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to be updated according to #679

Comment on lines +502 to +503
touch build/package_linux/dive_android_is_prebuilt
bash scripts/package_linux.sh
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optional: consider making dive_android_is_prebuilt an option for package_linux.sh so that it's more obvious to callers about the behavior they're going to get. It also lets the caller more easily choose behavior

run: ls -R build/package_linux/dive_android
- name: Build
run: |
mkdir -p build/package_linux/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: since you downloaded build/package_linux, do you need to mkdir?

Suggested change
mkdir -p build/package_linux/

@wangra-google
Copy link
Collaborator

a more general question, we are currently saving capture files, or even crash dump file (https://github.com/google/dive/pull/638/changes#diff-ecc0a1f137a1e178eb72d83ee5750d7f896705149afb8c3fab743c2a05e97952R106) at the same folder as executables, would that be a problem with your change since the user may not have write permission with the executable install folder?

@hysw
Copy link
Collaborator Author

hysw commented Dec 19, 2025

a more general question, we are currently saving capture files, or even crash dump file at the same folder as executables, would that be a problem with your change since the user may not have write permission with the executable install folder?

That's a related but separate question. We should follow platform idiom for those, e.g. probably ${HOME}/.dive-profiler on Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants