Skip to content

AndroidGradlePreprocessing

Igor Maznitsa edited this page Apr 20, 2019 · 13 revisions

if you want add some preprocessing into Android project (under Gradle build system) then you should add some prefix into your build script

buildscript {
    repositories {
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath 'com.igormaznitsa:jcp:7.0.1'
    }
}
apply plugin: 'com.igormaznitsa.jcp'

and postfix

preprocessSettings {
    def targetFolder = 'build/preprocessed/java'
    target = file(targetFolder)
    sources = ['src/main/java']
    android.sourceSets.main.java.srcDirs = [targetFolder]
}
preBuild.dependsOn preprocess

I made experiments with Android project created with Android Plug-in under Intellij IDEA and played with build.gradle on App module level which is created by the plug-in.

Clone this wiki locally