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

Update to gradle 6.3 and kotlin 1.3.72 #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marshallpierce
Copy link

No description provided.

@marshallpierce marshallpierce force-pushed the mp/build-updates branch 3 times, most recently from 76529b3 to 3f3ad3b Compare April 16, 2020 13:51
.idea/modules.xml
.idea/.name
.idea/compiler.xml
.idea/workspace.xml
Copy link
Author

Choose a reason for hiding this comment

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

My IDE wanted to add even more files, and also was having a slapfight with your IDE over the ones that were checked in. In my experience, having anything in .idea in VCS leads to discomfort.

Choose a reason for hiding this comment

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

For convenience .idea (and all constantly ignored files and folders) should be included in a global .gitignore file in the user home directory and be declared like this:

git config --global core.excludesFile '~/.gitignore'

Copy link
Author

Choose a reason for hiding this comment

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

That's one way of doing it, I suppose, but in my experience, the more behavior you can sqeeze into the repo itself, the better. I want to know that every clone of this repo will have the same ignored files the same way that I want them to all have the same source code.

println("building version $version")

repositories {
mavenCentral()
Copy link
Author

Choose a reason for hiding this comment

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

the buildscript repositories block was using jcenter(), which is a superset of mavenCentral(), but this one wasn't, so I left it as such

}

dependencies {
implementation(kotlin("stdlib"))
Copy link
Author

Choose a reason for hiding this comment

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

the previous setup was using compileOnly, which seems improbable, as the project is using non-inlined elements of the kotlin stdlib. Similarly, kotlin-reflect also looks like it's used at runtime.

}

java {
withSourcesJar()
Copy link
Author

Choose a reason for hiding this comment

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

new shortcut in recent gradle

}


task javadocJar(type: Jar) {
Copy link
Author

Choose a reason for hiding this comment

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

This was likely copied from another build -- it produced empty jars. Not too hard to set up kdoc to do something similar, but given that you've made it this far (and most people will just use the source jar anyway), probably fine without.

On master:

% gw clean javadocJar
Parallel execution is an incubating feature.

> Configure project :
building version SNAPSHOT
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
        at build_d5evhdqlezgzanmdvjnd6czsd.run(/vol/ssd-2/mbp-home/dev/forks/konfig/build.gradle:84)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)

BUILD SUCCESSFUL in 0s
2 actionable tasks: 2 executed

% find . -name '*.jar'                          
./gradle/wrapper/gradle-wrapper.jar
./build/libs/konfig-SNAPSHOT-javadoc.jar

% jar -tf build/libs/konfig-SNAPSHOT-javadoc.jar 
META-INF/
META-INF/MANIFEST.MF

val files = ArrayList<String>()
val properties = HashMap<Key<*>, CommandLineProperty>()
val shortOpts: Map<String, CommandLineOption> = options.filter { it.short != null }.associateBy({ "-${it.short!!}" }, { it })
val longOpts: Map<String, CommandLineOption> = options.associateBy({ "--${it.long}" }, { it })

var i = 0;
Copy link
Author

Choose a reason for hiding this comment

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

Sorry for the whitespace noise. I gave up trying to get IntelliJ to not fix it. This line is the warning I had it fix.

@@ -15,7 +15,7 @@ open class PropertyKeys : Iterable<Key<*>> {
open class PropertyGroup(private val outer: PropertyGroup? = null) : PropertyKeys() {
private fun outer() = outer ?: javaClass.enclosingClass?.kotlin?.objectInstance as? PropertyGroup
private fun name() : String = namePrefix() + groupName()
private fun namePrefix() = outer()?.name()?.let { it + "." } ?: ""
private fun namePrefix() = outer()?.name()?.let { "$it." } ?: ""
Copy link
Author

Choose a reason for hiding this comment

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

More letting the IDE apply its suggestions.

}

fun <T : Enum<T>> enumType(enumClass: Class<T>, allowed: Iterable<T>) = enumType(enumClass, allowed.associate { it.name to it })
fun <T : Enum<T>> enumType(enumClass: Class<T>, allowed: Iterable<T>) = enumType(enumClass,
allowed.associateBy { it.name })
Copy link
Author

Choose a reason for hiding this comment

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

and more accepting the IDE's suggestions. Here, no Pair need be allocated by using associateBy instead of associate.

@@ -5,7 +5,8 @@ script: ./b clean build
sudo: false

jdk:
- oraclejdk8
- oraclejdk11
Copy link
Author

Choose a reason for hiding this comment

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

Travis grumbles about 8, so figured we might as well have the LTS and the latest 6-mo release.


// anonymous objects don't get names in their KClass, so we have to resort to the JVM's name
private fun groupName() = javaClass.kotlin.simpleName?.substringBefore("$")
?: javaClass.name.split("$").let { chunks ->
Copy link
Author

Choose a reason for hiding this comment

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

turns out simpleName (and the other names in KClass) were documented to be null for anonymous objects, but happened to be non-null before. Now they are null, so this will fall back to attempting to parse Class.getName() before giving up.

@marshallpierce marshallpierce marked this pull request as ready for review April 16, 2020 14:15
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