Source:
<code>public void apply(final Project project) { project.getPlugins().apply(BasePublishPlugin.class); final BintrayCredentials credentials = project.getExtensions().getByType(BintrayCredentials.class); final Callable<File> repoDir = () -> project.getRootProject().getLayout().getBuildDirectory().dir("repo").get().getAsFile(); project.getExtensions().configure(PublishingExtension.class, extension -> { extension.getRepositories().maven(new ErroringAction<MavenArtifactRepository>() { @Override public void doExecute(MavenArtifactRepository repo) throws Exception { repo.setUrl(repoDir.call()); } }); extension.getPublications().withType(MavenPublication.class, publication -> { String capitalizedPublicationName = BasePublishPlugin.capitalize(publication.getName()); UpdatePackageMetadataTask update = project.getTasks().create("updatePackage" + capitalizedPublicationName, UpdatePackageMetadataTask.class); update.setPublication(publication); UploadTask upload = project.getTasks().create("uploadPackage" + capitalizedPublicationName, UploadTask.class); upload.setGroup("Upload"); upload.setDescription("Upload publication " + publication.getName()); upload.setLocalRepoDir(repoDir); upload.setPublication(publication); upload.dependsOn(update); if (!BasePublishPlugin.isMainPublication(publication)) { <START> Task uploadLifecycle = project.getTasks().maybeCreate("uploadJni"); <END> uploadLifecycle.setGroup("Upload"); uploadLifecycle.setDescription("Upload all JNI publications"); uploadLifecycle.dependsOn(upload); } }); }); project.getGradle().getTaskGraph().whenReady(graph -> { for (Task task : graph.getAllTasks()) { if (task instanceof BintrayTask) { credentials.assertPresent(); BintrayTask bintrayTask = (BintrayTask) task; bintrayTask.setUserName(credentials.getUserName()); bintrayTask.setApiKey(credentials.getApiKey()); } } }); }</code><technical_language>give uploadJni publishJni more descriptive names. For a while I notice different. Alternatively, original intent for this task, a single task called publishJni role is publish JNI libraries correct repository for kind of output build is producing. is, publishes JNI libraries snapshot repo if building a snapshot, bintray if building a release. good a similar lifecycle task for main publications too</technical_language>

Target:
public void apply(final Project project) { project.getPlugins().apply(BasePublishPlugin.class); final BintrayCredentials credentials = project.getExtensions().getByType(BintrayCredentials.class); final Callable<File> repoDir = () -> project.getRootProject().getLayout().getBuildDirectory().dir("repo").get().getAsFile(); project.getExtensions().configure(PublishingExtension.class, extension -> { extension.getRepositories().maven(new ErroringAction<MavenArtifactRepository>() { @Override public void doExecute(MavenArtifactRepository repo) throws Exception { repo.setUrl(repoDir.call()); } }); extension.getPublications().withType(MavenPublication.class, publication -> { String capitalizedPublicationName = BasePublishPlugin.capitalize(publication.getName()); UpdatePackageMetadataTask update = project.getTasks().create("updatePackage" + capitalizedPublicationName, UpdatePackageMetadataTask.class); update.setPublication(publication); UploadTask upload = project.getTasks().create(uploadTaskName(publication), UploadTask.class); upload.setGroup("Upload"); upload.setDescription("Upload publication " + publication.getName()); upload.setLocalRepoDir(repoDir); upload.setPublication(publication); upload.dependsOn(update); }); }); project.getGradle().getTaskGraph().whenReady(graph -> { for (Task task : graph.getAllTasks()) { if (task instanceof BintrayTask) { credentials.assertPresent(); BintrayTask bintrayTask = (BintrayTask) task; bintrayTask.setUserName(credentials.getUserName()); bintrayTask.setApiKey(credentials.getApiKey()); } } }); }