Skip to content

Commit 1f39a70

Browse files
committed
Build tools, readme update
1 parent 2b6bd7c commit 1f39a70

File tree

13 files changed

+472
-298
lines changed

13 files changed

+472
-298
lines changed

.github/workflows/publish.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@ jobs:
1717
- name: Extract version
1818
id: extract_version
1919
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
20-
- name: Build and publish Core, Client, and PubSub modules
20+
- name: Build and publish all modules
2121
run: |
22-
chmod +x ./gradlew
23-
./gradlew publishAllPublicationsToSonatypeRepository -PreleaseVersion=${{ env.VERSION }}
22+
bash publish_to_repsy.sh ${{ env.VERSION }}
2423
env:
25-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
26-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
27-
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
28-
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
24+
REPSY_USERNAME: ${{ secrets.REPSY_USERNAME }}
25+
REPSY_PASSWORD: ${{ secrets.REPSY_PASSWORD }}

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,73 @@
11
# fastcomments-java
22
The FastComments Java SDK. You can use this to build secure and scalable backend applications that interact with FastComments, or build reactive client applications.
33

4+
## Installation
5+
6+
### Maven
7+
8+
Add the Repsy repository to your project's POM:
9+
10+
```xml
11+
<repositories>
12+
<repository>
13+
<id>repsy</id>
14+
<name>FastComments Maven Repository on Repsy</name>
15+
<url>https://repo.repsy.io/mvn/winrid/fastcomments</url>
16+
</repository>
17+
</repositories>
18+
```
19+
20+
Then add the dependencies you need:
21+
22+
```xml
23+
<dependencies>
24+
<!-- API Client -->
25+
<dependency>
26+
<groupId>com.fastcomments</groupId>
27+
<artifactId>client</artifactId>
28+
<version>0.0.1</version>
29+
</dependency>
30+
31+
<!-- Core Library (includes SSO) -->
32+
<dependency>
33+
<groupId>com.fastcomments</groupId>
34+
<artifactId>core</artifactId>
35+
<version>0.0.1</version>
36+
</dependency>
37+
38+
<!-- PubSub Library (for live events) -->
39+
<dependency>
40+
<groupId>com.fastcomments</groupId>
41+
<artifactId>pubsub</artifactId>
42+
<version>0.0.1</version>
43+
</dependency>
44+
</dependencies>
45+
```
46+
47+
### Gradle
48+
49+
Add the Repsy repository to your build.gradle file:
50+
51+
```groovy
52+
repositories {
53+
mavenCentral()
54+
maven {
55+
url "https://repo.repsy.io/mvn/winrid/fastcomments"
56+
}
57+
}
58+
59+
dependencies {
60+
// API Client
61+
implementation "com.fastcomments:client:0.0.1"
62+
63+
// Core Library (includes SSO)
64+
implementation "com.fastcomments:core:0.0.1"
65+
66+
// PubSub Library (for live events)
67+
implementation "com.fastcomments:pubsub:0.0.1"
68+
}
69+
```
70+
471
### Library Contents
572

673
This library contains three modules. The generated API client, the core Java library which contains hand-written utilities

config.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,10 @@
2121
"developerOrganizationUrl": "https://fastcomments.com",
2222
"gitUserId": "fastcomments",
2323
"authorizeHint": "The FastComments API uses two types of endpoints: DefaultApi requires an API key for authentication, whereas PublicApi which can be accessed without an api key (often from browsers/client SDKs using SSO).",
24-
"hideGenerationTimestamp": true
24+
"hideGenerationTimestamp": true,
25+
"additionalProperties": {
26+
"mavenRepository": "https://repo.repsy.io/mvn/winrid/fastcomments",
27+
"mavenRepositoryId": "repsy",
28+
"mavenRepositoryName": "FastComments Maven Repository on Repsy"
29+
}
2530
}

core/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ The core package serves as the base for FastComments Java implementations, provi
1515

1616
### Maven
1717

18+
Add the Repsy repository to your project's POM:
19+
20+
```xml
21+
<repositories>
22+
<repository>
23+
<id>repsy</id>
24+
<name>FastComments Maven Repository on Repsy</name>
25+
<url>https://repo.repsy.io/mvn/winrid/fastcomments</url>
26+
</repository>
27+
</repositories>
28+
```
29+
30+
Then add the dependency:
31+
1832
```xml
1933
<dependency>
2034
<groupId>com.fastcomments</groupId>
@@ -25,6 +39,19 @@ The core package serves as the base for FastComments Java implementations, provi
2539

2640
### Gradle
2741

42+
Add the Repsy repository to your build.gradle file:
43+
44+
```groovy
45+
repositories {
46+
mavenCentral()
47+
maven {
48+
url "https://repo.repsy.io/mvn/winrid/fastcomments"
49+
}
50+
}
51+
```
52+
53+
Then add the dependency:
54+
2855
```groovy
2956
implementation 'com.fastcomments:core:0.0.1'
3057
```

core/build.gradle

Lines changed: 8 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
apply plugin: 'idea'
22
apply plugin: 'eclipse'
3-
apply plugin: 'java'
43
apply plugin: 'com.diffplug.spotless'
54
apply plugin: 'maven-publish'
6-
apply plugin: 'signing'
75

86
group = 'com.fastcomments'
97
version = project.findProperty('releaseVersion') ?: '0.0.1-SNAPSHOT'
@@ -36,137 +34,18 @@ jar {
3634
}
3735
}
3836

39-
java {
40-
withJavadocJar()
41-
withSourcesJar()
42-
}
43-
44-
publishing {
45-
publications {
46-
mavenJava(MavenPublication) {
47-
from components.java
48-
49-
pom {
50-
name = 'FastComments Java Core'
51-
description = 'Official FastComments Core Library for Java'
52-
url = 'https://github.com/FastComments/fastcomments-java'
53-
54-
licenses {
55-
license {
56-
name = 'MIT'
57-
}
58-
}
59-
60-
developers {
61-
developer {
62-
id = 'fastcomments'
63-
name = 'FastComments Team'
64-
65-
}
66-
}
67-
68-
scm {
69-
connection = 'scm:git:git://github.com/FastComments/fastcomments-java.git'
70-
developerConnection = 'scm:git:ssh://github.com/FastComments/fastcomments-java.git'
71-
url = 'https://github.com/FastComments/fastcomments-java'
72-
}
73-
}
74-
}
75-
}
76-
77-
repositories {
78-
maven {
79-
name = "sonatype"
80-
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
81-
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
82-
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
83-
84-
credentials {
85-
username = findProperty('ossrhUsername') ?: System.getenv('OSSRH_USERNAME')
86-
password = findProperty('ossrhPassword') ?: System.getenv('OSSRH_PASSWORD')
87-
}
88-
}
89-
}
90-
}
91-
92-
signing {
93-
def signingKey = findProperty('signingKey') ?: System.getenv('SIGNING_KEY')
94-
def signingPassword = findProperty('signingPassword') ?: System.getenv('SIGNING_PASSWORD')
95-
96-
// Only sign if credentials are available (required for Maven Central, optional for local)
97-
required = signingKey != null && signingPassword != null
98-
if (required) {
99-
useInMemoryPgpKeys(signingKey, signingPassword)
100-
sign publishing.publications.mavenJava
101-
}
102-
}
103-
104-
if (hasProperty('target') && target == 'android') {
105-
106-
apply plugin: 'com.android.library'
107-
apply plugin: 'com.github.dcendents.android-maven'
108-
109-
android {
110-
compileSdkVersion 25
111-
buildToolsVersion '25.0.2'
112-
defaultConfig {
113-
minSdkVersion 14
114-
targetSdkVersion 25
115-
}
116-
compileOptions {
117-
sourceCompatibility JavaVersion.VERSION_1_8
118-
targetCompatibility JavaVersion.VERSION_1_8
119-
}
120-
121-
// Rename the aar correctly
122-
libraryVariants.all { variant ->
123-
variant.outputs.each { output ->
124-
def outputFile = output.outputFile
125-
if (outputFile != null && outputFile.name.endsWith('.aar')) {
126-
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
127-
output.outputFile = new File(outputFile.parent, fileName)
128-
}
129-
}
130-
}
131-
132-
dependencies {
133-
provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version"
134-
}
135-
}
136-
137-
afterEvaluate {
138-
android.libraryVariants.all { variant ->
139-
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
140-
task.description = "Create jar artifact for ${variant.name}"
141-
task.dependsOn variant.javaCompile
142-
task.from variant.javaCompile.destinationDirectory
143-
task.destinationDirectory = project.file("${project.buildDir}/outputs/jar")
144-
task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar"
145-
artifacts.add('archives', task)
146-
}
147-
}
148-
149-
task sourcesJar(type: Jar) {
150-
from android.sourceSets.main.java.srcDirs
151-
classifier = 'sources'
152-
}
153-
154-
artifacts {
155-
archives sourcesJar
156-
}
37+
// No need to define publishing here; it's in the init script
15738

158-
} else {
15939

160-
apply plugin: 'java'
161-
apply plugin: 'maven-publish'
40+
// Only apply Java configuration
41+
apply plugin: 'java'
16242

163-
sourceCompatibility = JavaVersion.VERSION_1_8
164-
targetCompatibility = JavaVersion.VERSION_1_8
43+
sourceCompatibility = JavaVersion.VERSION_1_8
44+
targetCompatibility = JavaVersion.VERSION_1_8
16545

166-
task execute(type: JavaExec) {
167-
main = System.getProperty('mainClass')
168-
classpath = sourceSets.main.runtimeClasspath
169-
}
46+
task execute(type: JavaExec) {
47+
main = System.getProperty('mainClass')
48+
classpath = sourceSets.main.runtimeClasspath
17049
}
17150

17251
ext {

init-client.gradle

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1+
initscript {
2+
repositories {
3+
mavenCentral()
4+
gradlePluginPortal()
5+
}
6+
}
7+
18
allprojects {
29
apply plugin: 'java'
310
apply plugin: 'maven-publish'
4-
apply plugin: 'signing'
511

6-
// Use releaseVersion property if set, otherwise fallback to snapshot version
12+
13+
// Rest of your configuration…
714
project.version = project.findProperty('releaseVersion') ?: '0.0.1-SNAPSHOT'
815

916
java {
@@ -28,22 +35,22 @@ allprojects {
2835
name = 'FastComments Java Client'
2936
description = 'Official FastComments API Client for Java'
3037
url = 'https://github.com/FastComments/fastcomments-java'
31-
38+
3239
licenses {
3340
license {
3441
name = 'MIT'
3542
url = 'https://opensource.org/licenses/MIT'
3643
}
3744
}
38-
45+
3946
developers {
4047
developer {
4148
id = 'fastcomments'
4249
name = 'FastComments Team'
4350
4451
}
4552
}
46-
53+
4754
scm {
4855
connection = 'scm:git:git://github.com/FastComments/fastcomments-java.git'
4956
developerConnection = 'scm:git:ssh://github.com/FastComments/fastcomments-java.git'
@@ -52,31 +59,20 @@ allprojects {
5259
}
5360
}
5461
}
55-
62+
5663
repositories {
5764
maven {
58-
name = "sonatype"
59-
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
60-
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
65+
name = "repsy"
66+
def releasesRepoUrl = "https://repo.repsy.io/mvn/winrid/fastcomments"
67+
def snapshotsRepoUrl = "https://repo.repsy.io/mvn/winrid/fastcomments"
6168
url = project.version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
62-
69+
6370
credentials {
64-
username = project.findProperty('ossrhUsername') ?: System.getenv('OSSRH_USERNAME')
65-
password = project.findProperty('ossrhPassword') ?: System.getenv('OSSRH_PASSWORD')
71+
username = project.findProperty('repsyUsername') ?: System.getenv('REPSY_USERNAME')
72+
password = project.findProperty('repsyPassword') ?: System.getenv('REPSY_PASSWORD')
6673
}
6774
}
6875
}
6976
}
7077

71-
signing {
72-
def signingKey = project.findProperty('signingKey') ?: System.getenv('SIGNING_KEY')
73-
def signingPassword = project.findProperty('signingPassword') ?: System.getenv('SIGNING_PASSWORD')
74-
75-
// Only sign if credentials are available (required for Maven Central, optional for local)
76-
required = signingKey != null && signingPassword != null
77-
if (required) {
78-
useInMemoryPgpKeys(signingKey, signingPassword)
79-
sign publishing.publications.mavenJava
80-
}
81-
}
82-
}
78+
}

0 commit comments

Comments
 (0)