Skip to content

Commit 3fc16fc

Browse files
sarutakHyukjinKwon
authored andcommitted
[SPARK-37103][INFRA] Switch from Maven to SBT to build Spark on AppVeyor
### What changes were proposed in this pull request? This PR proposes to switch from Maven to SBT to build Spark on AppVeyor. ### Why are the changes needed? Recently, building Spark on AppVeyor almost always fails due to StackOverflowError at compile time. We can't identify the reason so far but one workaround would be building with SBT. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? AppVeyor itself. Closes #34373 from sarutak/appveyor-sbt. Authored-by: Kousuke Saruta <[email protected]> Signed-off-by: Hyukjin Kwon <[email protected]>
1 parent 8f6af64 commit 3fc16fc

File tree

4 files changed

+31
-9
lines changed

4 files changed

+31
-9
lines changed

appveyor.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ cache:
3939
- C:\Users\appveyor\.m2
4040

4141
install:
42-
# Install maven and dependencies
42+
# Install SBT and dependencies
4343
- ps: .\dev\appveyor-install-dependencies.ps1
4444
# Required package for R unit tests. xml2 is required to use jUnit reporter in testthat.
4545
- cmd: Rscript -e "install.packages(c('knitr', 'rmarkdown', 'testthat', 'e1071', 'survival', 'arrow', 'xml2'), repos='https://cloud.r-project.org/')"
@@ -49,7 +49,11 @@ build_script:
4949
# '-Djna.nosys=true' is required to avoid kernel32.dll load failure.
5050
# See SPARK-28759.
5151
# Ideally we should check the tests related to Hive in SparkR as well (SPARK-31745).
52-
- cmd: mvn -DskipTests -Psparkr -Djna.nosys=true package
52+
- cmd: set SBT_MAVEN_PROFILES=-Psparkr
53+
- cmd: set SBT_OPTS=-Djna.nosys=true -Dfile.encoding=UTF-8 -Xms4096m -Xms4096m -XX:ReservedCodeCacheSize=128m
54+
- cmd: sbt package
55+
- cmd: set SBT_MAVEN_PROFILES=
56+
- cmd: set SBT_OPTS=
5357

5458
environment:
5559
NOT_CRAN: true

dev/appveyor-install-dependencies.ps1

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,32 @@ if (!(Test-Path $tools)) {
7979
}
8080

8181
# ========================== Maven
82+
# Push-Location $tools
83+
#
84+
# $mavenVer = "3.6.3"
85+
# Start-FileDownload "https://archive.apache.org/dist/maven/maven-3/$mavenVer/binaries/apache-maven-$mavenVer-bin.zip" "maven.zip"
86+
#
87+
# # extract
88+
# Invoke-Expression "7z.exe x maven.zip"
89+
#
90+
# # add maven to environment variables
91+
# $env:PATH = "$tools\apache-maven-$mavenVer\bin;" + $env:PATH
92+
# $env:M2_HOME = "$tools\apache-maven-$mavenVer"
93+
# $env:MAVEN_OPTS = "-Xmx2g -XX:ReservedCodeCacheSize=1g"
94+
#
95+
# Pop-Location
96+
97+
# ========================== SBT
8298
Push-Location $tools
8399

84-
$mavenVer = "3.6.3"
85-
Start-FileDownload "https://archive.apache.org/dist/maven/maven-3/$mavenVer/binaries/apache-maven-$mavenVer-bin.zip" "maven.zip"
100+
$sbtVer = "1.5.5"
101+
Start-FileDownload "https://github.com/sbt/sbt/releases/download/v$sbtVer/sbt-$sbtVer.zip" "sbt.zip"
86102

87103
# extract
88-
Invoke-Expression "7z.exe x maven.zip"
104+
Invoke-Expression "7z.exe x sbt.zip"
89105

90106
# add maven to environment variables
91-
$env:PATH = "$tools\apache-maven-$mavenVer\bin;" + $env:PATH
92-
$env:M2_HOME = "$tools\apache-maven-$mavenVer"
93-
$env:MAVEN_OPTS = "-Xmx2g -XX:ReservedCodeCacheSize=1g"
107+
$env:PATH = "$tools\sbt\bin;" + $env:PATH
94108

95109
Pop-Location
96110

project/SparkBuild.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,8 @@ object SparkR {
917917
val buildRPackage = taskKey[Unit]("Build the R package")
918918
lazy val settings = Seq(
919919
buildRPackage := {
920-
val command = baseDirectory.value / ".." / "R" / "install-dev.sh"
920+
val postfix = if (File.separator == "\\") ".bat" else ".sh"
921+
val command = baseDirectory.value / ".." / "R" / s"install-dev$postfix"
921922
Process(command.toString).!!
922923
},
923924
(Compile / compile) := (Def.taskDyn {

project/build.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616
#
17+
18+
# If you change sbt.version, please change the version
19+
# specified in appveyor-install-dependencies.ps1 too.
1720
sbt.version=1.5.5

0 commit comments

Comments
 (0)