NI-Lab.

nilog:

← 前の日 2023-01-26 次の日 →
← 一年前 一年後 →
Twitter (2023-01-26)
build.gradle を Kotlin で書くために。

Gradle Kotlin DSL Primer https://docs.gradle.org/current/userguide/kotlin_dsl.html
[t] 2023-01-26 06:49:00
関連するかも情報
発売前なのに高値つけてるマケプレ業者がいるので、ブロックする機能が欲しいな

Amazon | 【EC限定】 ちいかわ 3種のかわいいシール付き 「チャルメラ×ちいかわ」 コラボ デザイン パッケージ 2種アソート 6袋 (しょうゆ3袋・宮崎辛麺3袋) 【セット買い】 | 明星 | ラーメン https://www.amazon.co.jp/dp/B0BS3B5696?tag=nilabnilog-22&linkCode=osi&th=1&psc=1
[t] 2023-01-26 06:29:32
build.gradle を Kotlin で書くために。

Gradle Kotlin DSL Primer https://docs.gradle.org/current/userguide/kotlin_dsl.html
[t] 2023-01-26 06:49:00
ほんとそう。Gradle はなぜデフォ便利じゃないのか・・・

「なんでデフォルトで失敗したテストの情報を出してくれないんだっけ」

Gradle経由でのテスト実行時、コンソールに失敗したテストケースの情報を出力する - たごもりすメモ https://tagomoris.hatenablog.com/entry/2021/04/22/105418
[t] 2023-01-26 06:51:56
書き方を学ぶ。

tasks.withType<JavaCompile> {
val compilerArgs = options.compilerArgs
compilerArgs.add("-Xdoclint:all,-missing")
compilerArgs.add("-Xlint:all")
}

Kotlin DSL equivalent for Groovy DSL compileJava.options.compilerArgs - Gradle Forums https://discuss.gradle.org/t/kotlin-dsl-equivalent-for-groovy-dsl-compilejava-options-compilerargs/27086
[t] 2023-01-26 06:58:04
Kotlin build.gradle で bootRun タスクの設定を追加する方法がわからぬ・・
[t] 2023-01-26 07:02:16
Groovy build.gradle のときはこんな感じで書いてた。

bootRun {
jvmArgs = ['-Dspring.profiles.active=dev']
}
[t] 2023-01-26 07:03:29
このへんかな。

tasks.named<BootRun>("bootRun") {
mainClass.set("com.example.ExampleApplication")
}

Spring Boot Gradle プラグインリファレンスガイド - ドキュメント https://spring.pleiades.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/
[t] 2023-01-26 07:04:27
import org. springframework. boot. gradle. tasks. run. BootRun

BootRun クラスを import したほうがラクそう。
[t] 2023-01-26 07:06:01
Kotlin build.gradle だとこれでいいかな。

tasks.named<BootRun>("bootRun") {
jvmArgs = listOf("-Dspring .profiles .active=dev")
}
[t] 2023-01-26 07:08:32
tasks.withType と tasks.named のちがいがわからぬ
[t] 2023-01-26 07:15:39
Zip - Gradle DSL Version 7.6 https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Zip.html
[t] 2023-01-26 07:28:57
destinationDirectory は DirectoryProperty インターフェースを実装していて、set メソッドで値をセットするらしい。

destinationDirectory.set(file(".."))

DirectoryProperty (Gradle API 7.6) https://docs.gradle.org/current/javadoc/org/gradle/api/file/DirectoryProperty.html
[t] 2023-01-26 07:31:12
「mainClass = 'grs .App' が mainClass.set("kts .App") となっています」

Gradle Groovy DSL から Kotlin DSL への乗り換え方 - A Memorandum https://blog1.mammb.com/entry/2020/11/14/090000
[t] 2023-01-26 07:32:12
「create() ではなく register() とすることで configuration avoidance となり、タスク実行時までその構成が遅延されます」

Gradle Groovy DSL から Kotlin DSL への乗り換え方 - A Memorandum https://blog1.mammb.com/entry/2020/11/14/090000
[t] 2023-01-26 07:32:35
setOf と mutableSetOf

「不変 (immutable) なセットは、Kotlin 組み込みの setOf 関数で作成することができます」

コレクションの基本的な使い方 (List, Set, Map) - まくまくKotlinノート https://maku77.github.io/kotlin/collection/basic.html
[t] 2023-01-26 07:39:19
参考になる。

Java開発者向けのKotlin Gradleビルドスクリプト入門 / Gradle Build Script in Kotlin 101 - Speaker Deck https://speakerdeck.com/eller86/gradle-build-script-in-kotlin-101
[t] 2023-01-26 07:53:59
org.gradle.api.Project.getVersion

"Returns the version of this project. Gradle always uses the toString() value of the version. The version defaults to "unspecified".

Project (Gradle API 7.6) https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html#getVersion--
[t] 2023-01-26 08:03:21
org.gradle.api.Project.version は String じゃなくて Object なので toString() しないと文字列連結でエラーになるみたい。
[t] 2023-01-26 08:04:10
RT @meitetsu_info:
常滑線 新舞子駅~大野町駅間 線路内立ち入り(線路内に倒れている人を発見)のため、常滑線 太田川駅~常滑駅間 で運転を見合わせております。警察による実況見分は終了しました。
まもなく運転再開する予定です。(2023/1/26 7:36)
詳しくはこちら→https://top.meitetsu.co.jp/em/
[t] 2023-01-26 08:20:00
RT @meitetsu_info:
新舞子駅~大野町駅間 線路内立ち入り(線路内に倒れている人を発見)のため、太田川駅~常滑駅間で運転を見合わせておりましたが、8時06分に運転を再開しました。この影響により一部線区の一部列車に遅延および運休が発生しております。(2023/1/26 8:06)
詳しくはこちら→https://top.meitetsu.co.jp/em/
[t] 2023-01-26 08:20:04
2023年01年26日のnilogをすべて表示する

- NI-Lab.
- Mastodon (@nilab@mastodon-japan.net)
- Twitter (@nilab)
- Timelog (@nilab)
- はてなブックマーク (id:nilab)

Web Services by Yahoo! JAPAN