kou commented on code in PR #13556:
URL: https://github.com/apache/arrow/pull/13556#discussion_r917139854


##########
cpp/cmake_modules/ThirdpartyToolchain.cmake:
##########
@@ -752,6 +752,14 @@ set(EP_COMMON_CMAKE_ARGS
     
-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=${CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY}
     -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE})
 
+# Enable s/ccache if set by parent.
+if(CMAKE_CXX_COMPILER_LAUNCHER AND CMAKE_CXX_COMPILER_LAUNCHER)
+  set(EP_COMMON_CMAKE_ARGS

Review Comment:
   Could you use `list(APPEND EP_COMMON_CMAKE_ARGS ...)`?



##########
dev/tasks/r/github.packages.yml:
##########
@@ -114,17 +124,38 @@ jobs:
       - run: git config --global core.autocrlf false
       {{ macros.github_checkout_arrow()|indent }}
       {{ macros.github_change_r_pkg_version(is_fork, '${{ 
needs.source.outputs.pkg_version }}')|indent }}
-
       - uses: r-lib/actions/setup-r@v2
         with:
           rtools-version: 40
           r-version: "4.0"
           Ncpus: 2
+      - name: Get sccache
+        shell: bash
+        run: |
+          SCCACHE_BUILD=pc-windows-msvc
+          
SCCACHE_URL="https://github.com/mozilla/sccache/releases/download/v0.3.0/sccache-v0.3.0-x86_64-$SCCACHE_BUILD.tar.gz";
+
+          # Download archive and checksum
+          curl -L $SCCACHE_URL --output sccache.tar.gz
+          curl -L $SCCACHE_URL.sha256 --output sccache.tar.gz.sha256
+
+          SCCACHE_ARCHIVE=sccache.tar.gz
+          echo "$(cat $SCCACHE_ARCHIVE.sha256) $SCCACHE_ARCHIVE" | sha256sum 
--check --status
+
+          mkdir -p sccache
+          tar -xzvf $SCCACHE_ARCHIVE --strip-component=1 --directory sccache
 
+          echo "$(pwd)/sccache" >> $GITHUB_PATH
+          echo "SCCACHE_PATH=$(pwd)/sccache/sccache.exe" >> $GITHUB_ENV
       - name: Build Arrow C++ with rtools40
         shell: bash
         env:
           ARROW_HOME: "arrow"
+          AWS_SECRET_ACCESS_KEY: {{ '${{ secrets.AWS_SECRET_ACCESS_KEY }}' }}
+          AWS_ACCESS_KEY_ID: {{ '${{ secrets.AWS_ACCESS_KEY_ID }}' }}
+          SCCACHE_BUCKET: {{ '${{ secrets.SCCACHE_BUCKET }}' }}
+          SCCACHE_S3_KEY_PREFIX: 'sccache'
+          ARROW_USE_SCCACHE: ON

Review Comment:
   Could you sort this list?



##########
cpp/cmake_modules/ThirdpartyToolchain.cmake:
##########
@@ -752,6 +752,14 @@ set(EP_COMMON_CMAKE_ARGS
     
-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=${CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY}
     -DCMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE})
 
+# Enable s/ccache if set by parent.
+if(CMAKE_CXX_COMPILER_LAUNCHER AND CMAKE_CXX_COMPILER_LAUNCHER)
+  set(EP_COMMON_CMAKE_ARGS
+      ${EP_COMMON_CMAKE_ARGS}
+      -DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}
+      -DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER})
+endif()

Review Comment:
   Wow! Can we split this as a separated pull request to merge only this 
without sscache change?



##########
cpp/CMakeLists.txt:
##########
@@ -215,18 +215,39 @@ else()
   set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
 endif()
 
-if(ARROW_USE_CCACHE
-   AND NOT CMAKE_C_COMPILER_LAUNCHER
-   AND NOT CMAKE_CXX_COMPILER_LAUNCHER)
+if((ARROW_USE_SCCACHE)
+  AND NOT CMAKE_C_COMPILER_LAUNCHER
+  AND NOT CMAKE_CXX_COMPILER_LAUNCHER)

Review Comment:
   ```suggestion
      AND NOT CMAKE_C_COMPILER_LAUNCHER
      AND NOT CMAKE_CXX_COMPILER_LAUNCHER)
   ```



##########
cpp/CMakeLists.txt:
##########
@@ -215,18 +215,39 @@ else()
   set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
 endif()
 
-if(ARROW_USE_CCACHE
-   AND NOT CMAKE_C_COMPILER_LAUNCHER
-   AND NOT CMAKE_CXX_COMPILER_LAUNCHER)
+if((ARROW_USE_SCCACHE)
+  AND NOT CMAKE_C_COMPILER_LAUNCHER
+  AND NOT CMAKE_CXX_COMPILER_LAUNCHER)
+
+  find_program(SCCACHE_FOUND sccache)
+  
+  if(NOT SCCACHE_FOUND AND DEFINED ENV{SCCACHE_PATH})
+    # cmake has problems finding sccache from within mingw

Review Comment:
   Can we remove this by adding `chmod +x sccache/sccache.exe`?



##########
ci/scripts/PKGBUILD:
##########
@@ -128,7 +129,7 @@ build() {
     -DCMAKE_BUILD_TYPE="release" \
     -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
     -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD} \
-    -DCMAKE_VERBOSE_MAKEFILE=ON
+    -DCMAKE_VERBOSE_MAKEFILE=ON 

Review Comment:
   ```suggestion
       -DCMAKE_VERBOSE_MAKEFILE=ON
   ```



##########
dev/tasks/r/github.packages.yml:
##########
@@ -82,14 +82,24 @@ jobs:
       {{ macros.github_checkout_arrow()|indent }}
       {{ macros.github_change_r_pkg_version(is_fork, '${{ 
needs.source.outputs.pkg_version }}')|indent }}
       {{ macros.github_install_archery()|indent }}
+
       - name: Build libarrow
         shell: bash
         env:
-          UBUNTU: {{ '${{ matrix.config.version}}' }}
+          UBUNTU: {{ '${{ matrix.config.version }}' }}
+          SC_KEY: {{' ${{ secrets.AWS_SECRET_ACCESS_KEY }}' }}
+          SC_ID: {{ '${{ secrets.AWS_ACCESS_KEY_ID }}' }}
+          SC_BUCKET: {{ '${{ secrets.SCCACHE_BUCKET }}' }}
+          SC_PREFIX: sccache

Review Comment:
   How about using `SCCACHE_` as prefix like others?



##########
dev/tasks/r/github.packages.yml:
##########
@@ -280,10 +319,33 @@ jobs:
         with:
           install-r: false
       {{ macros.github_setup_local_r_repo(false, false)|indent }}
+      - name: Get sccache
+        shell: bash
+        run: |
+          SCCACHE_BUILD=unknown-linux-musl
+          
SCCACHE_URL="https://github.com/mozilla/sccache/releases/download/v0.3.0/sccache-v0.3.0-x86_64-$SCCACHE_BUILD.tar.gz";
+
+          # Download archive and checksum
+          curl -L $SCCACHE_URL --output sccache.tar.gz
+          curl -L $SCCACHE_URL.sha256 --output sccache.tar.gz.sha256
+
+          SCCACHE_ARCHIVE=sccache.tar.gz
+          echo "$(cat $SCCACHE_ARCHIVE.sha256) $SCCACHE_ARCHIVE" | sha256sum 
--check --status
+
+          mkdir -p sccache
+          tar -xzvf $SCCACHE_ARCHIVE --strip-component=1 --directory sccache

Review Comment:
   Do we need `chmod +x sscache/sscache`?



##########
r/inst/build_arrow_static.sh:
##########
@@ -81,10 +96,14 @@ ${CMAKE} -DARROW_BOOST_USE_SHARED=OFF \
     -DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON \
     -DCMAKE_UNITY_BUILD=${CMAKE_UNITY_BUILD:-OFF} \
     -Dxsimd_SOURCE=${xsimd_SOURCE:-} \
+    -DARROW_USE_SCCACHE=ON \

Review Comment:
   Could you keep alphabetical order?



##########
dev/tasks/r/github.packages.yml:
##########
@@ -280,10 +319,33 @@ jobs:
         with:
           install-r: false
       {{ macros.github_setup_local_r_repo(false, false)|indent }}
+      - name: Get sccache
+        shell: bash
+        run: |
+          SCCACHE_BUILD=unknown-linux-musl
+          
SCCACHE_URL="https://github.com/mozilla/sccache/releases/download/v0.3.0/sccache-v0.3.0-x86_64-$SCCACHE_BUILD.tar.gz";
+
+          # Download archive and checksum
+          curl -L $SCCACHE_URL --output sccache.tar.gz
+          curl -L $SCCACHE_URL.sha256 --output sccache.tar.gz.sha256
+
+          SCCACHE_ARCHIVE=sccache.tar.gz
+          echo "$(cat $SCCACHE_ARCHIVE.sha256) $SCCACHE_ARCHIVE" | sha256sum 
--check --status
+
+          mkdir -p sccache
+          tar -xzvf $SCCACHE_ARCHIVE --strip-component=1 --directory sccache
+
+          echo "$(pwd)/sccache" >> $GITHUB_PATH
+          echo "SCCACHE_PATH=$(pwd)/sccache/sccache.exe" >> $GITHUB_ENV

Review Comment:
   ```suggestion
             echo "SCCACHE_PATH=$(pwd)/sccache/sccache" >> $GITHUB_ENV
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to