S3 repositories do not recognize AWS partitions

AWS has the concept of partitions, which affects the region endpoints used to interacts with AWS. For example, there exists a GovCloud partition and possibly others, all of which change the S3 endpoint. See http://docs.aws.amazon.com/govcloud-us/latest/UserGuide/using-govcloud-endpoints.html for the specific values. Unfortunately, Gradle assumes that there is single hardcoded endpoint in S3RegionalResource.java and even goes so far as to check for a fixed URL scheme.

See https://github.com/gradle/gradle/blob/f490bdf61bd9b4f5383cd9fb0d8ffbca93da8c32/subprojects/resources-s3/src/main/java/org/gradle/internal/resource/transport/aws/s3/S3RegionalResource.java

private static final Pattern REGIONAL_ENDPOINT_PATTERN = Pattern.compile("^s3:\\/\\/(.+)?\\.s3[.-]([a-z0-9-]+)\\.amazonaws\\.com(\\.[a-z]+)?\\/(.+)");

It does not seem possible to change the region. Please add the ability to select the region.

The partition concept is modeled in the AWS SDKs. For example, in the case of Java, see http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/partitions/model/Partition.html