-
Notifications
You must be signed in to change notification settings - Fork 79
Add IC for Compose Wasm #809
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
Open
nikpachoo
wants to merge
32
commits into
master
Choose a base branch
from
compose-deployment
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
737a012
Add IC for Compose Wasm
ilgonmic 24276ed
No need docker in local case
ilgonmic 774be3f
Remove image after cache build
ilgonmic 450acc2
Use lazy argumentProviders instead of args
ilgonmic 3f6474c
Readonly cache
ilgonmic 3b6b687
Remove time measure
ilgonmic b501e3f
Fix variant-aware configurations for Gradle
ilgonmic 44a201c
Fix sample to be compatible with example in playground
ilgonmic f8907a2
First version with typeinfo
ilgonmic 192a43f
Add resources server
ilgonmic 70f145f
Add test of resources server
ilgonmic 1ad372a
Add test of resources server
ilgonmic e6666a5
Microfix
ilgonmic 4d62cde
Microfix #2
ilgonmic e9e2027
Microfix #3
ilgonmic 8a744cc
Microfix #4
ilgonmic f9c5322
Microfix #5
ilgonmic 2a531d4
Microfix #6
ilgonmic 6272ff0
Microfix #7
ilgonmic 2ba3afb
Microfix #8
ilgonmic 7c01e96
Microfix #9
ilgonmic 278c883
Fix after version upgrade
ilgonmic f2eb7d4
Adopt #1
ilgonmic 1cb1d90
Adopt #2
ilgonmic 9bcdf1f
Adopt #3
ilgonmic a84cd62
Adopt #4
ilgonmic ca5c5a9
Adopt #5
ilgonmic d683836
One request for resources
ilgonmic b0eee73
Fix resource server
ilgonmic da96b9d
Fix stdlib.wasm file with hash
ilgonmic 4b7aa4d
Use compiler output instead of binaryen because it may be incorrect
ilgonmic 4e52b2e
Fixes after merge with current master
dkrasnoff File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,10 @@ | ||
import org.gradle.api.attributes.Attribute | ||
|
||
enum class CacheAttribute { | ||
FULL, | ||
WASM; | ||
|
||
companion object { | ||
val cacheAttribute = Attribute.of("org.jetbrains.kotlin-compiler-server.cache", CacheAttribute::class.java) | ||
} | ||
} |
This file contains hidden or 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,8 @@ | ||
import org.gradle.api.attributes.Category | ||
import org.gradle.api.model.ObjectFactory | ||
|
||
val ObjectFactory.categoryComposeCache | ||
get() = named(Category::class.java, "compose-cache") | ||
|
||
val ObjectFactory.categoryComposeWasmResources | ||
get() = named(Category::class.java, "compose-wasm-resources") |
This file contains hidden or 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,57 @@ | ||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.file.RegularFileProperty | ||
import org.gradle.api.provider.MapProperty | ||
import org.gradle.api.tasks.Input | ||
import org.gradle.api.tasks.InputFile | ||
import org.gradle.api.tasks.OutputFile | ||
import org.gradle.api.tasks.TaskAction | ||
import java.io.File | ||
import java.io.FileInputStream | ||
import java.security.MessageDigest | ||
|
||
abstract class PropertiesGenerator : DefaultTask() { | ||
|
||
@get:InputFile | ||
abstract val hashableFile: RegularFileProperty | ||
|
||
@get:Input | ||
abstract val propertiesMap: MapProperty<String, String> | ||
|
||
@get:OutputFile | ||
abstract val propertiesFile: RegularFileProperty | ||
|
||
@TaskAction | ||
fun updateProperties() { | ||
val file = propertiesFile.get().asFile | ||
|
||
propertiesMap.get().let { | ||
if (it.isNotEmpty()) { | ||
file.writeText("") | ||
it.forEach { (key, value) -> | ||
file.appendText("$key=$value\n") | ||
} | ||
} | ||
} | ||
|
||
file.appendText( | ||
"\ndependencies.compose.wasm=${hashFileContent(hashableFile.get().asFile.absolutePath)}" | ||
) | ||
} | ||
} | ||
|
||
fun hashFileContent(filePath: String, hashAlgorithm: String = "SHA-256"): String { | ||
val file = File(filePath) | ||
val digest = MessageDigest.getInstance(hashAlgorithm) | ||
|
||
// Read the file content in chunks and update the digest | ||
FileInputStream(file).use { fileInputStream -> | ||
val buffer = ByteArray(1024) | ||
var bytesRead: Int | ||
while (fileInputStream.read(buffer).also { bytesRead = it } != -1) { | ||
digest.update(buffer, 0, bytesRead) | ||
} | ||
} | ||
|
||
// Convert the resulting byte array to a readable hex string | ||
return digest.digest().joinToString("") { "%02x".format(it) } | ||
} |
46 changes: 46 additions & 0 deletions
46
buildSrc/src/main/kotlin/base-kotlin-conventions.gradle.kts
This file contains hidden or 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,46 @@ | ||
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension | ||
|
||
extensions.configure<KotlinProjectExtension>("kotlin") { | ||
logger.info("For the ${project.name} we used $kotlinVersion kotlin version in this build.") | ||
|
||
sourceSets.configureEach { | ||
languageSettings { | ||
val kotlinLanguageVersion = project.providers.gradleProperty("kotlin_language_version") | ||
if (kotlinLanguageVersion.isPresent) { | ||
languageVersion = kotlinLanguageVersion.get() | ||
logger.info("An overriding Kotlin language version of $languageVersion was found for project ${project.name}") | ||
} | ||
val kotlinApiVersion = project.providers.gradleProperty("kotlin_api_version") | ||
if (kotlinApiVersion.isPresent) { | ||
apiVersion = kotlinApiVersion.get() | ||
logger.info("An overriding Kotlin api version of $apiVersion was found for project ${project.name}") | ||
} | ||
} | ||
} | ||
|
||
jvmToolchain { | ||
languageVersion.set(JavaLanguageVersion.of(17)) | ||
vendor.set(JvmVendorSpec.AMAZON) | ||
} | ||
} | ||
|
||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach { | ||
compilerOptions { | ||
|
||
freeCompilerArgs.addAll( | ||
"-Xreport-all-warnings", | ||
"-Xrender-internal-diagnostic-names", | ||
"-Xuse-fir-experimental-checkers" | ||
) | ||
|
||
allWarningsAsErrors.set(false) | ||
extraWarnings.set(true) | ||
|
||
// Adding additional cli options for testing purpose | ||
project.providers.gradleProperty("kotlin_additional_cli_options").orNull?.let { options -> | ||
options.split(" ").filter { it.isNotBlank() }.forEach { | ||
freeCompilerArgs.add(it) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
With @ilgonmic we've discussed left only FULL.
Thus, the whole attribute can be deleted.