From 138650b60f46a0114e77305c1943943ecd1203d7 Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Fri, 14 Jun 2024 20:45:57 +0400 Subject: [PATCH] =?UTF-8?q?Move=20unicode=20dump=20outside=20build=20direc?= =?UTF-8?q?tory=20to=20be=20able=20use=20clear=20task=20a=E2=80=A6=20(#134?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …s before --- .github/workflows/build-and-test.yml | 4 ++-- .github/workflows/check.yml | 4 ++-- .github/workflows/platform-benchmark.yml | 4 ++-- .github/workflows/pull_request.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- .github/workflows/snapshot_release.yml | 4 ++-- .gitignore | 3 +++ build.gradle.kts | 28 +++++++++++++++++------- 8 files changed, 35 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 034305ca..0d3c65aa 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -34,8 +34,8 @@ jobs: - name: Cache unicode data uses: actions/cache@v4 with: - path: build/unicode_dump - key: unicode-dump-${{ hashFiles('build/unicode_dump/*') }} + path: unicode_dump + key: unicode-dump-${{ hashFiles('unicode_dump/*') }} restore-keys: | unicode-dump- - name: Setup Gradle diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 7f333de2..e92243a9 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -51,8 +51,8 @@ jobs: - name: Cache unicode data uses: actions/cache@v4 with: - path: build/unicode_dump - key: unicode-dump-${{ hashFiles('build/unicode_dump/*') }} + path: unicode_dump + key: unicode-dump-${{ hashFiles('unicode_dump/*') }} restore-keys: | unicode-dump- - name: Setup Gradle diff --git a/.github/workflows/platform-benchmark.yml b/.github/workflows/platform-benchmark.yml index cccf8cd6..de464485 100644 --- a/.github/workflows/platform-benchmark.yml +++ b/.github/workflows/platform-benchmark.yml @@ -63,8 +63,8 @@ jobs: - name: Cache unicode data uses: actions/cache@v4 with: - path: build/unicode_dump - key: unicode-dump-${{ hashFiles('build/unicode_dump/*') }} + path: unicode_dump + key: unicode-dump-${{ hashFiles('unicode_dump/*') }} restore-keys: | unicode-dump- - name: Setup Gradle diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index fc24e765..7e40ad96 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -34,8 +34,8 @@ jobs: - name: Cache unicode data uses: actions/cache@v4 with: - path: build/unicode_dump - key: unicode-dump-${{ hashFiles('build/unicode_dump/*') }} + path: unicode_dump + key: unicode-dump-${{ hashFiles('unicode_dump/*') }} restore-keys: | unicode-dump- - name: Setup Gradle diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0fe3c97e..bfbc23df 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,8 +55,8 @@ jobs: - name: Cache unicode data uses: actions/cache@v4 with: - path: build/unicode_dump - key: unicode-dump-${{ hashFiles('build/unicode_dump/*') }} + path: unicode_dump + key: unicode-dump-${{ hashFiles('unicode_dump/*') }} restore-keys: | unicode-dump- - name: Setup Gradle diff --git a/.github/workflows/snapshot_release.yml b/.github/workflows/snapshot_release.yml index b67faeb9..43b0c328 100644 --- a/.github/workflows/snapshot_release.yml +++ b/.github/workflows/snapshot_release.yml @@ -46,8 +46,8 @@ jobs: - name: Cache unicode data uses: actions/cache@v4 with: - path: build/unicode_dump - key: unicode-dump-${{ hashFiles('build/unicode_dump/*') }} + path: unicode_dump + key: unicode-dump-${{ hashFiles('unicode_dump/*') }} restore-keys: | unicode-dump- - name: Build with Gradle diff --git a/.gitignore b/.gitignore index 98007a8b..3cd20929 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,8 @@ out/ .gradle/ +# downloaded data for unicode characters +unicode_dump/ + # to keep the local secrets from been published local.properties \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index f8832e2f..5a29bd3a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -35,11 +35,11 @@ dependencies { generatorConfiguration(project(":generator")) } -val dumpDir: Provider = layout.buildDirectory.dir("unicode_dump") +val dumpDir: File = layout.projectDirectory.dir("unicode_dump").asFile val dumpCharacterData by tasks.register("dumpCharacterData") { onlyIf { - dumpDir.get().asFile.run { !exists() || listFiles().isNullOrEmpty() } + dumpDir.run { !exists() || listFiles().isNullOrEmpty() } } outputs.dir(dumpDir) classpath(generatorConfiguration) @@ -47,7 +47,7 @@ val dumpCharacterData by tasks.register("dumpCharacterData") { args( "dump", "-o", - dumpDir.get(), + dumpDir, ) } @@ -66,7 +66,7 @@ val generateCharacterDirectionData by tasks.register("generateCharacte "-o", generatedSourceDirectory.get(), "-d", - dumpDir.get(), + dumpDir, ) } @@ -85,12 +85,16 @@ val generateCharacterCategoryData by tasks.register("generateCharacter "-o", generatedSourceDirectory.get(), "-d", - dumpDir.get(), + dumpDir, ) } val generateDerivedProperties by tasks.register("generateDerivedProperties") { - val dataFile = layout.projectDirectory.dir("generator").dir("data").file("rfc5895_appendix_b_1.txt") + val dataFile = + layout.projectDirectory + .dir("generator") + .dir("data") + .file("rfc5895_appendix_b_1.txt") inputs.file(dataFile) outputs.dir(generatedSourceDirectory) @@ -108,7 +112,11 @@ val generateDerivedProperties by tasks.register("generateDerivedProper } val generateJoiningTypes by tasks.register("generateJoiningTypes") { - val dataFile = layout.projectDirectory.dir("generator").dir("data").file("DerivedJoiningType.txt") + val dataFile = + layout.projectDirectory + .dir("generator") + .dir("data") + .file("DerivedJoiningType.txt") inputs.file(dataFile) outputs.dir(generatedSourceDirectory) @@ -181,7 +189,11 @@ kotlin { api(libs.kotlin.serialization.json) api(libs.uri) // When using approach like above you won't be able to add because block - implementation(libs.kotlin.codepoints.get().toString()) { + implementation( + libs.kotlin.codepoints + .get() + .toString(), + ) { because("simplifies work with unicode codepoints") } implementation(libs.normalize.get().toString()) {