Skip to content

Latest commit

 

History

History
409 lines (369 loc) · 8.66 KB

File metadata and controls

409 lines (369 loc) · 8.66 KB

Archive

Creates a binary distribution archive.

YAML
partial$assemble/yaml/common-head.adoc

      # Name of the archive.
      # If left undefined, will use {{distributionName}}-{{projectVersion}}.
      # [dot circle] [file alt]
      archiveName: 'app-{{projectVersion}}'

      # The distribution type.
      # Used to determine packager templates.
      # Supported values are: [JAVA_BINARY, SINGLE_JAR, JLINK, NATIVE_IMAGE, NATIVE_PACKAGE, BINARY].
      # Defaults to `BINARY`.
      # [dot circle]
      distributionType: JAVA_BINARY

      # Attach the current platform to the archiveName.
      # Defaults to `false`.
      # [dot circle]
      attachPlatform: true

      # Set of archive formats to use.
      # Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TBZ2`, `TGZ`, `TXZ`].
      # [dot circle]
      formats:
        - ZIP
        - TGZ

partial$assemble/yaml/filesets.adoc
TOML
partial$assemble/toml/common-head.adoc

  # Name of the archive.
  # If left undefined, will use {{distributionName}}-{{projectVersion}}.
  # [dot circle] [file alt]
  archiveName = "app-{{projectVersion}}"

  # The distribution type.
  # Used to determine packager templates.
  # Supported values are: [JAVA_BINARY, SINGLE_JAR, JLINK, NATIVE_IMAGE, NATIVE_PACKAGE, BINARY].
  # Defaults to `BINARY`.
  # [dot circle]
  distributionType = "JAVA_BINARY"

  # Attach the current platform to the archiveName.
  # [dot circle]
  # Defaults to `false`.
  attachPlatform = true

  # Set of archive formats to use.
  # Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TBZ2`, `TGZ`, `TXZ`].
  # [dot circle]
  formats = [ "ZIP", "TGZ"]

partial$assemble/toml/filesets.adoc
JSON
partial$assemble/json/common-head.adoc

        // Name of the archive.
        // If left undefined, will use {{distributionName}}-{{projectVersion}}.
        // [dot circle] [file alt]
        "archiveName": "app-{{projectVersion}}",

        // The distribution type.
        // Used to determine packager templates.
        // Supported values are: [JAVA_BINARY, SINGLE_JAR, JLINK, NATIVE_IMAGE, NATIVE_PACKAGE, BINARY].
        // Defaults to `BINARY`.
        // [dot circle]
        "distributionType": "JAVA_BINARY",

        // Attach the current platform to the archiveName.
        // Defaults to `false`.
        // [dot circle]
        "attachPlatform": true,

        // Set of archive formats to use.
        // Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TBZ2`, `TGZ`, `TXZ`].
        // [dot circle]
        "formats": [
           "ZIP",
           "TGZ"
        ],

partial$assemble/json/filesets.adoc
partial$assemble/json/common-footer.adoc
Maven
partial$assemble/maven/common-head.adoc

        <!--
          Name of the archive.
          If left undefined, will use {{distributionName}}-{{projectVersion}}.
          [dot circle] [file alt]
        -->
        <archiveName>app-{{projectVersion}}</archiveName>

        <!--
          The distribution type.
          Used to determine packager templates.
          Supported values are>[JAVA_BINARY, SINGLE_JAR, JLINK, NATIVE_IMAGE, NATIVE_PACKAGE, BINARY].
          Defaults to `BINARY`.
          [dot circle]
        -->
        <distributionType>JAVA_BINARY</distributionType>

        <!--
          Attach the current platform to the archiveName.
          Defaults to `false`.
          [dot circle]
        -->
        <attachPlatform>true</attachPlatform>

        <!--
          Set of archive formats to use.
          Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TBZ2`, `TGZ`, `TXZ`].
          [dot circle]
        -->
        <formats>
          <format>ZIP</format>
          <format>TGZ</format>
        </formats>

partial$assemble/maven/filesets.adoc
partial$assemble/maven/common-footer.adoc
Gradle
partial$assemble/gradle/common-head.adoc

        // Name of the archive.
        // If left undefined, will use {{distributionName}}-{{projectVersion}}.
        // [dot circle] [file alt]
        archiveName = 'app-{{projectVersion}}'

        // The distribution type.
        // Used to determine packager templates.
        // Supported values are = [JAVA_BINARY, SINGLE_JAR, JLINK, NATIVE_IMAGE, NATIVE_PACKAGE, BINARY].
        // Defaults to `BINARY`.
        // [dot circle]
        distributionType = 'JAVA_BINARY'

        // Attach the current platform to the archiveName.
        // Defaults to `false`.
        // [dot circle]
        attachPlatform = true

        // Set of archive formats to use.
        // Supported values are [`ZIP`, `TAR`, `TAR_BZ2`, `TAR_GZ`, `TAR_XZ`, `TBZ2`, `TGZ`, `TXZ`].
        // [dot circle]
        formats = [
            'ZIP',
            'TGZ'
        ]

partial$assemble/gradle/filesets.adoc
partial$assemble/gradle/common-footer.adoc

Example

Given the following file structure

Unix
.
├── BUILD
├── LICENSE
├── README
└── target
    └── release
        └── app
Windows
.
├── BUILD
├── LICENSE
├── README
└── target
    └── release
        └── app.exe

And this assembly configuration

YAML
project:
  version: 1.0.0

assemble:
  archive:
    app:
      active: ALWAYS
      attachPlatform: true
      fileSets:
        - input: '.'
          includes:
            - 'LICENSE'
            - 'README'
        - input: 'target/release'
          output: 'bin'
          includes: [ 'app{.exe,}' ]
TOML
[project]
  version = "1.0.0"

[assemble.archive.app]
  active = "ALWAYS"
  attachPlatform = true
  [[assemble.archive.app.fileSets]]
    input = "."
    includes = ["LICENSE", "README"]
  [[assemble.archive.app.fileSets]]
    input = "target/release"
    output = "bin"
    includes = [ "app{.exe,}" ]
JSON
{
  "project": {
    "version": "1.0.0"
  },
  "assemble": {
    "archive": {
      "app": {
        "active": "ALWAYS",
        "attachPlatform": true,
        "fileSets": [
          {
            "input": ".",
            "includes": ["LICENSE", "README"]
          },
          {
            "input": "target/release",
            "output": "bin",
            "includes": [ "app{.exe,}" ]
          }
        ]
      }
    }
  }
}
Maven
<jreleaser>
  <project>
    <version>1.0.0</version>
  </project>
  <assemble>
    <archive>
      <app>
        <active>ALWAYS</active>
        <attachPlatform>true</attachPlatform>
        <fileSets>
          <fileSet>
            <input>.</input>
            <includes>
              <include>LICENSE</include>
              <include>README</include>
            </includes>
          </fileSet>
          <fileSet>
            <input>target/release</input>
            <output>bin</output>
            <includes>
              <include>app{.exe,}</include>
            </includes>
          </fileSet>
        </fileSets>
      </app>
    </archive>
  </assemble>
</jreleaser>
Gradle
jreleaser {
  project {
    version = '1.0.0'
  }
  assemble {
    archive {
      app {
        active = 'ALWAYS'
        attachPlatform = true
        fileSet {
          input = '.'
          includes = ['LICENSE', 'README']
        }
        fileSet {
          input = 'target/release'
          output = 'bin'
          includes = [ 'app{.exe,}' ]
        }
      }
    }
  }
}

When run on Linux, macOs, and Windows on intel chips results in the following assembled Zip archives:

app-1.0.0-linux-x86_64.zip
app-1.0.0-linux-x86_64
├── LICENSE
├── README
└── bin
    └── app
app-1.0.0-osx-x86_64.zip
app-1.0.0-osx-x86_64
├── LICENSE
├── README
└── bin
    └── app
app-1.0.0-windows-x86_64.zip
app-1.0.0-wndows-x86_64
├── LICENSE
├── README
└── bin
    └── app.exe