[Build] Add AGPL license to open source poms (#114403)

Aftermath of coming back to open source licensing
This commit is contained in:
Rene Groeschke 2024-10-10 11:25:00 +02:00 committed by GitHub
parent 430ec3b150
commit 0c3e52c11d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 33 additions and 4 deletions

View file

@ -44,7 +44,7 @@ class GitInfoPlugin implements Plugin<Project> {
gitInfo.disallowChanges(); gitInfo.disallowChanges();
gitInfo.finalizeValueOnRead(); gitInfo.finalizeValueOnRead();
revision = gitInfo.map(info -> info.getRevision() == null ? info.getRevision() : "master"); revision = gitInfo.map(info -> info.getRevision() == null ? info.getRevision() : "main");
} }
public Property<GitInfo> getGitInfo() { public Property<GitInfo> getGitInfo() {

View file

@ -21,6 +21,7 @@ import java.util.Map;
public class LicensingPlugin implements Plugin<Project> { public class LicensingPlugin implements Plugin<Project> {
static final String ELASTIC_LICENSE_URL_PREFIX = "https://raw.githubusercontent.com/elastic/elasticsearch/"; static final String ELASTIC_LICENSE_URL_PREFIX = "https://raw.githubusercontent.com/elastic/elasticsearch/";
static final String ELASTIC_LICENSE_URL_POSTFIX = "/licenses/ELASTIC-LICENSE-2.0.txt"; static final String ELASTIC_LICENSE_URL_POSTFIX = "/licenses/ELASTIC-LICENSE-2.0.txt";
static final String AGPL_ELASTIC_LICENSE_URL_POSTFIX = "/licenses/AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt";
private ProviderFactory providerFactory; private ProviderFactory providerFactory;
@ -36,15 +37,18 @@ public class LicensingPlugin implements Plugin<Project> {
isSnapshotVersion(project) ? revision.get() : "v" + project.getVersion() isSnapshotVersion(project) ? revision.get() : "v" + project.getVersion()
); );
Provider<String> projectLicenseURL = licenseCommitProvider.map(licenseCommit -> ELASTIC_LICENSE_URL_PREFIX + Provider<String> elasticLicenseURL = licenseCommitProvider.map(licenseCommit -> ELASTIC_LICENSE_URL_PREFIX +
licenseCommit + ELASTIC_LICENSE_URL_POSTFIX); licenseCommit + ELASTIC_LICENSE_URL_POSTFIX);
Provider<String> agplLicenseURL = licenseCommitProvider.map(licenseCommit -> ELASTIC_LICENSE_URL_PREFIX +
licenseCommit + AGPL_ELASTIC_LICENSE_URL_POSTFIX);
// But stick the Elastic license url in project.ext so we can get it if we need to switch to it // But stick the Elastic license url in project.ext so we can get it if we need to switch to it
project.getExtensions().getExtraProperties().set("elasticLicenseUrl", projectLicenseURL); project.getExtensions().getExtraProperties().set("elasticLicenseUrl", elasticLicenseURL);
MapProperty<String, String> licensesProperty = project.getObjects().mapProperty(String.class, String.class).convention( MapProperty<String, String> licensesProperty = project.getObjects().mapProperty(String.class, String.class).convention(
providerFactory.provider(() -> Map.of( providerFactory.provider(() -> Map.of(
"Server Side Public License, v 1", "https://www.mongodb.com/licensing/server-side-public-license", "Server Side Public License, v 1", "https://www.mongodb.com/licensing/server-side-public-license",
"Elastic License 2.0", projectLicenseURL.get()) "Elastic License 2.0", elasticLicenseURL.get(),
"GNU Affero General Public License Version 3", agplLicenseURL.get())
) )
); );

View file

@ -74,6 +74,11 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
<url>https://www.mongodb.com/licensing/server-side-public-license</url> <url>https://www.mongodb.com/licensing/server-side-public-license</url>
<distribution>repo</distribution> <distribution>repo</distribution>
</license> </license>
<license>
<name>The OSI-approved Open Source license Version 3.0</name>
<url>https://raw.githubusercontent.com/elastic/elasticsearch/v1.0/licenses/AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses> </licenses>
<developers> <developers>
<developer> <developer>
@ -149,6 +154,11 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
<url>https://www.mongodb.com/licensing/server-side-public-license</url> <url>https://www.mongodb.com/licensing/server-side-public-license</url>
<distribution>repo</distribution> <distribution>repo</distribution>
</license> </license>
<license>
<name>The OSI-approved Open Source license Version 3.0</name>
<url>https://raw.githubusercontent.com/elastic/elasticsearch/v1.0/licenses/AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses> </licenses>
<developers> <developers>
<developer> <developer>
@ -233,6 +243,11 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
<url>https://www.mongodb.com/licensing/server-side-public-license</url> <url>https://www.mongodb.com/licensing/server-side-public-license</url>
<distribution>repo</distribution> <distribution>repo</distribution>
</license> </license>
<license>
<name>The OSI-approved Open Source license Version 3.0</name>
<url>https://raw.githubusercontent.com/elastic/elasticsearch/v1.0/licenses/AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses> </licenses>
<developers> <developers>
<developer> <developer>
@ -326,6 +341,11 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
<url>https://www.mongodb.com/licensing/server-side-public-license</url> <url>https://www.mongodb.com/licensing/server-side-public-license</url>
<distribution>repo</distribution> <distribution>repo</distribution>
</license> </license>
<license>
<name>The OSI-approved Open Source license Version 3.0</name>
<url>https://raw.githubusercontent.com/elastic/elasticsearch/v1.0/licenses/AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses> </licenses>
<developers> <developers>
<developer> <developer>
@ -399,6 +419,11 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
<url>https://www.mongodb.com/licensing/server-side-public-license</url> <url>https://www.mongodb.com/licensing/server-side-public-license</url>
<distribution>repo</distribution> <distribution>repo</distribution>
</license> </license>
<license>
<name>The OSI-approved Open Source license Version 3.0</name>
<url>https://raw.githubusercontent.com/elastic/elasticsearch/v2.0/licenses/AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses> </licenses>
<developers> <developers>
<developer> <developer>