Skip to content

Commit b46f1f5

Browse files
committed
workflows and publish to private maven server.
1 parent 7b6fcd2 commit b46f1f5

File tree

9 files changed

+148
-45
lines changed

9 files changed

+148
-45
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Gradle Build Master
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: read
11+
packages: write
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up JDK 17
15+
uses: actions/setup-java@v4
16+
with:
17+
java-version: '17'
18+
distribution: 'temurin'
19+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
20+
settings-path: ${{ github.workspace }} # location for the settings.xml file
21+
- name: Setup Gradle
22+
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
23+
- name: Build with Gradle
24+
run: ./gradlew build
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Gradle Publish
2+
on:
3+
release:
4+
types: [created]
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: read
10+
packages: write
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Set up JDK 17
14+
uses: actions/setup-java@v4
15+
with:
16+
java-version: '17'
17+
distribution: 'temurin'
18+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
19+
settings-path: ${{ github.workspace }} # location for the settings.xml file
20+
- name: Setup Gradle
21+
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
22+
- name: Build with Gradle
23+
run: ./gradlew build
24+
- name: Publish
25+
run: ./gradlew publish
26+
env:
27+
MAVEN_PUBLISH_NAME: ${{ secrets.MAVEN_PRIVATE_DEPLOY_NAME }}
28+
MAVEN_PUBLISH_TOKEN: ${{ secrets.MAVEN_PRIVATE_DEPLOY_SECRET }}
29+
GPG_SIGNING_KEY_ID: ${{ secrets.GPG_SIGNING_KEY_ID }}
30+
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
31+
GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }}

LICENSE.txt renamed to LICENSE.APACHEV2

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Apache License
32
Version 2.0, January 2004
43
https://www.apache.org/licenses/
@@ -179,15 +178,15 @@
179178
APPENDIX: How to apply the Apache License to your work.
180179

181180
To apply the Apache License to your work, attach the following
182-
boilerplate notice, with the fields enclosed by brackets "[]"
181+
boilerplate notice, with the fields enclosed by brackets "{}"
183182
replaced with your own identifying information. (Don't include
184183
the brackets!) The text should be enclosed in the appropriate
185184
comment syntax for the file format. We also recommend that a
186185
file or class name and description of purpose be included on the
187186
same "printed page" as the copyright notice for easier
188187
identification within third-party archives.
189188

190-
Copyright [yyyy] [name of copyright owner]
189+
Copyright {yyyy} {name of copyright owner}
191190

192191
Licensed under the Apache License, Version 2.0 (the "License");
193192
you may not use this file except in compliance with the License.
@@ -199,4 +198,4 @@
199198
distributed under the License is distributed on an "AS IS" BASIS,
200199
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201200
See the License for the specific language governing permissions and
202-
limitations under the License.
201+
limitations under the License.

build.gradle

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

build.gradle.kts

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
plugins {
2+
`java-library`
3+
`maven-publish`
4+
signing
5+
}
6+
7+
/**
8+
* Extracted from the Netty project (commit hash: f235b37c281977b5428dacb32cc44072c9a441e5, version 4.1.76.Final-SNAPSHOT).
9+
*
10+
* The Netty project is licensed under the Apache License 2.0.
11+
*
12+
* commit f235b37c281977b5428dacb32cc44072c9a441e5 (HEAD -> 4.1, origin/HEAD, origin/4.1)
13+
* Author: Hiep Vo <[email protected]>
14+
* Date: Mon Mar 28 17:17:49 2022 +0700
15+
*
16+
* Fix a typo (#12241)
17+
**/
18+
group = "net.futureclient.netty-buffer"
19+
version = "1.0.0"
20+
21+
java {
22+
toolchain {
23+
languageVersion = JavaLanguageVersion.of(17)
24+
}
25+
withSourcesJar()
26+
}
27+
28+
sourceSets {
29+
main {
30+
tasks.getByName(compileJavaTaskName, closureOf<JavaCompile> {
31+
sourceCompatibility = "1.8"
32+
targetCompatibility = "1.8"
33+
})
34+
}
35+
}
36+
37+
repositories {
38+
mavenCentral()
39+
}
40+
41+
dependencies {
42+
testImplementation("org.hamcrest:hamcrest:2.2")
43+
testImplementation("org.mockito:mockito-core:5.11.0")
44+
}
45+
46+
testing {
47+
suites {
48+
@Suppress("UnstableApiUsage") val test by getting(JvmTestSuite::class) {
49+
useJUnitJupiter()
50+
}
51+
}
52+
}
53+
54+
publishing {
55+
repositories {
56+
val publishName = System.getenv("MAVEN_PUBLISH_NAME")
57+
val publishToken = System.getenv("MAVEN_PUBLISH_TOKEN")
58+
if (publishName != null && publishToken != null) {
59+
maven {
60+
name = "future-private"
61+
url = uri("https://maven.futureclient.net/private")
62+
credentials {
63+
username = publishName
64+
password = publishToken
65+
}
66+
}
67+
}
68+
}
69+
publications {
70+
create<MavenPublication>("maven") {
71+
from(components["java"])
72+
}
73+
}
74+
}
75+
76+
signing {
77+
val signingKeyId = System.getenv("GPG_SIGNING_KEY_ID")
78+
val signingKey = System.getenv("GPG_SIGNING_KEY")
79+
val signingPassword = System.getenv("GPG_SIGNING_PASSWORD")
80+
if (signingKey != null) {
81+
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
82+
sign(publishing.publications["maven"])
83+
}
84+
}

gradle/wrapper/gradle-wrapper.properties

100755100644
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

settings.gradle

Lines changed: 0 additions & 1 deletion
This file was deleted.

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = "netty-buffer"

src/test/java/io/netty/buffer/UnpooledTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ public void testUnmodifiableBuffer() throws Exception {
476476
} catch (UnsupportedOperationException e) {
477477
// Expected
478478
}
479-
Mockito.verifyZeroInteractions(inputStream);
479+
Mockito.verifyNoInteractions(inputStream);
480480

481481
ScatteringByteChannel scatteringByteChannel = Mockito.mock(ScatteringByteChannel.class);
482482
try {
@@ -485,7 +485,7 @@ public void testUnmodifiableBuffer() throws Exception {
485485
} catch (UnsupportedOperationException e) {
486486
// Expected
487487
}
488-
Mockito.verifyZeroInteractions(scatteringByteChannel);
488+
Mockito.verifyNoInteractions(scatteringByteChannel);
489489
buf.release();
490490
}
491491

0 commit comments

Comments
 (0)