Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HACKTOBERFEST] Update to pi4j-v2 & Multi-Chip support #1

Merged
merged 46 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
43eb692
update gradle
MMMMMNG Oct 4, 2023
9fd3144
update build.gradle to gradle version 8.3
MMMMMNG Oct 4, 2023
e1ee9b0
copy MCP23S17.java source from Connect 'n Charge project
MMMMMNG Oct 4, 2023
b69c715
add slf4j:2.0.9 dependency, remove "Component" parent class dependencies
MMMMMNG Oct 4, 2023
e2eeae9
add test infrastructure
MMMMMNG Oct 5, 2023
ea93c37
add more test infrastructure
MMMMMNG Oct 5, 2023
147871d
add MCPData convenience class to quickly generate byte arrays.
MMMMMNG Oct 5, 2023
f7b15e2
add more doc for janky workaround
MMMMMNG Oct 5, 2023
8a55e70
add first tests
MMMMMNG Oct 5, 2023
b1c95d2
overengineer MCPData.next() method for later tests
MMMMMNG Oct 5, 2023
e3b93d4
add test with interrupt
MMMMMNG Oct 5, 2023
dc9ca58
add test for newWithInterrupts() factory method
MMMMMNG Oct 6, 2023
d1bbec2
change junit dependency declaration
MMMMMNG Oct 6, 2023
c10b11f
remove hardcoded pigpio provider platform
MMMMMNG Oct 6, 2023
d981f18
add more convenience methods and some javadoc
MMMMMNG Oct 6, 2023
438fa9e
disable failsave and add TODO to document it
MMMMMNG Oct 6, 2023
7ffafb9
add final test for the MCP23S17.multipleNewOnSameBusWithTiedInterrupt…
MMMMMNG Oct 6, 2023
58e0440
Create GH action (gradle.yml)
MMMMMNG Oct 6, 2023
e0152c3
Update gradle.yml
MMMMMNG Oct 6, 2023
a9c0310
fix GH actions error: "...gradlew not executable"
MMMMMNG Oct 6, 2023
c16a5d4
Create upload.yml
MMMMMNG Oct 6, 2023
82f82d7
download SNAPSHOT version of pi4j-plugin-mock dependency
MMMMMNG Oct 6, 2023
e966a3c
use third party artifact downloader 'cuz apparently the default downl…
MMMMMNG Oct 6, 2023
e1d6679
fix path for dependency extraction
MMMMMNG Oct 6, 2023
a79a0e6
fix case sensitivity in settings.gradle
MMMMMNG Oct 8, 2023
0390e10
refactor test class for more DRY-ness
MMMMMNG Oct 8, 2023
06e499e
test PinView.invertInput() and PinView.uninvertInput()
MMMMMNG Oct 8, 2023
09bd673
refactor invertInput() test to parametrized test suitable for every o…
MMMMMNG Oct 8, 2023
762da48
reformat PinViewTest
MMMMMNG Oct 8, 2023
4cad112
optimize imports
MMMMMNG Oct 10, 2023
54d22d1
format PinViewTest.java
MMMMMNG Oct 10, 2023
3aa8456
create PinTest.java (test class for MCP23S17.Pin enum)
MMMMMNG Oct 10, 2023
462e9cf
bring method coverage to 98%
MMMMMNG Oct 10, 2023
2a90f17
put mockLow() into base class
MMMMMNG Oct 10, 2023
65d6d1b
reformat everything with IDEA default code styling
MMMMMNG Oct 11, 2023
3626df1
refactor chipSelect: already handled by SPI so remove completely.
MMMMMNG Oct 11, 2023
2d9a118
refactor spiBus: use dependency injection for the entire SPI object. …
MMMMMNG Oct 11, 2023
7efa16f
finally bring test coverage to 100% of methods
MMMMMNG Oct 11, 2023
99d1748
refactor pi4jContext: not needed anymore since the SPI object now get…
MMMMMNG Oct 11, 2023
38494be
add test for readGPIOOnInterrupt flag
MMMMMNG Oct 11, 2023
428ee23
refactor constructors: use a single constructor for everything again.
MMMMMNG Oct 11, 2023
76157f7
refactor read/write opcodes and null-check spi object
MMMMMNG Oct 11, 2023
c4924ea
refactor for some sonar lint warnings
MMMMMNG Oct 11, 2023
40bb998
fix 'address' typos in javadoc
MMMMMNG Oct 23, 2023
e7eacd0
update outdated artifact specification
MMMMMNG Oct 23, 2023
6ebf4a0
declare pi4j-pigpio dependencies
MMMMMNG Oct 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Java CI with Gradle

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Set up dependency
uses: dawidd6/action-download-artifact@v2
with:
workflow: upload.yml
name: pi4j-mock-plugin
path: /home/runner/.m2/repository/com
- name: Build with Gradle
uses: gradle/[email protected]
with:
arguments: build
41 changes: 26 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,35 +1,46 @@
plugins {
id 'com.github.johnrengelman.shadow' version '5.0.0'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'java'
}

group 'com.rrr'
version '1.3.0'

sourceCompatibility = 1.11
java {
sourceCompatibility = JavaVersion.VERSION_17
withSourcesJar()
withJavadocJar()
}

repositories {
mavenLocal {
content {
includeGroup("com.pi4j")
}
}

mavenCentral()
}

dependencies {
// testCompile group: 'junit', name: 'junit', version: '4.12'
implementation group: "com.pi4j", name: "pi4j-core", version: "1.2"
}
testImplementation(platform 'org.junit:junit-bom:5.10.0')
testImplementation 'org.junit.jupiter:junit-jupiter'

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
testImplementation 'org.mockito:mockito-core:3.+'
testImplementation 'com.pi4j:pi4j-plugin-mock:2.3.0-SNAPSHOT'

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
testRuntimeOnly 'org.slf4j:slf4j-simple:2.0.9'
implementation 'com.pi4j:pi4j-core:2.3.0'
implementation 'org.slf4j:slf4j-api:2.0.9'
implementation 'com.pi4j:pi4j-plugin-raspberrypi:2.3.0'
implementation 'com.pi4j:pi4j-plugin-pigpio:2.3.0'
}

artifacts {
archives sourcesJar
archives javadocJar
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}

javadoc {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Thu Jun 27 10:17:01 PDT 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
18 changes: 17 additions & 1 deletion gradlew
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down
18 changes: 17 additions & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rootProject.name = 'mcp23s17'
rootProject.name = 'MCP23S17'

Loading