-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
129 lines (113 loc) · 3.83 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
plugins {
id("java-gradle-plugin")
id("maven-publish")
alias(libs.plugins.benmanes.versions)
alias(libs.plugins.gradle.plugin.publish)
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.kotlinter)
}
apply plugin: 'maven-publish'
group 'com.tailoredapps.gradle'
version '0.4.0'
// We need to keep compatibility to Java 8 here, as otherwise projects on some machines targeting Java 11 will not be
// able to load the plugin.
targetCompatibility = 1.8
sourceCompatibility = 1.8
def ext_displayName = 'Gradle Localize Plugin'
def ext_description = 'Gradle Plugin to generate Android string resource files from a localization spreadsheet.'
def ext_website = 'https://github.com/tailoredmedia/gradle-localize-plugin'
def ext_vcs = 'https://github.com/tailoredmedia/gradle-localize-plugin.git'
def ext_labels = ['gradle', 'android', 'localization']
repositories {
mavenCentral()
}
dependencies {
implementation libs.diffutils
implementation libs.google.api.client
implementation libs.google.sheets
implementation libs.kotlinx.coroutines.jdk8
implementation libs.kotlinx.coroutines.core
implementation libs.kotlinx.serialization.json
testImplementation libs.junit
testImplementation libs.kluent
testImplementation libs.kotlinx.coroutines.test
testImplementation libs.mockk
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
gradlePlugin {
website = ext_website
vcsUrl = ext_vcs
plugins {
simplePlugin {
id = 'com.tailoredapps.gradle.localize'
description = ext_description
tags.addAll(ext_labels)
implementationClass = 'com.tailoredapps.gradle.localize.GradleLocalizePlugin'
}
}
}
task sourceJar(type: Jar) {
description = "An archive of the source code for Maven Central"
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
Properties properties = new Properties()
def credentialPropertiesFile = ""
def injectedCredentialsFilePath = System.getenv('CREDENTIALS_PROPERTIES_FILE')
if (injectedCredentialsFilePath != null && !injectedCredentialsFilePath.isEmpty()) {
credentialPropertiesFile = injectedCredentialsFilePath
} else {
credentialPropertiesFile = 'local.properties'
}
try {
properties.load(project.rootProject.file(credentialPropertiesFile).newDataInputStream())
} catch (IOException e) {
println("'${credentialPropertiesFile}' not found. This can be ignored, unless you want to publish. " + e.localizedMessage)
}
// Configure the maven-publish plugin
publishing {
publications {
localizePlugin(MavenPublication) {
from components.java
pom {
name = ext_displayName
description = ext_description
url = ext_website
packaging = 'jar'
licenses {
license {
name = 'Apache-2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'tailoredmedia'
name = 'Tailored Apps'
email = '[email protected]'
}
}
scm {
connection = ext_vcs
developerConnection = ext_vcs
url = ext_website
}
}
}
}
repositories {
maven {
url 'https://maven.tailored-apps.com/repository/maven-public'
credentials {
username properties.getProperty("maven.publish.username")
password properties.getProperty("maven.publish.password")
}
}
}
}