/*
 * Copyright 2022 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.gradle.jvm.toolchain;

import org.gradle.api.Incubating;
import org.gradle.api.services.BuildService;
import org.gradle.api.services.BuildServiceParameters;
import org.gradle.env.BuildEnvironment;

import java.net.URI;
import java.util.Optional;

/**
 * Interface that needs to be implemented by Toolchain SPI plugins, in order to
 * extend Gradle with the spec-to-URI logic required by Java toolchain auto-provisioning.
 *
 * @since 7.6
 */
@Incubating
public interface JavaToolchainRepository extends BuildService<BuildServiceParameters.None> {

    /**
     * Returns the URI from which a Java Toolchain matching the provided specification can be downloaded.
     * The URI must point to either a ZIP or a TAR archive file and has to be secure (so simple HTTP is
     * not allowed, only HTTPS).
     * <p>
     * Returns an empty Optional if and only if the provided specification can't be matched.
     */
    Optional<URI> toUri(JavaToolchainSpec spec, BuildEnvironment buildEnvironment);

    //TODO (#21082): update the design spec with the build environment addition

}

@@ -1260,24 +1260,31 @@
 pecification
+%0A     *
  can be down
@@ -1290,23 +1290,16 @@
 nloaded.
-%0A     *
  The URI
@@ -1351,16 +1351,23 @@
 file and
+%0A     *
  has to 
@@ -1394,23 +1394,16 @@
  HTTP is
-%0A     *
  not all
@@ -1431,30 +1431,185 @@
    *
- %3Cp%3E%0A     * Returns an
+%0A     * @param spec  toolchain specification for which a download URI is requested%0A     * @param env   information about the environment Gradle is running in%0A     * @return     
  emp
@@ -1674,16 +1674,36 @@
 t be
+%0A     *             
  matched
 .%0A  
@@ -1698,17 +1698,16 @@
  matched
-.
 %0A     */
@@ -1776,107 +1776,13 @@
 ent 
-buildEnvironment);%0A%0A    //TODO (#21082): update the design spec with the build environment addition
+env);
 %0A%0A%7D%0A

Remove TODO, improve docs