Skip to content

Commit

Permalink
Modified testScript.sh to allow for Win2012 to build JDK (#942)
Browse files Browse the repository at this point in the history
* Modified scripts to allow for jdk build on windows
  • Loading branch information
Willsparker authored and sxa555 committed Oct 30, 2019
1 parent 6858445 commit d85f303
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
9 changes: 9 additions & 0 deletions ansible/pbTestScripts/buildJDKWin.sh
Original file line number Diff line number Diff line change
@@ -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
16 changes: 15 additions & 1 deletion ansible/pbTestScripts/testScript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit d85f303

Please sign in to comment.