Skip to content

Commit a077840

Browse files
committed
Create build and release workflows
1 parent 6c9cf07 commit a077840

File tree

7 files changed

+166
-32
lines changed

7 files changed

+166
-32
lines changed

.github/workflows/gradle.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Java CI with Gradle
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
12+
- name: Set up JDK 8
13+
uses: actions/setup-java@v1
14+
with:
15+
java-version: 8
16+
17+
- name: Grant execute permission for gradlew
18+
run: chmod +x gradlew
19+
- name: Build with Gradle
20+
run: ./gradlew assemble
21+
22+
- name: Upload build artifacts
23+
uses: actions/upload-artifact@v1
24+
with:
25+
name: build-artifacts
26+
path: build/libs

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: Set up JDK 8
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 8
19+
20+
- name: Grant execute permission for gradlew
21+
run: chmod +x gradlew
22+
- name: Build with Gradle
23+
run: ./gradlew assemble
24+
25+
- name: Release
26+
uses: softprops/action-gh-release@v1
27+
with:
28+
files: build/libs/*.*
29+
draft: true
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Publish
34+
run: ./gradlew publish
35+
env:
36+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
37+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
38+
PGP_KEY: ${{ secrets.PGP_KEY }}
39+
PGP_KEY_ID: ${{ secrets.PGP_KEY_ID }}
40+
PGP_PASSWORD: ${{ secrets.PGP_PASSWORD }}
41+
42+
- name: Upload build artifacts
43+
uses: actions/upload-artifact@v1
44+
with:
45+
name: build-artifacts
46+
path: devolay-java/build/libs

build.gradle

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

build.gradle.kts

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
plugins {
2+
`java-library`
3+
`maven-publish`
4+
signing
5+
}
6+
7+
group = "me.walkerknapp"
8+
version = "0.0.1"
9+
10+
java.sourceCompatibility = JavaVersion.VERSION_1_9
11+
12+
repositories {
13+
mavenCentral()
14+
}
15+
16+
dependencies {
17+
implementation("com.dslplatform:dsl-json-java8:1+")
18+
annotationProcessor("com.dslplatform:dsl-json-java8:1+")
19+
20+
implementation("org.apache.commons:commons-lang3:3+")
21+
22+
implementation("org.slf4j:slf4j-api") {
23+
version {
24+
prefer("2+")
25+
}
26+
}
27+
}
28+
29+
val sourceJar by tasks.creating(Jar::class) {
30+
from(sourceSets.main.get().allJava)
31+
this.archiveClassifier.set("sources")
32+
}
33+
34+
publishing {
35+
repositories {
36+
maven {
37+
name = "OSSRH"
38+
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
39+
credentials {
40+
username = System.getenv("OSSRH_USERNAME")
41+
password = System.getenv("OSSRH_PASSWORD")
42+
}
43+
}
44+
}
45+
publications {
46+
create<MavenPublication>("cfi-java") {
47+
from(components["java"])
48+
artifact(sourceJar)
49+
50+
groupId = project.group as String
51+
artifactId = "cfi-java"
52+
version = project.version as String?
53+
54+
pom {
55+
name.set("CFI-Java")
56+
description.set("CFI-Java is a library to interact with CMake projects through the CMake File Api.")
57+
url.set("https://github.com/WalkerKnapp/cfi-java")
58+
59+
licenses {
60+
license {
61+
name.set("The Apache License, Version 2.0")
62+
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
63+
}
64+
}
65+
66+
developers {
67+
developer {
68+
id.set("WalkerKnapp")
69+
name.set("Walker Knapp")
70+
email.set("walker@walkerknapp.me")
71+
}
72+
}
73+
74+
scm {
75+
connection.set("scm:git:git://github.com/WalkerKnapp/cfi-java.git")
76+
developerConnection.set("scm:git:git@github.com:WalkerKnapp/cfi-java.git")
77+
url.set("https://github.com/WalkerKnapp/cfi-java")
78+
}
79+
}
80+
}
81+
}
82+
}
83+
84+
signing {
85+
useInMemoryPgpKeys(System.getenv("PGP_KEY_ID"), System.getenv("PGP_KEY"), System.getenv("PGP_PASSWORD"))
86+
sign(publishing.publications["cfi-java"])
87+
}

settings.gradle

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

settings.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
rootProject.name = "cfi-java"
2+

src/main/java/me/walkerknapp/cfi/CMakeInstance.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
import com.dslplatform.json.DslJson;
44
import com.dslplatform.json.runtime.Settings;
55
import me.walkerknapp.cfi.structs.CFIObject;
6-
import me.walkerknapp.cfi.structs.ClientQuery;
76
import me.walkerknapp.cfi.structs.Index;
87

98
import java.io.IOException;
109
import java.io.InputStream;
11-
import java.io.OutputStream;
12-
import java.nio.file.AccessDeniedException;
1310
import java.nio.file.Files;
1411
import java.nio.file.Path;
12+
import java.util.HashMap;
1513
import java.util.UUID;
1614
import java.util.concurrent.CompletableFuture;
1715
import java.util.concurrent.CompletionException;
@@ -88,11 +86,11 @@ public <T extends CFIObject> CompletableFuture<T> queueRequest(CFIQuery<T> query
8886
indexFile = dslJson.deserialize(Index.class, indexIs);
8987
}
9088

91-
var replies = indexFile.reply.clientStatelessReplies.get(this.clientName);
89+
HashMap<String, Index.Reply.ReplyFileReference> replies = indexFile.reply.clientStatelessReplies.get(this.clientName);
9290
if (replies == null) {
9391
throw new IllegalStateException("CMake didn't create a response for our client (" + this.clientName + ").");
9492
}
95-
var queryReply = replies.get(query.getQueryFileName());
93+
Index.Reply.ReplyFileReference queryReply = replies.get(query.getQueryFileName());
9694
if (queryReply == null) {
9795
throw new IllegalStateException("CMake didn't respond to the query " + query.getQueryFileName() + " from client " + this.clientName);
9896
}
@@ -159,11 +157,11 @@ public <T extends CFIObject> CompletableFuture<T> immediatelyRequestObject(CFIQu
159157
indexFile = dslJson.deserialize(Index.class, indexIs);
160158
}
161159

162-
var replies = indexFile.reply.clientStatelessReplies.get(this.clientName);
160+
HashMap<String, Index.Reply.ReplyFileReference> replies = indexFile.reply.clientStatelessReplies.get(this.clientName);
163161
if (replies == null) {
164162
throw new IllegalStateException("CMake didn't create a response for our client (" + this.clientName + ").");
165163
}
166-
var queryReply = replies.get(query.getQueryFileName());
164+
Index.Reply.ReplyFileReference queryReply = replies.get(query.getQueryFileName());
167165
if (queryReply == null) {
168166
throw new IllegalStateException("CMake didn't respond to the query " + query.getQueryFileName() + " from client " + this.clientName);
169167
}

0 commit comments

Comments
 (0)