Skip to content

Commit 2229ffc

Browse files
author
Kristjan Kosic
authored
release: 1.0.1 (#89)
* chore: fixed root project name * chore: clean build.gradle, prepare for github packages, adjust to latest format * style: back to aosp 1.1 format rules * fix: parameter passing * chore: github action to test against multiple java-versions * chore: github action for publish package when tag release
1 parent b01d507 commit 2229ffc

File tree

20 files changed

+416
-448
lines changed

20 files changed

+416
-448
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Set up JDK 11
15+
uses: actions/setup-java@v1
16+
with:
17+
java-version: 11
18+
19+
- name: Build with Gradle
20+
run: gradle build
21+
22+
- name: Publish to GitHub Packages
23+
run: gradle publish
24+
env:
25+
USERNAME: ${{ github.actor }}
26+
PASSWORD: ${{ secrets.GITHUB_TOKEN }}
27+

.github/workflows/test.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
name: Test
22

33
on:
4-
push:
5-
branches:
6-
- "master"
7-
- "develop"
8-
pull_request:
9-
types: [ready_for_review, synchronize, opened]
4+
push:
5+
branches:
6+
- "master"
7+
- "develop"
8+
pull_request:
9+
types: [ready_for_review, synchronize, opened]
1010

1111
jobs:
1212
unit:
1313
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
# test against latest update of each major Java version, as well as specific updates of LTS versions:
17+
java: [ 8, 9, 10, 11, 12, 13 ]
1418

1519
steps:
1620
- uses: actions/checkout@v1
17-
- name: Set up JDK 1.8
21+
- name: Use Java Version ${{ matrix.java }}
1822
uses: actions/setup-java@v1
1923
with:
20-
java-version: 1.8
24+
java-version: ${{ matrix.java }}
2125
- name: Install
2226
run: gradle dependencies
2327
- name: Test

build.gradle

Lines changed: 47 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,128 +1,41 @@
1-
buildscript {
2-
dependencies {
3-
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.27.1"
4-
}
5-
}
6-
71
plugins {
82
id 'java'
9-
id 'maven'
103
id 'maven-publish'
11-
id 'signing'
124
id 'jacoco'
5+
id 'com.diffplug.gradle.spotless' version '3.27.1'
136
}
147

15-
apply plugin:'java'
16-
apply plugin:'maven'
17-
apply plugin:'maven-publish'
18-
apply plugin: com.diffplug.gradle.spotless.SpotlessPlugin
19-
208
repositories {
219
jcenter()
2210
mavenCentral()
2311
}
2412

25-
task fatJar(type: Jar) {
26-
manifest.from jar.manifest
27-
classifier = 'standalone'
28-
from {
29-
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
30-
} {
31-
exclude "META-INF/*.SF"
32-
exclude "META-INF/*.DSA"
33-
exclude "META-INF/*.RSA"
34-
}
35-
with jar
36-
}
37-
38-
task javadocJar(type: Jar) {
39-
classifier = 'javadoc'
40-
from javadoc
41-
}
42-
43-
task sourcesJar(type: Jar) {
44-
classifier = 'sources'
45-
from sourceSets.main.allSource
46-
}
47-
48-
artifacts {
49-
archives javadocJar, sourcesJar
50-
}
51-
52-
uploadArchives {
53-
repositories {
54-
mavenDeployer {
55-
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
56-
57-
repository(url: "file://${buildDir}/repo") {}
58-
59-
//repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2") {
60-
// authentication(userName: '', password: '')
61-
// }
62-
63-
// snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
64-
// authentication(userName: ossrhUsername, password: ossrhPassword)
65-
// }
66-
67-
pom.project {
68-
groupId = 'org.arkecosystem'
69-
version = '1.0.0'
70-
artifactId = 'client'
71-
72-
name = 'java-client'
73-
description = 'A simple Java API client for the ARK Blockchain.'
74-
url = 'https://github.com/ArkEcosystem/java-client'
75-
inceptionYear = '2018'
76-
77-
licenses {
78-
license {
79-
name = 'MIT'
80-
distribution = 'repo'
81-
}
82-
}
83-
84-
developers {
85-
developer {
86-
name = 'Brian Faust'
87-
email = 'brian@ark.io'
88-
organization = 'Ark Ecosystem'
89-
organizationUrl = 'https://ark.io'
90-
}
91-
developer {
92-
name = 'Joshua Noack'
93-
email = 'joshua@ark.io'
94-
organization = 'Ark Ecosystem'
95-
organizationUrl = 'https://ark.io'
96-
}
97-
developer {
98-
name = 'Kristjan Kosic'
99-
email = 'kristjan@ark.io'
100-
organization = 'Ark Ecosystem'
101-
organizationUrl = 'https://ark.io'
102-
}
103-
developer {
104-
name = 'Zan Kovac'
105-
email = 'zan@ark.io'
106-
organization = 'Ark Ecosystem'
107-
organizationUrl = 'https://ark.io'
108-
}
109-
}
110-
111-
scm {
112-
connection = 'scm:git:git://github.com/ArkEcosystem/java-client.git'
113-
developerConnection = 'scm:git:ssh://github.com:ArkEcosystem/java-client.git'
114-
url = 'https://github.com/ArkEcosystem/java-client/tree/1.0.0'
13+
group = 'org.arkecosystem'
14+
version = '1.0.1'
15+
16+
publishing {
17+
publishing {
18+
repositories {
19+
maven {
20+
name = "github"
21+
url = uri("https://maven.pkg.github.com/arkecosystem/java-client")
22+
credentials {
23+
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
24+
password = project.findProperty("gpr.key") ?: System.getenv("PASSWORD")
11525
}
11626
}
11727
}
28+
publications {
29+
gpr(MavenPublication) {
30+
from(components.java)
31+
}
32+
}
11833
}
119-
}
120-
121-
if (project.hasProperty("signing.keyId")) {
122-
apply plugin:'signing'
12334

124-
signing {
125-
sign configurations.archives
35+
javadoc {
36+
if (JavaVersion.current().isJava9Compatible()) {
37+
options.addBooleanOption('html5', true)
38+
}
12639
}
12740
}
12841

@@ -151,7 +64,7 @@ jacocoTestReport {
15164
}
15265

15366
wrapper {
154-
gradleVersion = '5.6.2'
67+
gradleVersion = '6.2.0'
15568
}
15669

15770
spotless {
@@ -160,12 +73,35 @@ spotless {
16073
include 'src/main/**/*.java'
16174
exclude '**/build/**'
16275
}
163-
googleJavaFormat()
76+
googleJavaFormat('1.1').aosp()
16477
removeUnusedImports()
16578

16679
}
16780
}
16881

16982
task formatCode(dependsOn: ['spotlessApply'])
17083

84+
task fatJar(type: Jar) {
85+
manifest.from jar.manifest
86+
classifier = 'standalone'
87+
from {
88+
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
89+
} {
90+
exclude "META-INF/*.SF"
91+
exclude "META-INF/*.DSA"
92+
exclude "META-INF/*.RSA"
93+
}
94+
with jar
95+
}
96+
97+
task javadocJar(type: Jar) {
98+
classifier = 'javadoc'
99+
from javadoc
100+
}
101+
102+
task sourcesJar(type: Jar) {
103+
classifier = 'sources'
104+
from sourceSets.main.allSource
105+
}
106+
171107
build.dependsOn 'spotlessApply'

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
rootProject.name = 'arkecosystem-client'
1+
rootProject.name = 'java-client'
22

src/main/java/org/arkecosystem/client/Connection.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
import org.arkecosystem.client.http.Client;
66

77
public class Connection {
8-
private Api api;
9-
private Client client;
8+
private Api api;
9+
private Client client;
1010

11-
public Connection(Map<String, Object> config) {
12-
this.client = new Client(config.get("host").toString());
13-
this.api = new Api(this.client);
14-
}
11+
public Connection(Map<String, Object> config) {
12+
this.client = new Client(config.get("host").toString());
13+
this.api = new Api(this.client);
14+
}
1515

16-
public Api api() {
17-
return this.api;
18-
}
16+
public Api api() {
17+
return this.api;
18+
}
1919
}

src/main/java/org/arkecosystem/client/ConnectionManager.java

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,64 +4,64 @@
44
import java.util.Map;
55

66
public class ConnectionManager {
7-
private Map<String, Connection> connections;
8-
private String defaultConnection = "main";
7+
private Map<String, Connection> connections;
8+
private String defaultConnection = "main";
99

10-
public ConnectionManager() {
11-
this.connections = new HashMap<>();
12-
}
13-
14-
public String getDefaultConnection() {
15-
return this.defaultConnection;
16-
}
17-
18-
public void setDefaultConnection(String name) {
19-
this.defaultConnection = name;
20-
}
10+
public ConnectionManager() {
11+
this.connections = new HashMap<>();
12+
}
2113

22-
public Map<String, Connection> getConnections() {
23-
return this.connections;
24-
}
14+
public String getDefaultConnection() {
15+
return this.defaultConnection;
16+
}
2517

26-
public Connection connect(Map config, String name) {
27-
if (this.connections.containsKey(name)) {
28-
throw new IllegalArgumentException("Connection [" + name + "] is already configured.");
18+
public void setDefaultConnection(String name) {
19+
this.defaultConnection = name;
2920
}
3021

31-
this.connections.put(name, new Connection(config));
22+
public Map<String, Connection> getConnections() {
23+
return this.connections;
24+
}
3225

33-
return this.connections.get(name);
34-
}
26+
public Connection connect(Map config, String name) {
27+
if (this.connections.containsKey(name)) {
28+
throw new IllegalArgumentException("Connection [" + name + "] is already configured.");
29+
}
3530

36-
public Connection connect(Map config) {
37-
return connect(config, "main");
38-
}
31+
this.connections.put(name, new Connection(config));
3932

40-
public void disconnect(String name) {
41-
if (name == null || name.isEmpty()) {
42-
name = getDefaultConnection();
33+
return this.connections.get(name);
4334
}
4435

45-
this.connections.remove(name);
46-
}
36+
public Connection connect(Map config) {
37+
return connect(config, "main");
38+
}
4739

48-
public void disconnect() {
49-
disconnect(null);
50-
}
40+
public void disconnect(String name) {
41+
if (name == null || name.isEmpty()) {
42+
name = getDefaultConnection();
43+
}
5144

52-
public Connection connection(String name) {
53-
if (name == null || name.isEmpty()) {
54-
name = getDefaultConnection();
45+
this.connections.remove(name);
5546
}
5647

57-
if (!this.connections.containsKey(name)) {
58-
throw new IllegalArgumentException("Connection [" + name + "] not configured.");
48+
public void disconnect() {
49+
disconnect(null);
5950
}
6051

61-
return this.connections.get(name);
62-
}
52+
public Connection connection(String name) {
53+
if (name == null || name.isEmpty()) {
54+
name = getDefaultConnection();
55+
}
56+
57+
if (!this.connections.containsKey(name)) {
58+
throw new IllegalArgumentException("Connection [" + name + "] not configured.");
59+
}
6360

64-
public Connection connection() {
65-
return connection(null);
66-
}
61+
return this.connections.get(name);
62+
}
63+
64+
public Connection connection() {
65+
return connection(null);
66+
}
6767
}

0 commit comments

Comments
 (0)