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

#854 update projects to use new Kotlin Multiplatform Gradle plugin #855

Merged
merged 40 commits into from Aug 12, 2022

Conversation

aSemy
Copy link
Contributor

@aSemy aSemy commented Jul 21, 2022

Initial steps at implementing #854, and migrating to the new Kotlin Multiplatform plugin. Additionally, re-organises the subprojects to a flatter structure.

  • share common Gradle config in buildSrc convention plugins
  • verify the .api files are the same. They're still generated, but each new subproject has a single merged file, so I didn't try comparing
  • re-enable Android projects. I'm not an Android developer, so I would like help with this.
  • re-enable dokka
  • re-enable Maven publishing
  • finish migrating plugins/configuration plugins to buildSrc plugins
  • remove modules/mockk-agent-api/api-old files (I moved them here because the mockk-agent-common and mockk-agent-api projects were merged, and I wanted to make sure the new .api matched)
  • I wasn't sure what the purpose of localrepo=/Users/raibaz/.m2/repository in gradle.properties, so I didn't migrate it. @Raibaz Can this be replaced by running ./gradlew publishToMavenLocal?
    UPDATE: changed to be system-independent, can be overridden on machines in $GRADLE_USER_HOME/gradle.properties
  • Verify that the new Gradle Toolchain config means the different JDKs are tested in the GitHub action matrix. Might need to parameterise this...

Summary

  • refactored projects to use newer Kotlin Multiplatform plugin

  • New subprojects are

    • mockk
    • mockk-agent
    • mockk-agent-android
    • mockk-agent-android-dispatcher
    • mockk-agent-api
    • mockk-android
    • mockk-dsl

    the only significant difference is that mockk-agent-common was merged into mockk-agent-api.

  • grouped subprojects under 'modules' directory

  • set up buildSrc convention plugins

  • migrated all Gradle config to Kotlin

  • Renamed ValueClassSupport to ValueClassSupportAndroid in the Android project (temp fix because I got an error - this should be fixed in Reduce code duplication across subprojects #857)

  • You can test publishing by running ./gradlew publishAllPublicationsToLocalRepoRepository and seeing the result in ./build/maven-local-repo

  • removed Jacoco, and replaced it with Kotlinx Kover

  • Javadoc is now provided by Dokka HTML

@aSemy aSemy marked this pull request as draft July 21, 2022 20:41
@aSemy aSemy force-pushed the fix/854-update-build-config branch from a649c36 to 5dd6203 Compare July 30, 2022 12:48
@aSemy
Copy link
Contributor Author

aSemy commented Jul 30, 2022

@Raibaz Hey, could you have a look at the progress so far? I'd like to know what you think before I finish up.

It would probably be easier to look at the changes by checking out the branch, then you can see the new structure.

A summary

  • I haven't made any code changes - only build config
  • updated projects to use Kotlin Multiplatform layout
  • Created some convention plugins in buildSrc - the build config is a lot neater now!
  • moved subprojects to modules/ subdirectory, and flattened them so they're not nested (e.g. the mockk-agent-android-dispatcher project was nested inside mockk-agent-android). This helped during refactoring, so I knew which subprojects were refactored, and the un-refactored ones were still in the base project
  • I wanted to tidy up the root directory, so I moved some of the media files into the doc/ directory - this might break some links? I can revert it

@Raibaz
Copy link
Collaborator

Raibaz commented Jul 30, 2022

Looks pretty cool so far, thanks a lot!

@Raibaz
Copy link
Collaborator

Raibaz commented Aug 11, 2022

  • I'll add localrepo back into gradle.properties, but set it to ./build/maven-local-repo.
  • On your machine in $GRADLE_USER_HOME/gradle.properties set localrepo=/path/to/your/personal/.m2. This will override the project setting (the order is documented here).

This way, you can override the default, but the project has settings that work for everyone. I'd like to keep the project settings independent of machine-specific config.

Sure, this males a lot of sense, thanks!

@Raibaz
Copy link
Collaborator

Raibaz commented Aug 11, 2022

Still cannot build it locally btw, getting the same error.

@aSemy
Copy link
Contributor Author

aSemy commented Aug 11, 2022

Still cannot build it locally btw, getting the same error.

Are you on an M1 Mac? Is it this issue? gradle/gradle#19874

@Raibaz
Copy link
Collaborator

Raibaz commented Aug 12, 2022

Yep that looks exactly like my case.

@aSemy
Copy link
Contributor Author

aSemy commented Aug 12, 2022

I changed the buildSrc Toolchain to be jdk11 - that might fix it?

@Raibaz
Copy link
Collaborator

Raibaz commented Aug 12, 2022

Yep this fixed it, thanks a lot!

@Raibaz Raibaz merged commit 870bd59 into mockk:master Aug 12, 2022
@aSemy aSemy deleted the fix/854-update-build-config branch August 12, 2022 14:39
@kubode kubode mentioned this pull request Aug 23, 2022
3 tasks
kodiakhq bot pushed a commit to RBusarow/Dispatch that referenced this pull request Aug 23, 2022
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [io.mockk:mockk](https://mockk.io) ([source](https://togithub.com/mockk/mockk)) | `1.12.5` -> `1.12.7` | [![age](https://badges.renovateapi.com/packages/maven/io.mockk:mockk/1.12.7/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/maven/io.mockk:mockk/1.12.7/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/maven/io.mockk:mockk/1.12.7/compatibility-slim/1.12.5)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/maven/io.mockk:mockk/1.12.7/confidence-slim/1.12.5)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>mockk/mockk</summary>

### [`v1.12.7`](https://togithub.com/mockk/mockk/releases/tag/1.12.7)

[Compare Source](https://togithub.com/mockk/mockk/compare/1.12.6...1.12.7)

#### What's Changed

-   Update android-sdk-detector.settings.gradle.kts by [@&#8203;aSemy](https://togithub.com/aSemy) in [mockk/mockk#886
-   only sign if the signing properties are present by [@&#8203;aSemy](https://togithub.com/aSemy) in [mockk/mockk#885
-   Fix an issue that Android libraries was not published by [@&#8203;kubode](https://togithub.com/kubode) in [mockk/mockk#887

#### New Contributors

-   [@&#8203;kubode](https://togithub.com/kubode) made their first contribution in [mockk/mockk#887

**Full Changelog**: mockk/mockk@1.12.6...1.12.7

### [`v1.12.6`](https://togithub.com/mockk/mockk/releases/tag/1.12.6)

[Compare Source](https://togithub.com/mockk/mockk/compare/1.12.5...1.12.6)

#### What's Changed

-   Dependency updates, JDK17 v2 by [@&#8203;aSemy](https://togithub.com/aSemy) in [mockk/mockk#863
-   Dependency updates, JDK17 by [@&#8203;hduerkop](https://togithub.com/hduerkop) in [mockk/mockk#829
-   Fix unmockkAll to work if constructor was mocked multiple times by [@&#8203;Chrostoq](https://togithub.com/Chrostoq) in [mockk/mockk#870
-   fix: fix value class field determination by [@&#8203;qoomon](https://togithub.com/qoomon) in [mockk/mockk#872
-   [#&#8203;854](https://togithub.com/mockk/mockk/issues/854) update projects to use new Kotlin Multiplatform Gradle plugin by [@&#8203;aSemy](https://togithub.com/aSemy) in [mockk/mockk#855

#### New Contributors

-   [@&#8203;hduerkop](https://togithub.com/hduerkop) made their first contribution in [mockk/mockk#829
-   [@&#8203;Chrostoq](https://togithub.com/Chrostoq) made their first contribution in [mockk/mockk#870

**Full Changelog**: mockk/mockk@1.12.5...1.12.6

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Never, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/RBusarow/Dispatch).



PR-URL: #564
aSemy added a commit to aSemy/mockk that referenced this pull request Nov 16, 2022
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.

None yet

2 participants