Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Realize Reproducible Builds by stabilize name of the KoinMeta file #196

Merged

Conversation

KengoTODA
Copy link

Current implementation decides the name of KoinMeta file randomly, and it makes the build not reproducible. In other words, kspKotlin task generates different output even when input is same.

By this behaviour, Gradle tasks depending on the generated KoinMeta file like compileKotlin are executed even though no code has been changed. I will share screenshot of Gradle build scan for reference:

image

I want to suggest this change to stabilize name of the KoinMeta file. By this change, koin-ksp-compiler will compute digest of generated file, then use it to name the KoinMeta file. It will make the kspKotlin task reproducible, and make successor tasks able to use build cache.

Signed-off-by: Kengo TODA <toda_k@henry.jp>
Signed-off-by: Kengo TODA <toda_k@henry.jp>
@KengoTODA
Copy link
Author

note that this change includes the fix suggested by #195

@arnaudgiuliani arnaudgiuliani added this to the 2.0 milestone Dec 18, 2024
@arnaudgiuliani arnaudgiuliani self-requested a review December 18, 2024 11:08
@arnaudgiuliani arnaudgiuliani changed the base branch from main to 2.0.0 December 20, 2024 17:44
@arnaudgiuliani arnaudgiuliani added the status:checking Ticket is currently being checked label Dec 23, 2024
val allDefinitions = (moduleList + default).flatMap { it.definitions }
val tempFile = createTempFile("KoinMeta", ".kt")
val sha256 = MessageDigest.getInstance("SHA-256");
DigestOutputStream(tempFile.outputStream(), sha256).buffered().use {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, let's go with that 👍

@arnaudgiuliani arnaudgiuliani merged commit c5afa3a into InsertKoinIO:2.0.0 Dec 23, 2024
1 check passed
@arnaudgiuliani
Copy link
Member

merged in c5afa3a

@KengoTODA KengoTODA deleted the toda_k/reproducible-build branch December 24, 2024 02:42
@KengoTODA
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:checking Ticket is currently being checked type:improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants