Skip to content

Commit 8d9c488

Browse files
author
Gautam Korlam
committed
Add config generation before compile task.
1 parent 5f710dd commit 8d9c488

4 files changed

Lines changed: 15 additions & 6 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ buildscript {
1515
jcenter()
1616
}
1717
dependencies {
18-
classpath "com.kageiit:robojava-plugin:1.1.3"
18+
classpath "com.kageiit:robojava-plugin:1.1.4"
1919
}
2020
}
2121
```

example/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
}
55
dependencies {
66
classpath 'com.android.tools.build:gradle:1.0.0'
7-
classpath 'com.kageiit:robojava-plugin:1.1.3'
7+
classpath 'com.kageiit:robojava-plugin:1.1.4'
88
// add below dependency if you need cobertura code coverage
99
classpath("net.saliman:gradle-cobertura-plugin:2.2.5") {
1010
exclude group: "xerces", module: "xercesImpl"

robojava-plugin/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
id 'nu.studer.plugindev' version '1.0.3'
44
}
55

6-
version = "1.1.3"
6+
version = "1.1.4"
77

88
group = "com.kageiit"
99

robojava-plugin/src/main/groovy/com/kageiit/robojava/RobojavaPlugin.groovy

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import com.squareup.javawriter.JavaWriter
66
import org.gradle.api.Plugin
77
import org.gradle.api.Project
88
import org.gradle.api.artifacts.dsl.RepositoryHandler
9+
import org.gradle.api.tasks.compile.JavaCompile
910
import org.gradle.api.tasks.testing.Test
1011

1112
import static javax.lang.model.element.Modifier.FINAL
@@ -102,13 +103,24 @@ class RobojavaPlugin implements Plugin<Project> {
102103
}
103104
}
104105

106+
107+
def processedManifestPath = variant.outputs[0].processManifest.manifestOutputFile.absolutePath
108+
def processedResourcesPath = variant.mergeResources.outputDir.absolutePath
109+
def processedAssetsPath = variant.mergeAssets.outputDir.absolutePath
110+
105111
//configure test task
106112
robojavaProject.tasks.withType(Test) {
107113
outputs.upToDateWhen { false }
108114
scanForTestClasses = false
109115
include "**/*Test.class"
110116
}
111117

118+
androidProject.tasks.withType(JavaCompile) {
119+
it.doFirst {
120+
writeProperties(processedManifestPath, processedResourcesPath, processedAssetsPath)
121+
}
122+
}
123+
112124
//configure cobertura gradle plugin if applied
113125
try {
114126
if (robojavaProject.plugins.hasPlugin(Class.forName(COBERTURA_PLUGIN_CLASS_NAME))) {
@@ -128,9 +140,6 @@ class RobojavaPlugin implements Plugin<Project> {
128140
}
129141

130142
//write metadata useful for custom test runner
131-
def processedManifestPath = variant.outputs[0].processManifest.manifestOutputFile.absolutePath
132-
def processedResourcesPath = variant.mergeResources.outputDir.absolutePath
133-
def processedAssetsPath = variant.mergeAssets.outputDir.absolutePath
134143
writeProperties(processedManifestPath, processedResourcesPath, processedAssetsPath)
135144
}
136145

0 commit comments

Comments
 (0)