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

migration to multiplatform #2859

Draft
wants to merge 3 commits into
base: renovate/all-minor-patch
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ cpg = "7.1.2"
# should be taken from cpg
cpg-neo4j-ogm = { strictly = "4.0.6" }
cpg-neo4j-java-driver = { strictly = "5.7.0" }
aws-sdk = "2.21.16"
aws-sdk = "2.21.21"
cosv4k = "0.0.14"

[plugins]
Expand Down Expand Up @@ -121,7 +121,7 @@ springdoc-openapi-ui = { module = "org.springdoc:springdoc-openapi-ui", version.
springdoc-openapi-webflux-ui = { module = "org.springdoc:springdoc-openapi-webflux-ui", version.ref = "springdoc" }
springdoc-openapi-security = { module = "org.springdoc:springdoc-openapi-security", version.ref = "springdoc" }
springdoc-openapi-kotlin = { module = "org.springdoc:springdoc-openapi-kotlin", version.ref = "springdoc" }
swagger-annotations = { module = "io.swagger.core.v3:swagger-annotations", version = "2.2.18" }
swagger-annotations = { module = "io.swagger.core.v3:swagger-annotations", version = "2.2.19" }

ktor-client-apache = { module = "io.ktor:ktor-client-apache", version.ref = "ktor" }
ktor-client-auth = { module = "io.ktor:ktor-client-auth", version.ref = "ktor" }
Expand Down
221 changes: 112 additions & 109 deletions save-frontend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest

@Suppress("DSL_SCOPE_VIOLATION", "RUN_IN_SCRIPT") // https://github.com/gradle/gradle/issues/22797
plugins {
kotlin("js")
kotlin("multiplatform")
id("com.saveourtool.save.buildutils.build-frontend-image-configuration")
id("com.saveourtool.save.buildutils.code-quality-convention")
id("com.saveourtool.save.buildutils.save-cloud-version-file-configuration")
Expand All @@ -16,26 +16,6 @@ rootProject.plugins.withType<NodeJsRootPlugin> {
rootProject.the<NodeJsRootExtension>().nodeVersion = "16.13.1"
}

dependencies {
implementation(projects.saveCloudCommon)

implementation(enforcedPlatform(libs.kotlin.wrappers.bom))
implementation("org.jetbrains.kotlin-wrappers:kotlin-react")
implementation("org.jetbrains.kotlin-wrappers:kotlin-extensions")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-router-dom")
implementation("org.jetbrains.kotlin-wrappers:kotlin-tanstack-react-table")
implementation("org.jetbrains.kotlin-wrappers:kotlin-mui-icons")
implementation("org.jetbrains.kotlin-wrappers:kotlin-mui")
implementation("io.github.petertrr:kotlin-multiplatform-diff-js:0.4.0")

implementation(libs.save.common)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.datetime)
implementation(libs.ktor.http)
}

val distributionsDirName = "distributions"

kotlin {
Expand Down Expand Up @@ -76,85 +56,116 @@ kotlin {
optIn("kotlin.js.ExperimentalJsExport")
}
}
sourceSets["main"].dependencies {
compileOnly(devNpm("sass", "^1.43.0"))
compileOnly(devNpm("sass-loader", "^12.0.0"))
compileOnly(devNpm("style-loader", "^3.3.1"))
compileOnly(devNpm("css-loader", "^6.5.0"))
compileOnly(devNpm("file-loader", "^6.2.0"))
// https://getbootstrap.com/docs/4.0/getting-started/webpack/#importing-precompiled-sass
compileOnly(devNpm("postcss-loader", "^6.2.1"))
compileOnly(devNpm("postcss", "^8.2.13"))
// See https://stackoverflow.com/a/72828500; newer versions are supported only for Bootstrap 5.2+
compileOnly(devNpm("autoprefixer", "10.4.5"))
compileOnly(devNpm("webpack-bundle-analyzer", "^4.5.0"))
compileOnly(devNpm("mini-css-extract-plugin", "^2.6.0"))
compileOnly(devNpm("html-webpack-plugin", "^5.5.0"))
sourceSets {
val jsMain by getting {
kotlin {
srcDir(
tasks.named("generateSaveCloudVersionFile").map {
it.outputs.files.singleFile
}
)
}
dependencies {
implementation(projects.saveCloudCommon)

// web-specific dependencies
implementation(npm("@fortawesome/fontawesome-svg-core", "^1.2.36"))
implementation(npm("@fortawesome/free-solid-svg-icons", "5.15.3"))
implementation(npm("@fortawesome/free-brands-svg-icons", "5.15.3"))
implementation(npm("@fortawesome/react-fontawesome", "^0.1.16"))
implementation(npm("devicon", "^2.15.1"))
implementation(npm("animate.css", "^4.1.1"))
implementation(npm("react-scroll-motion", "^0.3.0"))
implementation(npm("react-spinners", "0.13.0"))
implementation(npm("react-tsparticles", "1.42.1"))
implementation(npm("tsparticles", "2.1.3"))
implementation(npm("jquery", "3.6.0"))
// BS5: implementation(npm("@popperjs/core", "2.11.0"))
implementation(npm("popper.js", "1.16.1"))
// BS5: implementation(npm("bootstrap", "5.0.1"))
implementation(npm("react-calendar", "^3.8.0"))
implementation(npm("bootstrap", "^4.6.0"))
implementation(npm("react", "^18.0.0"))
implementation(npm("react-dom", "^18.0.0"))
implementation(npm("react-modal", "^3.0.0"))
implementation(npm("os-browserify", "^0.3.0"))
implementation(npm("path-browserify", "^1.0.1"))
implementation(npm("react-minimal-pie-chart", "^8.2.0"))
implementation(npm("lodash.debounce", "^4.0.8"))
implementation(npm("react-markdown", "^8.0.3"))
implementation(npm("rehype-highlight", "^5.0.2"))
implementation(npm("react-ace", "^10.1.0"))
implementation(npm("react-avatar-image-cropper", "^1.4.2"))
implementation(npm("react-circle", "^1.1.1"))
implementation(npm("react-diff-viewer-continued", "^3.2.6"))
implementation(npm("react-json-view", "^1.21.3"))
implementation(npm("multi-range-slider-react", "^2.0.5"))
// react-sigma
implementation(npm("@react-sigma/core", "^3.1.0"))
implementation(npm("sigma", "^2.4.0"))
implementation(npm("graphology", "^0.25.1"))
implementation(npm("graphology-layout", "^0.6.1"))
implementation(npm("graphology-layout-forceatlas2", "^0.10.1"))
implementation(npm("@react-sigma/layout-core", "^3.1.0"))
implementation(npm("@react-sigma/layout-random", "^3.1.0"))
implementation(npm("@react-sigma/layout-circular", "^3.1.0"))
implementation(npm("@react-sigma/layout-forceatlas2", "^3.1.0"))
implementation(npm("react-graph-viz-engine", "^0.1.0"))
implementation(npm("cytoscape", "^3.25.0"))
// translation
implementation(npm("i18next", "^23.4.5"))
implementation(npm("react-i18next", "^13.2.0"))
implementation(npm("i18next-http-backend", "^2.2.2"))
implementation(npm("js-cookie", "^3.0.5"))
// transitive dependencies with explicit version ranges required for security reasons
compileOnly(devNpm("minimist", "^1.2.6"))
compileOnly(devNpm("async", "^2.6.4"))
compileOnly(devNpm("follow-redirects", "^1.14.8"))
}
sourceSets["test"].dependencies {
implementation(kotlin("test-js"))
implementation(devNpm("jsdom", "^19.0.0"))
implementation(devNpm("global-jsdom", "^8.4.0"))
implementation(devNpm("@testing-library/react", "^13.2.0"))
implementation(devNpm("@testing-library/user-event", "^14.0.0"))
implementation(devNpm("karma-mocha-reporter", "^2.0.0"))
implementation(devNpm("istanbul-instrumenter-loader", "^3.0.1"))
implementation(devNpm("karma-coverage-istanbul-reporter", "^3.0.3"))
implementation(devNpm("msw", "^0.40.0"))
implementation(project.dependencies.enforcedPlatform(libs.kotlin.wrappers.bom))
implementation("org.jetbrains.kotlin-wrappers:kotlin-react")
implementation("org.jetbrains.kotlin-wrappers:kotlin-extensions")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-router-dom")
implementation("org.jetbrains.kotlin-wrappers:kotlin-tanstack-react-table")
implementation("org.jetbrains.kotlin-wrappers:kotlin-mui-icons")
implementation("org.jetbrains.kotlin-wrappers:kotlin-mui")
implementation("io.github.petertrr:kotlin-multiplatform-diff-js:0.5.0")

implementation(libs.save.common)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.datetime)
implementation(libs.ktor.http)

compileOnly(devNpm("sass", "^1.43.0"))
compileOnly(devNpm("sass-loader", "^12.0.0"))
compileOnly(devNpm("style-loader", "^3.3.1"))
compileOnly(devNpm("css-loader", "^6.5.0"))
compileOnly(devNpm("file-loader", "^6.2.0"))
// https://getbootstrap.com/docs/4.0/getting-started/webpack/#importing-precompiled-sass
compileOnly(devNpm("postcss-loader", "^6.2.1"))
compileOnly(devNpm("postcss", "^8.2.13"))
// See https://stackoverflow.com/a/72828500; newer versions are supported only for Bootstrap 5.2+
compileOnly(devNpm("autoprefixer", "10.4.5"))
compileOnly(devNpm("webpack-bundle-analyzer", "^4.5.0"))
compileOnly(devNpm("mini-css-extract-plugin", "^2.6.0"))
compileOnly(devNpm("html-webpack-plugin", "^5.5.0"))

// web-specific dependencies
implementation(npm("@fortawesome/fontawesome-svg-core", "^1.2.36"))
implementation(npm("@fortawesome/free-solid-svg-icons", "5.15.3"))
implementation(npm("@fortawesome/free-brands-svg-icons", "5.15.3"))
implementation(npm("@fortawesome/react-fontawesome", "^0.1.16"))
implementation(npm("devicon", "^2.15.1"))
implementation(npm("animate.css", "^4.1.1"))
implementation(npm("react-scroll-motion", "^0.3.0"))
implementation(npm("react-spinners", "0.13.0"))
implementation(npm("react-tsparticles", "1.42.1"))
implementation(npm("tsparticles", "2.1.3"))
implementation(npm("jquery", "3.6.0"))
// BS5: implementation(npm("@popperjs/core", "2.11.0"))
implementation(npm("popper.js", "1.16.1"))
// BS5: implementation(npm("bootstrap", "5.0.1"))
implementation(npm("react-calendar", "^3.8.0"))
implementation(npm("bootstrap", "^4.6.0"))
implementation(npm("react", "^18.0.0"))
implementation(npm("react-dom", "^18.0.0"))
implementation(npm("react-modal", "^3.0.0"))
implementation(npm("os-browserify", "^0.3.0"))
implementation(npm("path-browserify", "^1.0.1"))
implementation(npm("react-minimal-pie-chart", "^8.2.0"))
implementation(npm("lodash.debounce", "^4.0.8"))
implementation(npm("react-markdown", "^8.0.3"))
implementation(npm("rehype-highlight", "^5.0.2"))
implementation(npm("react-ace", "^10.1.0"))
implementation(npm("react-avatar-image-cropper", "^1.4.2"))
implementation(npm("react-circle", "^1.1.1"))
implementation(npm("react-diff-viewer-continued", "^3.2.6"))
implementation(npm("react-json-view", "^1.21.3"))
implementation(npm("multi-range-slider-react", "^2.0.5"))
// react-sigma
implementation(npm("@react-sigma/core", "^3.1.0"))
implementation(npm("sigma", "^2.4.0"))
implementation(npm("graphology", "^0.25.1"))
implementation(npm("graphology-layout", "^0.6.1"))
implementation(npm("graphology-layout-forceatlas2", "^0.10.1"))
implementation(npm("@react-sigma/layout-core", "^3.1.0"))
implementation(npm("@react-sigma/layout-random", "^3.1.0"))
implementation(npm("@react-sigma/layout-circular", "^3.1.0"))
implementation(npm("@react-sigma/layout-forceatlas2", "^3.1.0"))
implementation(npm("react-graph-viz-engine", "^0.1.0"))
implementation(npm("cytoscape", "^3.25.0"))
// translation
implementation(npm("i18next", "^23.4.5"))
implementation(npm("react-i18next", "^13.2.0"))
implementation(npm("i18next-http-backend", "^2.2.2"))
implementation(npm("js-cookie", "^3.0.5"))
// transitive dependencies with explicit version ranges required for security reasons
compileOnly(devNpm("minimist", "^1.2.6"))
compileOnly(devNpm("async", "^2.6.4"))
compileOnly(devNpm("follow-redirects", "^1.14.8"))
}
}
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
implementation(devNpm("jsdom", "^19.0.0"))
implementation(devNpm("global-jsdom", "^8.4.0"))
implementation(devNpm("@testing-library/react", "^13.2.0"))
implementation(devNpm("@testing-library/user-event", "^14.0.0"))
implementation(devNpm("karma-mocha-reporter", "^2.0.0"))
implementation(devNpm("istanbul-instrumenter-loader", "^3.0.1"))
implementation(devNpm("karma-coverage-istanbul-reporter", "^3.0.3"))
implementation(devNpm("msw", "^0.40.0"))
}
}
}
}
}
Expand All @@ -178,7 +189,7 @@ val mswScriptTargetPath = file("${rootProject.buildDir}/js/packages/${rootProjec
val mswScriptTargetFile = "$mswScriptTargetPath/mockServiceWorker.js"
@Suppress("GENERIC_VARIABLE_WRONG_DECLARATION")
val installMwsScriptTaskProvider = tasks.register<Exec>("installMswScript") {
dependsOn(":kotlinNodeJsSetup", ":kotlinNpmInstall", "packageJson")
dependsOn(":kotlinNodeJsSetup", ":kotlinNpmInstall", "jsPackageJson")
inputs.dir(mswScriptTargetPath)
outputs.file(mswScriptTargetFile)
// cd to directory where the generated package.json is located. This is required for correct operation of npm/npx
Expand Down Expand Up @@ -219,19 +230,11 @@ val installMwsScriptTaskProvider = tasks.register<Exec>("installMswScript") {
"--no-save",
)
}
tasks.named<KotlinJsTest>("browserTest").configure {
tasks.named<KotlinJsTest>("jsBrowserTest").configure {
dependsOn(installMwsScriptTaskProvider)
inputs.file(mswScriptTargetFile)
}

kotlin.sourceSets.getByName("main") {
kotlin.srcDir(
tasks.named("generateSaveCloudVersionFile").map {
it.outputs.files.singleFile
}
)
}

tasks.withType<org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack> {
// Since we inject timestamp into HTML file, we would like this task to always be re-run.
inputs.property("Build timestamp", System.currentTimeMillis())
Expand Down
Loading
Loading