diff options
| author | Harsh Shandilya <me@msfjarvis.dev> | 2022-06-05 03:25:25 +0530 |
|---|---|---|
| committer | Harsh Shandilya <me@msfjarvis.dev> | 2022-06-05 03:58:15 +0530 |
| commit | fe3ca3f7d82436f2eaf1e6212ea278466dc85402 (patch) | |
| tree | 57a41f528b78bc9a933065c9b7b50d44657f94ef /build-logic/automation-plugins/src/main/kotlin/psl/PSLUpdateTask.kt | |
| parent | 504c8b466c44b4a8591976ed5d8662f7c83f67fc (diff) | |
| download | HardenedPass-fe3ca3f7d82436f2eaf1e6212ea278466dc85402.tar.gz HardenedPass-fe3ca3f7d82436f2eaf1e6212ea278466dc85402.zip | |
automation-plugins: convert to full plugins
Diffstat (limited to 'build-logic/automation-plugins/src/main/kotlin/psl/PSLUpdateTask.kt')
| -rw-r--r-- | build-logic/automation-plugins/src/main/kotlin/psl/PSLUpdateTask.kt | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/build-logic/automation-plugins/src/main/kotlin/psl/PSLUpdateTask.kt b/build-logic/automation-plugins/src/main/kotlin/psl/PSLUpdateTask.kt deleted file mode 100644 index e8fdc498..00000000 --- a/build-logic/automation-plugins/src/main/kotlin/psl/PSLUpdateTask.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright © 2014-2022 The Android Password Store Authors. All Rights Reserved. - * SPDX-License-Identifier: GPL-3.0-only - */ - -package psl - -import okio.buffer -import okio.sink -import org.gradle.api.DefaultTask -import org.gradle.api.file.RegularFile -import org.gradle.api.file.RegularFileProperty -import org.gradle.api.provider.Property -import org.gradle.api.tasks.CacheableTask -import org.gradle.api.tasks.Input -import org.gradle.api.tasks.OutputFile -import org.gradle.api.tasks.TaskAction - -@CacheableTask -abstract class PSLUpdateTask : DefaultTask() { - @get:Input abstract val pslData: Property<PublicSuffixListData> - @get:OutputFile abstract val outputFile: RegularFileProperty - - @TaskAction - fun updatePSL() { - writeListToDisk(outputFile.get(), pslData.get()) - } - - private fun writeListToDisk(destination: RegularFile, data: PublicSuffixListData) { - val fileSink = destination.asFile.sink() - - fileSink.buffer().use { sink -> - sink.writeInt(data.totalRuleBytes) - - for (domain in data.sortedRules) { - sink.write(domain).writeByte('\n'.toInt()) - } - - sink.writeInt(data.totalExceptionRuleBytes) - - for (domain in data.sortedExceptionRules) { - sink.write(domain).writeByte('\n'.toInt()) - } - } - } -} |
