Add platform compatibility range support

This commit adds a new `platformCompatibilityRange` in the metadata that
can be used to restrict the valid platform versions. If a project is
requested or metadata needs to be resolved against a version that does
not match the range, an exception is thrown.

Closes gh-1048
This commit is contained in:
Stephane Nicoll
2020-01-03 14:08:37 +01:00
parent e25fb74d23
commit eef529aa7c
9 changed files with 119 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@@ -186,6 +186,12 @@ public class InitializrMetadataTestBuilder {
return this;
}
public InitializrMetadataTestBuilder setPlatformCompatibilityRange(String platformCompatibilityRange) {
this.builder.withCustomizer(
(it) -> it.getConfiguration().getEnv().setPlatformCompatibilityRange(platformCompatibilityRange));
return this;
}
public InitializrMetadataTestBuilder setGradleEnv(String dependencyManagementPluginVersion) {
this.builder.withCustomizer((it) -> it.getConfiguration().getEnv().getGradle()
.setDependencyManagementPluginVersion(dependencyManagementPluginVersion));