private void configureBintray(Project project) { project.afterEvaluate(o -> { BintrayExtension bintray = project.getExtensions().getByType(BintrayExtension.class); BintrayExtension.PackageConfig packageConfig = bintray.getPkg(); packageConfig.setUserOrg(""); packageConfig.setLabels(""); packageConfig.setPublicDownloadNumbers(false); packageConfig.setRepo(project.getGroup().toString()); packageConfig.getVersion().setName(project.getVersion().toString()); packageConfig.getVersion().setVcsTag(project.getVersion().toString()); packageConfig.setLicenses("Apache-2.0"); project.getLogger().lifecycle("Bintray configuration updated; repo={},version={}", packageConfig.getRepo(), packageConfig.getVersion().getName()); }); }
pkg.setPublicDownloadNumbers(true); pkg.getVersion().getGpg().setSign(true);
pkg.setPublicDownloadNumbers(true); pkg.getVersion().getGpg().setSign(true); if (pkg.getDesc() == null) { pkg.setDesc(project.getDescription()); if (pkg.getName() == null) { pkg.setName(project.getGroup().toString()); if (pkg.getVersion().getVcsTag() == null) { pkg.getVersion().setVcsTag(conf.getGit().getTagPrefix() + project.getVersion()); if (pkg.getWebsiteUrl() == null) { pkg.setWebsiteUrl(conf.getGitHub().getUrl() + "/" + conf.getGitHub().getRepository()); if (pkg.getIssueTrackerUrl() == null) { pkg.setIssueTrackerUrl(conf.getGitHub().getUrl() + "/" + conf.getGitHub().getRepository() + "/issues"); if (pkg.getVcsUrl() == null) { pkg.setVcsUrl(conf.getGitHub().getUrl() + "/" + conf.getGitHub().getRepository() + ".git");
pkg.setPublicDownloadNumbers(true); pkg.getVersion().getGpg().setSign(true); if (pkg.getDesc() == null) { pkg.setDesc(project.getDescription()); if (pkg.getName() == null) { pkg.setName(project.getGroup().toString()); if (pkg.getVersion().getVcsTag() == null) { pkg.getVersion().setVcsTag(conf.getGit().getTagPrefix() + project.getVersion()); if (pkg.getWebsiteUrl() == null) { pkg.setWebsiteUrl(conf.getGitHub().getUrl() + "/" + conf.getGitHub().getRepository()); if (pkg.getIssueTrackerUrl() == null) { pkg.setIssueTrackerUrl(conf.getGitHub().getUrl() + "/" + conf.getGitHub().getRepository() + "/issues"); if (pkg.getVcsUrl() == null) { pkg.setVcsUrl(conf.getGitHub().getUrl() + "/" + conf.getGitHub().getRepository() + ".git");
/** * Configure the Bintray plugin * * <ul> * <li>Set Bintray user and password from Gradle properties file or environment * <li>Configure the Bintray package * </ul> * * @param bintray Bintray plugin's configuration * @param projectConfig Project configuration * @param bintrayConfig Bintray configuration * @param project Project context */ @Defaults public void configureBintrayExtension(BintrayExtension bintray, ProjectConfig projectConfig, BintrayConfig bintrayConfig, ProjectContext project) { bintray.setUser(project.getProperty("bintray.user")); bintray.setKey(project.getProperty("bintray.key")); PackageConfig pkg = bintray.getPkg(); pkg.setName(project.getName()); pkg.setDesc(project.getDescription()); pkg.setRepo(bintrayConfig.getRepository()); pkg.setVcsUrl(projectConfig.getRepository().getConnection()); pkg.setWebsiteUrl(projectConfig.getWebsiteUrl()); pkg.setIssueTrackerUrl(projectConfig.getIssueTracker().getWebsiteUrl()); pkg.setLicenses(projectConfig.getLicense().getId()); VersionConfig version = pkg.getVersion(); version.setName(project.getVersion().toString()); version.setVcsTag(project.getName() + "-" + project.getVersion()); }
/** * Configure the Bintray plugin * * <ul> * <li>Set Bintray user and password from Gradle properties file or environment * <li>Configure the Bintray package * </ul> * * @param bintray Bintray plugin's configuration * @param projectConfig Project configuration * @param bintrayConfig Bintray configuration * @param project Project context */ @Defaults public void configureBintrayExtension(BintrayExtension bintray, ProjectConfig projectConfig, BintrayConfig bintrayConfig, ProjectContext project) { bintray.setUser(project.getProperty("bintray.user")); bintray.setKey(project.getProperty("bintray.key")); PackageConfig pkg = bintray.getPkg(); pkg.setName(project.getName()); pkg.setDesc(project.getDescription()); pkg.setRepo(bintrayConfig.getRepository()); pkg.setVcsUrl(projectConfig.getRepository().getConnection()); pkg.setWebsiteUrl(projectConfig.getWebsiteUrl()); pkg.setIssueTrackerUrl(projectConfig.getIssueTracker().getWebsiteUrl()); pkg.setLicenses(projectConfig.getLicense().getId()); VersionConfig version = pkg.getVersion(); version.setName(project.getVersion().toString()); version.setVcsTag(project.getName() + "-" + project.getVersion()); }
/** * @return URL of artifact in Bintray, eg: * "https://bintray.com/shipkit/examples/download_file?file_path=org/mockito/release-tools-example/api/0.15.0/api-0.15.0.jar" */ @Override public String getDefaultUrl(String extension) { BintrayExtension bintrayExtension = project.getExtensions().getByType(BintrayExtension.class); String userOrgOrName = bintrayExtension.getPkg().getUserOrg(); if (userOrgOrName == null) { userOrgOrName = bintrayExtension.getUser(); } return String.format("https://bintray.com/%s/%s/download_file?file_path=%s/%s/%s/%s-%s%s", userOrgOrName, bintrayExtension.getPkg().getRepo(), project.getGroup().toString().replace('.', '/'), artifactBaseName, previousVersion, artifactBaseName, previousVersion, extension); } }
/** * @return URL of artifact in Bintray, eg: * "https://bintray.com/shipkit/examples/download_file?file_path=org/mockito/release-tools-example/api/0.15.0/api-0.15.0.jar" */ @Override public String getDefaultUrl(String extension) { BintrayExtension bintrayExtension = project.getExtensions().getByType(BintrayExtension.class); String userOrgOrName = bintrayExtension.getPkg().getUserOrg(); if (userOrgOrName == null) { userOrgOrName = bintrayExtension.getUser(); } return String.format("https://bintray.com/%s/%s/download_file?file_path=%s/%s/%s/%s-%s%s", userOrgOrName, bintrayExtension.getPkg().getRepo(), project.getGroup().toString().replace('.', '/'), artifactBaseName, previousVersion, artifactBaseName, previousVersion, extension); } }
/** * @return URL of artifact in Bintray, eg: * "https://bintray.com/shipkit/examples/download_file?file_path=org/mockito/release-tools-example/api/0.15.0/api-0.15.0.jar" */ @Override public String getDefaultUrl(String extension) { BintrayExtension bintrayExtension = project.getExtensions().getByType(BintrayExtension.class); return String.format("https://bintray.com/%s/%s/download_file?file_path=%s/%s/%s/%s-%s%s", bintrayExtension.getPkg().getUserOrg(), bintrayExtension.getPkg().getRepo(), project.getGroup().toString().replace('.', '/'), artifactBaseName, previousVersion, artifactBaseName, previousVersion, extension); } }
public void run() { //Below overwrites prior value in case the user configured dry run directly on the bintray extension. //It should be ok. bintray.setDryRun(conf.isDryRun()); if (pkg.getDesc() == null) { pkg.setDesc(project.getDescription()); } if (pkg.getVersion().getVcsTag() == null) { pkg.getVersion().setVcsTag("v" + project.getVersion()); } if (pkg.getWebsiteUrl() == null) { pkg.setWebsiteUrl(conf.getGitHub().getUrl() + "/" + conf.getGitHub().getRepository()); } if (pkg.getIssueTrackerUrl() == null) { pkg.setIssueTrackerUrl(conf.getGitHub().getUrl() + "/" + conf.getGitHub().getRepository() + "/issues"); } if (pkg.getVcsUrl() == null) { pkg.setVcsUrl(conf.getGitHub().getUrl() + "/" + conf.getGitHub().getRepository() + ".git"); } } });
/** * Constructs link to bintray repository. * * @param bintray * @return repository link */ public static String getRepoLink(BintrayExtension bintray) { String repo = bintray.getPkg().getRepo(); String pkg = bintray.getPkg().getName(); String org = bintray.getPkg().getUserOrg(); if (org == null) { org = bintray.getUser(); } return MessageFormat.format("https://bintray.com/{0}/{1}/{2}/", org, repo, pkg); } }
/** * Constructs link to bintray repository. * * @param bintray * @return repository link */ public static String getRepoLink(BintrayExtension bintray) { String repo = bintray.getPkg().getRepo(); String pkg = bintray.getPkg().getName(); String org = bintray.getPkg().getUserOrg(); if (org == null) { org = bintray.getUser(); } return MessageFormat.format("https://bintray.com/{0}/{1}/{2}", org, repo, pkg); } }
/** * Constructs link to bintray repository. * * @param bintray * @return repository link */ public static String getRepoLink(BintrayExtension bintray) { String repo = bintray.getPkg().getRepo(); String pkg = bintray.getPkg().getName(); String org = bintray.getPkg().getUserOrg(); if (org == null) { org = bintray.getUser(); } return MessageFormat.format("https://bintray.com/{0}/{1}/{2}/", org, repo, pkg); } }