Skip to content

Hendrix-Shen/replace-token

Repository files navigation

replace-token

JitPack Gradle Plugin Portal Version

A gradle to replace token in class file.

Usages

1. Apply

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")
}

2. Configure

// 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")
}

3. Done

That's it, everything is done

License

This project is available under the LGPLv3 license. Feel free to learn from it and incorporate it in your own projects.

About

A gradle to replace token in class file.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages