├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── layout │ │ │ │ └── activity_main.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ └── drawable │ │ │ │ └── ic_launcher_background.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── james │ │ │ │ └── modulemanager │ │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── james │ │ │ └── modulemanager │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── james │ │ └── modulemanager │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── library-c ├── .gitignore ├── consumer-rules.pro ├── src │ ├── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── james │ │ │ └── library_c │ │ │ └── ClassC.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── james │ │ │ └── library_c │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── james │ │ └── library_c │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── libraryA ├── .gitignore ├── consumer-rules.pro ├── src │ ├── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── james │ │ │ └── librarya │ │ │ └── LibraryAClass.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── james │ │ │ └── librarya │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── james │ │ └── librarya │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── libraryB ├── .gitignore ├── consumer-rules.pro ├── src │ ├── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── james │ │ │ └── libraryb │ │ │ └── LibraryB.java │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── james │ │ │ └── libraryb │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── james │ │ └── libraryb │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── module-manager ├── .gitignore ├── src │ └── main │ │ └── java │ │ └── com │ │ └── james │ │ ├── exts │ │ ├── NormalizeConfig.java │ │ ├── AarSettings.java │ │ ├── ModuleSettings.java │ │ └── ModuleConfig.java │ │ ├── tasks │ │ ├── SourcesJar.java │ │ ├── JavadocJarTask.java │ │ ├── OneKeyPublishTask.java │ │ ├── TaskManager.java │ │ └── AndroidJavaDocsTask.java │ │ ├── util │ │ └── StringUtil.java │ │ ├── DynamicPublishMethods.java │ │ ├── ModuleManagePlugin.java │ │ └── ModuleManageInternalPlugin.java └── build.gradle ├── moduleRepo └── com │ └── james │ └── libraryA │ ├── 1.4 │ ├── libraryA-1.4.aar.md5 │ ├── libraryA-1.4.pom.md5 │ ├── libraryA-1.4.module.md5 │ ├── libraryA-1.4-javadoc.jar.md5 │ ├── libraryA-1.4-sources.jar.md5 │ ├── libraryA-1.4.aar.sha1 │ ├── libraryA-1.4.module.sha1 │ ├── libraryA-1.4.pom.sha1 │ ├── libraryA-1.4-javadoc.jar.sha1 │ ├── libraryA-1.4-sources.jar.sha1 │ ├── libraryA-1.4.aar.sha256 │ ├── libraryA-1.4.pom.sha256 │ ├── libraryA-1.4.module.sha256 │ ├── libraryA-1.4-javadoc.jar.sha256 │ ├── libraryA-1.4-sources.jar.sha256 │ ├── libraryA-1.4.aar │ ├── libraryA-1.4-javadoc.jar │ ├── libraryA-1.4-sources.jar │ ├── libraryA-1.4.aar.sha512 │ ├── libraryA-1.4.module.sha512 │ ├── libraryA-1.4.pom.sha512 │ ├── libraryA-1.4-javadoc.jar.sha512 │ ├── libraryA-1.4-sources.jar.sha512 │ ├── libraryA-1.4.pom │ └── libraryA-1.4.module │ ├── maven-metadata.xml.md5 │ ├── maven-metadata.xml.sha1 │ ├── maven-metadata.xml.sha256 │ ├── maven-metadata.xml.sha512 │ └── maven-metadata.xml ├── moduleRepoB └── com │ └── james │ └── libraryB │ ├── 1.3 │ ├── libraryB-1.3.aar.md5 │ ├── libraryB-1.3.pom.md5 │ ├── libraryB-1.3.module.md5 │ ├── libraryB-1.3-javadoc.jar.md5 │ ├── libraryB-1.3-sources.jar.md5 │ ├── libraryB-1.3.aar.sha1 │ ├── libraryB-1.3.pom.sha1 │ ├── libraryB-1.3.module.sha1 │ ├── libraryB-1.3-javadoc.jar.sha1 │ ├── libraryB-1.3-sources.jar.sha1 │ ├── libraryB-1.3.aar.sha256 │ ├── libraryB-1.3.pom.sha256 │ ├── libraryB-1.3.module.sha256 │ ├── libraryB-1.3-javadoc.jar.sha256 │ ├── libraryB-1.3-sources.jar.sha256 │ ├── libraryB-1.3.aar │ ├── libraryB-1.3-javadoc.jar │ ├── libraryB-1.3-sources.jar │ ├── libraryB-1.3.aar.sha512 │ ├── libraryB-1.3.pom.sha512 │ ├── libraryB-1.3.module.sha512 │ ├── libraryB-1.3-javadoc.jar.sha512 │ ├── libraryB-1.3-sources.jar.sha512 │ ├── libraryB-1.3.pom │ └── libraryB-1.3.module │ ├── maven-metadata.xml.md5 │ ├── maven-metadata.xml.sha1 │ ├── maven-metadata.xml.sha256 │ ├── maven-metadata.xml.sha512 │ └── maven-metadata.xml ├── localAarRepo ├── localAarMavenRepo3 │ └── com │ │ └── james │ │ ├── test1aar │ │ ├── 2.0 │ │ │ ├── test1aar-2.0.aar.md5 │ │ │ ├── test1aar-2.0.pom.md5 │ │ │ ├── test1aar-2.0.aar.sha1 │ │ │ ├── test1aar-2.0.pom.sha1 │ │ │ ├── test1aar-2.0.aar.sha256 │ │ │ ├── test1aar-2.0.pom.sha256 │ │ │ ├── test1aar-2.0.aar │ │ │ ├── test1aar-2.0.aar.sha512 │ │ │ ├── test1aar-2.0.pom.sha512 │ │ │ └── test1aar-2.0.pom │ │ ├── maven-metadata.xml.md5 │ │ ├── maven-metadata.xml.sha1 │ │ ├── maven-metadata.xml.sha256 │ │ ├── maven-metadata.xml.sha512 │ │ └── maven-metadata.xml │ │ ├── test2aar │ │ ├── 2.0 │ │ │ ├── test2aar-2.0.aar.md5 │ │ │ ├── test2aar-2.0.pom.md5 │ │ │ ├── test2aar-2.0.aar.sha1 │ │ │ ├── test2aar-2.0.pom.sha1 │ │ │ ├── test2aar-2.0.aar.sha256 │ │ │ ├── test2aar-2.0.pom.sha256 │ │ │ ├── test2aar-2.0.aar │ │ │ ├── test2aar-2.0.aar.sha512 │ │ │ ├── test2aar-2.0.pom.sha512 │ │ │ └── test2aar-2.0.pom │ │ ├── maven-metadata.xml.md5 │ │ ├── maven-metadata.xml.sha1 │ │ ├── maven-metadata.xml.sha256 │ │ ├── maven-metadata.xml.sha512 │ │ └── maven-metadata.xml │ │ └── test3aar │ │ ├── 2.0 │ │ ├── test3aar-2.0.aar.md5 │ │ ├── test3aar-2.0.pom.md5 │ │ ├── test3aar-2.0.aar.sha1 │ │ ├── test3aar-2.0.pom.sha1 │ │ ├── test3aar-2.0.aar.sha256 │ │ ├── test3aar-2.0.pom.sha256 │ │ ├── test3aar-2.0.aar │ │ ├── test3aar-2.0.aar.sha512 │ │ ├── test3aar-2.0.pom.sha512 │ │ └── test3aar-2.0.pom │ │ ├── maven-metadata.xml.md5 │ │ ├── maven-metadata.xml.sha1 │ │ ├── maven-metadata.xml.sha256 │ │ ├── maven-metadata.xml.sha512 │ │ └── maven-metadata.xml ├── test1.aar ├── test2.aar └── test3.aar ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── aar-settings.gradle ├── .idea ├── compiler.xml ├── vcs.xml ├── runConfigurations.xml ├── $CACHE_FILE$ ├── gradle.xml ├── jarRepositories.xml ├── codeStyles │ └── Project.xml └── misc.xml ├── settings.gradle ├── .gitignore ├── module-settings.gradle ├── gradle.properties ├── gradlew.bat ├── README.md ├── gradlew └── LICENSE /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /library-c/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /library-c/consumer-rules.pro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /libraryA/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /libraryA/consumer-rules.pro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /libraryB/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /libraryB/consumer-rules.pro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /module-manager/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4.aar.md5: -------------------------------------------------------------------------------- 1 | c32f35850bcfbaca4df9c8caf8a0b747 -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4.pom.md5: -------------------------------------------------------------------------------- 1 | 01ffffefe953a0e0dd552330ac6d6493 -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/maven-metadata.xml.md5: -------------------------------------------------------------------------------- 1 | 17d240210355169a3904212313924183 -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3.aar.md5: -------------------------------------------------------------------------------- 1 | 073a9ebbc57de20d2bcfa14ab000591a -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3.pom.md5: -------------------------------------------------------------------------------- 1 | 250f9a3ae7fc3b1c83a3023749806bf8 -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/maven-metadata.xml.md5: -------------------------------------------------------------------------------- 1 | 579718c31dbadfbb89314574bbf0e40d -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4.module.md5: -------------------------------------------------------------------------------- 1 | 828e8f33b126b19e0c50c5ede1885026 -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/maven-metadata.xml.sha1: -------------------------------------------------------------------------------- 1 | febdbc6e5b8bed6745f65204567866649abc677b -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3.module.md5: -------------------------------------------------------------------------------- 1 | 574cb9fa5f0759d33346161b513bd357 -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4-javadoc.jar.md5: -------------------------------------------------------------------------------- 1 | 037bfc7c56f2c9018032e9d7f7e4f164 -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4-sources.jar.md5: -------------------------------------------------------------------------------- 1 | 93332905b03941c0937ee920006fc7e3 -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4.aar.sha1: -------------------------------------------------------------------------------- 1 | 7f25d38673e2050cb77c5683911c8028422beddf -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4.module.sha1: -------------------------------------------------------------------------------- 1 | 522fb7aa280582bdb2ff6355ef92cda0d52857e7 -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4.pom.sha1: -------------------------------------------------------------------------------- 1 | f76432e83a5a1528c85e2a6571c43f27a60dd92c -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3-javadoc.jar.md5: -------------------------------------------------------------------------------- 1 | 9681c79b67d7a214f092c238a15ac0ee -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3-sources.jar.md5: -------------------------------------------------------------------------------- 1 | 2103dc2880eeb38b5ad8f24b13c06f2c -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3.aar.sha1: -------------------------------------------------------------------------------- 1 | 1c3769c4ed954e4707fd3f3a87b39cef95fc4cde -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3.pom.sha1: -------------------------------------------------------------------------------- 1 | 3f17e920c48641af269cafb34cbbe3f02020e9da -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/maven-metadata.xml.sha1: -------------------------------------------------------------------------------- 1 | 9e375072ae51b4947b7bb279cb9a399d801b98a6 -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4-javadoc.jar.sha1: -------------------------------------------------------------------------------- 1 | 48110f4f35e8586a742854cb3db99e36155d8b83 -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4-sources.jar.sha1: -------------------------------------------------------------------------------- 1 | 28003b41615f2f69dc2e49f38d446ca29d82525a -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3.module.sha1: -------------------------------------------------------------------------------- 1 | 5b2dc6b8600054091a3b51d4bb38648c58fa5335 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test1aar/2.0/test1aar-2.0.aar.md5: -------------------------------------------------------------------------------- 1 | b481008a5282444f1622ba00dad3a7d6 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test1aar/2.0/test1aar-2.0.pom.md5: -------------------------------------------------------------------------------- 1 | eb1ce97005bcd445d0251c30b639a544 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test1aar/maven-metadata.xml.md5: -------------------------------------------------------------------------------- 1 | 30ee03bc4bdd26f47b92f7dc7da4e767 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test2aar/2.0/test2aar-2.0.aar.md5: -------------------------------------------------------------------------------- 1 | b481008a5282444f1622ba00dad3a7d6 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test2aar/2.0/test2aar-2.0.pom.md5: -------------------------------------------------------------------------------- 1 | 010c3b8c119039e659da633605edaaf2 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test2aar/maven-metadata.xml.md5: -------------------------------------------------------------------------------- 1 | 0ff086864f644b5b45cdee73d89fdd54 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test3aar/2.0/test3aar-2.0.aar.md5: -------------------------------------------------------------------------------- 1 | b481008a5282444f1622ba00dad3a7d6 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test3aar/2.0/test3aar-2.0.pom.md5: -------------------------------------------------------------------------------- 1 | 4d6345210ff71544b890ee9aaa0e644f -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test3aar/maven-metadata.xml.md5: -------------------------------------------------------------------------------- 1 | c9fb251cfdf507392cd0cb5e3a728650 -------------------------------------------------------------------------------- /localAarRepo/test1.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/localAarRepo/test1.aar -------------------------------------------------------------------------------- /localAarRepo/test2.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/localAarRepo/test2.aar -------------------------------------------------------------------------------- /localAarRepo/test3.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/localAarRepo/test3.aar -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3-javadoc.jar.sha1: -------------------------------------------------------------------------------- 1 | 1b8ca476e944bf6e64b5aa18643a6764a8be656f -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3-sources.jar.sha1: -------------------------------------------------------------------------------- 1 | f68f11a6af2d68cdcc4c98902eb3aec729e0b4e4 -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ModuleManager 3 | -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test1aar/2.0/test1aar-2.0.aar.sha1: -------------------------------------------------------------------------------- 1 | 02c5015b013e81bbd1cb2b225d41cecce94c0a80 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test1aar/2.0/test1aar-2.0.pom.sha1: -------------------------------------------------------------------------------- 1 | 58d5595a8e9744686062b9d3c2da55d7e6986c36 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test1aar/maven-metadata.xml.sha1: -------------------------------------------------------------------------------- 1 | 832eee463598ad00e947cf136d5876df6b69b0e3 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test2aar/2.0/test2aar-2.0.aar.sha1: -------------------------------------------------------------------------------- 1 | 02c5015b013e81bbd1cb2b225d41cecce94c0a80 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test2aar/2.0/test2aar-2.0.pom.sha1: -------------------------------------------------------------------------------- 1 | ba39cb121ab28f8264b4d51bbbc64d4973653d75 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test2aar/maven-metadata.xml.sha1: -------------------------------------------------------------------------------- 1 | a1c3afc47d46c18ae42467e8f49fb3a3392cb213 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test3aar/2.0/test3aar-2.0.aar.sha1: -------------------------------------------------------------------------------- 1 | 02c5015b013e81bbd1cb2b225d41cecce94c0a80 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test3aar/2.0/test3aar-2.0.pom.sha1: -------------------------------------------------------------------------------- 1 | b3bfac3a386218d17d327d456b5e4884cb6f2430 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test3aar/maven-metadata.xml.sha1: -------------------------------------------------------------------------------- 1 | 05df3920c1c6805068a12dfa27764a6366e2141a -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4.aar.sha256: -------------------------------------------------------------------------------- 1 | cf4307b9aa585e8f3b00835ee2c940179abfd0a97b26a56cfc0ce2c3353ae7aa -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4.pom.sha256: -------------------------------------------------------------------------------- 1 | 42736f97a31e1caa7c672f26d8600f43a0f4598118c38cc5e25625c4e16c41a6 -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/maven-metadata.xml.sha256: -------------------------------------------------------------------------------- 1 | 7ed78d5c2b91e27ecd30cfe24a86b65edd86853c948e60754140b68ef9d68741 -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3.aar.sha256: -------------------------------------------------------------------------------- 1 | 020bfef901d8f0740ff2c4e17aad23856525a315d87aaa891edac8a644343615 -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3.pom.sha256: -------------------------------------------------------------------------------- 1 | 90b3f3d213738dbf7dacebc632a7d5d0ff0b31656887d3a055c2c733fd90ffee -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/maven-metadata.xml.sha256: -------------------------------------------------------------------------------- 1 | e8efce7897a08fc1faee09885572a2c14cb76e1824bc85d43e9732e51c67daf3 -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4.module.sha256: -------------------------------------------------------------------------------- 1 | 7546949499c979c5632b74ea67d16457616f1e34d05dfdeb886df75b9c7f0909 -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3.module.sha256: -------------------------------------------------------------------------------- 1 | 0b0e4273ee9d97557a2b3d32dd717f839ba2147c9b6c402228d67dd712751690 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4-javadoc.jar.sha256: -------------------------------------------------------------------------------- 1 | 664bf82af8e03533e469a0f99123213d71ca8fb7e38cd297b783386bc46cffe9 -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4-sources.jar.sha256: -------------------------------------------------------------------------------- 1 | 314b25d0146be8609427daf6d9f018e873e4242c47699149e90881597018cd17 -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3-javadoc.jar.sha256: -------------------------------------------------------------------------------- 1 | 12a102e017b610a6d0d5c80d7f1835615ef322dc7511a2eaaae87e1f41fd2d1a -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3-sources.jar.sha256: -------------------------------------------------------------------------------- 1 | 6a03f64634c1d1c85fe49e3ebf9b773b1ac3752e6f26acd9df9020d374279921 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test1aar/2.0/test1aar-2.0.aar.sha256: -------------------------------------------------------------------------------- 1 | 530df9e84dd559e4db66a947eb39670947d59c3b23936a7872978a4aaaac8b7f -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test1aar/2.0/test1aar-2.0.pom.sha256: -------------------------------------------------------------------------------- 1 | a8260af9e89e268ead22349f8bbf23b7febbd32f472e287287ec1b63c95e8852 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test1aar/maven-metadata.xml.sha256: -------------------------------------------------------------------------------- 1 | 250a340b049e7a572b6885e649fafc4fa16e8656df0fbbe05b9f636b144b8ce6 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test2aar/2.0/test2aar-2.0.aar.sha256: -------------------------------------------------------------------------------- 1 | 530df9e84dd559e4db66a947eb39670947d59c3b23936a7872978a4aaaac8b7f -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test2aar/2.0/test2aar-2.0.pom.sha256: -------------------------------------------------------------------------------- 1 | ab4c58bb4beaeb90789a04a15d1052654b8580627a606913faf6629f7ac7cc2b -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test2aar/maven-metadata.xml.sha256: -------------------------------------------------------------------------------- 1 | cc597dc069a4e5015fdfce4383a5639ed5ffcc0058709aa42d4be6e9fcbb2557 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test3aar/2.0/test3aar-2.0.aar.sha256: -------------------------------------------------------------------------------- 1 | 530df9e84dd559e4db66a947eb39670947d59c3b23936a7872978a4aaaac8b7f -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test3aar/2.0/test3aar-2.0.pom.sha256: -------------------------------------------------------------------------------- 1 | a9c5d9635bac1e9ef151bec7e22dacb94f619f57f2fd890728a58aa3c4510940 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test3aar/maven-metadata.xml.sha256: -------------------------------------------------------------------------------- 1 | 73e79782a2cf47b6a5c921428351300124a8f48c0f04e84cce12e40033d544fc -------------------------------------------------------------------------------- /aar-settings.gradle: -------------------------------------------------------------------------------- 1 | localAarSettings{ 2 | aarDir = "$rootDir/localAarRepo" 3 | mavenUrl = "$rootDir/localAarRepo/localAarMavenRepo3" 4 | } -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/moduleRepo/com/james/libraryA/1.4/libraryA-1.4.aar -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/moduleRepoB/com/james/libraryB/1.3/libraryB-1.3.aar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4-javadoc.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/moduleRepo/com/james/libraryA/1.4/libraryA-1.4-javadoc.jar -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/moduleRepo/com/james/libraryA/1.4/libraryA-1.4-sources.jar -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/maven-metadata.xml.sha512: -------------------------------------------------------------------------------- 1 | 614435e476d0cbf90456013cc87660d2cb2b4555a8bfe9edc04bb3c51e67e689108342c71e3a706a23e8ed6ebd5c072dbcf40349c0ff471f170d4b1253a98783 -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3-javadoc.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/moduleRepoB/com/james/libraryB/1.3/libraryB-1.3-javadoc.jar -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/moduleRepoB/com/james/libraryB/1.3/libraryB-1.3-sources.jar -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4.aar.sha512: -------------------------------------------------------------------------------- 1 | 5d426bbfd7d89b126af4c872eaf3306cf6ae6fcdecf35b6cf4dde41b0f79a1e091287c0841e29cb668db87a4408a2fa85c41f2b5d89b05ad662f8a044b0f52a0 -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4.module.sha512: -------------------------------------------------------------------------------- 1 | 798c238f504849cdf06885befc248f121a4154ac117b064befc50317702a4a06b56aa37d4d9a4a14bd430558fad53345bfa3d079af2a539a2c6711fe278de45a -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4.pom.sha512: -------------------------------------------------------------------------------- 1 | 7213de442cd76376a19e532b5d6d23eeadb20e41db129682521e25d942266eb2c47919a6e7a90e313be159ed550cc39b9422cb565a16a86bb4ca1ea87c00cb18 -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3.aar.sha512: -------------------------------------------------------------------------------- 1 | 512b6e45cf51a21f30b2bf706b2a08bbef777a49f183ea4809d39dde5b07e64ad14f1478f98ba07aadad695501c3580fd4f55f69ee96df4c815ee5aa13c51176 -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3.pom.sha512: -------------------------------------------------------------------------------- 1 | 889fe3407bff8ca8abefe1c3f25f0168ad3f253a1f144a3b2865b08c59b4bae9103c93015937b2c6250e249beb9cd3e41cc4340142acaf68958c967d3638c0fe -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/maven-metadata.xml.sha512: -------------------------------------------------------------------------------- 1 | 406d82bdcfdbe5ac785d968ffb0545642f38c7e868ce27d646d4265e0fde5e532035c18e73228651626e92d02647f9b2f745414bb116103ab3a7205afdf50ce6 -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4-javadoc.jar.sha512: -------------------------------------------------------------------------------- 1 | 675a430424dc280df3256504599f66cb8b76acd07ad11d9683b1e808c8add8bdea9bc4352dcdc0040fa3eb8b51105ced0353148d102e462f56ea3faa4a087232 -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4-sources.jar.sha512: -------------------------------------------------------------------------------- 1 | 3c9d49fb1716bbdc19c3c74f246f34936803c54b373d2c261efbfa4f38a486882ddc86e33f5a7781fabb5ed375e3e527ae7f454721faa4a754278fb8e2e8e308 -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3.module.sha512: -------------------------------------------------------------------------------- 1 | e882bb5d3b9eb452beaf15ba4c29d0d33544858a04511c86b4537419f780fb458a3e7aa2748fd0e14d3bc1a58ba5fe4b4629d84e6da8897945e115d82c3b1a7d -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3-javadoc.jar.sha512: -------------------------------------------------------------------------------- 1 | f05a87a4cce140246b353d202416f8e7847cb51966d3f8cf4be15a87660109757fac19cc190a4bd773cc558116abf204b690d1e98f7d507fab011b154f47b869 -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3-sources.jar.sha512: -------------------------------------------------------------------------------- 1 | 5f120d0ce41623b9cbb9dce4ea688962690688c3c921a6ca9cf929e2873ebc4c776929aba463785b47406901f7c0854ef7b9fd77d05967d878ff15c171d55bb2 -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /libraryA/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /libraryB/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test1aar/2.0/test1aar-2.0.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/localAarRepo/localAarMavenRepo3/com/james/test1aar/2.0/test1aar-2.0.aar -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test1aar/2.0/test1aar-2.0.aar.sha512: -------------------------------------------------------------------------------- 1 | 1e9a8be25a4a87effe1aaf2860e9393c54c11ab1ee26ff19e02da990b047b6f2165b483be9781a03cf029ae901f48bee6a831fe9cf73502bcaf4a33137f4cc55 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test1aar/2.0/test1aar-2.0.pom.sha512: -------------------------------------------------------------------------------- 1 | d40cc393523ce44bec02533adab67aabee3554d7ac84aab0b4aad48512b7b98f8caa617937cae6f6c1f60486464cdc40066433ed633b4229558a764df443b485 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test1aar/maven-metadata.xml.sha512: -------------------------------------------------------------------------------- 1 | 425785eacc1e4babb371ec2bd0f4c8055f262d70b23ba59f39070468cb12ddec0adbbb64e30e55913832f0c40c5ab76290db0bc2382852b66ee3ca0b1f883a39 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test2aar/2.0/test2aar-2.0.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/localAarRepo/localAarMavenRepo3/com/james/test2aar/2.0/test2aar-2.0.aar -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test2aar/2.0/test2aar-2.0.aar.sha512: -------------------------------------------------------------------------------- 1 | 1e9a8be25a4a87effe1aaf2860e9393c54c11ab1ee26ff19e02da990b047b6f2165b483be9781a03cf029ae901f48bee6a831fe9cf73502bcaf4a33137f4cc55 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test2aar/2.0/test2aar-2.0.pom.sha512: -------------------------------------------------------------------------------- 1 | 243a3e17aaa3db119d56ae86b595ccfbfcc05645c77ec36627d74b310ea8e886a9c54e7003cfd5109a667165e01205b48e890763774b7768272ad67904b23f2f -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test2aar/maven-metadata.xml.sha512: -------------------------------------------------------------------------------- 1 | a206ecb006a447719fcb9d991f7b87106f3cef7eb7276a0781bd5c4777e5aeb2e8ac60da10c93a1a9dd2fdff05b32337703cb183785bb0ddb8cd1b9cd2317e34 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test3aar/2.0/test3aar-2.0.aar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/theCakeOfCupid/ModuleManager/HEAD/localAarRepo/localAarMavenRepo3/com/james/test3aar/2.0/test3aar-2.0.aar -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test3aar/2.0/test3aar-2.0.aar.sha512: -------------------------------------------------------------------------------- 1 | 1e9a8be25a4a87effe1aaf2860e9393c54c11ab1ee26ff19e02da990b047b6f2165b483be9781a03cf029ae901f48bee6a831fe9cf73502bcaf4a33137f4cc55 -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test3aar/2.0/test3aar-2.0.pom.sha512: -------------------------------------------------------------------------------- 1 | 84f04829922f5e744e8b957636ee3688f39c90a9fd310e5330b55ca67e7966662fe9d3128fd3ba2b5ba7e1efd4dda8d3645b38a76091f8043d62b956f376f02d -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test3aar/maven-metadata.xml.sha512: -------------------------------------------------------------------------------- 1 | 060fcfe094cbda940073a1af3b09362052e6600be8fa1923214c73fe68c186714fa3d1cd88af2cab9a78e4794a001c0012256fd0b88a5e6a4e6d29123d7d57ff -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /library-c/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':library-c' 2 | include ':libraryB' 3 | include ':libraryA' 4 | include ':module-manager' 5 | include ':app' 6 | 7 | //project(':library-c').projectDir = new File('test/library-c') 8 | 9 | rootProject.name = "ModuleManager" -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6200EE 4 | #3700B3 5 | #03DAC5 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Jul 13 13:45:57 CST 2021 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip 7 | -------------------------------------------------------------------------------- /library-c/src/main/java/com/james/library_c/ClassC.java: -------------------------------------------------------------------------------- 1 | package com.james.library_c; 2 | 3 | /** 4 | * @author james 5 | * @date :2021/7/22 0:15 6 | */ 7 | public class ClassC { 8 | public static void testC(){ 9 | System.out.println("hello, ClassC"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /module-manager/src/main/java/com/james/exts/NormalizeConfig.java: -------------------------------------------------------------------------------- 1 | package com.james.exts; 2 | 3 | import java.util.HashMap; 4 | 5 | /** 6 | * @author james 7 | * @date 2021/7/13 8 | */ 9 | public class NormalizeConfig { 10 | public HashMap moduleNormalizes; 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /module-manager/src/main/java/com/james/tasks/SourcesJar.java: -------------------------------------------------------------------------------- 1 | package com.james.tasks; 2 | 3 | import org.gradle.jvm.tasks.Jar; 4 | 5 | /** 6 | * @author james 7 | * @date 2021/7/27 8 | */ 9 | public class SourcesJar extends Jar { 10 | 11 | { 12 | getArchiveClassifier().set("sources"); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /module-manager/src/main/java/com/james/tasks/JavadocJarTask.java: -------------------------------------------------------------------------------- 1 | package com.james.tasks; 2 | 3 | import org.gradle.jvm.tasks.Jar; 4 | 5 | /** 6 | * @author james 7 | * @date 2021/7/27 8 | */ 9 | public class JavadocJarTask extends Jar { 10 | 11 | { 12 | getArchiveClassifier().set("javadoc"); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /libraryA/src/main/java/com/james/librarya/LibraryAClass.java: -------------------------------------------------------------------------------- 1 | package com.james.librarya; 2 | 3 | /** 4 | * @author james 5 | * @date :2021/7/18 22:17 6 | */ 7 | public class LibraryAClass { 8 | 9 | /** 10 | * 测试JavaSource 11 | */ 12 | public static void testHello() { 13 | System.out.println("im libraryA"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /libraryB/src/main/java/com/james/libraryb/LibraryB.java: -------------------------------------------------------------------------------- 1 | package com.james.libraryb; 2 | 3 | 4 | /** 5 | * @author james 6 | * @date :2021/7/18 22:18 7 | */ 8 | public class LibraryB { 9 | 10 | /** 11 | * libraryB testHello 12 | */ 13 | public static void testHello() { 14 | System.out.println("im libraryB"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /module-manager/src/main/java/com/james/tasks/OneKeyPublishTask.java: -------------------------------------------------------------------------------- 1 | package com.james.tasks; 2 | 3 | import org.gradle.api.DefaultTask; 4 | import org.gradle.api.tasks.TaskAction; 5 | 6 | /** 7 | * @author james 8 | * @date 2021/7/13 9 | */ 10 | public class OneKeyPublishTask extends DefaultTask { 11 | @TaskAction 12 | public void run() { 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.james 4 | libraryA 5 | 6 | 1.4 7 | 1.4 8 | 9 | 1.4 10 | 11 | 20220430164002 12 | 13 | 14 | -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.james 4 | libraryB 5 | 6 | 1.3 7 | 1.3 8 | 9 | 1.3 10 | 11 | 20220430164317 12 | 13 | 14 | -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test1aar/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.james 4 | test1aar 5 | 6 | 2.0 7 | 2.0 8 | 9 | 2.0 10 | 11 | 20220430163928 12 | 13 | 14 | -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test2aar/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.james 4 | test2aar 5 | 6 | 2.0 7 | 2.0 8 | 9 | 2.0 10 | 11 | 20220430163928 12 | 13 | 14 | -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test3aar/maven-metadata.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | com.james 4 | test3aar 5 | 6 | 2.0 7 | 2.0 8 | 9 | 2.0 10 | 11 | 20220430163928 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /libraryA/src/test/java/com/james/librarya/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.james.librarya; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /libraryB/src/test/java/com/james/libraryb/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.james.libraryb; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/test/java/com/james/modulemanager/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.james.modulemanager; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /library-c/src/test/java/com/james/library_c/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.james.library_c; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test1aar/2.0/test1aar-2.0.pom: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | com.james 6 | test1aar 7 | 2.0 8 | aar 9 | 10 | -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test2aar/2.0/test2aar-2.0.pom: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | com.james 6 | test2aar 7 | 2.0 8 | aar 9 | 10 | -------------------------------------------------------------------------------- /localAarRepo/localAarMavenRepo3/com/james/test3aar/2.0/test3aar-2.0.pom: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | com.james 6 | test3aar 7 | 2.0 8 | aar 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/james/modulemanager/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.james.modulemanager; 2 | 3 | import android.os.Bundle; 4 | 5 | import com.james.library_c.ClassC; 6 | import com.james.libraryb.LibraryB; 7 | 8 | import androidx.appcompat.app.AppCompatActivity; 9 | 10 | public class MainActivity extends AppCompatActivity { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.activity_main); 16 | LibraryB.testHello(); 17 | ClassC.testC(); 18 | } 19 | } -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /libraryA/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /libraryB/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /library-c/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /module-settings.gradle: -------------------------------------------------------------------------------- 1 | moduleSettings { 2 | libraryA( 3 | useByAar: true, 4 | groupId: 'com.james', 5 | artifactId: 'libraryA', 6 | version: '1.4', 7 | androidJavaDoc: true, 8 | androidJavaSource: true 9 | ) 10 | libraryB( 11 | useByAar: true, 12 | groupId: 'com.james', 13 | artifactId: 'libraryB', 14 | version: '1.3', 15 | androidJavaDoc: true, 16 | androidJavaSource: true, 17 | mavenUrl: "$rootDir/moduleRepoB" 18 | ) 19 | libraryc( 20 | useByAar: false, 21 | groupId: 'com.james', 22 | artifactId: 'library-c', 23 | version: '1.3', 24 | mavenUrl: "$rootDir/moduleRepoB" 25 | ) 26 | 27 | mavenUrl = "$rootDir/moduleRepo" 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | -------------------------------------------------------------------------------- /module-manager/src/main/java/com/james/exts/AarSettings.java: -------------------------------------------------------------------------------- 1 | package com.james.exts; 2 | 3 | import com.james.util.StringUtil; 4 | 5 | import org.codehaus.groovy.runtime.GStringImpl; 6 | 7 | /** 8 | * @author james 9 | * @date :2022/4/30 0:32 10 | */ 11 | public class AarSettings { 12 | private String groupId; 13 | private String version; 14 | public String aarDir; 15 | public GStringImpl mavenUrl; 16 | 17 | public String getGroupId() { 18 | return StringUtil.isNullOrEmpty(groupId) ? "com.default" : groupId; 19 | } 20 | 21 | public void setGroupId(String groupId) { 22 | this.groupId = groupId; 23 | } 24 | 25 | public String getVersion() { 26 | return StringUtil.isNullOrEmpty(version) ? "1.0" : version; 27 | } 28 | 29 | public void setVersion(String version) { 30 | this.version = version; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /libraryA/src/androidTest/java/com/james/librarya/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.james.librarya; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | assertEquals("com.james.librarya.test", appContext.getPackageName()); 25 | } 26 | } -------------------------------------------------------------------------------- /libraryB/src/androidTest/java/com/james/libraryb/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.james.libraryb; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | assertEquals("com.james.libraryb.test", appContext.getPackageName()); 25 | } 26 | } -------------------------------------------------------------------------------- /app/src/androidTest/java/com/james/modulemanager/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.james.modulemanager; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | assertEquals("com.james.modulemanager", appContext.getPackageName()); 25 | } 26 | } -------------------------------------------------------------------------------- /library-c/src/androidTest/java/com/james/library_c/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.james.library_c; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | assertEquals("com.james.library_c.test", appContext.getPackageName()); 25 | } 26 | } -------------------------------------------------------------------------------- /.idea/$CACHE_FILE$: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Android 10 | 11 | 12 | ComplianceLintAndroid 13 | 14 | 15 | CorrectnessLintAndroid 16 | 17 | 18 | LintAndroid 19 | 20 | 21 | PerformanceLintAndroid 22 | 23 | 24 | UsabilityLintAndroid 25 | 26 | 27 | 28 | 29 | Android 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | 1# Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app"s APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 30 5 | buildToolsVersion "30.0.3" 6 | 7 | defaultConfig { 8 | applicationId "com.james.modulemanager" 9 | minSdkVersion 16 10 | targetSdkVersion 30 11 | versionCode 1 12 | versionName "1.0" 13 | 14 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 15 | } 16 | 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | implementation project(':libraryB') 27 | implementation project(':library-c') 28 | implementation fileTree(dir: "libs", include: ["*.jar"]) 29 | implementation 'androidx.appcompat:appcompat:1.2.0' 30 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4' 31 | testImplementation 'junit:junit:4.12' 32 | androidTestImplementation 'androidx.test.ext:junit:1.1.2' 33 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' 34 | 35 | } -------------------------------------------------------------------------------- /libraryA/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.library' 3 | } 4 | 5 | android { 6 | compileSdkVersion 30 7 | buildToolsVersion "30.0.3" 8 | 9 | defaultConfig { 10 | minSdkVersion 16 11 | targetSdkVersion 30 12 | versionCode 1 13 | versionName "1.0" 14 | 15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 16 | consumerProguardFiles "consumer-rules.pro" 17 | } 18 | 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | compileOptions { 26 | sourceCompatibility JavaVersion.VERSION_1_8 27 | targetCompatibility JavaVersion.VERSION_1_8 28 | } 29 | } 30 | 31 | dependencies { 32 | 33 | implementation 'androidx.appcompat:appcompat:1.1.0' 34 | implementation 'com.google.android.material:material:1.1.0' 35 | testImplementation 'junit:junit:4.+' 36 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 37 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 38 | } -------------------------------------------------------------------------------- /library-c/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.library' 3 | } 4 | 5 | android { 6 | compileSdkVersion 30 7 | buildToolsVersion "30.0.3" 8 | 9 | defaultConfig { 10 | minSdkVersion 16 11 | targetSdkVersion 30 12 | versionCode 1 13 | versionName "1.0" 14 | 15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 16 | consumerProguardFiles "consumer-rules.pro" 17 | } 18 | 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | compileOptions { 26 | sourceCompatibility JavaVersion.VERSION_1_8 27 | targetCompatibility JavaVersion.VERSION_1_8 28 | } 29 | } 30 | 31 | dependencies { 32 | 33 | implementation 'androidx.appcompat:appcompat:1.1.0' 34 | implementation 'com.google.android.material:material:1.1.0' 35 | testImplementation 'junit:junit:4.+' 36 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 37 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 38 | } -------------------------------------------------------------------------------- /libraryB/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'com.android.library' 3 | } 4 | 5 | android { 6 | compileSdkVersion 30 7 | buildToolsVersion "30.0.3" 8 | 9 | defaultConfig { 10 | minSdkVersion 16 11 | targetSdkVersion 30 12 | versionCode 1 13 | versionName "1.0" 14 | 15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 16 | consumerProguardFiles "consumer-rules.pro" 17 | } 18 | 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | compileOptions { 26 | sourceCompatibility JavaVersion.VERSION_1_8 27 | targetCompatibility JavaVersion.VERSION_1_8 28 | } 29 | } 30 | 31 | dependencies { 32 | // implementation aars["test1.aar"] 33 | implementation 'androidx.appcompat:appcompat:1.1.0' 34 | implementation 'com.google.android.material:material:1.1.0' 35 | testImplementation 'junit:junit:4.+' 36 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 37 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 38 | } -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 25 | 26 | -------------------------------------------------------------------------------- /module-manager/src/main/java/com/james/util/StringUtil.java: -------------------------------------------------------------------------------- 1 | package com.james.util; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * @author james 7 | * @date 2021/7/12 8 | */ 9 | public class StringUtil { 10 | 11 | public static boolean isNullOrEmpty(String str) { 12 | return str == null || str.isEmpty(); 13 | } 14 | 15 | public static String getNormalizeName(String projectName) { 16 | if (isNullOrEmpty(projectName)) { 17 | return projectName; 18 | } 19 | projectName = projectName.replaceAll("_", ""); 20 | projectName = projectName.replaceAll("-", ""); 21 | projectName = projectName.replaceAll("\\.", ""); 22 | return projectName; 23 | } 24 | 25 | public static String joinToString(List list, String joined) { 26 | StringBuilder stringBuffer = new StringBuilder(); 27 | int count = 0; 28 | for (Object o : list) { 29 | if (++count > 1) stringBuffer.append(joined); 30 | stringBuffer.append(o.toString()); 31 | } 32 | return stringBuffer.toString(); 33 | } 34 | 35 | public static String getMavenPath(String groupId,String name, String version){ 36 | return groupId+":"+name+":"+version; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /module-manager/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'groovy' 2 | apply plugin: 'java-gradle-plugin' 3 | apply plugin: 'java' 4 | apply plugin: 'maven-publish' 5 | 6 | gradlePlugin { 7 | plugins { 8 | moduleManager { 9 | id = 'module-manager-plugin' 10 | implementationClass = 'com.james.ModuleManagePlugin' 11 | } 12 | } 13 | } 14 | 15 | def javadocJar = task("javadocJar", type: Jar, dependsOn: javadoc) { 16 | classifier = 'javadoc' 17 | from javadoc.destinationDir 18 | } 19 | def sourcesJar = task("sourcesJar", type: Jar) { 20 | classifier = 'sources' 21 | from sourceSets.main.java.srcDirs 22 | } 23 | 24 | tasks.withType(JavaCompile) { 25 | options.encoding = "UTF-8" 26 | } 27 | 28 | publishing { 29 | publications { 30 | Component(MavenPublication) { 31 | from components.java 32 | groupId = 'com.james' 33 | artifactId = 'module-manager-plugin' 34 | version = '1.0.4' 35 | artifact sourcesJar 36 | } 37 | } 38 | } 39 | 40 | dependencies { 41 | implementation gradleApi() 42 | implementation localGroovy() 43 | compileOnly 'com.android.tools.build:gradle:3.6.0' 44 | 45 | implementation 'com.google.code.gson:gson:2.8.2' 46 | } 47 | 48 | -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4.pom: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 4.0.0 10 | com.james 11 | libraryA 12 | 1.4 13 | aar 14 | 15 | 16 | androidx.appcompat 17 | appcompat 18 | 1.1.0 19 | runtime 20 | 21 | 22 | com.google.android.material 23 | material 24 | 1.1.0 25 | runtime 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /module-manager/src/main/java/com/james/exts/ModuleSettings.java: -------------------------------------------------------------------------------- 1 | package com.james.exts; 2 | 3 | import com.james.DynamicPublishMethods; 4 | 5 | import org.gradle.internal.metaobject.MethodAccess; 6 | import org.gradle.internal.metaobject.MethodMixIn; 7 | 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | /** 12 | * @author james 13 | * @date 2021/7/9 14 | */ 15 | public class ModuleSettings implements MethodMixIn { 16 | private final Map moduleConfigHashMap = new HashMap<>(); 17 | 18 | public String mavenUrl; 19 | 20 | @Override 21 | public MethodAccess getAdditionalMethods() { 22 | return new DynamicPublishMethods(moduleConfigHashMap); 23 | } 24 | 25 | public Map getModuleConfigHashMap() { 26 | return moduleConfigHashMap; 27 | } 28 | 29 | /** 30 | * 获取module的仓库标识 31 | * 32 | * @param key 配置文件中定义的module名 33 | */ 34 | public String module(String key) throws Exception { 35 | ModuleConfig moduleConfig = moduleConfigHashMap.get(key); 36 | if (null == moduleConfig) { 37 | throw new Exception("can't find module " + key 38 | + ",make sure you have publish it to mavenLocal or specify repo"); 39 | } 40 | 41 | return moduleConfig.getPath(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3.pom: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 4.0.0 10 | com.james 11 | libraryB 12 | 1.3 13 | aar 14 | 15 | 16 | com.james 17 | test1aar 18 | 2.0 19 | compile 20 | 21 | 22 | androidx.appcompat 23 | appcompat 24 | 1.1.0 25 | runtime 26 | 27 | 28 | com.google.android.material 29 | material 30 | 1.1.0 31 | runtime 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /module-manager/src/main/java/com/james/exts/ModuleConfig.java: -------------------------------------------------------------------------------- 1 | package com.james.exts; 2 | 3 | 4 | import com.james.util.StringUtil; 5 | 6 | import org.codehaus.groovy.runtime.GStringImpl; 7 | import org.gradle.api.Project; 8 | 9 | /** 10 | * @author james 11 | * @date 2021/7/12 12 | */ 13 | public class ModuleConfig { 14 | public boolean enabled; 15 | public String groupId; 16 | public String artifactId; 17 | public String version; 18 | public String name; 19 | private String path; 20 | public boolean useByAar; 21 | private Project project; 22 | public GStringImpl mavenUrl; 23 | public boolean androidJavaDoc; 24 | public boolean androidJavaSource; 25 | public boolean needAndroidJavaDocsAddReferencesLinks; 26 | 27 | public void setProject(Project project) { 28 | this.project = project; 29 | } 30 | 31 | public String getGroupId() { 32 | return StringUtil.isNullOrEmpty(groupId) ? "com.default" : groupId; 33 | } 34 | 35 | public String getArtifactId() { 36 | return StringUtil.isNullOrEmpty(artifactId) ? project.getName() : artifactId; 37 | } 38 | 39 | public String getVersion() { 40 | return StringUtil.isNullOrEmpty(version) ? "1.0" : version; 41 | } 42 | 43 | public String getName() { 44 | return StringUtil.isNullOrEmpty(name) ? project.getName() : name; 45 | } 46 | 47 | public String getPath() { 48 | return getGroupId() + ":" + getArtifactId() + ":" + getVersion(); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | 34 | 35 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /module-manager/src/main/java/com/james/DynamicPublishMethods.java: -------------------------------------------------------------------------------- 1 | package com.james; 2 | 3 | 4 | import com.james.exts.ModuleConfig; 5 | 6 | import org.gradle.internal.impldep.org.jetbrains.annotations.NotNull; 7 | import org.gradle.internal.metaobject.DynamicInvokeResult; 8 | import org.gradle.internal.metaobject.MethodAccess; 9 | 10 | import java.lang.reflect.Field; 11 | import java.util.Map; 12 | import java.util.Set; 13 | 14 | /** 15 | * @author james 16 | * @date 2021/7/15 17 | */ 18 | public class DynamicPublishMethods implements MethodAccess { 19 | private Map moduleConfigHashMap; 20 | 21 | 22 | public DynamicPublishMethods(Map moduleConfigHashMap) { 23 | this.moduleConfigHashMap = moduleConfigHashMap; 24 | } 25 | 26 | @Override 27 | public boolean hasMethod(String name, Object... arguments) { 28 | return true; 29 | } 30 | 31 | @Override 32 | public DynamicInvokeResult tryInvokeMethod(String name, Object... arguments) { 33 | for (Object object : arguments) { 34 | if (object instanceof Map) { 35 | @SuppressWarnings("unchecked") 36 | Map map = (Map) object; 37 | ModuleConfig moduleConfig = new ModuleConfig(); 38 | attemptPackageModuleConfig(moduleConfig, name, map); 39 | } 40 | } 41 | return DynamicInvokeResult.found(moduleConfigHashMap); 42 | } 43 | 44 | private void attemptPackageModuleConfig(@NotNull ModuleConfig moduleConfig, 45 | @NotNull String name, @NotNull Map paramsMap) { 46 | if (paramsMap.isEmpty()) { 47 | return; 48 | } 49 | try { 50 | Class moduleConfigClass = moduleConfig.getClass(); 51 | Set> entries = paramsMap.entrySet(); 52 | for (Map.Entry entry : entries) { 53 | Field field = moduleConfigClass.getField(entry.getKey()); 54 | field.setAccessible(true); 55 | field.set(moduleConfig, entry.getValue()); 56 | field.setAccessible(false); 57 | } 58 | moduleConfigHashMap.put(name, moduleConfig); 59 | } catch (Exception e) { 60 | e.printStackTrace(); 61 | System.out.println(e.getMessage()); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /moduleRepo/com/james/libraryA/1.4/libraryA-1.4.module: -------------------------------------------------------------------------------- 1 | { 2 | "formatVersion": "1.1", 3 | "component": { 4 | "group": "com.james", 5 | "module": "libraryA", 6 | "version": "1.4", 7 | "attributes": { 8 | "org.gradle.status": "release" 9 | } 10 | }, 11 | "createdBy": { 12 | "gradle": { 13 | "version": "6.1.1", 14 | "buildId": "2u7gym4c2na63hj5xmpy5zknkm" 15 | } 16 | }, 17 | "variants": [ 18 | { 19 | "name": "releaseApiPublication", 20 | "attributes": { 21 | "org.gradle.category": "library", 22 | "org.gradle.dependency.bundling": "external", 23 | "org.gradle.libraryelements": "aar", 24 | "org.gradle.usage": "java-api" 25 | }, 26 | "files": [ 27 | { 28 | "name": "libraryA-1.4.aar", 29 | "url": "libraryA-1.4.aar", 30 | "size": 23430, 31 | "sha512": "5d426bbfd7d89b126af4c872eaf3306cf6ae6fcdecf35b6cf4dde41b0f79a1e091287c0841e29cb668db87a4408a2fa85c41f2b5d89b05ad662f8a044b0f52a0", 32 | "sha256": "cf4307b9aa585e8f3b00835ee2c940179abfd0a97b26a56cfc0ce2c3353ae7aa", 33 | "sha1": "7f25d38673e2050cb77c5683911c8028422beddf", 34 | "md5": "c32f35850bcfbaca4df9c8caf8a0b747" 35 | } 36 | ] 37 | }, 38 | { 39 | "name": "releaseRuntimePublication", 40 | "attributes": { 41 | "org.gradle.category": "library", 42 | "org.gradle.dependency.bundling": "external", 43 | "org.gradle.libraryelements": "aar", 44 | "org.gradle.usage": "java-runtime" 45 | }, 46 | "dependencies": [ 47 | { 48 | "group": "androidx.appcompat", 49 | "module": "appcompat", 50 | "version": { 51 | "requires": "1.1.0" 52 | } 53 | }, 54 | { 55 | "group": "com.google.android.material", 56 | "module": "material", 57 | "version": { 58 | "requires": "1.1.0" 59 | } 60 | } 61 | ], 62 | "files": [ 63 | { 64 | "name": "libraryA-1.4.aar", 65 | "url": "libraryA-1.4.aar", 66 | "size": 23430, 67 | "sha512": "5d426bbfd7d89b126af4c872eaf3306cf6ae6fcdecf35b6cf4dde41b0f79a1e091287c0841e29cb668db87a4408a2fa85c41f2b5d89b05ad662f8a044b0f52a0", 68 | "sha256": "cf4307b9aa585e8f3b00835ee2c940179abfd0a97b26a56cfc0ce2c3353ae7aa", 69 | "sha1": "7f25d38673e2050cb77c5683911c8028422beddf", 70 | "md5": "c32f35850bcfbaca4df9c8caf8a0b747" 71 | } 72 | ] 73 | } 74 | ] 75 | } 76 | -------------------------------------------------------------------------------- /module-manager/src/main/java/com/james/tasks/TaskManager.java: -------------------------------------------------------------------------------- 1 | package com.james.tasks; 2 | 3 | import com.android.build.gradle.LibraryExtension; 4 | 5 | import org.gradle.api.Project; 6 | import org.gradle.api.plugins.JavaPluginConvention; 7 | import org.gradle.api.tasks.TaskContainer; 8 | import org.gradle.api.tasks.TaskProvider; 9 | 10 | /** 11 | * refer to {@link 'https://github.com/vanniktech/gradle-maven-publish-plugin'} 12 | * 13 | * @author james 14 | * @date 2021/7/27 15 | */ 16 | public class TaskManager { 17 | 18 | /** 19 | * 获取AndroidSourcesJarTask 20 | * 21 | * @param project project 22 | * @return AndroidSourcesJar 23 | */ 24 | public static SourcesJar getAndroidSourcesJar(Project project) { 25 | return project.getTasks().create("androidSourcesJar", 26 | SourcesJar.class, sourcesJar -> { 27 | LibraryExtension libraryExtension = project.getExtensions().getByType( 28 | LibraryExtension.class); 29 | sourcesJar.from(libraryExtension.getSourceSets().getByName( 30 | "main").getJava().getSrcDirs()); 31 | }); 32 | } 33 | 34 | /** 35 | * 获取JavaSourcesJarTaskProvider 36 | * 37 | * @param project project 38 | * @return JavaSourcesJarTaskProvider 39 | */ 40 | public static TaskProvider getJavaSourcesJar(Project project) { 41 | return project.getTasks().register("javaSourcesJar", 42 | SourcesJar.class, sourcesJar -> { 43 | JavaPluginConvention plugin = project.getConvention().getPlugin( 44 | JavaPluginConvention.class); 45 | sourcesJar.from(plugin.getSourceSets().getByName("main").getAllSource()); 46 | }); 47 | } 48 | 49 | /** 50 | * 获取AndroidJavaDocTask 51 | * 52 | * @param project project 53 | * @return AndroidJavaDocTask 54 | */ 55 | public static JavadocJarTask getAndroidJavadocJar(Project project) { 56 | TaskContainer tasks = project.getTasks(); 57 | TaskProvider androidJavadoc = tasks.register( 58 | "androidJavadoc", AndroidJavaDocsTask.class); 59 | JavadocJarTask androidJavadocJar = project.getTasks().create("androidJavadocJar", 60 | JavadocJarTask.class, 61 | javadocJarTask -> { 62 | javadocJarTask.dependsOn(androidJavadoc); 63 | javadocJarTask.from(androidJavadoc); 64 | }); 65 | return androidJavadocJar; 66 | } 67 | 68 | // public static TaskProvider getSimple(Project project){ 69 | // project.tasks.register("simpleJavadocJar", JavadocJar) { 70 | // val task = tasks.named("javadoc") 71 | // it.dependsOn(task) 72 | // it.from(task) 73 | // } 74 | // } 75 | } 76 | -------------------------------------------------------------------------------- /moduleRepoB/com/james/libraryB/1.3/libraryB-1.3.module: -------------------------------------------------------------------------------- 1 | { 2 | "formatVersion": "1.1", 3 | "component": { 4 | "group": "com.james", 5 | "module": "libraryB", 6 | "version": "1.3", 7 | "attributes": { 8 | "org.gradle.status": "release" 9 | } 10 | }, 11 | "createdBy": { 12 | "gradle": { 13 | "version": "6.1.1", 14 | "buildId": "3naknoynivfqjfim4g3y3fecji" 15 | } 16 | }, 17 | "variants": [ 18 | { 19 | "name": "releaseApiPublication", 20 | "attributes": { 21 | "org.gradle.category": "library", 22 | "org.gradle.dependency.bundling": "external", 23 | "org.gradle.libraryelements": "aar", 24 | "org.gradle.usage": "java-api" 25 | }, 26 | "dependencies": [ 27 | { 28 | "group": "com.james", 29 | "module": "test1aar", 30 | "version": { 31 | "requires": "2.0" 32 | } 33 | } 34 | ], 35 | "files": [ 36 | { 37 | "name": "libraryB-1.3.aar", 38 | "url": "libraryB-1.3.aar", 39 | "size": 23450, 40 | "sha512": "512b6e45cf51a21f30b2bf706b2a08bbef777a49f183ea4809d39dde5b07e64ad14f1478f98ba07aadad695501c3580fd4f55f69ee96df4c815ee5aa13c51176", 41 | "sha256": "020bfef901d8f0740ff2c4e17aad23856525a315d87aaa891edac8a644343615", 42 | "sha1": "1c3769c4ed954e4707fd3f3a87b39cef95fc4cde", 43 | "md5": "073a9ebbc57de20d2bcfa14ab000591a" 44 | } 45 | ] 46 | }, 47 | { 48 | "name": "releaseRuntimePublication", 49 | "attributes": { 50 | "org.gradle.category": "library", 51 | "org.gradle.dependency.bundling": "external", 52 | "org.gradle.libraryelements": "aar", 53 | "org.gradle.usage": "java-runtime" 54 | }, 55 | "dependencies": [ 56 | { 57 | "group": "androidx.appcompat", 58 | "module": "appcompat", 59 | "version": { 60 | "requires": "1.1.0" 61 | } 62 | }, 63 | { 64 | "group": "com.google.android.material", 65 | "module": "material", 66 | "version": { 67 | "requires": "1.1.0" 68 | } 69 | }, 70 | { 71 | "group": "com.james", 72 | "module": "test1aar", 73 | "version": { 74 | "requires": "2.0" 75 | } 76 | } 77 | ], 78 | "files": [ 79 | { 80 | "name": "libraryB-1.3.aar", 81 | "url": "libraryB-1.3.aar", 82 | "size": 23450, 83 | "sha512": "512b6e45cf51a21f30b2bf706b2a08bbef777a49f183ea4809d39dde5b07e64ad14f1478f98ba07aadad695501c3580fd4f55f69ee96df4c815ee5aa13c51176", 84 | "sha256": "020bfef901d8f0740ff2c4e17aad23856525a315d87aaa891edac8a644343615", 85 | "sha1": "1c3769c4ed954e4707fd3f3a87b39cef95fc4cde", 86 | "md5": "073a9ebbc57de20d2bcfa14ab000591a" 87 | } 88 | ] 89 | } 90 | ] 91 | } 92 | -------------------------------------------------------------------------------- /module-manager/src/main/java/com/james/tasks/AndroidJavaDocsTask.java: -------------------------------------------------------------------------------- 1 | package com.james.tasks; 2 | 3 | import com.android.build.gradle.LibraryExtension; 4 | import com.android.build.gradle.api.LibraryVariant; 5 | 6 | import com.james.exts.ModuleConfig; 7 | import com.james.util.StringUtil; 8 | 9 | import org.gradle.api.JavaVersion; 10 | import org.gradle.api.Project; 11 | import org.gradle.api.file.FileCollection; 12 | import org.gradle.api.tasks.TaskProvider; 13 | import org.gradle.api.tasks.compile.JavaCompile; 14 | import org.gradle.api.tasks.javadoc.Javadoc; 15 | import org.gradle.external.javadoc.StandardJavadocDocletOptions; 16 | 17 | import java.io.File; 18 | 19 | /** 20 | * @author james 21 | * @date 2021/7/27 22 | */ 23 | public class AndroidJavaDocsTask extends Javadoc { 24 | private static final String ANDROID_PLUGIN = "org.jetbrains.kotlin.android"; 25 | 26 | public void AndroidJavaDocsTask() { 27 | Project project = getProject(); 28 | ModuleConfig moduleConfig = project.getExtensions().getByType(ModuleConfig.class); 29 | LibraryExtension libraryExtension = project.getExtensions().getByType( 30 | LibraryExtension.class); 31 | LibraryVariant[] libraryVariants = new LibraryVariant[]{}; 32 | libraryExtension.getLibraryVariants().toArray(libraryVariants); 33 | int index = libraryVariants.length - 1; 34 | LibraryVariant libraryVariant = libraryVariants[index]; 35 | TaskProvider javaCompileProvider = libraryVariant.getJavaCompileProvider(); 36 | if (!project.getPluginManager().hasPlugin(ANDROID_PLUGIN)) { 37 | setSource(libraryExtension.getSourceSets().getByName("main").getJava().getSrcDirs()); 38 | } 39 | 40 | setFailOnError(true); 41 | FileCollection classpath = getClasspath(); 42 | classpath.plus(project.files( 43 | StringUtil.joinToString(libraryExtension.getBootClasspath(), File.separator))); 44 | // Safe to call get() here because we'ved marked this as dependent on the TaskProvider 45 | classpath.plus(javaCompileProvider.get().getClasspath()); 46 | classpath.plus(javaCompileProvider.get().getOutputs().getFiles()); 47 | 48 | // We don't need javadoc for internals. 49 | exclude("**/internal/*"); 50 | 51 | // Append Java 8 and Android references 52 | 53 | StandardJavadocDocletOptions options = (StandardJavadocDocletOptions) getOptions(); 54 | 55 | if (moduleConfig.needAndroidJavaDocsAddReferencesLinks) { 56 | options.links("https://developer.android.com/reference"); 57 | options.links("https://docs.oracle.com/javase/8/docs/api/"); 58 | } 59 | 60 | // Workaround for the following error when running on on JDK 9+ 61 | // "The code being documented uses modules but the packages defined in ... are in the 62 | // unnamed module." 63 | if (JavaVersion.current().ordinal() >= JavaVersion.VERSION_1_9.ordinal()) { 64 | options.addStringOption("-release", "8"); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 20 | 21 | 22 | 23 | 25 | 26 | 27 |
28 | 29 | 30 | 31 | xmlns:android 32 | 33 | ^$ 34 | 35 | 36 | 37 |
38 |
39 | 40 | 41 | 42 | xmlns:.* 43 | 44 | ^$ 45 | 46 | 47 | BY_NAME 48 | 49 |
50 |
51 | 52 | 53 | 54 | .*:id 55 | 56 | http://schemas.android.com/apk/res/android 57 | 58 | 59 | 60 |
61 |
62 | 63 | 64 | 65 | .*:name 66 | 67 | http://schemas.android.com/apk/res/android 68 | 69 | 70 | 71 |
72 |
73 | 74 | 75 | 76 | name 77 | 78 | ^$ 79 | 80 | 81 | 82 |
83 |
84 | 85 | 86 | 87 | style 88 | 89 | ^$ 90 | 91 | 92 | 93 |
94 |
95 | 96 | 97 | 98 | .* 99 | 100 | ^$ 101 | 102 | 103 | BY_NAME 104 | 105 |
106 |
107 | 108 | 109 | 110 | .* 111 | 112 | http://schemas.android.com/apk/res/android 113 | 114 | 115 | ANDROID_ATTRIBUTE_ORDER 116 | 117 |
118 |
119 | 120 | 121 | 122 | .* 123 | 124 | .* 125 | 126 | 127 | BY_NAME 128 | 129 |
130 |
131 |
132 |
133 |
134 |
-------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | # ModuleManager 6 | 7 | - [支持功能](#支持功能) 8 | - [完成配置只需要两步](#完成配置只需要两步) 9 | - [引入插件](#引入插件) 10 | - [配置module清单](#配置module清单) 11 | - [配置参数说明](#配置参数说明) 12 | - [一键发布所有module](#一键发布所有module) 13 | - [发布单个module](#发布单个module) 14 | - [module内引用了本地aar怎么办](#module内引用了本地aar怎么办) 15 | - [配置本地aar仓库](#配置本地aar仓库) 16 | - [引用本地aar](#引用本地aar) 17 | 18 | 19 | [![](https://jitpack.io/v/theCakeOfCupid/ModuleManager.svg)](https://jitpack.io/#theCakeOfCupid/ModuleManager) 20 | 21 | ## 支持功能 22 | 23 | - 自动构建发布脚本 24 | - 动态切换依赖 25 | - 一键发布所有module至仓库 26 | - 动态切换maven仓库 27 | 28 | 29 | 30 | ## 完成配置只需要两步 31 | 32 | ### 引入插件 33 | 34 | 在工程目录下build.gradle文件中引入插件 35 | 36 | ``` 37 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 38 | apply plugin: 'module-manager-plugin' 39 | 40 | buildscript { 41 | repositories { 42 | maven { url 'https://jitpack.io' } 43 | } 44 | dependencies { 45 | //引入插件 46 | classpath 'com.github.theCakeOfCupid:ModuleManager:1.0.2' 47 | } 48 | } 49 | ``` 50 | 51 | ### 配置module清单 52 | 53 | 你可以在工程目录下build.gradle文件里直接配置也可以单独创建一份清单文件,然后在工程目录下build.gradle文件里引入, 54 | 55 | 我这里的示例是第二种,这里我在工程目录下创建了一个module-settings.gradle的文件,具体配置如下: 56 | 57 | ``` 58 | moduleSettings { 59 | libraryA( 60 | useByAar: false, 61 | groupId: 'com.james', 62 | artifactId: 'libraryA', 63 | version: '1.3' 64 | ) 65 | libraryB( 66 | useByAar: false, 67 | groupId: 'com.james', 68 | artifactId: 'libraryB', 69 | version: '1.2' 70 | ) 71 | 72 | mavenUrl = "$rootDir/moduleRepo" 73 | } 74 | ``` 75 | 76 | 然后在工程目录下build.gradle文件里引入即可 77 | 78 | ``` 79 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 80 | apply plugin: 'module-manager-plugin' 81 | apply from: 'module-settings.gradle' 82 | ``` 83 | 84 | #### 配置参数说明 85 | 86 | - **libraryA、libraryB** 87 | 88 | 显而易见是module名称,这里一定要和你的真实module名称一致,不然插件会找不到对应的module,如果你的module名携带特殊字符,你需要处理一下,因为groovy dsl对特殊字符支持并不友好,例如你的module名是module-library-A,你需要将特殊字符去掉,改成modulelibraryA,即 89 | 90 | ``` 91 | modulelibraryA( 92 | useByAar: false, 93 | groupId: 'com.james', 94 | artifactId: 'module-library-A', 95 | version: '1.2' 96 | ) 97 | ``` 98 | 99 | - **useByAar** 100 | 101 | 是否以aar方式引入,默认为false,该属性被设置为true时,项目里所有以project方式引用此module的依赖会自动替换成aar引用 102 | 103 | 比如app模块当前是以project方式引用的libraryA 104 | 105 | ``` 106 | dependencies { 107 | implementation project(path: ':libraryA') 108 | } 109 | ``` 110 | 111 | 当useByAar被设置成true时,该依赖会自动转换成aar依赖,无需手动更改。 112 | 113 | - **groupId、artifactId、version** 114 | 115 | 这个没啥好说的,发布到仓库的三件套,仓库通过这三个路径找到对应的产物。 116 | 117 | - **mavenUrl** 118 | 119 | 指定仓库发布,当该属性被定义时,module将会发布到指定的仓库,且从该从库引入依赖件,你可以单独为module设置自己的仓库,也可以设置一个全局仓库,也可以什么都不设置(默认将使用本地maven仓库),示例如下: 120 | 121 | ``` 122 | moduleSettings { 123 | libraryA( 124 | useByAar: true, 125 | groupId: 'com.james', 126 | artifactId: 'libraryA', 127 | version: '1.4' 128 | ) 129 | libraryB( 130 | useByAar: true, 131 | groupId: 'com.james', 132 | artifactId: 'libraryB', 133 | version: '1.2', 134 | //为libraryB单独设置仓库 135 | mavenUrl:"$rootDir/moduleRepoB" 136 | ) 137 | //设置全局仓库 138 | mavenUrl = "$rootDir/moduleRepo" 139 | } 140 | ``` 141 | 142 | 仓库生效优先级依次是:module参数内配置的仓库 > 全局仓库 > 本地仓库 143 | 144 | ## 一键发布所有module 145 | 146 | ``` 147 | gradlew oneKeyPublish 148 | ``` 149 | 150 | 151 | 152 | ## 发布单个module 153 | 154 | ``` 155 | gradlew ::assembleRelease 156 | 157 | //例如发布libraryA 158 | gradlew :libraryA:assembleRelease 159 | ``` 160 | ## module内引用了本地aar怎么办 161 | 162 | 需要将本地aar继续转换成仓库,两步即可实现: 163 | 164 | ### 配置本地aar仓库 165 | 166 | 以demo为示例,我们在项目根目录下新建一个文件夹“localAarRepo”,将所有本地aar放入该文件夹,然后跟模块配置一样,我们新建一个aar-settings.gradle的配置文件: 167 | 168 | ``` 169 | localAarSettings{ 170 | //存放本地aar的路径 171 | aarDir = "$rootDir/localAarRepo" 172 | //本地aar生成的仓库路径 173 | mavenUrl = "$rootDir/localAarRepo/localAarMavenRepo3" 174 | } 175 | ``` 176 | 177 | 同样,我们需要在项目build.gradle里引入aar-settings.gradle配置文件 178 | 179 | ``` 180 | //... 181 | apply plugin:'module-manager-plugin' 182 | apply from: 'module-settings.gradle' 183 | apply from: 'aar-settings.gradle' 184 | //... 185 | ``` 186 | 187 | 完成以上步骤,我们就可以将所有本地aar发布到配置的仓库路径下了,发布命令为: 188 | 189 | ``` 190 | gradlew oneKeyPublishLocalAar 191 | ``` 192 | 193 | ### 引用本地aar 194 | 195 | 在步骤一里面我们已经成功将所有本地aar发布到仓库,接下来我们只需要在对应的模块更改下引用方式即可,例如我们需要引用test1.aar: 196 | 197 | ``` 198 | //引用test1.aar 199 | implementation aars["test1.aar"] 200 | //引用test2.aar 201 | implementation aars["test2.aar"] 202 | ``` 203 | 204 | 205 | 206 | ## 直接引用仓库模块路径 207 | 208 | 当本地仓库已有module aar且settings.gradle文件下module没有配置时,直接引用aar 209 | ``` 210 | implementation moduleSettings.module('libraryA') 211 | ``` 212 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /module-manager/src/main/java/com/james/ModuleManagePlugin.java: -------------------------------------------------------------------------------- 1 | package com.james; 2 | 3 | 4 | import static com.james.ModuleManageInternalPlugin.MAVEN_PUBLISH_PLUGIN_NAME; 5 | import static com.james.ModuleManageInternalPlugin.PUBLISH_ALL_PUBLICATIONS; 6 | 7 | import com.james.exts.AarSettings; 8 | import com.james.exts.ModuleConfig; 9 | import com.james.exts.ModuleSettings; 10 | import com.james.exts.NormalizeConfig; 11 | import com.james.tasks.OneKeyPublishTask; 12 | import com.james.util.StringUtil; 13 | 14 | import org.gradle.api.Plugin; 15 | import org.gradle.api.Project; 16 | import org.gradle.api.Task; 17 | import org.gradle.api.publish.PublicationContainer; 18 | import org.gradle.api.publish.PublishingExtension; 19 | import org.gradle.api.publish.maven.MavenPublication; 20 | import org.gradle.api.tasks.TaskContainer; 21 | import org.gradle.api.tasks.TaskProvider; 22 | 23 | import java.io.File; 24 | import java.util.HashMap; 25 | import java.util.Set; 26 | 27 | /** 28 | * @author james 29 | * @date 2021/7/7 30 | */ 31 | public class ModuleManagePlugin implements Plugin { 32 | public static final String ONE_KEY_PUBLISH = "oneKeyPublish"; 33 | public static final String ONE_KEY_PUBLISH_LOCAL_AAR = "oneKeyPublishLocalAar"; 34 | 35 | @Override 36 | public void apply(Project project) { 37 | System.out.println("ModuleManagePlugin executed"); 38 | ModuleSettings moduleSettings = project.getExtensions().create("moduleSettings", 39 | ModuleSettings.class); 40 | AarSettings aarSettings = project.getExtensions().create("localAarSettings", 41 | AarSettings.class); 42 | initSubProject(project); 43 | if (!project.getPluginManager().hasPlugin(MAVEN_PUBLISH_PLUGIN_NAME)) { 44 | project.getPluginManager().apply(MAVEN_PUBLISH_PLUGIN_NAME); 45 | } 46 | project.afterEvaluate(p -> { 47 | configLocalAar(project, aarSettings); 48 | }); 49 | } 50 | 51 | private void initNormalize(Project project, NormalizeConfig normalizeConfig) { 52 | if (!normalizeConfig.moduleNormalizes.isEmpty()) { 53 | System.out.println("normalize is not empty"); 54 | Set subProjects = project.getSubprojects(); 55 | for (Project subProject : subProjects) { 56 | String value = normalizeConfig.moduleNormalizes.get(subProject.getName()); 57 | if (value != null) { 58 | System.out.println("value:" + value); 59 | project.getRootProject().getExtensions().create(value, ModuleConfig.class); 60 | } 61 | } 62 | } else { 63 | System.out.println("normalize is empty"); 64 | } 65 | } 66 | 67 | /** 68 | * 配置本地aar发布脚本 69 | */ 70 | private void configLocalAar(Project project, AarSettings aarSettings) { 71 | project.getTasks().whenTaskAdded(task -> { 72 | if (task.getName().equals(PUBLISH_ALL_PUBLICATIONS)) { 73 | TaskContainer tasks = project.getTasks(); 74 | TaskProvider taskPublishAar = tasks.register(ONE_KEY_PUBLISH_LOCAL_AAR, 75 | (publish) -> System.out.println("begin publish all local aar")); 76 | Task t = project.getTasks().getByName(PUBLISH_ALL_PUBLICATIONS); 77 | taskPublishAar.get().finalizedBy(t); 78 | } 79 | }); 80 | configLocalAarInternal(project, aarSettings); 81 | } 82 | 83 | private void configLocalAarInternal(Project project, AarSettings aarSettings) { 84 | if (StringUtil.isNullOrEmpty(aarSettings.aarDir)) { 85 | System.out.println("local aarDir not config"); 86 | return; 87 | } 88 | File file = new File(aarSettings.aarDir); 89 | if (!file.isDirectory()) { 90 | System.out.println("local aarDir is not a directory"); 91 | return; 92 | } 93 | File[] files = file.listFiles(); 94 | if (files == null || files.length <= 0) { 95 | System.out.println("local aarDir is empty"); 96 | return; 97 | } 98 | configLocalAarMavenPublication(project, aarSettings, files); 99 | } 100 | 101 | private void configLocalAarMavenPublication(Project project, 102 | AarSettings aarSettings, File[] files) { 103 | PublishingExtension publishingExt = project.getExtensions().getByType( 104 | PublishingExtension.class); 105 | 106 | String localAarMavenRepository = aarSettings.mavenUrl.toString(); 107 | 108 | boolean hasSpecifyMaven = !StringUtil.isNullOrEmpty(localAarMavenRepository); 109 | 110 | System.out.println("local aar maven path configs:" + localAarMavenRepository); 111 | 112 | if (hasSpecifyMaven) { 113 | //为每个subject配置maven仓库地址 114 | for (Project subproject : project.getSubprojects()) { 115 | subproject.getRepositories().maven(mp -> mp.setUrl(localAarMavenRepository)); 116 | } 117 | } 118 | HashMap aarMap = new HashMap<>(); 119 | project.getExtensions().add("aars", aarMap); 120 | publishingExt.getRepositories().maven(mp -> mp.setUrl(localAarMavenRepository)); 121 | PublicationContainer publications = publishingExt.getPublications(); 122 | for (File file : files) { 123 | if (!file.getName().endsWith(".aar")) { 124 | continue; 125 | } 126 | String publishName = StringUtil.getNormalizeName(file.getName()); 127 | publications.create(publishName, MavenPublication.class, publication -> { 128 | publication.artifact(file.getAbsolutePath()); 129 | System.out.println( 130 | "publish = " + aarSettings.getGroupId() + ":" + publishName 131 | + ":" + aarSettings.getVersion()); 132 | publication.setGroupId(aarSettings.getGroupId()); 133 | publication.setArtifactId(publishName); 134 | publication.setVersion(aarSettings.getVersion()); 135 | aarMap.put(file.getName(), 136 | StringUtil.getMavenPath(aarSettings.getGroupId(), publishName, 137 | aarSettings.getVersion())); 138 | }); 139 | } 140 | } 141 | 142 | private void initSubProject(Project project) { 143 | Set subProjects = project.getSubprojects(); 144 | project.getTasks().register(ONE_KEY_PUBLISH, OneKeyPublishTask.class); 145 | for (Project p : subProjects) { 146 | System.out.println(p.getName()); 147 | p.getPlugins().apply(ModuleManageInternalPlugin.class); 148 | } 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 41 | 42 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 97 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /module-manager/src/main/java/com/james/ModuleManageInternalPlugin.java: -------------------------------------------------------------------------------- 1 | package com.james; 2 | 3 | 4 | import static com.james.ModuleManagePlugin.ONE_KEY_PUBLISH; 5 | 6 | import com.james.exts.ModuleConfig; 7 | import com.james.exts.ModuleSettings; 8 | import com.james.tasks.TaskManager; 9 | import com.james.util.StringUtil; 10 | 11 | import org.codehaus.groovy.runtime.GStringImpl; 12 | import org.gradle.api.Plugin; 13 | import org.gradle.api.Project; 14 | import org.gradle.api.Task; 15 | import org.gradle.api.artifacts.Configuration; 16 | import org.gradle.api.artifacts.ConfigurationContainer; 17 | import org.gradle.api.artifacts.Dependency; 18 | import org.gradle.api.artifacts.DependencySet; 19 | import org.gradle.api.artifacts.DependencySubstitutions; 20 | import org.gradle.api.artifacts.ProjectDependency; 21 | import org.gradle.api.artifacts.dsl.RepositoryHandler; 22 | import org.gradle.api.artifacts.repositories.ArtifactRepository; 23 | import org.gradle.api.component.SoftwareComponent; 24 | import org.gradle.api.internal.artifacts.repositories.DefaultMavenArtifactRepository; 25 | import org.gradle.api.publish.PublicationContainer; 26 | import org.gradle.api.publish.PublishingExtension; 27 | import org.gradle.api.publish.maven.MavenPublication; 28 | import org.gradle.internal.impldep.org.eclipse.jgit.annotations.NonNull; 29 | 30 | import java.util.HashMap; 31 | import java.util.Map; 32 | import java.util.Set; 33 | 34 | /** 35 | * @author james 36 | * @date 2021/7/8 37 | */ 38 | public class ModuleManageInternalPlugin implements Plugin { 39 | private static final String PUBLISH_NAME = "module"; 40 | private static final String DEFAULT_COMPONENT = "release"; 41 | private static final String LIBRARY_PLUGIN_NAME = "com.android.library"; 42 | public static final String MAVEN_PUBLISH_PLUGIN_NAME = "maven-publish"; 43 | public static final String PUBLISH_ALL_PUBLICATIONS = "publishAllPublicationsToMavenRepository"; 44 | private static final String DEFAULT_PUBLISH_TASK = "publishToMavenLocal"; 45 | private static final String ASSEMBLE_TASK = "assembleRelease"; 46 | 47 | @Override 48 | public void apply(Project project) { 49 | System.out.println("ModuleManageInternalPlugin executed"); 50 | 51 | ModuleSettings moduleSettings = project.getRootProject().getExtensions().getByType( 52 | ModuleSettings.class); 53 | 54 | project.beforeEvaluate(p -> { 55 | configMavenRepositories(p, moduleSettings); 56 | p.getPluginManager().apply(MAVEN_PUBLISH_PLUGIN_NAME); 57 | }); 58 | 59 | project.afterEvaluate(p -> { 60 | configAutoPublishToMavenLocal(p, moduleSettings); 61 | configResolutionStrategy(p, moduleSettings); 62 | }); 63 | 64 | project.getGradle().projectsEvaluated(gradle -> configPublish(project, moduleSettings)); 65 | } 66 | 67 | /** 68 | * 配置maven仓库 69 | * 70 | * @param project project 71 | * @param moduleSettings moduleSettings 72 | */ 73 | private void configMavenRepositories(Project project, ModuleSettings moduleSettings) { 74 | String maven = getConfiguredMavenRepository(project, moduleSettings); 75 | if (!StringUtil.isNullOrEmpty(maven)) { 76 | project.getRepositories().maven(mp -> mp.setUrl(moduleSettings.mavenUrl)); 77 | } 78 | } 79 | 80 | /** 81 | * 获取当前project需要配置的maven仓库 82 | * 83 | * @param project project 84 | * @param moduleSettings moduleSettings 85 | * @return 仓库地址 86 | */ 87 | private String getConfiguredMavenRepository(@NonNull Project project, 88 | @NonNull ModuleSettings moduleSettings) { 89 | 90 | ModuleConfig moduleConfig = moduleSettings.getModuleConfigHashMap().get( 91 | StringUtil.getNormalizeName(project.getName())); 92 | 93 | if (null != moduleConfig && null != moduleConfig.mavenUrl) { 94 | return moduleConfig.mavenUrl.toString(); 95 | } 96 | 97 | if (!StringUtil.isNullOrEmpty(moduleSettings.mavenUrl)) { 98 | return moduleSettings.mavenUrl; 99 | } 100 | 101 | return null; 102 | } 103 | 104 | /** 105 | * 配置publish 106 | * 107 | * @param project project 108 | */ 109 | private void configPublish(Project project, ModuleSettings moduleSettings) { 110 | if (!project.getPluginManager().hasPlugin(LIBRARY_PLUGIN_NAME)) { 111 | return; 112 | } 113 | 114 | ModuleConfig moduleConfig = moduleSettings.getModuleConfigHashMap().get( 115 | StringUtil.getNormalizeName(project.getName())); 116 | if (moduleConfig == null) { 117 | return; 118 | } 119 | 120 | System.out.println(project.getName() + " begin configPublish"); 121 | 122 | moduleConfig.setProject(project); 123 | PublishingExtension publishingExt = project.getExtensions().getByType( 124 | PublishingExtension.class); 125 | 126 | String configuredMavenRepository = getConfiguredMavenRepository(project, moduleSettings); 127 | 128 | boolean hasSpecifyMaven = !StringUtil.isNullOrEmpty(configuredMavenRepository); 129 | 130 | System.out.println("hasSpecifyMaven:" + hasSpecifyMaven); 131 | 132 | if (hasSpecifyMaven) { 133 | publishingExt.getRepositories().maven(mp -> mp.setUrl(configuredMavenRepository)); 134 | } 135 | 136 | PublicationContainer publications = publishingExt.getPublications(); 137 | if (publications.findByName(PUBLISH_NAME) != null) { 138 | return; 139 | } 140 | publications.create(PUBLISH_NAME, MavenPublication.class, publication -> { 141 | SoftwareComponent release = project.getComponents().findByName(DEFAULT_COMPONENT); 142 | if (release == null) { 143 | System.out.println("can't find default component"); 144 | return; 145 | } 146 | 147 | publication.from(release); 148 | if (moduleConfig.androidJavaDoc) { 149 | System.out.println(project.getName() + "---1doc---" + project.getTasks().findByName( 150 | "androidJavadocJar")); 151 | publication.artifact(TaskManager.getAndroidJavadocJar(project)); 152 | } 153 | if (moduleConfig.androidJavaSource) { 154 | publication.artifact(TaskManager.getAndroidSourcesJar(project)); 155 | } 156 | System.out.println( 157 | "publish = " + moduleConfig.getGroupId() + ":" + moduleConfig.getArtifactId() 158 | + ":" + moduleConfig.getVersion()); 159 | publication.setGroupId(moduleConfig.getGroupId()); 160 | publication.setArtifactId(moduleConfig.getArtifactId()); 161 | publication.setVersion(moduleConfig.getVersion()); 162 | }); 163 | } 164 | 165 | /** 166 | * 自动发布脚本 167 | * 168 | * @param project project 169 | */ 170 | private void configAutoPublishToMavenLocal(Project project, ModuleSettings moduleSettings) { 171 | if (!project.getPluginManager().hasPlugin(LIBRARY_PLUGIN_NAME)) { 172 | return; 173 | } 174 | System.out.println(project.getName() + " begin configAutoPublish"); 175 | if (!StringUtil.isNullOrEmpty(moduleSettings.mavenUrl)) { 176 | publishToMavenRepository(project, moduleSettings); 177 | return; 178 | } 179 | project.getTasks().whenTaskAdded(task -> { 180 | if (task.getName().equals(ASSEMBLE_TASK)) { 181 | Task publishTask = project.getTasks().getByName(DEFAULT_PUBLISH_TASK); 182 | task.finalizedBy(publishTask); 183 | configOneKeyPublish(project, publishTask); 184 | } 185 | }); 186 | 187 | } 188 | 189 | /** 190 | * 配置一键发布 191 | * 192 | * @param project project 193 | */ 194 | private void configOneKeyPublish(Project project, Task publishTask) { 195 | System.out.println("config " + ONE_KEY_PUBLISH); 196 | Task oneKeyPublish = project.getRootProject().getTasks().getByName(ONE_KEY_PUBLISH); 197 | oneKeyPublish.dependsOn(project.getTasks().getByName(ASSEMBLE_TASK)); 198 | oneKeyPublish.mustRunAfter(publishTask); 199 | } 200 | 201 | /** 202 | * 发布到指定仓库 203 | * 204 | * @param project project 205 | */ 206 | private void publishToMavenRepository(Project project, ModuleSettings moduleSettings) { 207 | if (StringUtil.isNullOrEmpty(moduleSettings.mavenUrl)) { 208 | return; 209 | } 210 | System.out.println("config publishToMavenRepository"); 211 | char firstLetter = Character.toUpperCase(PUBLISH_NAME.charAt(0)); 212 | String theRest = PUBLISH_NAME.substring(1); 213 | String result = firstLetter + theRest; 214 | String taskName = "publish" + result + "PublicationToMavenRepository"; 215 | project.getTasks().whenTaskAdded(task -> { 216 | if (task.getName().equals(taskName)) { 217 | Task assembleTask = project.getTasks().getByName(ASSEMBLE_TASK); 218 | task.dependsOn(assembleTask); 219 | assembleTask.finalizedBy(task); 220 | configOneKeyPublish(project, task); 221 | } 222 | }); 223 | } 224 | 225 | /** 226 | * 配置替换规则 227 | * 228 | * @param project project 229 | * @param moduleSettings moduleSettings 230 | */ 231 | private void configResolutionStrategy(Project project, ModuleSettings moduleSettings) { 232 | System.out.println("configResolutionStrategy"); 233 | Map resolutions = getResolutions(project, moduleSettings); 234 | if (resolutions.isEmpty()) { 235 | return; 236 | } 237 | project.getConfigurations().all(configuration -> { 238 | Set> entries = resolutions.entrySet(); 239 | for (Map.Entry entry : entries) { 240 | configuration.resolutionStrategy( 241 | resolutionStrategy -> resolutionStrategy.dependencySubstitution( 242 | dependencySubstitutions -> { 243 | DependencySubstitutions.Substitution substitute = 244 | dependencySubstitutions.substitute( 245 | dependencySubstitutions.project( 246 | entry.getKey())); 247 | substitute.with( 248 | dependencySubstitutions.module(entry.getValue())); 249 | })); 250 | } 251 | }); 252 | } 253 | 254 | /** 255 | * 获取替换对象集合 256 | * 257 | * @param project project 258 | * @param moduleSettings moduleSettings 259 | * @return 替换对象集合 260 | */ 261 | private Map getResolutions(Project project, ModuleSettings moduleSettings) { 262 | HashMap resolutionHashMap = new HashMap<>(); 263 | ConfigurationContainer configurations = project.getConfigurations(); 264 | for (Configuration configuration : configurations) { 265 | DependencySet allDependencies = configuration.getAllDependencies(); 266 | for (Dependency dependency : allDependencies) { 267 | if (!(dependency instanceof ProjectDependency)) { 268 | continue; 269 | } 270 | String normalizeName = StringUtil.getNormalizeName(dependency.getName()); 271 | ModuleConfig moduleConfig = moduleSettings.getModuleConfigHashMap().get( 272 | normalizeName); 273 | if (null == moduleConfig) { 274 | continue; 275 | } 276 | 277 | GStringImpl ml = moduleConfig.mavenUrl; 278 | String mavenUrl = ml == null ? "" : ml.toString(); 279 | 280 | if (!StringUtil.isNullOrEmpty(mavenUrl)) { 281 | mavenIfItNotExist(project, mavenUrl); 282 | } 283 | 284 | if (!moduleConfig.useByAar) { 285 | continue; 286 | } 287 | resolutionHashMap.put(":" + dependency.getName(), moduleConfig.getPath()); 288 | } 289 | } 290 | return resolutionHashMap; 291 | } 292 | 293 | /** 294 | * 如果当前project不包含该maven仓库,则添加该maven仓库 295 | * 296 | * @param project project 297 | * @param mavenUrl mavenUrl 298 | */ 299 | private void mavenIfItNotExist(@NonNull Project project, @NonNull String mavenUrl) { 300 | if (StringUtil.isNullOrEmpty(mavenUrl)) { 301 | return; 302 | } 303 | //防止重复添加 304 | RepositoryHandler repositories = project.getRepositories(); 305 | for (ArtifactRepository artifactRepository : repositories) { 306 | if (artifactRepository instanceof DefaultMavenArtifactRepository) { 307 | 308 | DefaultMavenArtifactRepository defaultMavenArtifactRepository = 309 | (DefaultMavenArtifactRepository) artifactRepository; 310 | String url = defaultMavenArtifactRepository.getUrl().getRawPath(); 311 | 312 | if (getTempFormatRawPath(url).equals(getTempFormatRawPath(mavenUrl))) { 313 | return; 314 | } 315 | } 316 | } 317 | project.getRepositories().maven(mp -> mp.setUrl(mavenUrl)); 318 | } 319 | 320 | private String getTempFormatRawPath(String url) { 321 | if (StringUtil.isNullOrEmpty(url)) { 322 | return url; 323 | } 324 | String temp = url; 325 | temp = temp.replaceAll("\\\\", ""); 326 | temp = temp.replaceAll("/", ""); 327 | return temp; 328 | } 329 | 330 | } 331 | --------------------------------------------------------------------------------