Skip to content

Commit 83e30a4

Browse files
committed
Document matrix updates
Relates to jreleaser/jreleaser#1780 Relates to jreleaser/jreleaser#1782 Relates to jreleaser/jreleaser#1783
1 parent 0f18ebd commit 83e30a4

File tree

9 files changed

+476
-117
lines changed

9 files changed

+476
-117
lines changed

docs/modules/reference/pages/assemble/archive.adoc

Lines changed: 83 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,7 @@ include::partial$assemble/yaml/common-head.adoc[]
4949
- ZIP
5050
- TGZ
5151
52-
# Includes the default matrix.
53-
# icon:dot-circle[]
54-
applyDefaultMatrix: false
55-
56-
# Configures matrix variables.
57-
# icon:dot-circle[]
58-
matrix:
59-
vars:
60-
os: [ linux, osx, windows ]
61-
arch: [ arm64, amd64 ]
62-
rows:
63-
- { os: linux, arch: arm64 }
64-
- { os: linux, arch: amd64 }
65-
- { os: osx, arch: arm64 }
66-
- { os: osx, arch: amd64 }
67-
- { os: windows, arch: arm64 }
68-
- { os: windows, arch: amd64 }
52+
include::partial$matrix/yaml/matrix.adoc[indent=6]
6953
7054
include::partial$assemble/yaml/common-archive-options.adoc[]
7155
@@ -104,20 +88,7 @@ include::partial$assemble/toml/common-head.adoc[]
10488
# icon:dot-circle[]
10589
formats = [ "ZIP", "TGZ"]
10690
107-
# Includes the default matrix.
108-
# icon:dot-circle[]
109-
applyDefaultMatrix = false
110-
111-
# Configures matrix variables.
112-
# icon:dot-circle[]
113-
matrix.vars.os = [ "linux", "osx", "windows" ]
114-
matrix.vars.arch= [ "arm64", "amd64" ]
115-
rows = [{ os = "linux", arch = "arm64" },
116-
{ os = "linux", arch = "amd64" },
117-
{ os = "osx", arch = "arm64" },
118-
{ os = "osx", arch = "amd64" },
119-
{ os = "windows", arch = "arm64" },
120-
{ os = "windows", arch = "amd64" }]
91+
include::partial$matrix/toml/matrix.adoc[]
12192
12293
include::partial$assemble/toml/common-archive-options.adoc[]
12394
@@ -159,26 +130,7 @@ include::partial$assemble/json/common-head.adoc[]
159130
"TGZ"
160131
],
161132
162-
// Includes the default matrix.
163-
// icon:dot-circle[]
164-
"applyDefaultMatrix": false,
165-
166-
// Configures matrix variables.
167-
// icon:dot-circle[]
168-
"matrix": {
169-
"vars": {
170-
"os": [ "linux", "osx", "windows" ],
171-
"arch": [ "arm64", "amd64" ]
172-
},
173-
"rows": [
174-
{ "os": "linux", "arch": "arm64" },
175-
{ "os": "linux", "arch": "amd64" },
176-
{ "os": "osx", "arch": "arm64" },
177-
{ "os": "osx", "arch": "amd64" },
178-
{ "os": "windows", "arch": "arm64" },
179-
{ "os": "windows", "arch": "amd64" }
180-
]
181-
}
133+
include::partial$matrix/json/matrix.adoc[indent=8]
182134
183135
include::partial$assemble/json/common-archive-options.adoc[]
184136
@@ -229,55 +181,7 @@ include::partial$assemble/maven/common-head.adoc[]
229181
<format>TGZ</format>
230182
</formats>
231183
232-
<!--
233-
Includes the default matrix.
234-
icon:dot-circle[]
235-
-->
236-
<applyDefaultMatrix>false</applyDefaultMatrix>
237-
238-
<!--
239-
Configures matrix variables.
240-
icon:dot-circle[]
241-
-->
242-
<matrix>
243-
<vars>
244-
<os>
245-
<e>linux</e>
246-
<e>osx</e>
247-
<e>windows</e>
248-
</os>
249-
<arch>
250-
<e>arm64</e>
251-
<e>amd64</e>
252-
</arch>
253-
</vars>
254-
<rows>
255-
<row>
256-
<os>linux</os>
257-
<arch>arm64</arch>
258-
</row>
259-
<row>
260-
<os>linux</os>
261-
<arch>amd64</arch>
262-
</row>
263-
<row>
264-
<os>osx</os>
265-
<arch>arm64</arch>
266-
</row>
267-
<row>
268-
<os>osx</os>
269-
<arch>amd64</arch>
270-
</row>
271-
<row>
272-
<os>windows</os>
273-
<arch>arm64</arch>
274-
</row>
275-
<row>
276-
<os>windows</os>
277-
<arch>amd64</arch>
278-
</row>
279-
</rows>
280-
</matrix>
184+
include::partial$matrix/maven/matrix.adoc[indent=8]
281185
282186
include::partial$assemble/maven/common-archive-options.adoc[]
283187
@@ -320,23 +224,7 @@ include::partial$assemble/gradle/common-head.adoc[]
320224
'TGZ'
321225
]
322226
323-
// Includes the default matrix.
324-
// icon:dot-circle[]
325-
applyDefaultMatrix = false
326-
327-
// Configures matrix variables.
328-
// icon:dot-circle[]
329-
matrix {
330-
variable('os', ['linux', 'osx', 'windows'])
331-
variable('arch', ['arm64', 'amd64'])
332-
333-
row(os: 'linux', arch: 'arm64')
334-
row(os: 'linux', arch: 'amd64')
335-
row(os: 'osx', arch: 'arm64')
336-
row(os: 'osx', arch: 'amd64')
337-
row(os: 'windows', arch: 'arm64')
338-
row(os: 'windows', arch: 'amd64')
339-
}
227+
include::partial$matrix/gradle/matrix.adoc[indent=8]
340228
341229
include::partial$assemble/gradle/common-archive-options.adoc[]
342230
@@ -380,6 +268,84 @@ include::partial$assemble/additional-files.adoc[]
380268

381269
NOTE: This assembler ignores filtering artifacts by platform when `attachPlatform` is not enabled.
382270

271+
== Matrix
272+
273+
Parameterize archive generation with a set of key/value pairs. For example the following definitions are equivalent
274+
275+
[source,yaml]
276+
.With matrix
277+
----
278+
matrix:
279+
rows:
280+
- { goos: darwin, goarch: arm64, platform: osx-aarch_64 }
281+
- { goos: darwin, goarch: amd64, platform: osx-x86_64 }
282+
- { goos: linux, goarch: arm64, platform: linux-aarch_64 }
283+
- { goos: linux, goarch: amd64, platform: linux-x86_64 }
284+
- { goos: windows, goarch: arm64, platform: windows-aarch_64 }
285+
- { goos: windows, goarch: amd64, platform: windows-x86_64 }
286+
287+
assemble:
288+
archive:
289+
helloworld:
290+
active: ALWAYS
291+
formats: [ ZIP ]
292+
applyDefaultMatrix: true
293+
archiveName: '{{distributionName}}-{{projectVersion}}-{{ matrix.goos }}-{{ matrix.goarch }}'
294+
fileSets:
295+
- input: 'target/{{ matrix.goos }}-{{ matrix.goarch }}'
296+
output: 'bin'
297+
includes: [ 'helloworld{.exe,}' ]
298+
- input: '.'
299+
includes: [ 'LICENSE' ]
300+
301+
distributions:
302+
helloworld:
303+
executable:
304+
windowsExtension: exe
305+
----
306+
307+
[source,yaml]
308+
.Without matrix
309+
----
310+
assemble:
311+
archive:
312+
helloworld:
313+
active: ALWAYS
314+
formats: [ ZIP ]
315+
attachPlatform: true
316+
fileSets:
317+
- input: 'target/{{ osPlatformReplaced }}'
318+
output: 'bin'
319+
includes: [ 'helloworld{.exe,}' ]
320+
- input: '.'
321+
includes: [ 'LICENSE' ]
322+
distributions:
323+
helloworld:
324+
executable:
325+
windowsExtension: exe
326+
artifacts:
327+
- path: '{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-darwin-arm64.zip'
328+
platform: 'darwin-arm64'
329+
- path: '{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-darwin-amd64.zip'
330+
platform: 'darwin-amd64'
331+
- path: '{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-windows-arm64.zip'
332+
platform: 'windows-arm64'
333+
- path: '{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-windows-amd64.zip'
334+
platform: 'windows-amd64'
335+
- path: '{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-linux-arm64.zip'
336+
platform: 'linux-arm64'
337+
- path: '{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-linux-amd64.zip'
338+
platform: 'linux-amd64'
339+
----
340+
341+
=== Special keys
342+
343+
The following keys have special meaning:
344+
345+
[horizontal]
346+
platform:: Sets the platform for a matching archive.
347+
skip*:: Any properties with `skip` as prefix will be set as `extraProperties` in the matching archive.
348+
383349
== Example
384350

385351
Given the following file structure

docs/modules/reference/pages/assemble/jlink.adoc

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ include::partial$assemble/yaml/common-head.adoc[]
7070
- jdk.crypto.ec
7171
- jdk.localedata
7272
73+
include::partial$matrix/yaml/matrix.adoc[indent=6]
74+
75+
# Define a pattern for parameterizable targetJdks
76+
# icon:dot-circle[] icon:file-alt[]
77+
targetJdkPattern:
78+
path: path/to/jdk
79+
7380
# List of JDKs for generating cross-platform images.
7481
# icon:dot-circle[] icon:file-alt[]
7582
targetJdks:
@@ -203,6 +210,12 @@ include::partial$assemble/toml/common-head.adoc[]
203210
"jdk.crypto.ec",
204211
"jdk.localedata"]
205212
213+
include::partial$matrix/toml/matrix.adoc[]
214+
215+
# Define a pattern for parameterizable targetJdks
216+
# icon:dot-circle[] icon:file-alt[]
217+
targetJdkPattern.path = "path/to/jdk"
218+
206219
# List of JDKs for generating cross-platform images.
207220
# icon:dot-circle[] icon:file-alt[]
208221
targetJdks = [
@@ -333,6 +346,14 @@ include::partial$assemble/json/common-head.adoc[]
333346
"jdk.localedata"
334347
],
335348
349+
include::partial$matrix/json/matrix.adoc[indent=8]
350+
351+
// Define a pattern for parameterizable targetJdks
352+
// icon:dot-circle[] icon:file-alt[]
353+
"targetJdkPattern": {
354+
"path": "path/to/jdk"
355+
},
356+
336357
// List of JDKs for generating cross-platform images.
337358
// icon:dot-circle[] icon:file-alt[]
338359
"targetJdks": [
@@ -493,6 +514,16 @@ include::partial$assemble/maven/common-head.adoc[]
493514
<additionalModuleName>jdk.localedata</additionalModuleName>
494515
</additionalModuleNames>
495516
517+
include::partial$matrix/maven/matrix.adoc[indent=8]
518+
519+
<!--
520+
Define a pattern for parameterizable targetJdks
521+
icon:dot-circle[] icon:file-alt[]
522+
-->
523+
<targetJdkPattern>
524+
<path>path/to/jdk</path>
525+
</targetJdkPattern>
526+
496527
<!--
497528
List of JDKs for generating cross-platform images.
498529
icon:dot-circle[] icon:file-alt[]
@@ -668,6 +699,14 @@ include::partial$assemble/gradle/common-head.adoc[]
668699
'jdk.localedata'
669700
]
670701
702+
include::partial$matrix/gradle/matrix.adoc[indent=8]
703+
704+
// Define a pattern for parameterizable targetJdks
705+
// icon:dot-circle[] icon:file-alt[]
706+
targetJdkPattern {
707+
path = 'path/to/jdk'
708+
}
709+
671710
// List of JDKs for generating cross-platform images.
672711
// icon:dot-circle[] icon:file-alt[]
673712
targetJdk {
@@ -812,6 +851,67 @@ default if left unspecified.
812851

813852
include::partial$envvars-footer.adoc[]
814853

854+
== Matrix
855+
856+
Parameterize targetJdk resolution with a set of key/value pairs. For example the following definitions are equivalent
857+
858+
[source,yaml]
859+
.With matrix
860+
----
861+
assemble:
862+
jlink:
863+
helloworld:
864+
active: ALWAYS
865+
imageName: '{{distributionName}}-{{projectVersion}}'
866+
matrix:
867+
rows:
868+
- { platform: osx-aarch_64, jdkdir: OsxArm, filename: macosx_aarch64, suffix: '/zulu-17.jdk/Contents/Home' }
869+
- { platform: osx-x86_64, jdkdir: OsxIntel, filename: macosx_x64, suffix: '/zulu-17.jdk/Contents/Home' }
870+
- { platform: linux_musl-x86_64, jdkdir: LinuxMuslIntel, filename: linux_musl_x64, suffix: '' }
871+
- { platform: linux-x86_64, jdkdir: LinuxIntel, filename: linux_x64, suffix: '' }
872+
- { platform: linux-aarch_64, jdkdir: LinuxArm, filename: linux_aarch64, suffix: '' }
873+
- { platform: windows-x86_64, jdkdir: WindowsIntel, filename: win_x64, suffix: '' }
874+
- { platform: windows-aarch_64, jdkdir: WindowsArm, filename: win_aarch64, suffix: '' }
875+
targetJdkPattern:
876+
path: '{{jdkPathPrefix}}/zulu17{{matrix.jdkdir}}/{{jdkFilePrefix}}-{{matrix.filename}}{{matrix.suffix}}'
877+
mainJar:
878+
path: 'target/{{distributionName}}-{{projectVersion}}.jar'
879+
----
880+
881+
[source,yaml]
882+
.Without matrix
883+
----
884+
assemble:
885+
jlink:
886+
helloworld:
887+
active: ALWAYS
888+
imageName: '{{distributionName}}-{{projectVersion}}'
889+
targetJdks:
890+
- path: '{{jdkPathPrefix}}/zulu17OsxIntel/{{jdkFilePrefix}}-macosx_x64/zulu-17.jdk/Contents/Home'
891+
platform: 'osx-x86_64'
892+
- path: '{{jdkPathPrefix}}/zulu17OsxArm/{{jdkFilePrefix}}-macosx_aarch64/zulu-17.jdk/Contents/Home'
893+
platform: 'osx-aarch_64'
894+
- path: '{{jdkPathPrefix}}/zulu17LinuxIntel/{{jdkFilePrefix}}-linux_x64'
895+
platform: 'linux-x86_64'
896+
- path: '{{jdkPathPrefix}}/zulu17LinuxMuslIntel/{{jdkFilePrefix}}-linux_musl_x64'
897+
platform: 'linux_musl-x86_64'
898+
- path: '{{jdkPathPrefix}}/zulu17LinuxArm/{{jdkFilePrefix}}-linux_aarch64'
899+
platform: 'linux-aarch_64'
900+
- path: '{{jdkPathPrefix}}/zulu17WindowsIntel/{{jdkFilePrefix}}-win_x64'
901+
platform: 'windows-x86_64'
902+
- path: '{{jdkPathPrefix}}/zulu17WindowsArm/{{jdkFilePrefix}}-win_aarch64'
903+
platform: 'windows-aarch_64'
904+
mainJar:
905+
path: 'target/{{distributionName}}-{{projectVersion}}.jar'
906+
----
907+
908+
=== Special keys
909+
910+
The following keys have special meaning:
911+
912+
[horizontal]
913+
platform:: Sets the platform for a matching JDK.
914+
815915
== JDKs
816916

817917
You may specify a value for both `jdk` and `targetJdks`, either, or none. The following rules apply when resolving which

0 commit comments

Comments
 (0)