Skip to content

Commit 76f6f37

Browse files
authored
Modernize the build (#21)
2 parents 385d94a + bd39a09 commit 76f6f37

File tree

12 files changed

+188
-141
lines changed

12 files changed

+188
-141
lines changed

.circleci/config.yml

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

.github/workflows/changelog-print.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: changelogPrint
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
name: changelogPrint
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: jdk 11
14+
uses: actions/setup-java@v3
15+
with:
16+
java-version: 11
17+
distribution: 'temurin'
18+
- name: gradle caching
19+
uses: gradle/gradle-build-action@v2
20+
with:
21+
gradle-home-cache-cleanup: true
22+
- run: ./gradlew changelogPrint

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
on:
2+
pull_request:
3+
push:
4+
branches: [main]
5+
concurrency:
6+
group: ${{ github.workflow }}-${{ github.ref }}
7+
cancel-in-progress: true
8+
jobs:
9+
build:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
jre: [17]
14+
os: [ubuntu-latest, windows-latest]
15+
include:
16+
- jre: 11
17+
os: ubuntu-latest
18+
runs-on: ${{ matrix.os }}
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
22+
- name: Install JDK ${{ matrix.jre }}
23+
uses: actions/setup-java@v3
24+
with:
25+
distribution: "temurin"
26+
java-version: ${{ matrix.jre }}
27+
- name: gradle caching
28+
uses: gradle/gradle-build-action@v2
29+
with:
30+
gradle-home-cache-cleanup: true
31+
- name: git fetch origin main
32+
run: git fetch origin main
33+
- name: gradlew build
34+
run: |
35+
if [ "$RUNNER_OS" == "Linux" ]; then
36+
sudo apt-get install xvfb
37+
Xvfb :99 &
38+
export DISPLAY=:99
39+
fi
40+
./gradlew build
41+
shell: bash
42+
- name: junit result
43+
uses: mikepenz/action-junit-report@v3
44+
if: always() # always run even if the previous step fails
45+
with:
46+
check_name: JUnit ${{ matrix.jre }} ${{ matrix.os }}
47+
report_paths: '*/build/test-results/*/TEST-*.xml'

.github/workflows/deploy.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# GH_TOKEN
2+
# NEXUS_USER
3+
# NEXUS_PASS64 (base64 NOTE: `base64` and `openssl base64` failed, had to use Java
4+
# byte[] data = "{{password}}".getBytes(StandardCharsets.UTF_8);
5+
# String encoded = new String(Base64.getEncoder().encode(data), StandardCharsets.UTF_8);
6+
# System.out.println(encoded);
7+
# GPG_PASSPHRASE
8+
# GPG_KEY64 (base64)
9+
# gpg --export-secret-keys --armor KEY_ID | openssl base64 | pbcopy
10+
11+
name: deploy
12+
on:
13+
workflow_dispatch:
14+
inputs:
15+
to_publish:
16+
description: 'What to publish'
17+
required: true
18+
default: 'all'
19+
type: choice
20+
options:
21+
- all
22+
23+
jobs:
24+
build:
25+
runs-on: ubuntu-latest
26+
name: deploy
27+
env:
28+
gh_token: ${{ secrets.GH_TOKEN }}
29+
ORG_GRADLE_PROJECT_nexus_user: ${{ secrets.NEXUS_USER }}
30+
ORG_GRADLE_PROJECT_nexus_pass64: ${{ secrets.NEXUS_PASS64 }}
31+
ORG_GRADLE_PROJECT_gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
32+
ORG_GRADLE_PROJECT_gpg_key64: ${{ secrets.GPG_KEY64 }}
33+
steps:
34+
- uses: actions/checkout@v3
35+
- name: jdk 11
36+
uses: actions/setup-java@v3
37+
with:
38+
java-version: 11
39+
distribution: 'temurin'
40+
- name: gradle caching
41+
uses: gradle/gradle-build-action@v2
42+
with:
43+
gradle-home-cache-cleanup: true
44+
- name: git fetch origin main
45+
run: git fetch origin main
46+
- name: publish all
47+
if: "${{ github.event.inputs.to_publish == 'all' }}"
48+
run: |
49+
./gradlew :changelogPush -Prelease=true -Penable_publishing=true --stacktrace --warning-mode all
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: "Validate Gradle Wrapper"
2+
on:
3+
push:
4+
paths:
5+
- 'gradlew'
6+
- 'gradlew.bat'
7+
- 'gradle/wrapper/'
8+
pull_request:
9+
paths:
10+
- 'gradlew'
11+
- 'gradlew.bat'
12+
- 'gradle/wrapper/'
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
validation:
19+
name: "Validation"
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v3
23+
- uses: gradle/wrapper-validation-action@v1

.travis.yml

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

build.gradle

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ apply from: 干.file('base/sonatype.gradle')
1515

1616
subprojects { subProject ->
1717
apply plugin: 'java-library'
18-
apply from: 干.file('base/java8.gradle')
18+
apply from: 干.file('base/java.gradle')
1919
apply from: 干.file('spotless/java.gradle')
2020

2121
ext.maven_name = subProject.name
@@ -47,12 +47,16 @@ subprojects { subProject ->
4747
main = 'com.diffplug.common.swt.os.OS'
4848
}
4949
} else {
50-
apply plugin: 'com.diffplug.eclipse.mavencentral'
5150
String platformCode = project.name.substring('durian-swt.'.length())
5251
String SWT_TO_USE = platformCode.endsWith("x86") ? SWT_VERSION_X86 : SWT_VERSION
53-
eclipseMavenCentral {
54-
release SWT_TO_USE, {
55-
api "org.eclipse.swt.$platformCode"
52+
apply plugin: 'dev.equo.p2deps'
53+
p2deps {
54+
into 'api', {
55+
p2repo "https://download.eclipse.org/eclipse/updates/$SWT_TO_USE/"
56+
install "org.eclipse.swt.$platformCode"
57+
addFilter 'no-platform-filter', {
58+
it.platformAll()
59+
}
5660
}
5761
}
5862
dependencies {

durian-swt/build.gradle

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
apply from: 干.file('base/kotlin.gradle')
22

3-
apply plugin: 'com.diffplug.eclipse.mavencentral'
4-
eclipseMavenCentral {
5-
release SWT_VERSION, {
6-
api 'org.eclipse.swt'
7-
api 'org.eclipse.jface'
8-
useNativesForRunningPlatform()
3+
apply plugin: 'dev.equo.p2deps'
4+
p2deps {
5+
into 'api', {
6+
p2repo "https://download.eclipse.org/eclipse/updates/$SWT_VERSION/"
7+
install 'org.eclipse.swt'
8+
install 'org.eclipse.jface'
99
}
1010
}
1111
dependencies {
@@ -23,12 +23,6 @@ dependencies {
2323
testImplementation "org.assertj:assertj-core:$VER_ASSERTJ"
2424
testImplementation "com.diffplug.durian:durian-debug:$VER_DURIAN_DEBUG"
2525
}
26-
/*
27-
apply plugin: 'com.diffplug.gradle.eclipse.projectdeps'
28-
eclipseProjectDeps {
29-
replaceWithProject('durian-rx')
30-
}
31-
*/
3226
// in java-library mode, durian-swt.os remains as a folder of classes for gradle internally, which the osgi plugin does not like
3327
tasks.named('jar').configure {
3428
dependsOn(':durian-swt.os:jar')

gradle.properties

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ maven_desc=DurianSwt - Reactive utilities and fluent builders for SWT
55
osgi_symbolic_name=com.diffplug.durian.swt
66
osgi_export=com.diffplug.common.swt.*
77

8+
ver_java=8
9+
kotlin_jvmTarget=1.8
10+
811
# Build requirements
9-
VER_JAVA=1.8
1012
VER_FINDBUGS=3.0.1
1113

1214
# Dependencies
@@ -15,8 +17,8 @@ VER_DURIAN_RX=4.0.0
1517
VER_DURIAN_DEBUG=1.0.0
1618
VER_RXJAVA=2.0.0
1719
# SWT Dependencies from P2
18-
SWT_VERSION=4.21.0
19-
SWT_VERSION_X86=4.7.0
20+
SWT_VERSION=4.21
21+
SWT_VERSION_X86=4.7
2022

2123
# Testing
2224
VER_JUNIT=4.12

gradle/wrapper/gradle-wrapper.jar

285 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)