From d85f30362099bd7eed669ea6b1b2c47df8c92282 Mon Sep 17 00:00:00 2001 From: William Parker <52783864+Willsparker@users.noreply.github.com> Date: Wed, 30 Oct 2019 10:39:21 +0000 Subject: [PATCH] Modified testScript.sh to allow for Win2012 to build JDK (#942) * Modified scripts to allow for jdk build on windows --- ansible/pbTestScripts/buildJDKWin.sh | 9 +++++++++ ansible/pbTestScripts/testScript.sh | 16 +++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100755 ansible/pbTestScripts/buildJDKWin.sh diff --git a/ansible/pbTestScripts/buildJDKWin.sh b/ansible/pbTestScripts/buildJDKWin.sh new file mode 100755 index 0000000000..5ce5797b1d --- /dev/null +++ b/ansible/pbTestScripts/buildJDKWin.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -eu +export TARGET_OS=windows +export ARCHITECTURE=x64 +export JAVA_TO_BUILD=jdk8 +export VARIANT=hotspot +export JDK7_BOOT_DIR=/cygdrive/c/openjdk/jdk7 +export PATH=/usr/bin/:$PATH +/cygdrive/c/openjdk-build/makejdk-any-platform.sh -J /cygdrive/c/openjdk/jdk-8 --configure-args "--disable-ccache --with-toolchain-version=2013" --freetype-version 2.5.3 -v jdk8u diff --git a/ansible/pbTestScripts/testScript.sh b/ansible/pbTestScripts/testScript.sh index c2f5eb001e..5339fc3864 100755 --- a/ansible/pbTestScripts/testScript.sh +++ b/ansible/pbTestScripts/testScript.sh @@ -144,6 +144,16 @@ testBuild() vagrant ssh -c "cd /vagrant/pbTestScripts && ./buildJDK.sh" } +testBuildWin() +{ + # Ensures the git config won't change line endings + vagrant powershell -c "Start-Process powershell -Verb runAs; C:/cygwin64/bin/sed -i -e 's/autocrlf.*/autocrlf = false/g' C:\\ProgramData/Git/config" + vagrant powershell -c "cd C:/; if (-not (Test-Path C:/openjdk-build -PathType Container) ) { echo 'Cloning openJDK-build repo' ; git clone https://github.com/adoptopenjdk/openjdk-build ; sleep 3 }" + # Runs the build script via ansible, as vagrant powershell gives error messages that ansible doesn't. + # See: https://github.com/AdoptOpenJDK/openjdk-infrastructure/pull/942#issuecomment-539946564 + cd $WORKSPACE/adoptopenjdkPBTests/$folderName-$branchName/ansible && ansible all -i playbooks/AdoptOpenJDK_Windows_Playbook/hosts.win -u vagrant -m raw -a "Start-Process powershell.exe -Verb runAs; cd C:/; sh C:/vagrant/pbTestScripts/buildJDKWin.sh" +} + # Takes the OS as arg 1 startVMPlaybook() { @@ -197,7 +207,11 @@ startVMPlaybookWin() vagrant powershell -c "Start-Process powershell -Verb runAs; \$size = (Get-PartitionSupportedSize -DriveLetter c); Resize-Partition -DriveLetter c -Size \$size.SizeMax" fi # run the ansible playbook on the VM & logs the output. - ansible-playbook -i playbooks/AdoptOpenJDK_Windows_Playbook/hosts.win -u vagrant --skip-tags jenkins,adoptopenjdk playbooks/AdoptOpenJDK_Windows_Playbook/main.yml 2>&1 | tee $WORKSPACE/adoptopenjdkPBTests/logFiles/$folderName.$branchName.$OS.log + ansible-playbook -i playbooks/AdoptOpenJDK_Windows_Playbook/hosts.win -u vagrant --skip-tags jenkins,adoptopenjdk,build playbooks/AdoptOpenJDK_Windows_Playbook/main.yml 2>&1 | tee $WORKSPACE/adoptopenjdkPBTests/logFiles/$folderName.$branchName.$OS.log + if [[ "$testNativeBuild" = true ]]; then + testBuildWin + fi + vagrant halt } destroyVM()