Skip to content

Commit 138650b

Browse files
authored
Move unicode dump outside build directory to be able use clear task a… (#134)
…s before
1 parent fcf9f70 commit 138650b

File tree

8 files changed

+35
-20
lines changed

8 files changed

+35
-20
lines changed

.github/workflows/build-and-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ jobs:
3434
- name: Cache unicode data
3535
uses: actions/cache@v4
3636
with:
37-
path: build/unicode_dump
38-
key: unicode-dump-${{ hashFiles('build/unicode_dump/*') }}
37+
path: unicode_dump
38+
key: unicode-dump-${{ hashFiles('unicode_dump/*') }}
3939
restore-keys: |
4040
unicode-dump-
4141
- name: Setup Gradle

.github/workflows/check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ jobs:
5151
- name: Cache unicode data
5252
uses: actions/cache@v4
5353
with:
54-
path: build/unicode_dump
55-
key: unicode-dump-${{ hashFiles('build/unicode_dump/*') }}
54+
path: unicode_dump
55+
key: unicode-dump-${{ hashFiles('unicode_dump/*') }}
5656
restore-keys: |
5757
unicode-dump-
5858
- name: Setup Gradle

.github/workflows/platform-benchmark.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ jobs:
6363
- name: Cache unicode data
6464
uses: actions/cache@v4
6565
with:
66-
path: build/unicode_dump
67-
key: unicode-dump-${{ hashFiles('build/unicode_dump/*') }}
66+
path: unicode_dump
67+
key: unicode-dump-${{ hashFiles('unicode_dump/*') }}
6868
restore-keys: |
6969
unicode-dump-
7070
- name: Setup Gradle

.github/workflows/pull_request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ jobs:
3434
- name: Cache unicode data
3535
uses: actions/cache@v4
3636
with:
37-
path: build/unicode_dump
38-
key: unicode-dump-${{ hashFiles('build/unicode_dump/*') }}
37+
path: unicode_dump
38+
key: unicode-dump-${{ hashFiles('unicode_dump/*') }}
3939
restore-keys: |
4040
unicode-dump-
4141
- name: Setup Gradle

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ jobs:
5555
- name: Cache unicode data
5656
uses: actions/cache@v4
5757
with:
58-
path: build/unicode_dump
59-
key: unicode-dump-${{ hashFiles('build/unicode_dump/*') }}
58+
path: unicode_dump
59+
key: unicode-dump-${{ hashFiles('unicode_dump/*') }}
6060
restore-keys: |
6161
unicode-dump-
6262
- name: Setup Gradle

.github/workflows/snapshot_release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ jobs:
4646
- name: Cache unicode data
4747
uses: actions/cache@v4
4848
with:
49-
path: build/unicode_dump
50-
key: unicode-dump-${{ hashFiles('build/unicode_dump/*') }}
49+
path: unicode_dump
50+
key: unicode-dump-${{ hashFiles('unicode_dump/*') }}
5151
restore-keys: |
5252
unicode-dump-
5353
- name: Build with Gradle

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@ out/
44

55
.gradle/
66

7+
# downloaded data for unicode characters
8+
unicode_dump/
9+
710
# to keep the local secrets from been published
811
local.properties

build.gradle.kts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ dependencies {
3535
generatorConfiguration(project(":generator"))
3636
}
3737

38-
val dumpDir: Provider<Directory> = layout.buildDirectory.dir("unicode_dump")
38+
val dumpDir: File = layout.projectDirectory.dir("unicode_dump").asFile
3939

4040
val dumpCharacterData by tasks.register<JavaExec>("dumpCharacterData") {
4141
onlyIf {
42-
dumpDir.get().asFile.run { !exists() || listFiles().isNullOrEmpty() }
42+
dumpDir.run { !exists() || listFiles().isNullOrEmpty() }
4343
}
4444
outputs.dir(dumpDir)
4545
classpath(generatorConfiguration)
4646
mainClass.set("io.github.optimumcode.unocode.generator.Main")
4747
args(
4848
"dump",
4949
"-o",
50-
dumpDir.get(),
50+
dumpDir,
5151
)
5252
}
5353

@@ -66,7 +66,7 @@ val generateCharacterDirectionData by tasks.register<JavaExec>("generateCharacte
6666
"-o",
6767
generatedSourceDirectory.get(),
6868
"-d",
69-
dumpDir.get(),
69+
dumpDir,
7070
)
7171
}
7272

@@ -85,12 +85,16 @@ val generateCharacterCategoryData by tasks.register<JavaExec>("generateCharacter
8585
"-o",
8686
generatedSourceDirectory.get(),
8787
"-d",
88-
dumpDir.get(),
88+
dumpDir,
8989
)
9090
}
9191

9292
val generateDerivedProperties by tasks.register<JavaExec>("generateDerivedProperties") {
93-
val dataFile = layout.projectDirectory.dir("generator").dir("data").file("rfc5895_appendix_b_1.txt")
93+
val dataFile =
94+
layout.projectDirectory
95+
.dir("generator")
96+
.dir("data")
97+
.file("rfc5895_appendix_b_1.txt")
9498
inputs.file(dataFile)
9599
outputs.dir(generatedSourceDirectory)
96100

@@ -108,7 +112,11 @@ val generateDerivedProperties by tasks.register<JavaExec>("generateDerivedProper
108112
}
109113

110114
val generateJoiningTypes by tasks.register<JavaExec>("generateJoiningTypes") {
111-
val dataFile = layout.projectDirectory.dir("generator").dir("data").file("DerivedJoiningType.txt")
115+
val dataFile =
116+
layout.projectDirectory
117+
.dir("generator")
118+
.dir("data")
119+
.file("DerivedJoiningType.txt")
112120
inputs.file(dataFile)
113121
outputs.dir(generatedSourceDirectory)
114122

@@ -181,7 +189,11 @@ kotlin {
181189
api(libs.kotlin.serialization.json)
182190
api(libs.uri)
183191
// When using approach like above you won't be able to add because block
184-
implementation(libs.kotlin.codepoints.get().toString()) {
192+
implementation(
193+
libs.kotlin.codepoints
194+
.get()
195+
.toString(),
196+
) {
185197
because("simplifies work with unicode codepoints")
186198
}
187199
implementation(libs.normalize.get().toString()) {

0 commit comments

Comments
 (0)