forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/data_stream_support_routing
* master: Fix DataTierTests package and add a validation test (elastic#78880) Fix split package org.elasticsearch.common.xcontent (elastic#78831) Store DataTier Preference directly on IndexMetadata (elastic#78668) [DOCS] Fixes typo in calendar API example (elastic#78867) Improve Node Shutdown Observability (elastic#78727) Convert encrypted snapshot license object to LicensedFeature (elastic#78731) Revert "Make nodePaths() singular (elastic#72514)" (elastic#78801) Fix incorrect generic type in PolicyStepsRegistry (elastic#78628) [DOCS] Fixes ML get calendars API (elastic#78808) Implement GET API for System Feature Upgrades (elastic#78642) [TEST] More MetadataStateFormat tests (elastic#78577) Add support for rest compatibility headers to the HLRC (elastic#78490) Un-ignoring tests after backporting fix (elastic#78830) Add node REPLACE shutdown implementation (elastic#76247) Wrap VersionPropertiesLoader in a BuildService to decouple build logic projects (elastic#78704) Adjust /_cat/templates not to request all metadata (elastic#78829) [DOCS] Fixes ML get scheduled events API (elastic#78809) Enable exit on out of memory error (elastic#71542) # Conflicts: # server/src/main/java/org/elasticsearch/cluster/metadata/DataStream.java
- Loading branch information
Showing
5,059 changed files
with
16,874 additions
and
14,420 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
...ain/java/org/elasticsearch/gradle/internal/conventions/VersionPropertiesBuildService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
package org.elasticsearch.gradle.internal.conventions; | ||
|
||
import org.apache.commons.io.FileUtils; | ||
import org.gradle.api.GradleException; | ||
import org.gradle.api.JavaVersion; | ||
import org.gradle.api.file.RegularFileProperty; | ||
import org.gradle.api.provider.ProviderFactory; | ||
import org.gradle.api.services.BuildService; | ||
import org.gradle.api.services.BuildServiceParameters; | ||
import org.gradle.initialization.layout.BuildLayout; | ||
import org.gradle.initialization.layout.BuildLayoutFactory; | ||
|
||
import javax.inject.Inject; | ||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.Properties; | ||
import java.util.function.Function; | ||
|
||
abstract class VersionPropertiesBuildService implements BuildService<VersionPropertiesBuildService.Params>, AutoCloseable { | ||
|
||
private final Properties properties; | ||
|
||
@Inject | ||
public VersionPropertiesBuildService(ProviderFactory providerFactory) { | ||
File infoPath = getParameters().getInfoPath().getAsFile().get(); | ||
try { | ||
File propertiesInputFile = new File(infoPath, "version.properties"); | ||
properties = VersionPropertiesLoader.loadBuildSrcVersion(propertiesInputFile, providerFactory); | ||
properties.computeIfAbsent("minimumJava", s -> resolveMinimumJavaVersion(infoPath)); | ||
} catch (IOException e) { | ||
throw new GradleException("Cannot load VersionPropertiesBuildService", e); | ||
} | ||
} | ||
|
||
private JavaVersion resolveMinimumJavaVersion(File infoPath) { | ||
final JavaVersion minimumJavaVersion; | ||
File minimumJavaInfoSource = new File(infoPath, "src/main/resources/minimumCompilerVersion"); | ||
try { | ||
String versionString = FileUtils.readFileToString(minimumJavaInfoSource); | ||
minimumJavaVersion = JavaVersion.toVersion(versionString); | ||
} catch (IOException e) { | ||
throw new GradleException("Cannot resolve minimum compiler version via VersionPropertiesBuildService", e); | ||
} | ||
return minimumJavaVersion; | ||
} | ||
|
||
public Properties getProperties() { | ||
return properties; | ||
} | ||
|
||
@Override | ||
public void close() throws Exception { | ||
} | ||
|
||
public interface Params extends BuildServiceParameters { | ||
RegularFileProperty getInfoPath(); | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
.../src/main/java/org/elasticsearch/gradle/internal/conventions/VersionPropertiesPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
package org.elasticsearch.gradle.internal.conventions; | ||
|
||
import org.gradle.api.Plugin; | ||
import org.gradle.api.Project; | ||
import org.gradle.api.provider.Provider; | ||
import org.gradle.initialization.layout.BuildLayout; | ||
|
||
import javax.inject.Inject; | ||
import java.io.File; | ||
|
||
public class VersionPropertiesPlugin implements Plugin<Project> { | ||
|
||
private BuildLayout buildLayout; | ||
|
||
@Inject | ||
VersionPropertiesPlugin(BuildLayout buildLayout) { | ||
this.buildLayout = buildLayout; | ||
} | ||
|
||
@Override | ||
public void apply(Project project) { | ||
// Register the service if not done yet | ||
File infoPath = new File(buildLayout.getRootDirectory(), "build-tools-internal"); | ||
Provider<VersionPropertiesBuildService> serviceProvider = project.getGradle().getSharedServices() | ||
.registerIfAbsent("versions", VersionPropertiesBuildService.class, spec -> { | ||
spec.getParameters().getInfoPath().set(infoPath); | ||
}); | ||
project.getExtensions().add("versions", serviceProvider.forUseAtConfigurationTime().get().getProperties()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.