Home / Class/ ChangelogGenerator Class — spring-boot Architecture

ChangelogGenerator Class — spring-boot Architecture

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

Entity Profile

Relationship Graph

Source Code

configuration-metadata/spring-boot-configuration-metadata-changelog-generator/src/main/java/org/springframework/boot/configurationmetadata/changelog/ChangelogGenerator.java lines 42–83

public final class ChangelogGenerator {

	private ChangelogGenerator() {
	}

	public static void main(String[] args) throws IOException {
		generate(new File(args[0]), new File(args[1]), new File(args[2]));
	}

	private static void generate(File oldDir, File newDir, File out) throws IOException {
		String oldVersionNumber = oldDir.getName();
		ConfigurationMetadataRepository oldMetadata = buildRepository(oldDir);
		String newVersionNumber = newDir.getName();
		ConfigurationMetadataRepository newMetadata = buildRepository(newDir);
		Changelog changelog = Changelog.of(oldVersionNumber, oldMetadata, newVersionNumber, newMetadata);
		try (ChangelogWriter writer = new ChangelogWriter(out)) {
			writer.write(changelog);
		}
		System.out.println("%nConfiguration metadata changelog written to '%s'".formatted(out));
	}

	static ConfigurationMetadataRepository buildRepository(File directory) {
		ConfigurationMetadataRepositoryJsonBuilder builder = ConfigurationMetadataRepositoryJsonBuilder.create();
		File[] files = directory.listFiles();
		if (files == null) {
			throw new IllegalStateException("'files' must not be null");
		}
		for (File file : files) {
			try (JarFile jarFile = new JarFile(file)) {
				JarEntry metadataEntry = jarFile.getJarEntry("META-INF/spring-configuration-metadata.json");
				if (metadataEntry != null) {
					builder.withJsonResource(jarFile.getInputStream(metadataEntry));
				}
			}
			catch (IOException ex) {
				throw new RuntimeException(ex);
			}
		}
		return builder.build();
	}

}

Domain

Analyze Your Own Codebase

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

Try Supermodel Free