Skip to content

Commit 9569671

Browse files
committed
[Change] Gradle + Publishing Data
1 parent fd66bda commit 9569671

File tree

11 files changed

+593
-104
lines changed

11 files changed

+593
-104
lines changed

.gitattributes

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
* text=auto eol=lf
2+
*.java text eol=lf
3+
*.groovy text eol=lf
4+
*.scala text eol=lf
5+
*.sh text eol=lf
6+
*.bat text eol=crlf
7+
*.md text
8+
*.properties text
9+
10+
*.dat binary
11+
*.bin binary
12+
*.png binary
13+
*.exe binary
14+
*.dll binary
15+
*.zip binary
16+
*.jar binary
17+
*.7z binary
18+
*.db binary

.github/workflows/build.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build Release
2+
on:
3+
release:
4+
types: [ created ]
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
11+
- name: Import GPG Key
12+
uses: crazy-max/ghaction-import-gpg@v6
13+
with:
14+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
15+
passphrase: ${{ secrets.MAVEN_TOKEN }}
16+
17+
- name: update cache
18+
uses: actions/cache@v4
19+
with:
20+
path: |
21+
~/.gradle/caches
22+
~/.gradle/wrapper
23+
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
24+
restore-keys: |
25+
${{ runner.os }}-gradle-
26+
27+
- name: Set up Build JDK
28+
uses: actions/setup-java@v4
29+
with:
30+
distribution: 'temurin'
31+
java-version: '8'
32+
33+
- name: Set up Gradle JDK
34+
uses: actions/setup-java@v4
35+
with:
36+
distribution: 'temurin'
37+
java-version: '21'
38+
39+
- name: Grant execute permission for gradlew
40+
run: chmod +x gradlew
41+
42+
- name: Publish
43+
run: ./gradlew publish -Pmvn.user=${{ secrets.MAVEN_USER }} -Pmvn.key=${{ secrets.MAVEN_KEY }}
44+
45+
- uses: actions/upload-artifact@v4
46+
with:
47+
name: DiscordIPC Artifacts
48+
path: ./build/libs/
49+
50+
- name: stop daemon
51+
run: ./gradlew --stop

.github/workflows/build_snapshot.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build Snapshot
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- 'feature/**'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Import GPG Key
15+
uses: crazy-max/ghaction-import-gpg@v6
16+
with:
17+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
18+
passphrase: ${{ secrets.MAVEN_TOKEN }}
19+
20+
- name: update cache
21+
uses: actions/cache@v4
22+
with:
23+
path: |
24+
~/.gradle/caches
25+
~/.gradle/wrapper
26+
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
27+
restore-keys: |
28+
${{ runner.os }}-gradle-
29+
30+
- name: Set up Build JDK
31+
uses: actions/setup-java@v4
32+
with:
33+
distribution: 'temurin'
34+
java-version: '8'
35+
36+
- name: Set up Gradle JDK
37+
uses: actions/setup-java@v4
38+
with:
39+
distribution: 'temurin'
40+
java-version: '21'
41+
42+
- name: Grant execute permission for gradlew
43+
run: chmod +x gradlew
44+
45+
- name: Publish
46+
run: ./gradlew publish -Pversion_snapshot -Pmvn.user=${{ secrets.MAVEN_USER }} -Pmvn.key=${{ secrets.MAVEN_KEY }} -x test
47+
48+
- uses: actions/upload-artifact@v4
49+
with:
50+
name: DiscordIPC Snapshot Artifacts
51+
path: ./build/libs/
52+
53+
- name: stop daemon
54+
run: ./gradlew --stop

.gitignore

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,19 @@
1-
# Compiled class file
2-
*.class
1+
#General
2+
/repo
3+
/.gradle
4+
/build
35

4-
# Log file
5-
*.log
6+
#Eclipse
7+
.settings
8+
.metadata
9+
.classpath
10+
.project
11+
/bin
612

7-
# BlueJ files
8-
*.ctxt
9-
10-
# Mobile Tools for Java (J2ME)
11-
.mtj.tmp/
12-
13-
# Package Files #
14-
*.jar
15-
*.war
16-
*.ear
17-
*.zip
18-
*.tar.gz
19-
*.rar
20-
21-
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
22-
hs_err_pid*
23-
24-
# Intellij Project Files
25-
/.idea/
26-
/out/
13+
#IntelliJ Idea
14+
/out
15+
/.idea
2716
*.iml
28-
29-
# Testing
30-
/src/test/
31-
/target/
17+
*.iws
18+
*.ipr
19+
s101plugin.state

build.gradle

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
plugins {
2+
id 'java'
3+
id 'signing'
4+
id 'maven-publish'
5+
}
6+
7+
version = '0.9.2' + (project.hasProperty("version_snapshot") ? "-SNAPSHOT" : "")
8+
group = 'io.github.CDAGaming'
9+
description = 'Connect locally to the Discord client using IPC for a subset of RPC features like Rich Presence and Activity Join/Spectate'
10+
base.archivesName = 'DiscordIPC'
11+
12+
JavaVersion targetVersion = JavaVersion.VERSION_1_8
13+
int targetVersionInt = Integer.parseInt(targetVersion.majorVersion)
14+
15+
[java].each {
16+
it.toolchain {
17+
languageVersion.set(JavaLanguageVersion.of(targetVersionInt))
18+
}
19+
it.withSourcesJar()
20+
it.withJavadocJar()
21+
}
22+
23+
repositories {
24+
mavenCentral()
25+
}
26+
27+
dependencies {
28+
implementation group: 'com.google.code.gson', name: 'gson', version: '2.11.0'
29+
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.13'
30+
implementation group: 'com.kohlschutter.junixsocket', name: 'junixsocket-common', version: '2.9.1'
31+
implementation group: 'com.kohlschutter.junixsocket', name: 'junixsocket-native-common', version: '2.9.1'
32+
implementation group: 'net.lenni0451', name: 'Reflect', version: '1.3.4'
33+
}
34+
35+
jar.manifest.mainAttributes([
36+
'Implementation-Title' : project.name,
37+
'Implementation-Version': project.version
38+
])
39+
40+
[compileJava].each {
41+
it.options.encoding = 'UTF-8'
42+
it.options.deprecation = true
43+
it.options.fork = true
44+
}
45+
46+
publishing {
47+
publications {
48+
mavenJava(MavenPublication) {
49+
from components.java
50+
51+
pom {
52+
name = rootProject.name
53+
artifactId = rootProject.name
54+
packaging = 'jar'
55+
description = project.description
56+
url = 'https://github.com/CDAGaming/DiscordIPC'
57+
58+
scm {
59+
connection = 'scm:git:git://github.com/CDAGaming/DiscordIPC.git'
60+
developerConnection = 'scm:git:ssh://github.com/CDAGaming/DiscordIPC.git'
61+
url = 'https://github.com/CDAGaming/DiscordIPC'
62+
}
63+
licenses {
64+
license {
65+
name = 'Apache License 2.0'
66+
url = 'https://github.com/CDAGaming/DiscordIPC/blob/master/LICENSE'
67+
}
68+
}
69+
developers {
70+
developer {
71+
id = 'cdagaming'
72+
name = 'CDAGaming'
73+
email = 'cstack2011@yahoo.com'
74+
}
75+
developer {
76+
id = 'jagrosh'
77+
name = 'John Grosh'
78+
email = 'j@gro.sh'
79+
}
80+
}
81+
}
82+
}
83+
}
84+
repositories {
85+
maven {
86+
credentials {
87+
username = project.findProperty("mvn.user") ?: System.getenv("OSSRH_USERNAME")
88+
password = project.findProperty("mvn.key") ?: System.getenv("OSSRH_PASSWORD")
89+
}
90+
91+
def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
92+
def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
93+
url = version.endsWith('-SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
94+
}
95+
}
96+
}
97+
98+
signing {
99+
useGpgCmd()
100+
sign publishing.publications.mavenJava
101+
}

gradle/wrapper/gradle-wrapper.jar

42.4 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)