@@ -2,10 +2,56 @@ import org.labkey.gradle.plugin.LabKey
22import org.labkey.gradle.util.BuildUtils
33import org.labkey.gradle.util.GroupNames
44
5+ buildscript {
6+ repositories {
7+ jcenter()
8+ maven {
9+ url " ${ artifactory_contextUrl} /plugins-release"
10+ }
11+ if (gradlePluginsVersion. contains(" SNAPSHOT" ))
12+ {
13+ maven {
14+ url " ${ artifactory_contextUrl} /plugins-snapshot-local"
15+ }
16+ }
17+ }
18+ dependencies {
19+ classpath " org.labkey.build:gradlePlugins:${ gradlePluginsVersion} "
20+ // N.B. We use the "old-fashioned" way of applying the artifactory plugin because if we use
21+ // the plugins block below and specify a version number, the following error happens if building
22+ // in conjunction with LabKey server (i.e., when including this project in the server's build.gradle
23+ // Error resolving plugin [id: 'com.jfrog.artifactory', version: '4.13.0', apply: false]
24+ // > Plugin request for plugin already on the classpath must not include a version
25+ // We could instead include the plugin without a version number, which would work until
26+ // some change in the latest version of the plugin came along that we aren't compatible with.
27+ classpath " org.jfrog.buildinfo:build-info-extractor-gradle:${ artifactoryPluginVersion} "
28+ }
29+ }
30+
531plugins {
632 id ' java-library'
733 id ' java'
834 id ' maven-publish'
35+ id " com.jfrog.bintray" version " ${ bintrayPluginVersion} " apply false
36+ }
37+
38+ repositories {
39+ jcenter()
40+ maven {
41+ url " ${ artifactory_contextUrl} /libs-release"
42+
43+ if (hasProperty(' artifactory_user' ) && hasProperty(' artifactory_password' ))
44+ {
45+ credentials {
46+ username = artifactory_user
47+ password = artifactory_password
48+ }
49+ authentication {
50+ basic(BasicAuthentication )
51+ // enable preemptive authentication to get around https://www.jfrog.com/jira/browse/RTFACT-4434
52+ }
53+ }
54+ }
955}
1056
1157buildDir = new File (project. rootProject. buildDir, " /remoteapi/java" )
@@ -14,7 +60,7 @@ def artifactPrefix = 'labkey-client-api'
1460
1561group " org.labkey.api"
1662// Issue #39336 (comment 4): Updating to use SNAPSHOT until migration to git
17- version " 1.1.1 -SNAPSHOT"
63+ version " 1.2.0 -SNAPSHOT"
1864
1965dependencies {
2066 api " org.apache.httpcomponents:httpmime:${ httpmimeVersion} "
@@ -165,24 +211,39 @@ project.afterEvaluate {
165211 }
166212 }
167213
168- // Comment this out for now as we don't need to publish snapshot versions of the remoteapi jar file all the time since
169- // we are referencing the release version in our builds and this code changes infrequently. Without a modification
170- // to this file. this publishing fails when the LabKey version is a release version because the repository set for
171- // publishing is a release repository, but the version set in this file will be a SNAPSHOT version. Could probalby be fixed
172- // with some configuration work, but it will be easier once this is moved to its own git repository.
173- // if (BuildUtils.shouldPublish(project))
174- // {
175- // project.artifactoryPublish {
176- // project.tasks.each {
177- // if (it instanceof Jar)
178- // {
179- // dependsOn it
180- // }
181- // }
182- // // dependsOn pomFileTask
183- // publications('libs')
184- // }
185- // }
214+ if (project. hasProperty(' doClientApiPublishing' ))
215+ {
216+ apply plugin : ' com.jfrog.artifactory'
217+ artifactory {
218+ contextUrl = " ${ artifactory_contextUrl} " // The base Artifactory URL if not overridden by the publisher/resolver
219+ publish {
220+ repository {
221+ repoKey = BuildUtils . getRepositoryKey(project)
222+ if (project. hasProperty(' artifactory_user' ) && project. hasProperty(' artifactory_password' ))
223+ {
224+ username = artifactory_user
225+ password = artifactory_password
226+ }
227+ maven = true
228+ }
229+ defaults
230+ {
231+ publishPom = true
232+ publishIvy = false
233+ }
234+ }
235+ }
236+
237+ project. artifactoryPublish {
238+ project. tasks. each {
239+ if (it instanceof Jar )
240+ {
241+ dependsOn it
242+ }
243+ }
244+ publications(' libs' )
245+ }
246+ }
186247
187248 }
188249 project. model {
0 commit comments