Skip to content

graalvm native image #24

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

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
54 changes: 54 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CI Build

permissions:
contents: write
on:
push:
branches:
- master

jobs:
build:
name: Building java-curl on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- uses: graalvm/setup-graalvm@v1
with:
version: "latest"
java-version: "17"
components: "native-image"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: checkout
uses: actions/checkout@v2
- name: create the native image
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -ntp -DskipTests -Pnative package
- name: rename
if: matrix.os == 'ubuntu-latest'
run: mv target/java-curl java-curl-${{ matrix.os }}
- name: rename
if: matrix.os == 'macos-latest'
run: mv target/java-curl java-curl-${{ matrix.os }}
- name: rename
if: matrix.os == 'windows-latest'
run: mv target/java-curl.exe java-curl-${{ matrix.os }}.exe

- name: Upload binary
uses: actions/upload-artifact@v2
with:
name: java-curl-${{ matrix.os }}
path: target/java-curl

- name: Release with Notes
uses: softprops/action-gh-release@v1
with:
# draft: true
tag_name: ${{ github.run_number }}.${{ github.run_id }}
target_commitish: ${{ github.sha }}
files: |
java-curl*

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ hs_err_pid*
java-curl.iml
.idea
target
.vscode
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
java-curl is a pure-java HTTP utility implemented based on HttpURLConnection in the standard JRE, while the usage references to the commonly-used CURL command line tool under Linux.

# Features
* Based on the standard JRE, the source compatibility level is 1.6, can be used on Java server-side, Android and other Java environments.
* Based on the standard JRE, the source compatibility level is 11, can be used on Java server-side, Android and other Java environments.
* The code is super compact (one java file with less than 2000 lines), without any external dependencies, can be easily reused at source level.
* Easy to use, fully compatible with the most common switches of CURL tool, can be directly used as a command line tool.
* Support all HTTP methods; Support multi-part file uploads; Support simple HTTP authentication.
Expand Down
49 changes: 47 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>8</source>
<target>8</target>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<!-- Source -->
Expand Down Expand Up @@ -168,4 +168,49 @@
</repository>
</distributionManagement>

<pluginRepositories>
<pluginRepository>
<id>graalvm-native-build-tools-snapshots</id>
<name>GraalVM native-build-tools Snapshots</name>
<url>https://raw.githubusercontent.com/graalvm/native-build-tools/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>

<profiles>
<profile>
<id>native</id>
<build>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>0.10.1</version>
<extensions>true</extensions>
<executions>
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<mainClass>com.roxstudio.utils.CUrl</mainClass>
<buildArgs>
<buildArg>--no-fallback</buildArg>
</buildArgs>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>