GithubHelp home page GithubHelp logo

gradle / foojay-toolchains Goto Github PK

View Code? Open in Web Editor NEW
102.0 21.0 17.0 257 KB

Java Toolchain Resolve Plugin based on the foojay DiscoAPI

License: Apache License 2.0

Kotlin 100.00%
gradle-bt gradle-bt-jvm

foojay-toolchains's Introduction

Foojay Toolchains Plugin

The org.gradle.toolchains.foojay-resolver plugin provides a repository for downloading JVMs. It is based on the foojay DiscoAPI. Requires Gradle 7.6 or later to work.

TAKE HEED! As opposed to most of the Gradle plugins, which are Project plugins and must be applied in build.gradle[.kts] files, this is a SETTINGS PLUGIN and must be applied in settings.gradle[.kts] files.

Usage

To make use of the plugin add following to your settings.gradle[.kts] file.

Kotlin DSL
// settings.gradle.kts
plugins {
    id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}
Groovy DSL
// settings.gradle
plugins {
    id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
}

This is a convention plugin meant to simplify configuration. What it does is equivalent to applying the base plugin and some extra configuration:

Kotlin DSL
// settings.gradle.kts
plugins {
    id("org.gradle.toolchains.foojay-resolver") version "0.8.0"
}

toolchainManagement {
    jvm {
        javaRepositories {
            repository("foojay") {
                resolverClass.set(org.gradle.toolchains.foojay.FoojayToolchainResolver::class.java)
            }
        }
    }
}
Groovy DSL
// settings.gradle
plugins {
    id("org.gradle.toolchains.foojay-resolver") version "0.8.0"
}

toolchainManagement {
    jvm {
        javaRepositories {
            repository("foojay") {
                resolverClass = org.gradle.toolchains.foojay.FoojayToolchainResolver
            }
        }
    }
}

Feel free to use either approach.

For further information about using Toolchain Download Repositories consult the Gradle Manual.

Matching Toolchain Specifications

The main thing the plugin does is to match Gradle's toolchain specifications to foojay DiscoAPI distributions and packages.

Vendors

There is mostly a 1-to-1 relationship between the DiscoAPI's distributions and Gradle vendors. The plugin works with the following mapping:

Gradle JVM Vendor Foojay Distribution
ADOPTIUM Temurin
ADOPTOPENJDK AOJ
AMAZON Corretto
APPLE -
AZUL Zulu
BELLSOFT Liberica
GRAAL_VM Graal VM CE 8/11/16/17/19
HEWLETT_PACKARD -
IBM Semeru
IBM_SEMERU Semeru
JETBRAINS JetBrains
MICROSOFT Microsoft
ORACLE Oracle OpenJDK
SAP SAP Machine

To note: Not all Gradle vendors have an equivalent DiscoAPI distribution, empty cells indicate that no toolchain will be provisioned. If no vendor is specified, distributions are iterated in the order they are provided by the DiscoAPI, and the first one that has a compatible installation package available is selected. The exception to the Foojay ordering of distributions is that "Temurin" (ADOPTIUM) and then "AOJ" (ADOPTOPENJDK) come first, due to the history of the auto-provisioning feature in Gradle, specifically that AdoptOpenJDK/Adoptium have been the default sources for downloading JVMs.

Implementations

When specifying toolchains Gradle distinguishes between J9 JVMs and VENDOR_SPECIFIC ones (ie. any other). What this criteria does in the plugin is to influence the Vendor-to-Distribution matching table. VENDOR_SPECIFICATION doesn't change it at all, while J9 alter it like this:

Gradle JVM Vendor Foojay Distribution
<no vendor specified> Semeru
ADOPTIUM -
ADOPTOPENJDK AOJ OpenJ9
AMAZON -
APPLE -
AZUL -
BELLSOFT -
GRAAL_VM -
HEWLETT_PACKARD -
IBM Semeru
IBM_SEMERU Semeru
JETBRAINS -
MICROSOFT -
ORACLE -
SAP -

Empty cells indicate that no toolchain will be provisioned

Versions

Once the vendor and the implementation values of the toolchain spec have been used to select a DiscoAPI distribution, a specific package of that distribution needs to be picked by the plugin, in order for it to obtain a download link. The inputs it uses to do this are:

  • the major Java version number for the spec
  • the operating system running the build that made the request
  • the CPU architecture of the system running the build that made the request

Additional criteria used for selection:

  • for each major version number only packages having the latest minor version will be considered
  • only packages containing an archive of a format known to Gradle will be considered (zip, tar, tgz)
  • JDKs have priority over JREs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.