diff --git a/build.gradle b/build.gradle index 3531c43..b46698f 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { } } dependencies { - classpath "com.gradle.publish:plugin-publish-plugin:0.9.7" + classpath "com.gradle.publish:plugin-publish-plugin:0.15.0" } } @@ -20,8 +20,8 @@ apply plugin: 'java-gradle-plugin' apply plugin: 'kotlin' apply plugin: 'maven-publish' -group 'com.betomorrow.gradle' -version '1.3.3' +group 'gradle.plugin.com.betomorrow.gradle' +version '1.3.4' repositories { mavenCentral() @@ -91,6 +91,12 @@ check.dependsOn integrationTest gradlePlugin { testSourceSets sourceSets.integrationTest + plugins { + wordingPlugin { + id = 'com.betomorrow.gradle.wording' + implementationClass = 'com.betomorrow.gradle.wording.WordingPlugin' + } + } } /** @@ -102,15 +108,6 @@ task sourceJar(type: Jar) { from sourceSets.main.allSource } -publishing { - publications { - BintrayPublication(MavenPublication) { - from components.java - artifact sourceJar - } - } -} - wrapper { gradleVersion = "5.1" distributionType = Wrapper.DistributionType.ALL @@ -123,13 +120,10 @@ pluginBundle { tags = ['android', 'wording', 'plugin', 'tool'] plugins { - - libraryPlugin { + wordingPlugin { id = 'com.betomorrow.gradle.wording' displayName = 'Gradle Wording Plugin' description = 'Plugin to import wording from Google Sheet then integrate it in standard translations files.' } - } - } \ No newline at end of file diff --git a/sample/build.gradle b/sample/build.gradle index 0c41ffe..4381939 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -4,7 +4,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.betomorrow.gradle:gradle-android-wording-plugin:1.3.3' + classpath 'gradle.plugin.com.betomorrow.gradle:gradle-android-wording-plugin:1.3.4' } } diff --git a/src/main/kotlin/com/betomorrow/gradle/wording/domain/XmlExtensions.kt b/src/main/kotlin/com/betomorrow/gradle/wording/domain/XmlExtensions.kt index 7ba20ed..6925850 100644 --- a/src/main/kotlin/com/betomorrow/gradle/wording/domain/XmlExtensions.kt +++ b/src/main/kotlin/com/betomorrow/gradle/wording/domain/XmlExtensions.kt @@ -1,6 +1,5 @@ package com.betomorrow.gradle.wording.domain -import com.sun.org.apache.xml.internal.serializer.OutputPropertiesFactory import org.w3c.dom.Document import org.w3c.dom.Element import org.w3c.dom.Node @@ -32,8 +31,8 @@ fun writeToFile(document : Document, path: String) { transformer.setOutputProperty(OutputKeys.INDENT, "yes") transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC,"yes"); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); - transformer.setOutputProperty(OutputPropertiesFactory.S_KEY_INDENT_AMOUNT, "4") - transformer.setOutputProperty(OutputPropertiesFactory.S_KEY_LINE_SEPARATOR, "4") + transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4") + transformer.setOutputProperty("{http://xml.apache.org/xslt}line-separator", "4") val domSource = DOMSource(document) val streamResult = StreamResult(File(path)) diff --git a/src/main/kotlin/com/betomorrow/gradle/wording/tasks/DownloadWordingTask.kt b/src/main/kotlin/com/betomorrow/gradle/wording/tasks/DownloadWordingTask.kt index 0cbbbcd..52bb76a 100644 --- a/src/main/kotlin/com/betomorrow/gradle/wording/tasks/DownloadWordingTask.kt +++ b/src/main/kotlin/com/betomorrow/gradle/wording/tasks/DownloadWordingTask.kt @@ -3,23 +3,25 @@ package com.betomorrow.gradle.wording.tasks import com.betomorrow.gradle.wording.infra.drive.DriveMimeType import com.betomorrow.gradle.wording.infra.drive.GoogleDrive import org.gradle.api.DefaultTask -import org.gradle.api.tasks.Optional -import org.gradle.api.tasks.OutputFile -import org.gradle.api.tasks.TaskAction +import org.gradle.api.tasks.* import java.io.File import java.nio.file.Paths open class DownloadWordingTask : DefaultTask() { + @Input @Optional var clientId: String? = null + @Input @Optional var clientSecret: String? = null + @InputFile @Optional var credentials: File? = null + @Input lateinit var fileId: String @OutputFile @@ -37,6 +39,7 @@ open class DownloadWordingTask : DefaultTask() { googleDrive.downloadFile(fileId, DriveMimeType.XLSX, output) } + @get:Internal val tokenDirectory: String get() { return project.projectDir diff --git a/src/main/kotlin/com/betomorrow/gradle/wording/tasks/UpdateWordingTask.kt b/src/main/kotlin/com/betomorrow/gradle/wording/tasks/UpdateWordingTask.kt index cfd07b8..ba401a2 100644 --- a/src/main/kotlin/com/betomorrow/gradle/wording/tasks/UpdateWordingTask.kt +++ b/src/main/kotlin/com/betomorrow/gradle/wording/tasks/UpdateWordingTask.kt @@ -4,6 +4,7 @@ import com.betomorrow.gradle.wording.domain.Column import com.betomorrow.gradle.wording.domain.XlsxExtractor import com.betomorrow.gradle.wording.domain.XmlUpdater import org.gradle.api.DefaultTask +import org.gradle.api.tasks.Input import org.gradle.api.tasks.InputFile import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.TaskAction @@ -18,12 +19,18 @@ open class UpdateWordingTask : DefaultTask() { @OutputFile lateinit var output: File + @Input var skipHeaders: Boolean = true + @Input lateinit var keysColumn: String + @Input lateinit var column: String + @Input var sheetNames = emptyList() + @Input var failOnMissingKeys = false + @Input var addMissingKeys = false @TaskAction