How do I tranform a `project.getKotlinPluginVersio...
# gradle
m
How do I tranform a
project.getKotlinPluginVersion: String
into a
KotlinVersion(Int, Int,Int)
?
b
split(".").map(String.toInt)
m
Fair πŸ™‚
b
Note that it will break with x.y.z-RC and similar
m
exactly
b
So remove suffix before splitting
m
I was hoping for something that would handle all the weird semver magic without having to worry about it
t
use Semver library
πŸ‘ 1
m
b
version.removeSubstringAfterLast("-").split(".").map(String.toInt)
t
yep. There should be another one, but this works ok
m
I'll most likely end up parsing myself to avoid the dependency since I don't really care about edge cases here but having a robust semver lib can be handy
t
semver dependency is quite small πŸ™‚
m
Yes, it's more about having to audit for security stuff and so on
Recent news have proven that these things can happen 😬
Even if we're lucky the maven ecosystem is relatively sane so far 😌
b
Maven central demands you sign your artefacts at least, so hijacking is way less probable as you need to steal 3 passwords as opposed to 1 to do it (api key, gpg key, gpg key password)
πŸ’― 2
Plus you can't run random scripts on installation...
βž• 2
m
Yea, you can run random scripts anytime 🧌
I know IntelliJ has a "safe" mode, I wonder how many people pay attention to this
b
Can you really with maven? How??
m
Plugin code runs on the dev machine unrestricted
Or in gradle
Anyone using my plugin trusts all the transitive dependencies
t
run unknown projects in docker )
πŸ’― 2
b
Ah, yes. True for plugins, but not for libs
πŸ‘Œ 2
m
It's certainly perfectly fine for the semver lib but 🀷
run unknown projects in docker )
πŸ’― I'd be curious who does that though πŸ˜…
t
I have following useful alias πŸ™‚
Copy code
alias docker-one-time='docker run --rm -ti -w "/command" -v `pwd`:/command'
πŸ‘€ 2
πŸ‘ 2
just cleans container after run
a
@tapchicoma that is a germstone