1 #
2 # Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 #
5 # This code is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 only, as
7 # published by the Free Software Foundation. Oracle designates this
8 # particular file as subject to the "Classpath" exception as provided
9 # by Oracle in the LICENSE file that accompanied this code.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
23 # questions.
24 #
25
26 name: 'Build (windows)'
27
28 on:
29 workflow_call:
30 inputs:
31 platform:
32 required: true
33 type: string
34 runs-on:
35 required: true
36 type: string
37 extra-conf-options:
38 required: false
39 type: string
40 make-target:
41 required: false
42 type: string
43 default: 'product-bundles test-bundles'
44 debug-levels:
45 required: false
46 type: string
47 default: '[ "debug", "release" ]'
48 msvc-toolset-version:
49 required: true
50 type: string
51 msvc-toolset-architecture:
52 required: true
53 type: string
54 configure-arguments:
55 required: false
56 type: string
57 make-arguments:
58 required: false
59 type: string
60 dry-run:
61 required: false
62 type: boolean
63 default: false
64
65 env:
66 # These are needed to make the MSYS2 bash work properly
67 MSYS2_PATH_TYPE: minimal
68 CHERE_INVOKING: 1
69
70 jobs:
71 build-windows:
72 name: build
73 runs-on: ${{ inputs.runs-on }}
74 defaults:
75 run:
76 shell: bash
77
78 strategy:
79 fail-fast: false
80 matrix:
81 debug-level: ${{ fromJSON(inputs.debug-levels) }}
82 include:
83 - debug-level: debug
84 flags: --with-debug-level=fastdebug
85 suffix: -debug
86
87 steps:
88 - name: 'Checkout the JDK source'
89 uses: actions/checkout@v6
90
91 - name: 'Get MSYS2'
92 uses: ./.github/actions/get-msys2
93
94 - name: 'Get the BootJDK'
95 id: bootjdk
96 uses: ./.github/actions/get-bootjdk
97 with:
98 platform: windows-x64
99
100 - name: 'Get JTReg'
101 id: jtreg
102 uses: ./.github/actions/get-jtreg
103
104 - name: 'Get GTest'
105 id: gtest
106 uses: ./.github/actions/get-gtest
107
108 - name: 'Check toolchain installed'
109 id: toolchain-check
110 run: |
111 set +e
112 '/c/Program Files/Microsoft Visual Studio/2022/Enterprise/vc/auxiliary/build/vcvars64.bat' -vcvars_ver=${{ inputs.msvc-toolset-version }}
113 if [ $? -eq 0 ]; then
114 echo "Toolchain is already installed"
115 echo "toolchain-installed=true" >> $GITHUB_OUTPUT
116 else
117 echo "Toolchain is not yet installed"
118 echo "toolchain-installed=false" >> $GITHUB_OUTPUT
119 fi
120
121 - name: 'Install toolchain and dependencies'
122 run: |
123 # Run Visual Studio Installer
124 '/c/Program Files (x86)/Microsoft Visual Studio/Installer/vs_installer.exe' \
125 modify --quiet --installPath 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise' \
126 --add Microsoft.VisualStudio.Component.VC.${{ inputs.msvc-toolset-version }}.${{ inputs.msvc-toolset-architecture }}
127 if: steps.toolchain-check.outputs.toolchain-installed != 'true'
128
129 - name: 'Configure'
130 run: >
131 bash configure
132 --with-conf-name=${{ inputs.platform }}
133 ${{ matrix.flags }}
134 --with-version-opt=${GITHUB_ACTOR}-${GITHUB_SHA}
135 --with-boot-jdk=${{ steps.bootjdk.outputs.path }}
136 --with-jtreg=${{ steps.jtreg.outputs.path }}
137 --with-gtest=${{ steps.gtest.outputs.path }}
138 --with-msvc-toolset-version=${{ inputs.msvc-toolset-version }}
139 --with-jmod-compress=zip-1
140 --disable-jvm-feature-shenandoahgc
141 --with-external-symbols-in-bundles=none
142 ${{ inputs.extra-conf-options }} ${{ inputs.configure-arguments }} || (
143 echo "Dumping config.log:" &&
144 cat config.log &&
145 exit 1)
146 env:
147 # We need a minimal PATH on Windows
148 # Set PATH to "", so just GITHUB_PATH is included
149 PATH: ''
150 shell: env /usr/bin/bash --login -eo pipefail {0}
151 if: ${{ inputs.dry-run == false }}
152
153 - name: 'Build'
154 id: build
155 uses: ./.github/actions/do-build
156 with:
157 make-target: '${{ inputs.make-target }} ${{ inputs.make-arguments }}'
158 platform: ${{ inputs.platform }}
159 debug-suffix: '${{ matrix.suffix }}'
160 if: ${{ inputs.dry-run == false }}
161
162 - name: 'Upload bundles'
163 uses: ./.github/actions/upload-bundles
164 with:
165 platform: ${{ inputs.platform }}
166 debug-suffix: '${{ matrix.suffix }}'
167 if: ${{ inputs.dry-run == false }}