@@ -15,6 +15,7 @@ import java.util.function.Function
1515class LibraryHelper {
1616 private final List<String > resolvedLibraries = new ArrayList<> ()
1717 private Project project
18+ private List<String > addedLibraries = new ArrayList<> ();
1819 /**
1920 * 收集依赖用的配置
2021 */
@@ -47,6 +48,7 @@ class LibraryHelper {
4748 }
4849
4950 void library (String dependencyNotation ) {
51+ addedLibraries. add(dependencyNotation)
5052 def dependencies = project. getDependencies()
5153 dependencies. add(configuration. getName(), dependencyNotation)
5254 if (targetConfiguration != null ) {
@@ -55,6 +57,7 @@ class LibraryHelper {
5557 }
5658
5759 void library (String dependencyNotation , Consumer<ExternalModuleDependency > consumer ) {
60+ addedLibraries. add(dependencyNotation)
5861 def dependencies = project. getDependencies()
5962 dependencies. add(configuration. getName(), dependencyNotation, toClosure(consumer))
6063 if (targetConfiguration != null ) {
@@ -183,4 +186,17 @@ class LibraryHelper {
183186 resolvedLibraries. addAll(collectLibraries(collector))
184187 return resolvedLibraries
185188 }
189+
190+ List<String > getAddedLibraries () {
191+ return Collections . unmodifiableList(addedLibraries)
192+ }
193+
194+ List<String > getAddedLibrariesYAML () {
195+ List<String > list = new ArrayList<> ();
196+ list. add(" libraries:" )
197+ for (final def lib in addedLibraries) {
198+ list. add(" - \" " + lib + " \" " )
199+ }
200+ return list
201+ }
186202}
0 commit comments