-
Notifications
You must be signed in to change notification settings - Fork 162
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
Add support for incremental compile #612
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏🏻 🎉 LOVE THIS
manifestSigner = manifestSigner | ||
) | ||
if (inputChanges.isIncremental) { | ||
val filterByChangeType: ((ChangeType) -> Boolean) -> List<File> = { filter -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooooh this is a tricky signature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be a fun
instead of a val
?
fun filesByChangeType(changeType: ChangeType): List<File> {
inputChanges.getFileChanges(inputDir)
.filter { filter(it.changeType) }
.map { outputDir.file(it.normalizedPath).get().asFile }
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is the problem with incremental refactors 😅 - definitely should be a fun instead.
writeManifest(outputDir, mainFunction, mainModuleId, manifestSigner, modules) | ||
} | ||
|
||
fun incrementalCompile( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is rad!
}.quickjsBytecode.toByteArray()) | ||
} | ||
|
||
assertZiplineIncrementalCompile("$rootProject/base", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neato
hashingSink.hash | ||
} | ||
val jsFiles = getJsFiles(inputDir.listFiles()!!.asList()) | ||
jsFiles.forEach { jsFile -> compileSingleFile(jsFile, outputDir, modules) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to skip non-.js
files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getJsFiles
handles that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's probably a long tail of smaller optimizations such as avoiding intermediate collections, minimizing string allocation, etc.
This is a huge improvement as-is though!
zipline-gradle-plugin/src/main/kotlin/app/cash/zipline/gradle/ZiplineCompileTask.kt
Outdated
Show resolved
Hide resolved
zipline-gradle-plugin/src/main/kotlin/app/cash/zipline/gradle/ZiplineCompiler.kt
Outdated
Show resolved
Hide resolved
// Clean up dir from previous runs | ||
if (outputDir.exists()) { | ||
outputDir.deleteRecursively() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably use a JUnit temporary directory rule here to ensure a clear slate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'll do this as a separate PR, since really we should do this for all test, not just the incremental ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG
…ZiplineCompileTask.kt Co-authored-by: Jake Wharton <jw@squareup.com>
…ZiplineCompiler.kt Co-authored-by: Jake Wharton <jw@squareup.com>
No description provided.