From 70a8b9b65ba98aacbbdbe203515be97dc43167e5 Mon Sep 17 00:00:00 2001 From: Andres Almiray Date: Thu, 9 Jan 2025 19:23:42 +0100 Subject: [PATCH] Document matrix updates Relates to https://github.com/jreleaser/jreleaser/issues/1780 Relates to https://github.com/jreleaser/jreleaser/issues/1782 Relates to https://github.com/jreleaser/jreleaser/issues/1783 --- .../reference/pages/assemble/archive.adoc | 200 ++++++++---------- .../reference/pages/assemble/jlink.adoc | 100 +++++++++ .../pages/assemble/native-image.adoc | 91 ++++++++ .../reference/pages/distributions.adoc | 85 ++++++++ .../partials/matrix/gradle/matrix.adoc | 17 ++ .../partials/matrix/json/matrix.adoc | 20 ++ .../partials/matrix/maven/matrix.adoc | 49 +++++ .../partials/matrix/toml/matrix.adoc | 14 ++ .../partials/matrix/yaml/matrix.adoc | 17 ++ 9 files changed, 476 insertions(+), 117 deletions(-) create mode 100644 docs/modules/reference/partials/matrix/gradle/matrix.adoc create mode 100644 docs/modules/reference/partials/matrix/json/matrix.adoc create mode 100644 docs/modules/reference/partials/matrix/maven/matrix.adoc create mode 100644 docs/modules/reference/partials/matrix/toml/matrix.adoc create mode 100644 docs/modules/reference/partials/matrix/yaml/matrix.adoc diff --git a/docs/modules/reference/pages/assemble/archive.adoc b/docs/modules/reference/pages/assemble/archive.adoc index a50528c30..07be37063 100644 --- a/docs/modules/reference/pages/assemble/archive.adoc +++ b/docs/modules/reference/pages/assemble/archive.adoc @@ -49,23 +49,7 @@ include::partial$assemble/yaml/common-head.adoc[] - ZIP - TGZ - # Includes the default matrix. - # icon:dot-circle[] - applyDefaultMatrix: false - - # Configures matrix variables. - # icon:dot-circle[] - matrix: - vars: - os: [ linux, osx, windows ] - arch: [ arm64, amd64 ] - rows: - - { os: linux, arch: arm64 } - - { os: linux, arch: amd64 } - - { os: osx, arch: arm64 } - - { os: osx, arch: amd64 } - - { os: windows, arch: arm64 } - - { os: windows, arch: amd64 } +include::partial$matrix/yaml/matrix.adoc[indent=6] include::partial$assemble/yaml/common-archive-options.adoc[] @@ -104,20 +88,7 @@ include::partial$assemble/toml/common-head.adoc[] # icon:dot-circle[] formats = [ "ZIP", "TGZ"] - # Includes the default matrix. - # icon:dot-circle[] - applyDefaultMatrix = false - - # Configures matrix variables. - # icon:dot-circle[] - matrix.vars.os = [ "linux", "osx", "windows" ] - matrix.vars.arch= [ "arm64", "amd64" ] - rows = [{ os = "linux", arch = "arm64" }, - { os = "linux", arch = "amd64" }, - { os = "osx", arch = "arm64" }, - { os = "osx", arch = "amd64" }, - { os = "windows", arch = "arm64" }, - { os = "windows", arch = "amd64" }] +include::partial$matrix/toml/matrix.adoc[] include::partial$assemble/toml/common-archive-options.adoc[] @@ -159,26 +130,7 @@ include::partial$assemble/json/common-head.adoc[] "TGZ" ], - // Includes the default matrix. - // icon:dot-circle[] - "applyDefaultMatrix": false, - - // Configures matrix variables. - // icon:dot-circle[] - "matrix": { - "vars": { - "os": [ "linux", "osx", "windows" ], - "arch": [ "arm64", "amd64" ] - }, - "rows": [ - { "os": "linux", "arch": "arm64" }, - { "os": "linux", "arch": "amd64" }, - { "os": "osx", "arch": "arm64" }, - { "os": "osx", "arch": "amd64" }, - { "os": "windows", "arch": "arm64" }, - { "os": "windows", "arch": "amd64" } - ] - } +include::partial$matrix/json/matrix.adoc[indent=8] include::partial$assemble/json/common-archive-options.adoc[] @@ -229,55 +181,7 @@ include::partial$assemble/maven/common-head.adoc[] TGZ - - false - - - - - - linux - osx - windows - - - arm64 - amd64 - - - - - linux - arm64 - - - linux - amd64 - - - osx - arm64 - - - osx - amd64 - - - windows - arm64 - - - windows - amd64 - - - +include::partial$matrix/maven/matrix.adoc[indent=8] include::partial$assemble/maven/common-archive-options.adoc[] @@ -320,23 +224,7 @@ include::partial$assemble/gradle/common-head.adoc[] 'TGZ' ] - // Includes the default matrix. - // icon:dot-circle[] - applyDefaultMatrix = false - - // Configures matrix variables. - // icon:dot-circle[] - matrix { - variable('os', ['linux', 'osx', 'windows']) - variable('arch', ['arm64', 'amd64']) - - row(os: 'linux', arch: 'arm64') - row(os: 'linux', arch: 'amd64') - row(os: 'osx', arch: 'arm64') - row(os: 'osx', arch: 'amd64') - row(os: 'windows', arch: 'arm64') - row(os: 'windows', arch: 'amd64') - } +include::partial$matrix/gradle/matrix.adoc[indent=8] include::partial$assemble/gradle/common-archive-options.adoc[] @@ -380,6 +268,84 @@ include::partial$assemble/additional-files.adoc[] NOTE: This assembler ignores filtering artifacts by platform when `attachPlatform` is not enabled. +== Matrix + +Parameterize archive generation with a set of key/value pairs. For example the following definitions are equivalent + +[source,yaml] +.With matrix +---- +matrix: + rows: + - { goos: darwin, goarch: arm64, platform: osx-aarch_64 } + - { goos: darwin, goarch: amd64, platform: osx-x86_64 } + - { goos: linux, goarch: arm64, platform: linux-aarch_64 } + - { goos: linux, goarch: amd64, platform: linux-x86_64 } + - { goos: windows, goarch: arm64, platform: windows-aarch_64 } + - { goos: windows, goarch: amd64, platform: windows-x86_64 } + +assemble: + archive: + helloworld: + active: ALWAYS + formats: [ ZIP ] + applyDefaultMatrix: true + archiveName: '{{distributionName}}-{{projectVersion}}-{{ matrix.goos }}-{{ matrix.goarch }}' + fileSets: + - input: 'target/{{ matrix.goos }}-{{ matrix.goarch }}' + output: 'bin' + includes: [ 'helloworld{.exe,}' ] + - input: '.' + includes: [ 'LICENSE' ] + +distributions: + helloworld: + executable: + windowsExtension: exe +---- + +[source,yaml] +.Without matrix +---- +assemble: + archive: + helloworld: + active: ALWAYS + formats: [ ZIP ] + attachPlatform: true + fileSets: + - input: 'target/{{ osPlatformReplaced }}' + output: 'bin' + includes: [ 'helloworld{.exe,}' ] + - input: '.' + includes: [ 'LICENSE' ] +distributions: + helloworld: + executable: + windowsExtension: exe + artifacts: + - path: '{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-darwin-arm64.zip' + platform: 'darwin-arm64' + - path: '{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-darwin-amd64.zip' + platform: 'darwin-amd64' + - path: '{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-windows-arm64.zip' + platform: 'windows-arm64' + - path: '{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-windows-amd64.zip' + platform: 'windows-amd64' + - path: '{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-linux-arm64.zip' + platform: 'linux-arm64' + - path: '{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-linux-amd64.zip' + platform: 'linux-amd64' +---- + +=== Special keys + +The following keys have special meaning: + +[horizontal] +platform:: Sets the platform for a matching archive. +skip*:: Any properties with `skip` as prefix will be set as `extraProperties` in the matching archive. + == Example Given the following file structure diff --git a/docs/modules/reference/pages/assemble/jlink.adoc b/docs/modules/reference/pages/assemble/jlink.adoc index 0808eb342..66cbb9540 100644 --- a/docs/modules/reference/pages/assemble/jlink.adoc +++ b/docs/modules/reference/pages/assemble/jlink.adoc @@ -70,6 +70,13 @@ include::partial$assemble/yaml/common-head.adoc[] - jdk.crypto.ec - jdk.localedata +include::partial$matrix/yaml/matrix.adoc[indent=6] + + # Define a pattern for parameterizable targetJdks + # icon:dot-circle[] icon:file-alt[] + targetJdkPattern: + path: path/to/jdk + # List of JDKs for generating cross-platform images. # icon:dot-circle[] icon:file-alt[] targetJdks: @@ -203,6 +210,12 @@ include::partial$assemble/toml/common-head.adoc[] "jdk.crypto.ec", "jdk.localedata"] +include::partial$matrix/toml/matrix.adoc[] + + # Define a pattern for parameterizable targetJdks + # icon:dot-circle[] icon:file-alt[] + targetJdkPattern.path = "path/to/jdk" + # List of JDKs for generating cross-platform images. # icon:dot-circle[] icon:file-alt[] targetJdks = [ @@ -333,6 +346,14 @@ include::partial$assemble/json/common-head.adoc[] "jdk.localedata" ], +include::partial$matrix/json/matrix.adoc[indent=8] + + // Define a pattern for parameterizable targetJdks + // icon:dot-circle[] icon:file-alt[] + "targetJdkPattern": { + "path": "path/to/jdk" + }, + // List of JDKs for generating cross-platform images. // icon:dot-circle[] icon:file-alt[] "targetJdks": [ @@ -493,6 +514,16 @@ include::partial$assemble/maven/common-head.adoc[] jdk.localedata +include::partial$matrix/maven/matrix.adoc[indent=8] + + + + path/to/jdk + + TGZ +include::partial$matrix/maven/matrix.adoc[indent=8] + + + + path/to/jdk + + + + path/to/archive + + + false + + + + + + linux + osx + windows + + + arm64 + amd64 + + + + + linux + arm64 + + + linux + amd64 + + + osx + arm64 + + + osx + amd64 + + + windows + arm64 + + + windows + amd64 + + + \ No newline at end of file diff --git a/docs/modules/reference/partials/matrix/toml/matrix.adoc b/docs/modules/reference/partials/matrix/toml/matrix.adoc new file mode 100644 index 000000000..0a9072167 --- /dev/null +++ b/docs/modules/reference/partials/matrix/toml/matrix.adoc @@ -0,0 +1,14 @@ + # Includes the default matrix. + # icon:dot-circle[] + applyDefaultMatrix = false + + # Configures matrix variables. + # icon:dot-circle[] + matrix.vars.os = [ "linux", "osx", "windows" ] + matrix.vars.arch= [ "arm64", "amd64" ] + rows = [{ os = "linux", arch = "arm64" }, + { os = "linux", arch = "amd64" }, + { os = "osx", arch = "arm64" }, + { os = "osx", arch = "amd64" }, + { os = "windows", arch = "arm64" }, + { os = "windows", arch = "amd64" }] \ No newline at end of file diff --git a/docs/modules/reference/partials/matrix/yaml/matrix.adoc b/docs/modules/reference/partials/matrix/yaml/matrix.adoc new file mode 100644 index 000000000..0898fa8f4 --- /dev/null +++ b/docs/modules/reference/partials/matrix/yaml/matrix.adoc @@ -0,0 +1,17 @@ + # Includes the default matrix. + # icon:dot-circle[] + applyDefaultMatrix: false + + # Configures matrix variables. + # icon:dot-circle[] + matrix: + vars: + os: [ linux, osx, windows ] + arch: [ arm64, amd64 ] + rows: + - { os: linux, arch: arm64 } + - { os: linux, arch: amd64 } + - { os: osx, arch: arm64 } + - { os: osx, arch: amd64 } + - { os: windows, arch: arm64 } + - { os: windows, arch: amd64 } \ No newline at end of file