Skip to content
Open
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
26 changes: 10 additions & 16 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

Expand All @@ -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()
Expand Down Expand Up @@ -91,6 +91,12 @@ check.dependsOn integrationTest

gradlePlugin {
testSourceSets sourceSets.integrationTest
plugins {
wordingPlugin {
id = 'com.betomorrow.gradle.wording'
implementationClass = 'com.betomorrow.gradle.wording.WordingPlugin'
}
}
}

/**
Expand All @@ -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
Expand 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.'
}

}

}
2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -37,6 +39,7 @@ open class DownloadWordingTask : DefaultTask() {
googleDrive.downloadFile(fileId, DriveMimeType.XLSX, output)
}

@get:Internal
val tokenDirectory: String
get() {
return project.projectDir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<String>()
@Input
var failOnMissingKeys = false
@Input
var addMissingKeys = false

@TaskAction
Expand Down