-
Notifications
You must be signed in to change notification settings - Fork 16
RouteTable
During the compilation process of Butterfly, a corresponding routing table is generated for each module in the project, and each routing table is a subclass of Module.
The naming convention for routing table classes is: class Butterfly[ModuleNname]Module
For example, there are the following modules:
The compiled routing table classes are: ButterflyFeature1Module,ButterflyFeature2Module,ButterflyNormalModule
The generated routing table class is located in the build folder in the module:
You can register the routing table manually through ButterflyCore
.
ButterflyCore.addModule(ButterflyFeature1Module())
ButterflyCore.addModule(ButterflyFeature2Module())
ButterflyCore.addModule(ButterflyNormalModule())
The routing table can be automatically registered through the plug-in provided by Butterfly. During the compilation process, the plug-in scans all generated Module classes and realizes automatic registration through ASM bytecode processing technology.
//using plugins DSL:
plugins {
id "io.github.ssseasonnn.butterfly" version "1.0.1"
}
//or using legacy plugin application:
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "io.github.ssseasonnn:plugin:1.0.1"
}
}
//apply plugin
apply plugin: "io.github.ssseasonnn.butterfly"
Plugin automatic registration is to insert the code for registering routing tables into the onCreate method of the Application, so a custom Application class is required in the project.
class TestApplication : Application() {
override fun onCreate() {
super.onCreate()
}
}