@@ -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
7054include::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
12293include::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
183135include::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
282186include::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
341229include::partial$assemble/gradle/common-archive-options.adoc[]
342230
@@ -380,6 +268,84 @@ include::partial$assemble/additional-files.adoc[]
380268
381269NOTE: 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
385351Given the following file structure
0 commit comments