- 
                Notifications
    
You must be signed in to change notification settings  - Fork 71
 
Remove JS Legacy configurations (updated) #296
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
Conversation
…f atomicfu is compiled with Kotlin 1.9+
In addition to removal of JS/Legacy configurations, JS compiler type should also be changed from BOTH to IR when switching to Kotlin 1.9. The removal condition is also based on Kotlin language version now instead of compiler release version (it allows to adopt newer compiler releases without removing JS/Legacy until language version is changed to 1.9+).
This test only fails during testing of Kotlin compiler dev builds at the moment, and thus should probably be muted in `kotlin-community`-branches instead of `develop`.
        
          
                atomicfu/build.gradle
              
                Outdated
          
        
      | // (right now it implements a toggle between IR and BOTH JS compiler types for testing of Kotlin dev builds) | ||
| def fromVersion = { String arg -> KotlinVersion.values().find { it.version == arg } } | ||
| def kotlinLanguageVersion = fromVersion(KotlinAggregateBuild.getOverriddenKotlinLanguageVersion(project) ?: "1.4") | ||
| def isJsLegacyCompilerEnabled = kotlinLanguageVersion < KotlinVersion.KOTLIN_1_9 | 
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.
LanguageVersion has nothing with JS target deprecation. Should be checked using KGP version.
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.
I made these changes based on the fact that CLI-level deprecation of JS/Legacy seems to work based on the language version at the moment, so we might want to take a closer look at it in the compiler as well then.
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.
Hmm 👀
For now I rolled this back to KGP version check
        
          
                atomicfu-gradle-plugin/build.gradle
              
                Outdated
          
        
      | def kotlinVersion = ext.kotlin_version.split('\\.').take(2).collect { it.toInteger() } | ||
| if (kotlinVersion[0] == 1 && kotlinVersion[1] == 9) { | ||
| test { | ||
| exclude "**/JsLegacyTransformationTest*", "**/MppLegacyTransformationTest*" | ||
| } | ||
| } | 
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.
I would propose to move kotlin version parsing into a method inside buildSrc module. So it could be used in all build files.
        
          
                atomicfu/build.gradle
              
                Outdated
          
        
      | if (it instanceof IvyArtifactRepository) { | ||
| metadataSources { | ||
| artifact() | ||
| tasks.withType(compileJsLegacy.getClass()) { | 
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.
compileJsLegacyshould be already aClass.- after 
.withType.configureEach { ... }should be used 
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 gradle 6.8.3 compilation fails if I remove getClass()
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.
I mean in the lines above it could be:
    def compileJsLegacy = tasks.hasProperty("compileKotlinJsLegacy")
            ? compileKotlinJsLegacy.getClass()
            : compileKotlinJs.getClass()| } | ||
| } | ||
| 
               | 
          ||
| internal fun isKotlinVersionAtLeast(project: Project, atLeastMajor: Int, atLeastMinor: Int): Boolean = | 
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.
Probably it should be moved to another file
| 
           I've tried compiling this branch with Kotlin 1.9.0-dev-6688 and various LVs. The results are: 
 From testing of Kotlin dev-builds's perspective, everything is great for 1.9.0-dev TC configurations and good enough for K2 TC configurations (we will probably mute all tests in relevant TC configurations eventually regardless, so red tests are not a big problem).  | 
    
| 
           Thank you! I'll have a look what is wrong with   | 
    
| 
           @FenstonSingel Am I right, that we can merge these change into develop now? And for dev-builds you will be able to mute failing tests for now?  | 
    
23db8f0    to
    b831000      
    Compare
  
    * moved check function to buildsrc
b831000    to
    6966e9d      
    Compare
  
    | 
           I can locally reproduce the failure of   | 
    
          
 Yes, any failing tests are not a blocker for dev-builds testing.  | 
    
* JS Legacy build configurations as well as JS Legacy test projects were conditionally removed for KGP version >= 1.9.0 Co-authored-by: Stanislav Ruban <[email protected]> (cherry picked from commit 4dd0a6c)
No description provided.