Home / Class/ BuildInfo Class — spring-boot Architecture

BuildInfo Class — spring-boot Architecture

Architecture documentation for the BuildInfo class in BuildInfo.java from the spring-boot codebase.

Entity Profile

Relationship Graph

Source Code

build-plugin/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/buildinfo/BuildInfo.java lines 44–107

@DisableCachingByDefault(because = "Not worth caching")
public abstract class BuildInfo extends DefaultTask {

	private final BuildInfoProperties properties;

	public BuildInfo() {
		this.properties = getProject().getObjects().newInstance(BuildInfoProperties.class, getExcludes());
		getDestinationDir().convention(getProject().getLayout().getBuildDirectory().dir(getName()));
	}

	/**
	 * Returns the names of the properties to exclude from the output.
	 * @return names of the properties to exclude
	 * @since 3.0.0
	 */
	@Internal
	public abstract SetProperty<String> getExcludes();

	/**
	 * Generates the {@code build-info.properties} file in the configured
	 * {@link #getDestinationDir destination}.
	 */
	@TaskAction
	public void generateBuildProperties() {
		try {
			ProjectDetails details = new ProjectDetails(this.properties.getGroupIfNotExcluded(),
					this.properties.getArtifactIfNotExcluded(), this.properties.getVersionIfNotExcluded(),
					this.properties.getNameIfNotExcluded(), this.properties.getTimeIfNotExcluded(),
					this.properties.getAdditionalIfNotExcluded());
			new BuildPropertiesWriter(new File(getDestinationDir().get().getAsFile(), "build-info.properties"))
				.writeBuildProperties(details);
		}
		catch (IOException ex) {
			throw new TaskExecutionException(this, ex);
		}
	}

	/**
	 * Returns the directory to which the {@code build-info.properties} file will be
	 * written.
	 * @return the destination directory
	 */
	@OutputDirectory
	public abstract DirectoryProperty getDestinationDir();

	/**
	 * Returns the {@link BuildInfoProperties properties} that will be included in the
	 * {@code build-info.properties} file.
	 * @return the properties
	 */
	@Nested
	public BuildInfoProperties getProperties() {
		return this.properties;
	}

	/**
	 * Executes the given {@code action} on the {@link #getProperties()} properties.
	 * @param action the action
	 */
	public void properties(Action<BuildInfoProperties> action) {
		action.execute(this.properties);
	}

}

Domain

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free