Skip to content

Commit dec6060

Browse files
authored
Merge pull request #16 from LikeTheSalad/release/1.3.0
Release/1.3.0
2 parents 975d31f + 5a5c5be commit dec6060

File tree

129 files changed

+1014
-4847
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+1014
-4847
lines changed

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Change Log
22
==========
33

4+
Version 1.3.0 *(19-12-2021)*
5+
---
6+
7+
* Fix: #10 keeping generic strings outside of language specific resolved files.
8+
* New: Raw resource collection has been moved outside this project.
9+
* New: Deprecated `keepResolvedFiles` and `useDependenciesRes` configurations.
10+
* New: Updated minimum Android Gradle Plugin version to 5.6.4.
11+
412
Version 1.2.2 *(11-04-2021)*
513
---
614

README.md

+4-21
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,7 @@ will be able to access to the new auto-generated resolved string: `my_message`,
113113
same way as with any other string, e.g. This way for Java and Kotlin: `R.string.my_message` and this way for XML layouts: `@string/my_message`.
114114

115115
### 2.2- Where do resolved strings go to?
116-
By default the resolved strings go into your app's `build` folder, specifically under the `build/generated/resolved` path. That's where this plugin places them into when it is run. The build folder is usually ignored for a VCS repository, so the resolved strings won't go into your repo unless you want to change it by applying the following configuration into your app's `build.gradle` file:
117-
118-
```groovy
119-
// Optional:
120-
stringXmlReference {
121-
keepResolvedFiles = true // By default it is false.
122-
// If false: Resolved strings will go into the 'app/build' dir (which is a hidden dir for your VCS).
123-
// If true: Resolved string will go into the 'app/src' dir.
124-
}
125-
```
116+
The resolved strings go into your app's `build` folder, specifically under the `build/generated/resolved` path. That's where this plugin places them into when it is run.
126117

127118
The following cases are supported:
128119

@@ -158,13 +149,6 @@ this plugin won't run automatically during your app's build process and instead
158149
proper Gradle commands depending on the build variant you'd want to resolve the strings for. More info on this below under
159150
"Running it manually".
160151

161-
- **keepResolvedFiles** (Boolean, default is `false`, added in version 1.1.0). When false, it will send all of the resolved strings to your app's build directory. Otherwise, when true,
162-
it will send all of the resolved strings to your app's src dir, meaning that you will see them in your working directory.
163-
164-
- **useDependenciesRes** (Boolean, default is `false`, added in version 1.2.0). When false, it will only take your app's string resources into account
165-
for resolving your string's placeholders. When true, it will take both your app's strings as well as your app's dependencies strings
166-
for doing the resolving process. It will take all strings from your dependencies, even templates (if any) which will be resolved too.
167-
168152
### 3.2- How to change a configuration parameter?
169153

170154
In order to set any of the configuration parameters available, you'll have to add to your app's `build.gradle` file
@@ -181,8 +165,7 @@ android {
181165
182166
// Example of how to change some config flags
183167
stringXmlReference {
184-
keepResolvedFiles = true // Its default value is false.
185-
useDependenciesRes = true // Its default value is false.
168+
resolveOnBuild = false // Its default value is true.
186169
}
187170
```
188171

@@ -328,7 +311,7 @@ First, in your `Root's build.gradle` file, you'll need to add this
328311
line into your `buildscript` dependencies block:
329312

330313
```groovy
331-
classpath "com.likethesalad.android:string-reference:1.2.2"
314+
classpath "com.likethesalad.android:string-reference:1.3.0"
332315
```
333316
Example:
334317

@@ -340,7 +323,7 @@ buildscript {
340323
}
341324
dependencies {
342325
//...
343-
classpath "com.likethesalad.android:string-reference:1.2.2"
326+
classpath "com.likethesalad.android:string-reference:1.3.0"
344327
345328
// NOTE: Do not place your application dependencies here; they belong
346329
// in the individual module build.gradle files

build.gradle

+18-15
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,40 @@
11
buildscript {
2-
ext.kotlin_version = '1.3.72'
2+
ext.kotlin_version = '1.5.10'
33
repositories {
4+
mavenLocal()
45
mavenCentral()
56
google()
6-
gradlePluginPortal()
77
}
88

99
dependencies {
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
classpath "io.github.gradle-nexus:publish-plugin:1.0.0"
11+
classpath 'com.likethesalad.tools:artifact-publisher:1.1.1'
1212
}
1313
}
1414

15-
apply plugin: "io.github.gradle-nexus.publish-plugin"
15+
apply plugin: "artifact-publisher"
16+
17+
artifactPublisher {
18+
displayName = "Android String XML Reference"
19+
url = "https://github.com/LikeTheSalad/android-string-reference"
20+
vcsUrl = "https://github.com/LikeTheSalad/android-string-reference.git"
21+
issueTrackerUrl = "https://github.com/LikeTheSalad/android-string-reference/issues"
22+
}
23+
24+
description = "This is a Gradle plugin for Android applications which resolves XML string references in other XML strings."
25+
group = 'com.likethesalad.android'
26+
version = '1.3.0'
1627

1728
ext {
18-
dagger_version = '2.29.1'
19-
autoFactory_version = '1.0-beta8'
29+
dagger_version = '2.39.1'
2030
androidBuild_version = '3.3.3'
31+
testingUtilities_version = '1.0.6'
2132
}
2233

2334
allprojects {
2435
repositories {
36+
mavenLocal()
2537
mavenCentral()
2638
google()
2739
}
28-
}
29-
30-
group 'com.likethesalad.android'
31-
version '1.2.2'
32-
33-
nexusPublishing {
34-
repositories {
35-
sonatype()
36-
}
3740
}

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#Wed Aug 28 16:11:02 IST 2019
2-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
2+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
33
distributionBase=GRADLE_USER_HOME
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists

javaUpload.gradle

-70
This file was deleted.

settings.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
include ':string-reference'
2-
rootProject.name = 'placeholder'
2+
rootProject.name = 'placeholder-resolver'

string-reference/build.gradle

+30-11
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
1-
apply plugin: 'java-library'
2-
apply plugin: 'kotlin'
3-
apply plugin: 'kotlin-kapt'
4-
apply from: '../javaUpload.gradle'
1+
plugins {
2+
id 'java-gradle-plugin'
3+
id 'org.jetbrains.kotlin.jvm'
4+
id 'kotlin-kapt'
5+
id 'com.gradle.plugin-publish' version '0.18.0'
6+
}
57

68
dependencies {
79
api gradleApi()
810
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
911
implementation 'com.google.code.gson:gson:2.8.5'
10-
implementation "com.google.auto.factory:auto-factory:$autoFactory_version"
1112
implementation "com.google.dagger:dagger:$dagger_version"
12-
implementation 'com.squareup.retrofit2:retrofit:2.1.0'
13+
implementation "com.likethesalad.tools.resources:string-android-resource-locator:1.0.1"
1314
compileOnly "com.android.tools.build:gradle:$androidBuild_version"
1415
kapt "com.google.dagger:dagger-compiler:$dagger_version"
15-
kapt "com.google.auto.factory:auto-factory:$autoFactory_version"
16-
annotationProcessor "com.google.auto.factory:auto-factory:$autoFactory_version"
17-
testImplementation gradleTestKit()
16+
testImplementation "com.likethesalad.tools.testing:android-gradle:$testingUtilities_version"
17+
testImplementation "com.likethesalad.tools.testing:unit-testing:$testingUtilities_version"
1818
testImplementation "com.android.tools.build:gradle:$androidBuild_version"
19-
testImplementation "io.mockk:mockk:1.9.3"
20-
testImplementation 'com.google.truth:truth:1.0'
2119
testImplementation group: 'junit', name: 'junit', version: '4.12'
2220
}
2321

22+
tasks.withType(PluginUnderTestMetadata).configureEach {
23+
pluginClasspath.from(configurations.compileOnly)
24+
}
25+
2426
kapt {
2527
correctErrorTypes = true
2628
}
@@ -43,6 +45,23 @@ task functionalTest(type: Test) {
4345
classpath = sourceSets.functionalTest.runtimeClasspath
4446
}
4547

48+
pluginBundle {
49+
website = rootProject.artifactPublisher.url.get()
50+
vcsUrl = rootProject.artifactPublisher.vcsUrl.get()
51+
description = rootProject.description
52+
tags = ['android', 'resolved-strings', 'xml-strings']
53+
}
54+
55+
gradlePlugin {
56+
plugins {
57+
placeholderResolverPlugin {
58+
id = 'placeholder-resolver'
59+
displayName = rootProject.artifactPublisher.displayName.get()
60+
implementationClass = 'com.likethesalad.placeholder.ResolvePlaceholdersPlugin'
61+
}
62+
}
63+
}
64+
4665
compileKotlin {
4766
kotlinOptions.jvmTarget = "1.8"
4867
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<resources>
2+
<string name="app_name">Strings playground</string>
3+
<string name="template_welcome_message">Welcome to ${app_name}</string>
4+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string name="app_name">Idiomas diferentes</string>
4+
<string name="template_welcome_message">Bienvenido a ${app_name}</string>
5+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<resources>
2+
<string name="app_name">Different Languages</string>
3+
<string name="app_international_name" translatable="false">Babel</string>
4+
<string name="template_welcome_message">Welcome to ${app_name}</string>
5+
<string name="template_international_welcome_message">Welcome to ${app_name} also known as ${app_international_name}</string>
6+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string name="app_name">Idiomas diferentes</string>
4+
<string name="template_welcome_message">Bienvenido a ${app_name}</string>
5+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<string name="app_name">Different languages IT</string>
4+
<string name="template_welcome_message">Italian welcome message to ${app_name}</string>
5+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<resources>
2+
<string name="app_name">Different Languages</string>
3+
<string name="app_international_name" translatable="false">Babel</string>
4+
<string name="template_welcome_message">Welcome to ${app_name}</string>
5+
<string name="template_international_welcome_message">Welcome to ${app_name} also known as ${app_international_name}</string>
6+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="welcome_message">Welcome to Strings playground</string>
3+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="welcome_message">Bienvenido a Idiomas diferentes</string>
3+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<resources>
2+
<string name="international_welcome_message">Welcome to Different Languages also known as Babel</string>
3+
<string name="welcome_message">Welcome to Different Languages</string>
4+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="welcome_message">Bienvenido a Idiomas diferentes</string>
3+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="welcome_message">Italian welcome message to Different languages IT</string>
3+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<resources>
2+
<string name="international_welcome_message">Welcome to Different Languages also known as Babel</string>
3+
<string name="welcome_message">Welcome to Different Languages</string>
4+
</resources>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
<resources>
2-
<string name="international_welcome_message">Welcome to Idiomas diferentes also known as Babel</string>
32
<string name="welcome_message">Bienvenido a Idiomas diferentes</string>
43
</resources>

0 commit comments

Comments
 (0)