exaV / screeps-kotlin-types

Screep's Kotlin type definitions
MIT License
17 stars 18 forks source link

Testing locally #72

Closed wesleyhall closed 3 years ago

wesleyhall commented 3 years ago

This PR is designed to make local testing slightly easier and to document the process.

I added a gradle.properties file with version=SNAPSHOT. This is so as to avoid the step of altering the build.gradle.kts file to add a version when building locally. ./gradlew publishKotlinPublicationToMavenLocal will now build and add a version as "SNAPSHOT" without any other changes required.

No need, I think, to add a version number before SNAPSHOT here (I'd actually argue, ever, but there is a time and place for development philosophy ;)), and this avoids having to update this file on each release.

I had to remove gradle.properties from .gitignore in order to add this file. I think it is fine (possibly recommended) to add this file to SCM, but I don't know if this will clash with anyone's local configuration.

In order to release a named version ./gradlew -Pversion=<version> publish can be used at the command line or from CI.

I have added a section to CONTRIBUTING.md describing how to locally install and reference based on this procedure.

magnusesp commented 3 years ago

I find it easier to checkout my fork of the types as a git submodule and then adding it as a source set in the build.gradle.kts file like this:

kotlin {
    sourceSets["main"].apply {
        kotlin.srcDir("src/libs/screeps-kotlin-types/src/main/kotlin")
    }
...
wesleyhall commented 3 years ago

@magnusesp

That's a nice option as it means you can co-develop and don't have to keep reinstalling changes locally. I suppose what I am a little worried about is offering too many options in the doc. There are already two with local install and jitpack.

I guess ideally you would develop with your approach but still run a final test with the maven local approach because of the three options, I think that is the only one that would run the tests.

I will let @exaV add his perspective. I can add your solution above to the doc but I don't even know if he will want this PR yet.