From a1c45af018ad8ebab328771ec0d05a1868d567dc Mon Sep 17 00:00:00 2001 From: Haroon Khel <34969545+Haroon-Khel@users.noreply.github.com> Date: Fri, 17 Nov 2023 06:22:22 +0800 Subject: [PATCH] unixpb: Add Xcode11 installation tasks to Unix playbook (#3197) * unixPb: add xcode11 install tasks to playbook * update message * correct tags * correct condition and update comment * fix conditional * change command to shell * xcode11 * change hosts parameter back to original * typo * switch to blob storage --------- Co-authored-by: George Adams --- .../AdoptOpenJDK_Unix_Playbook/main.yml | 4 +- .../roles/Xcode11/tasks/main.yml | 46 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode11/tasks/main.yml diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/main.yml index b72e993743..cec258edef 100644 --- a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/main.yml +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/main.yml @@ -74,7 +74,9 @@ tags: [build_tools] - role: Xcode when: ansible_distribution == "MacOSX" - tags: [build_tools, xcode, adoptopenjdk] + - role: Xcode11 + when: ansible_distribution == "MacOSX" and ansible_architecture == "arm64" + tags: [xcode11] - role: cmake # OpenJ9 / OpenJFX when: ansible_distribution != "Solaris" # Compile fails on Solaris tags: [build_tools, build_tools_openj9, build_tools_openjfx] diff --git a/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode11/tasks/main.yml b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode11/tasks/main.yml new file mode 100644 index 0000000000..6cd83dd4f4 --- /dev/null +++ b/ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/Xcode11/tasks/main.yml @@ -0,0 +1,46 @@ +--- +# Xcode 11.7 is needed to build x64 JDK8 om Arm64 Mac +# Xcode11.7 can be downloaded from https://developer.apple.com/download/all after authentication with apple ID and password +# See https://github.com/adoptium/infrastructure/issues/2536#issuecomment-1708716478 + +- name: Check if Xcode11.7 is installed + stat: + path: /Applications/Xcode-11.7.app/ + register: xcode11_installed + +- name: Check if SAS variable is defined + set_fact: + apple_variables: yes + when: not xcode11_installed.stat.exists and XCode11.7_SAS_TOKEN is defined + +- name: Display Information when XCode11.7_SAS_TOKEN is not defined + debug: + msg: "XCode11.7_SAS_TOKEN is not defined. Xcode will need to be installed manually. + Skipping Xcode installation" + when: not xcode11_installed.stat.exists and apple_variables is not defined + +- name: Install Xcode11.7 + when: not xcode11_installed.stat.exists and apple_variables is defined + block: + - name: Download XCode 11.7 from Azure blob storage + get_url: + url: "https://ansiblestorageadopt.blob.core.windows.net/xcode11-7/Xcode_11.7.xip?{{ XCode11.7_SAS_TOKEN }}" + dest: /tmp/Xcode_11.7.xip + mode: 0755 + + - name: Extract Xcode11.7 + shell: xip -x /tmp/Xcode_11.7.xip + args: + chdir: /tmp + creates: /tmp/Xcode.app + + - name: Move Xcode11.7 to /Applications directory + copy: + src: /tmp/Xcode.app + dest: /Applications/Xcode-11.7.app/ + remote_src: true + + - name: Clean up Xcode11.7.xip file + file: + path: /tmp/Xcode_11.7.xip + state: absent