Skip to content

Commit 7e4ce96

Browse files
committed
[Change] Gradle + Publishing Data
1 parent 0c4008f commit 7e4ce96

File tree

11 files changed

+606
-104
lines changed

11 files changed

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

gradle/wrapper/gradle-wrapper.jar

42.7 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.14.2-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)