Skip to content

Move unicode dump outside build directory to be able use clear task a… #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading