Skip to content

Commit

Permalink
switch to xcode 15
Browse files Browse the repository at this point in the history
  • Loading branch information
gdams committed Nov 20, 2023
1 parent 6871690 commit ac10e96
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 65 deletions.
11 changes: 7 additions & 4 deletions ansible/packer/orka-base.pkr.hcl
Expand Up @@ -23,8 +23,8 @@ variable "XCode11_7_SAS_TOKEN" {
default = env("XCode11_7_SAS_TOKEN")
}

variable "XCode12_4_SAS_TOKEN" {
default = env("XCode12_4_SAS_TOKEN")
variable "XCode15_0_1_SAS_TOKEN" {
default = env("XCode15_0_1_SAS_TOKEN")
}

source "macstadium-orka" "sonoma-arm64" {
Expand Down Expand Up @@ -61,6 +61,9 @@ build {
]
}

# Pause the provisioner until user interacts (for install Xcode etc)
provisioner "breakpoint" {}

# Install homebrew and ansible
provisioner "shell" {
inline = [<<EOF
Expand All @@ -87,8 +90,8 @@ EOF
extra_arguments = [
"--extra-vars", "ansible_user=admin",
"--extra-vars", "XCode11_7_SAS_TOKEN=\"${var.XCode11_7_SAS_TOKEN}\"",
"--extra-vars", "XCode12_4_SAS_TOKEN=\"${var.XCode12_4_SAS_TOKEN}\"",
"--tags", "xcode11,xcode12"
"--extra-vars", "XCode15_0_1_SAS_TOKEN=\"${var.XCode15_0_1_SAS_TOKEN}\"",
"--tags", "xcode11,xcode15"
]
command = "source /Users/admin/.zprofile; ansible-playbook"
}
Expand Down
4 changes: 2 additions & 2 deletions ansible/playbooks/AdoptOpenJDK_Unix_Playbook/main.yml
Expand Up @@ -75,9 +75,9 @@
- role: Xcode11
when: ansible_distribution == "MacOSX" and ansible_architecture == "arm64"
tags: [xcode11] # JDK 8
- role: Xcode12
- role: Xcode15
when: ansible_distribution == "MacOSX" and ansible_architecture == "arm64"
tags: [xcode12] # JDK 17+
tags: [xcode15] # JDK 17+
- role: cmake # OpenJ9 / OpenJFX
when: ansible_distribution != "Solaris" # Compile fails on Solaris
tags: [build_tools, build_tools_openj9, build_tools_openjfx]
Expand Down

This file was deleted.

@@ -0,0 +1,59 @@
---
# Xcode 15.0.1 is needed to build JDK 17+
# Xcode 15.0.1 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 Xcode15.0.1 is installed
stat:
path: /Applications/Xcode.app
register: xcode15_installed

- name: Check if SAS variable is defined
set_fact:
apple_variables: yes
when: not xcode15_installed.stat.exists and xcode15_0_1_SAS_TOKEN is defined

- name: Display Information when xcode15_0_1_SAS_TOKEN is not defined
debug:
msg: "xcode15_0_1_SAS_TOKEN is not defined. Xcode will need to be installed manually.
Skipping Xcode installation"
when: not xcode15_installed.stat.exists and apple_variables is not defined

- name: Install Xcode15.0.1
when: not xcode15_installed.stat.exists and apple_variables is defined
block:
- name: Check for /tmp/Xcode_15.0.1.xip
stat:
path: /tmp/Xcode_15.0.1.xip
register: xcode15_4_xip

# Stored in Azure Blob Storage (SAS URL set to expire in 2033)
- name: Download XCode 15.0.1 from Azure blob storage
when: not xcode15_4_xip.stat.exists
get_url:
url: "https://ansiblestorageadopt.blob.core.windows.net/xcode-15-0-1/Xcode_15.0.1.xip?{{ xcode15_0_1_SAS_TOKEN }}"
dest: /tmp/Xcode_15.0.1.xip
mode: 0755

- name: Extract Xcode15.0.1
shell: xip -x /tmp/Xcode_15.0.1.xip
args:
chdir: /tmp
creates: /tmp/Xcode.app

- name: Move Xcode15.0.1 to /Applications directory
copy:
src: /tmp/Xcode.app
dest: /Applications/Xcode.app/
remote_src: true

- name: Select Xcode15.0.1 as the default Xcode
shell: sudo xcode-select --switch /Applications/Xcode.app

- name: Accept Xcode license
shell: arch -x86_64 sudo xcodebuild -license accept

- name: Clean up Xcode15.0.1.xip file
file:
path: /tmp/Xcode_15.0.1.xip
state: absent

0 comments on commit ac10e96

Please sign in to comment.