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

KTOR-7832 Rewrite client-mpp sample to fix build errors #211

Merged
merged 6 commits into from
Jan 8, 2025

Conversation

stokado
Copy link
Contributor

@stokado stokado commented Jan 5, 2025

Summary

This PR aims to fix failing builds of the client-mpp sample.

Approach

  • Migrate Gradle to Kotlin DSL
  • Migrate from kotlin-js Gradle plugin to kotlin-multiplatform Gradle plugin
  • Update Android Gradle Plugin (AGP) to latest stable version (8.6.1)
  • Update Kotlin plugin to 2.1.0, fix warnings in multiplatform builds
  • Update iOS build stages to use task "embedAndSignAppleFrameworkForXcode" instead of self-written task

YouTrack Ticket

client-mpp/androidApp/build.gradle.kts Dismissed Show dismissed Hide dismissed
client-mpp/androidApp/build.gradle.kts Dismissed Show dismissed Hide dismissed
client-mpp/androidApp/build.gradle.kts Dismissed Show dismissed Hide dismissed
}

android {
compileSdk = 34

Check warning

Code scanning / detekt

Report magic numbers. Magic number is a numeric literal that is not defined as a constant and hence it's unclear what the purpose of this number is. It's better to declare such numbers as constants and give them a proper name. By default, -1, 0, 1, and 2 are not considered to be magic numbers. Warning

This expression contains a magic number. Consider defining it to a well named constant.
client-mpp/shared/build.gradle.kts Dismissed Show dismissed Hide dismissed
client-mpp/shared/build.gradle.kts Dismissed Show dismissed Hide dismissed
@@ -0,0 +1,5 @@
package io.ktor.samples.mpp.client

Check warning

Code scanning / detekt

Checks whether files end with a line separator. Warning

The file /home/runner/work/ktor-samples/ktor-samples/client-mpp/shared/src/macosX64Main/kotlin/io/ktor/samples/mpp/client/ApplicationDispatcher.kt is not ending with a new line.
@@ -0,0 +1,5 @@
package io.ktor.samples.mpp.client

import kotlinx.coroutines.*

Check warning

Code scanning / detekt

Wildcard imports should be replaced with imports using fully qualified class names. Wildcard imports can lead to naming conflicts. A library update can introduce naming clashes with your classes which results in compilation errors. Warning

kotlinx.coroutines.* is a wildcard import. Replace it with fully qualified imports.
@stokado
Copy link
Contributor Author

stokado commented Jan 5, 2025

Latest build is successful :)

But I couldn't figure out what should be changed in order to open "preview" in xCode

@stokado
Copy link
Contributor Author

stokado commented Jan 5, 2025

Also I should mention, URL we try to fetch in this sample always returns the same html

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>503 Server Error</title>
</head>
<body text="#000000" bgcolor="#ffffff">
<h1>Error: Server Error</h1>
<h2>The service you requested is not available yet.<p>Please try again in 30 seconds.</p></h2>
<h2></h2>

</body></html>

Maybe we should change it to https://example.org?

@osipxd osipxd self-requested a review January 6, 2025 11:02
@e5l
Copy link
Member

e5l commented Jan 8, 2025

@stokado, yep. Let's change.

Copy link
Member

@e5l e5l left a comment

Choose a reason for hiding this comment

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

@stokado, thank you for the pr! LGTM

@e5l e5l merged commit 184239a into ktorio:main Jan 8, 2025
22 of 24 checks passed
@stokado stokado deleted the fix/KTOR-7832 branch January 8, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants