package org.minimallycorrect.gradle;

import org.gradle.api.Project;

import com.jfrog.bintray.gradle.BintrayExtension;
import com.jfrog.bintray.gradle.BintrayPlugin;

public class BintrayExtensions {
	public static void applyBintray(DefaultsPluginExtension settings, Project project) {
		project.allprojects(it -> {
			it.getPlugins().apply(BintrayPlugin.class);
			it.getExtensions().configure(BintrayExtension.class, (bintray) -> {
				bintray.setUser(System.getenv("BINTRAY_USER"));
				bintray.setKey(System.getenv("BINTRAY_KEY"));
				var pkg = bintray.getPkg();
				pkg.setName(project.getName());
				pkg.setRepo("minimallycorrectmaven");
				pkg.setUserOrg("minimallycorrect");
				pkg.setVcsUrl(DefaultsPlugin.getVcsUrl(settings));
				pkg.setGithubReleaseNotesFile(DefaultsPlugin.RELEASE_NOTES_PATH);
				pkg.setWebsiteUrl(DefaultsPlugin.getWebsiteUrl(settings));
				if (settings.licenses == null)
					throw new IllegalArgumentException("Must set settings.licenses when shipkit is enabled");
				pkg.setLicenses(settings.licenses);
				if (settings.labels == null)
					throw new IllegalArgumentException("Must set labels when shipkit is enabled");
				pkg.setLabels(settings.labels);
				if (settings.description == null)
					throw new IllegalArgumentException("Must set description when shipkit is enabled");
				pkg.setDesc(settings.description);
				var githubRepo = DefaultsPlugin.getGithubRepo(settings);
				pkg.setGithubRepo(githubRepo);
				pkg.setIssueTrackerUrl("https://github.com/" + githubRepo + "/issues");
				pkg.getVersion().setName(project.getVersion().toString());
				pkg.getVersion().setVcsTag("v" + project.getVersion());
			});
		});
	}
}

@@ -428,16 +428,46 @@
 y) -%3E %7B%0A
+%09%09%09%09bintray.setPublish(true);%0A
 %09%09%09%09bint
@@ -1002,31 +1002,31 @@
 censes when 
-shipkit
+bintray
  is enabled%22
@@ -1159,31 +1159,31 @@
 labels when 
-shipkit
+bintray
  is enabled%22
@@ -1330,15 +1330,15 @@
 hen 
-shipkit
+bintray
  is 

Set publish true on bintray