/**
 * This project generates a maven bill of materials (BOM) that includes the deprecated modules, alongside the main project.
 */
version = rootProject.version

publishing {
	publications {
		mavenJava(MavenPublication) {
			artifactId = 'fabric-api-deprecated'

			List<Map<String, String>> dependencies = []

			allprojects.each {
				if (it.name == "deprecated") {
					return // Dont depend on yourself :)
				}

				// Depend on all of the deprecated projects
				if (!it.path.startsWith(":deprecated")) {
					return
				}

				dependencies.add([
					'groupId': it.group,
					'artifactId': it.name,
					'version': getSubprojectVersion(it),
					'scope': 'compile'
				])
			}

			def thisGroup = group
			def thisVersion = version

			pom.withXml {
				def depsNode = asNode().appendNode("dependencies")
				for (dep in dependencies) {
					def depNode = depsNode.appendNode("dependency")
					depNode.appendNode("groupId", dep['groupId'])
					depNode.appendNode("artifactId", dep['artifactId'])
					depNode.appendNode("version", dep['version'])
					depNode.appendNode("scope", dep['scope'])
				}
			}
		}
	}
}
