Skip to content

Commit

Permalink
Move unicode dump outside build directory to be able use clear task a… (
Browse files Browse the repository at this point in the history
#134)

…s before
  • Loading branch information
OptimumCode authored Jun 14, 2024
1 parent fcf9f70 commit 138650b
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/platform-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/snapshot_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ out/

.gradle/

# downloaded data for unicode characters
unicode_dump/

# to keep the local secrets from been published
local.properties
28 changes: 20 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ dependencies {
generatorConfiguration(project(":generator"))
}

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

val dumpCharacterData by tasks.register<JavaExec>("dumpCharacterData") {
onlyIf {
dumpDir.get().asFile.run { !exists() || listFiles().isNullOrEmpty() }
dumpDir.run { !exists() || listFiles().isNullOrEmpty() }
}
outputs.dir(dumpDir)
classpath(generatorConfiguration)
mainClass.set("io.github.optimumcode.unocode.generator.Main")
args(
"dump",
"-o",
dumpDir.get(),
dumpDir,
)
}

Expand All @@ -66,7 +66,7 @@ val generateCharacterDirectionData by tasks.register<JavaExec>("generateCharacte
"-o",
generatedSourceDirectory.get(),
"-d",
dumpDir.get(),
dumpDir,
)
}

Expand All @@ -85,12 +85,16 @@ val generateCharacterCategoryData by tasks.register<JavaExec>("generateCharacter
"-o",
generatedSourceDirectory.get(),
"-d",
dumpDir.get(),
dumpDir,
)
}

val generateDerivedProperties by tasks.register<JavaExec>("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)

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

val generateJoiningTypes by tasks.register<JavaExec>("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)

Expand Down Expand Up @@ -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()) {
Expand Down

0 comments on commit 138650b

Please sign in to comment.