A gradle to replace token in class file.
Since version 1.1.1
, replace-token is available in the gradle plugin portal:
// settings.gradle
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
}
}
Now you can apply the plugin to your project:
// build.gradle
plugins {
id("top.hendrixshen.replace-token").version("1.1.2")
}
// build.gradle
replaceToken {
// Set sourceSets
targetSourceSets.set([sourceSets.main])
// Global token
replace("foo", "bar")
// If not specified, all classes are processed by default.
replaceIn("com/example1/Main")
// Local token
replace("foo", "bar", "com/example2/Main")
// Inner class example
replace("foo", "bar", "com/example3/Main\$Inner")
}
That's it, everything is done
This project is available under the LGPLv3 license. Feel free to learn from it and incorporate it in your own projects.