Last active
July 5, 2023 18:58
-
-
Save gabrielfeo/924682a4d6ef4b1b96c20d40d5fbe2d7 to your computer and use it in GitHub Desktop.
Maven versioning example (https://github.com/Kotlin/kotlin-jupyter-libraries/pull/201#issuecomment-1540264501)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"id": "a3073412-ae2a-44af-836f-8943fe8a03d6", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [], | |
"source": [ | |
"@file:DependsOn(\"org.apache.maven:maven-artifact:3.9.1\")\n", | |
"\n", | |
"import org.apache.maven.artifact.versioning.ComparableVersion" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"id": "6b74f282-a4f1-402e-84a2-f9e71b3417e1", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"0.3.0\n", | |
"0.3.1-dev-5\n", | |
"0.4.0\n", | |
"0.5.0\n", | |
"0.5.3-dev-1\n", | |
"0.5.3-dev-1\n", | |
"0.10.0\n", | |
"0.11.0-dev-1626\n", | |
"1.0.0-beta6\n", | |
"1.0.0-SNAPSHOT\n", | |
"1.0.0" | |
] | |
}, | |
"execution_count": 7, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"val problemUpdates = \"\"\"\n", | |
" 1.0.0-beta6 -> 1.0.0-SNAPSHOT\n", | |
" 0.3.0 -> 0.3.1-dev-5\n", | |
" 0.5.0 -> 0.5.3-dev-1\n", | |
" 0.10.0 -> 0.11.0-dev-1626\n", | |
" 0.4.0 -> 0.5.3-dev-1\n", | |
" 1.0.0\n", | |
"\"\"\"\n", | |
"val versions = problemUpdates.trim().lines().flatMap { it.trim().split(\" -> \") }\n", | |
"versions.map {\n", | |
" ComparableVersion(it)\n", | |
"}.sorted().joinToString(\"\\n\")" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Kotlin", | |
"language": "kotlin", | |
"name": "kotlin" | |
}, | |
"language_info": { | |
"codemirror_mode": "text/x-kotlin", | |
"file_extension": ".kt", | |
"mimetype": "text/x-kotlin", | |
"name": "kotlin", | |
"nbconvert_exporter": "", | |
"pygments_lexer": "kotlin", | |
"version": "1.8.20" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment