Răsfoiți Sursa

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

Aftermath of coming back to open source licensing
Rene Groeschke 1 an în urmă
părinte
comite
94ea8efb90

+ 1 - 1
build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/GitInfoPlugin.java

@@ -44,7 +44,7 @@ class GitInfoPlugin implements Plugin<Project> {
         gitInfo.disallowChanges();
         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() {

+ 7 - 3
build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/LicensingPlugin.java

@@ -21,6 +21,7 @@ import java.util.Map;
 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_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;
 
@@ -36,15 +37,18 @@ public class LicensingPlugin implements Plugin<Project> {
              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);
+        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
-        project.getExtensions().getExtraProperties().set("elasticLicenseUrl", projectLicenseURL);
+        project.getExtensions().getExtraProperties().set("elasticLicenseUrl", elasticLicenseURL);
 
         MapProperty<String, String> licensesProperty = project.getObjects().mapProperty(String.class, String.class).convention(
                 providerFactory.provider(() -> Map.of(
                         "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())
                 )
         );
 

+ 25 - 0
build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/PublishPluginFuncTest.groovy

@@ -74,6 +74,11 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
       <url>https://www.mongodb.com/licensing/server-side-public-license</url>
       <distribution>repo</distribution>
     </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>
   <developers>
     <developer>
@@ -149,6 +154,11 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
                   <url>https://www.mongodb.com/licensing/server-side-public-license</url>
                   <distribution>repo</distribution>
                 </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>
                 <developers>
                   <developer>
@@ -233,6 +243,11 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
                   <url>https://www.mongodb.com/licensing/server-side-public-license</url>
                   <distribution>repo</distribution>
                 </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>
               <developers>
                 <developer>
@@ -326,6 +341,11 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
                   <url>https://www.mongodb.com/licensing/server-side-public-license</url>
                   <distribution>repo</distribution>
                 </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>
               <developers>
                 <developer>
@@ -399,6 +419,11 @@ class PublishPluginFuncTest extends AbstractGradleFuncTest {
                   <url>https://www.mongodb.com/licensing/server-side-public-license</url>
                   <distribution>repo</distribution>
                 </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>
               <developers>
                 <developer>