Skip to content

Commit 5bdea2a

Browse files
Item 7295: Publish and version API artifacts independently (#3)
1 parent 40068d6 commit 5bdea2a

File tree

189 files changed

+615
-88
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+615
-88
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# LabKey Server Java and SAS API
2+
3+
This repository contains the source for the Java and SAS API artifacts for LabKey Server.
4+
5+
If you are doing development in this repository in conjunction with the overall LabKey Server Gradle project,
6+
you should clone this repository into the `$LABKEY_ROOT/remoteapi` directory.
7+
8+
See the individual packages' documentation for more information.
9+
10+
| Package | | | |
11+
| --- | --- | --- | --- |
12+
| java | [README](labkey-client-api/README.md) | [Change log](labkey-client-api/CHANGELOG.md) | [labkey.org docs](https://www.labkey.org/Documentation/wiki-page.view?name=javaAPI)
13+
| sas | [README](labkey-api-sas/README.md) | [Change log](labkey-api-sas/CHANGELOG.md) | [docs](https://www.labkey.org/Documentation/wiki-page.view?name=sasAPI)

java/README.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

labkey-api-sas/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# The LabKey Remote API Library for SAS - Change Log
2+
3+
## version 1.0.0
4+
*Released* : TBD
5+
6+
* Initial publication using [SemVer](https://semver.org/) for library versioning.
7+
With 1.0.0, we will move away from using the LabKey server version
8+
and adopt the standard used in our other API libraries.
9+
Version 1.0.0 will be published as `org.labkey.api:labkey-api-sas:1.0.0`.
10+

labkey-api-sas/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# The LabKey Remote API Library for SAS
2+
3+
Library of macros for use in accessing LabKey Server via SAS.
4+
5+
For more information on the library, including setup instructions and
6+
examples, see our [SAS API](https://www.labkey.org/Documentation/wiki-page.view?name=sasAPI)
7+
documentation.
8+
9+
This library is licensed under the [Apache 2.0 open-source license](http://www.apache.org/licenses/LICENSE-2.0).
10+
11+
See the [change log](CHANGELOG.md) for information on the released versions.
12+
13+
### Publishing
14+
15+
For publishing a new version of this library, follow the same pattern as outlined
16+
in our [internal documentation](https://internal.labkey.com/Handbook/Dev/wiki-page.view?name=mavenArtifacts)
17+
for publishing a new version of the java API client library, skipping the
18+
part about publishing to Maven Central.

labkey-api-sas/build.gradle

Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
import org.labkey.gradle.util.BuildUtils
2+
import org.labkey.gradle.util.GroupNames
3+
import org.labkey.gradle.util.PomFileHelper
4+
import org.labkey.gradle.plugin.extension.TeamCityExtension
5+
6+
buildscript {
7+
repositories {
8+
jcenter()
9+
maven {
10+
url "${artifactory_contextUrl}/plugins-release"
11+
}
12+
if (gradlePluginsVersion.contains("SNAPSHOT"))
13+
{
14+
maven {
15+
url "${artifactory_contextUrl}/plugins-snapshot-local"
16+
}
17+
}
18+
}
19+
dependencies {
20+
classpath "org.labkey.build:gradlePlugins:${gradlePluginsVersion}"
21+
// N.B. We use the "old-fashioned" way of applying the artifactory plugin because if we use
22+
// the plugins block below and specify a version number, the following error happens if building
23+
// in conjunction with LabKey server (i.e., when including this project in the server's build.gradle
24+
// Error resolving plugin [id: 'com.jfrog.artifactory', version: '4.13.0', apply: false]
25+
// > Plugin request for plugin already on the classpath must not include a version
26+
// We could instead include the plugin without a version number, which would work until
27+
// some change in the latest version of the plugin came along that we aren't compatible with.
28+
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:${artifactoryPluginVersion}"
29+
}
30+
}
31+
32+
plugins {
33+
id 'java'
34+
id 'maven-publish'
35+
}
36+
37+
repositories {
38+
maven {
39+
url "${artifactory_contextUrl}/libs-release"
40+
41+
if (hasProperty('artifactory_user') && hasProperty('artifactory_password'))
42+
{
43+
credentials {
44+
username = artifactory_user
45+
password = artifactory_password
46+
}
47+
authentication {
48+
basic(BasicAuthentication)
49+
// enable preemptive authentication to get around https://www.jfrog.com/jira/browse/RTFACT-4434
50+
}
51+
}
52+
}
53+
}
54+
55+
// TODO remove once client-api distribution no longer requires this
56+
buildDir = new File(project.rootProject.buildDir, "/remoteapi/sas")
57+
58+
group 'org.labkey.api'
59+
60+
version '1.0.0-SNAPSHOT'
61+
62+
// We add the TeamCity extension here if it doesn't exist because we will use the build
63+
// number property from TeamCity in the distribution artifact names, if present.
64+
TeamCityExtension teamCityExt = project.getExtensions().findByType(TeamCityExtension.class)
65+
if (TeamCityExtension.isOnTeamCity(project) && teamCityExt == null)
66+
project.extensions.create("teamCity", TeamCityExtension, project)
67+
68+
configurations {
69+
remoteApi
70+
}
71+
72+
BuildUtils.addLabKeyDependency(project: project, config: "remoteApi", depProjectPath: BuildUtils.getRemoteApiProjectPath(gradle), depVersion: project.labkeyClientApiVersion)
73+
74+
// TODO change name and destination once client-api no longer requires this
75+
project.task("distribution",
76+
group: GroupNames.DISTRIBUTION,
77+
description: "Create a zip file for the SAS API client distribution containing the SAS macros, java client api jar and its dependencies",
78+
type: Zip,
79+
{Zip zip ->
80+
zip.from (project.file("macros"))
81+
zip.from project.configurations.remoteApi
82+
zip.into zip.archiveBaseName
83+
zip.destinationDirectory = project.rootProject.file("dist/client-api/sas")
84+
}
85+
)
86+
87+
artifacts {
88+
archives project.tasks.distribution
89+
}
90+
91+
project.afterEvaluate {
92+
project.publishing {
93+
publications {
94+
libs(MavenPublication) {
95+
groupId = project.group
96+
artifact project.tasks.distribution
97+
pom {
98+
name = "LabKey Server SAS Client API"
99+
description = "Library of macros for use in accessing LabKey Server via SAS"
100+
url = PomFileHelper.LABKEY_ORG_URL
101+
developers PomFileHelper.getLabKeyTeamDevelopers()
102+
licenses PomFileHelper.getApacheLicense()
103+
organization PomFileHelper.getLabKeyOrganization()
104+
scm {
105+
connection = 'scm:git:https://github.com/LabKey/labkey-api-java/sas'
106+
developerConnection = 'scm:git:https://github.com/LabKey/labkey-api-java/sas'
107+
url = 'scm:git:https://github.com/LabKey/labkey-api-java/sas'
108+
}
109+
}
110+
}
111+
}
112+
113+
if (project.hasProperty('doClientApiPublishing'))
114+
{
115+
apply plugin: 'com.jfrog.artifactory'
116+
artifactory {
117+
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
118+
publish {
119+
repository {
120+
repoKey = BuildUtils.getRepositoryKey(project)
121+
if (project.hasProperty('artifactory_user') && project.hasProperty('artifactory_password'))
122+
{
123+
username = artifactory_user
124+
password = artifactory_password
125+
}
126+
maven = true
127+
}
128+
defaults
129+
{
130+
publishPom = true
131+
publishIvy = false
132+
}
133+
}
134+
}
135+
136+
project.artifactoryPublish {
137+
publications('libs')
138+
}
139+
}
140+
}
141+
project.model {
142+
tasks.publishLibsPublicationToMavenLocal {
143+
enabled = false
144+
}
145+
}
146+
}
File renamed without changes.

labkey-api-sas/gradle.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# the URL for the artifact repository where our build plugins are housed
2+
# as well as the build artifacts. (Be careful not to include a trailing slash
3+
# in the context URL or you will get a 500 error from artifactory.)
4+
artifactory_contextUrl=https://artifactory.labkey.com/artifactory
5+
6+
artifactoryPluginVersion=4.13.0
7+
gradlePluginsVersion=1.12.0
8+
labkeyClientApiVersion=1.2.0

0 commit comments

Comments
 (0)