Skip to content

Commit

Permalink
initial imports
Browse files Browse the repository at this point in the history
  • Loading branch information
umjammer committed Apr 30, 2023
0 parents commit 567dbd0
Show file tree
Hide file tree
Showing 22 changed files with 1,302 additions and 0 deletions.
81 changes: 81 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
# schedule:
# - cron: '19 18 * * 0'

jobs:
analyze:
name: Analyze
runs-on: macos-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'java' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

#- name: Set up JDK 8
# uses: actions/setup-java@v3
# with:
# java-version: '8'
# distribution: 'temurin'
# cache: maven
# server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
# settings-path: ${{ github.workspace }} # location for the settings.xml file

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- name: Build with Maven
# run: mvn -B package --file pom.xml -DskipTests
# #run: mvn package -s $GITHUB_WORKSPACE/settings.xml --file pom.xml -DskipTests
# #env:
# # GITHUB_TOKEN: ${{ github.token }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
38 changes: 38 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Java CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: macos-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Check w/o SNAPSHOT when "bump version"
if: ${{ contains(github.event.head_commit.message, 'bump version') }}
run: grep "<version>" pom.xml | head -1 | grep -v SNAPSHOT

- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven

# git clone https://github.com/mirrorer/libbpg /tmp/libbpg
# cd /tmp/libbpg
# git fetch --depth 1 origin 0e2aadb
# git checkout 0e2aadb
# patch -p 0 < /home/runner/work/vavi-image-bpg/vavi-image-bpg/src/main/pacth/mac.patch
# make

- name: Build with Maven
run: |
mvn -B package --file pom.xml
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

[![Release](https://jitpack.io/v/umjammer/vavi-image-bpg.svg)](https://jitpack.io/#umjammer/vavi-image-bpg)
[![Java CI](https://github.com/umjammer/vavi-image-bpg/actions/workflows/maven.yml/badge.svg)](https://github.com/umjammer/vavi-image-bpg/actions/workflows/maven.yml)
[![CodeQL](https://github.com/umjammer/vavi-image-bpg/actions/workflows/codeql.yml/badge.svg)](https://github.com/umjammer/vavi-image-bpg/actions/workflows/codeql-analysis.yml)
![Java](https://img.shields.io/badge/Java-8-b07219)

# vavi-image-bpg

## Install

* [maven](https://jitpack.io/#umjammer/vavi-image-bpg)

## Usage

```java
BufferedImage image = ImageIO.read(Paths.get("/foo/bar.bpg").toFile());
```

## References

* https://bellard.org/bpg/
* https://github.com/alexandruc/android-bpg

## TODO
157 changes: 157 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>vavi</groupId>
<artifactId>vavi-image-bpg</artifactId>
<version>0.0.1-SNAPSHOT</version>

<properties>
<jnaerator.version>0.12</jnaerator.version>
</properties>

<profiles>
<profile>
<id>local (not on jitpack)</id>
<activation>
<os>
<family>mac</family>
<arch>x86_64</arch>
</os>
<property>
<name>env.JITPACK</name>
<value>!true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<execution>
<id>install-library</id>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<packaging>dylib</packaging>
<file>${project.build.directory}/libjxlwrapper-${project.version}.dylib</file>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<!-- mvn -P jnaerator jnaerator:generate -->
<id>jnaerator</id>
<build>
<plugins>
<plugin>
<groupId>com.nativelibs4java</groupId>
<artifactId>maven-jnaerator-plugin</artifactId>
<version>${jnaerator.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<javaOutputDirectory>${project.build.sourceDirectory}</javaOutputDirectory>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>8</source>
<target>8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<configuration>
<argLine>
-Djava.util.logging.config.file=${project.build.testOutputDirectory}/logging.properties
</argLine>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.9.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>com.github.umjammer</groupId>
<artifactId>vavi-commons</artifactId>
<version>1.1.9</version>
</dependency>
<dependency>
<groupId>com.github.umjammer</groupId>
<artifactId>vavi-image</artifactId>
<version>1.0.11</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.12.1</version>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
49 changes: 49 additions & 0 deletions src/main/java/vavi/awt/image/jna/libbpg/BPGExtensionData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package vavi.awt.image.jna.libbpg;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
import java.util.Arrays;
import java.util.List;
/**
* <i>native declaration : libbpg.h</i><br>
* This file was autogenerated by <a href="http://jnaerator.googlecode.com/">JNAerator</a>,<br>
* a tool written by <a href="http://ochafik.com/">Olivier Chafik</a> that <a href="http://code.google.com/p/jnaerator/wiki/CreditsAndLicense">uses a few opensource projects.</a>.<br>
* For help, please visit <a href="http://nativelibs4java.googlecode.com/">NativeLibs4Java</a> , <a href="http://rococoa.dev.java.net/">Rococoa</a>, or <a href="http://jna.dev.java.net/">JNA</a>.
*/
public class BPGExtensionData extends Structure {
/**
* @see LibbpgLibrary.BPGExtensionTagEnum
* C type : BPGExtensionTagEnum
*/
public int tag;
public int buf_len;
/** C type : uint8_t* */
public Pointer buf;
/** C type : BPGExtensionData* */
public BPGExtensionData.ByReference next;
public BPGExtensionData() {
super();
}
@Override protected List<String> getFieldOrder() {
return Arrays.asList("tag", "buf_len", "buf", "next");
}
/**
* @param tag @see BPGExtensionTagEnum<br>
* C type : BPGExtensionTagEnum<br>
* @param buf C type : uint8_t*<br>
* @param next C type : BPGExtensionData*
*/
public BPGExtensionData(int tag, int buf_len, Pointer buf, BPGExtensionData.ByReference next) {
super();
this.tag = tag;
this.buf_len = buf_len;
this.buf = buf;
this.next = next;
}
public BPGExtensionData(Pointer peer) {
super(peer);
}
public static class ByReference extends BPGExtensionData implements Structure.ByReference {
}
public static class ByValue extends BPGExtensionData implements Structure.ByValue {
}
}
Loading

0 comments on commit 567dbd0

Please sign in to comment.