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

Add multiplatform support via ksp #78

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

alexvanyo
Copy link
Collaborator

@alexvanyo alexvanyo commented Aug 21, 2021

Adds multiplatform support for converting sealed-enum into a multiplatform library using ksp to generate code.

Current progress:

  • Convert project to use kotlin("multiplatform") plugin globally
  • Convert runtime to multiplatform project
    • Convert Class to KClass for return type of enumClass to remove Java dependency Convert Class to KClass #128
    • Make runtime tests multiplatform to run on all platforms
  • Move sealed classes of processing-tests to common code
  • Enable all platforms for ksp-tests
  • Configure ksp to generate commonMain code
  • Make basic tests multiplatform to run on all platforms (not compilation tests)
  • Configure publishing to support multiplatform: Add publishing to mavenCentral #104

@github-actions
Copy link

github-actions bot commented Aug 21, 2021

🧛 Project Code Coverage: 97.57%

Coverage of Modified Files:

File Coverage
CamelCase.kt 100.00%
ClassInspectorUtil.kt 92.59%
EnumForSealedEnumTypeSpec.kt 100.00%
EnumSealedObjectPropertySpec.kt 100.00%
GenSealedEnumHolder.kt 91.27%
InvalidSubclassVisibilityException.kt 100.00%
KotlinPoetKsp.kt 86.76%
KspUtils.kt 100.00%
MaybeAddOriginatingElement.kt 100.00%
NonObjectSealedSubclassException.kt 100.00%
SealedClassExtensions.kt 100.00%
SealedClassNode.kt 100.00%
SealedEnum.kt 100.00%
SealedEnumEnumPropertySpec.kt 100.00%
SealedEnumFileSpec.kt 100.00%
SealedEnumNamePropertySpec.kt 100.00%
SealedEnumOrdinalPropertySpec.kt 100.00%
SealedEnumProcessor.kt 97.49%
SealedEnumSealedEnumPropertySpec.kt 100.00%
SealedEnumTypeSpec.kt 100.00%
SealedEnumValueOfFunSpec.kt 100.00%
SealedEnumValuesPropertySpec.kt 100.00%
SealedEnumWithEnumProvider.kt 100.00%
SuperInterfaces.kt 93.36%
TreeTraversalOrder.kt 100.00%
TreeUtils.kt 100.00%
Unique.kt 100.00%
Visibility.kt 100.00%
WildcardedTypeParameters.kt 89.13%

Modified Files Not Found In Coverage Report:

AnnotationErrors.kt
Compilation.kt
Compilation.kt
CompilationAssertions.kt
CreateSealedEnumFromEnumTests.kt
CurrentProcessingType.kt
CurrentProcessingType.kt
Dangerfile
EmptySealedClass.kt
EmptySealedClassCompilationTests.kt
EmptySealedClassTests.kt
EmptySealedInterface.kt
EmptySealedInterfaceCompilationTests.kt
EmptySealedInterfaceTests.kt
EnumForSealedEnumProvider.kt
EnvironmentsSealedEnum.kt
EnvironmentsSealedEnumCompilationTests.kt
EnvironmentsSealedEnumTests.kt
Flag.kt
FlagCompilationTests.kt
FlagTests.kt
GenSealedEnum.kt
GenericSealedClass.kt
GenericSealedClassCompilationTests.kt
GenericSealedClassTests.kt
JavaBaseClasses.kt
JavaBaseClassesTests.kt
JavaFirstBaseClass.java
JavaInterface1.java
JavaInterface2.java
JavaInterface3.java
JavaInterface4.java
JavaInterface5.java
JavaPrivateInterfaceOuterClass.java
JavaPrivateInterfaceSubclass.java
JavaProtectedInterfaceBaseClass.java
JavaProtectedInterfaceBaseClass.java
JavaProtectedInterfaceSubclass.java
JavaProtectedInterfaceSubclass.java
JavaSecondBaseClass.java
MultiInterfaceFlag.kt
MultiInterfaceFlagCompilationTests.kt
MultiInterfaceFlagTests.kt
NestedClass.kt
NestedClassCompilationTests.kt
NestedClassTests.kt
NestedObjectsWithSameName.kt
NestedObjectsWithSameNameCompilationTests.kt
NestedObjectsWithSameNameTests.kt
NonObjectErrors.kt
OneObjectSealedClass.kt
OneObjectSealedClassCompilationTests.kt
OneObjectSealedClassTests.kt
OneObjectSealedInterface.kt
OneObjectSealedInterfaceCompilationTests.kt
OneObjectSealedInterfaceTests.kt
OutsideSealedClass.kt
OutsideSealedClassCompilationTests.kt
OutsideSealedClassTests.kt
PathsUtils.kt
PrivateInterfaceSealedClass.kt
PrivateInterfaceSealedClassTests.kt
ProcessingType.kt
ProtectedInterfaceSealedClass.kt
ProtectedInterfaceSealedClassTests.kt
ProtectedInterfaceSealedClassWithDifferentPackageBaseClass.kt
ProtectedInterfaceSealedClassWithDifferentPackageBaseClassTests.kt
README.md
README.md
README.md
RepeatableContainer.jvm.kt
RepeatableContainer.kt
SealedClassHierarchy.kt
SealedClassHierarchyCompilationTests.kt
SealedClassHierarchyTests.kt
SealedEnumWithAbstractBaseClasses.kt
SealedEnumWithAbstractBaseClassesCompilationTests.kt
SealedEnumWithAbstractBaseClassesTests.kt
SealedEnumWithInterfaces.kt
SealedEnumWithInterfacesCompilationTests.kt
SealedEnumWithInterfacesTests.kt
SealedInterfaceHierarchy.kt
SealedInterfaceHierarchyCompilationTests.kt
SealedInterfaceHierarchyTests.kt
SplitAcrossFilesSealedClass.kt
SplitAcrossFilesSealedClassCompilationTests.kt
SplitAcrossFilesSealedClassTests.kt
SplitAcrossFilesSubclassA.kt
SplitAcrossFilesSubclassB.kt
SplitAcrossFilesSubclassC.kt
TraversalOrder.kt
TraversalOrderCompilationTests.kt
TraversalOrderTests.kt
TreeUtilsTests.kt
TwoObjectSealedClass.kt
TwoObjectSealedClassCompilationTests.kt
TwoObjectSealedClassTests.kt
TwoObjectSealedInterface.kt
TwoObjectSealedInterfaceCompilationTests.kt
TwoObjectSealedInterfaceTests.kt
VisibilitySealedClass.kt
VisibilitySealedClassCompilationTests.kt
VisibilitySealedClassTests.kt
VisibilitySealedClassVisibilityTests.kt
build.gradle.kts
build.gradle.kts
build.gradle.kts
build.gradle.kts
build.gradle.kts
build.gradle.kts
build.gradle.kts
build.gradle.kts
ci.yml
com.livefront.sealedenum.detekt.gradle.kts
com.livefront.sealedenum.kotlin.gradle.kts
com.livefront.sealedenum.publish.gradle.kts
detekt.yml
gradle.properties
libs.versions.toml
settings.gradle.kts
yarn.lock

Codebase cunningly covered by count Shroud 🧛

Generated by 🚫 Danger

@alexvanyo alexvanyo force-pushed the av/multiplatform-exploration branch 9 times, most recently from 8c99e84 to 9e8e184 Compare August 21, 2021 23:36
@cdflynn
Copy link

cdflynn commented Aug 21, 2021

An initial exploration of converting sealed-enum into a multiplatform library (based on #76).

excellent, multiplatform++

Every other module was still impacted however, with the only target being jvm

So this will be interesting, I see ubuntu has no issues and our familiar platform problems have taken their new flavors, ala

\D:\a\sealed-enum\sealed-enum\runtime\src\jvmMain\kotlin\com\livefront\sealedenum\RepeatableContainer.jvm.kt:8:8: error: the feature "multi platform projects" is experimental and should be enabled explicitly

Feels like progress =)
Really curious to watch what comes out of the kotlin compiler issue.

@alexvanyo alexvanyo force-pushed the av/multiplatform-exploration branch 3 times, most recently from f8fccda to 75dd212 Compare August 22, 2021 00:49
@alexvanyo
Copy link
Collaborator Author

Yep, this exploration is roughly tangential to the kotlin-compile-testing + KSP + KotlinPoet issue that's causing the tests to fail on macOS and Windows on #76 , but those same tests are also causing the failures here 😄. Another options is disabling those tests on the offending platforms, since the logic and code coverage is still maintained by the Linux build.

The key bit is that for runtime, the additional targets require testing on all three platforms, since there are targets that can only be run on each platform (fun fact, it is literally impossible to fully this project in one go, since there are both macOS and Windows specific targets). So the good news is the tests and macOS and Windows are passing for those targets, before failing on the same tests again.

The next step here is reworking the test suite, so that it can be run on more than just jvm (which mostly will consist of removing a direct dependency on JUnit and anything else Java).

@alexvanyo alexvanyo force-pushed the av/multiplatform-exploration branch 15 times, most recently from 0a6a122 to 1e3bcd4 Compare September 3, 2021 17:01
@alexvanyo alexvanyo changed the base branch from main to av/gradle-7.2-remove-buildSrc November 8, 2021 20:30
Base automatically changed from av/gradle-7.2-remove-buildSrc to main November 9, 2021 19:02
@alexvanyo alexvanyo force-pushed the av/multiplatform-exploration branch 4 times, most recently from 8360961 to df49143 Compare November 20, 2021 00:06
@alexvanyo alexvanyo force-pushed the av/multiplatform-exploration branch 2 times, most recently from 649a0c5 to c24f074 Compare April 17, 2022 01:16
@alexvanyo alexvanyo force-pushed the av/multiplatform-exploration branch from c24f074 to 7d53e8c Compare July 27, 2022 03:52
@alexvanyo alexvanyo force-pushed the av/multiplatform-exploration branch from 7d53e8c to e414c48 Compare April 4, 2023 20:48
@alexvanyo alexvanyo changed the title Multiplatform Exploration Add multiplatform support via ksp Apr 5, 2023
@alexvanyo alexvanyo mentioned this pull request Apr 7, 2023
@alexvanyo alexvanyo force-pushed the av/multiplatform-exploration branch from e414c48 to 37fead7 Compare April 7, 2023 17:50
@alexvanyo alexvanyo changed the base branch from main to av/class-to-kclass April 7, 2023 17:50
Base automatically changed from av/class-to-kclass to main April 7, 2023 19:48
@alexvanyo alexvanyo marked this pull request as ready for review April 7, 2023 19:49
@alexvanyo alexvanyo linked an issue Apr 7, 2023 that may be closed by this pull request
@alexvanyo
Copy link
Collaborator Author

This is ready to review, but if merged will be blocked on switching to mavenCentral publishing (#104) since Jitpack won't be building on macOS.

@alexvanyo alexvanyo force-pushed the av/multiplatform-exploration branch from 37fead7 to 8742bdf Compare June 1, 2023 02:47
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.

Multiplatform support
2 participants