Skip to content

Commit

Permalink
Merge pull request #37 from Tongsuo-Project/feature/ts84
Browse files Browse the repository at this point in the history
Upgrade Tongsuo from 8.3 to 8.4;Support Windows and MacOS
  • Loading branch information
dongbeiouba authored Sep 26, 2024
2 parents af82af3 + a9c7c90 commit 9fbdd8d
Show file tree
Hide file tree
Showing 29 changed files with 386 additions and 968 deletions.
118 changes: 61 additions & 57 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,94 +2,90 @@ name: Continuous integration

on:
workflow_dispatch:
push:
pull_request:
schedule:
# Run every day at midnight UTC
- cron: '0 0 * * *'

jobs:
build-with-tongsuo-831:
tongsuo_clone:
# This step ensures that all builders have the same version of Tongsuo
runs-on: ubuntu-latest

steps:
- name: Clone Tongsuo repo
uses: actions/checkout@v4
with:
repository: Tongsuo-Project/Tongsuo
ref: 8.4-stable
path: Tongsuo

- name: Archive Tongsuo source
uses: actions/upload-artifact@v1
with:
name: tongsuo-source
path: ${{ github.workspace }}/Tongsuo

build:
needs: tongsuo_clone
strategy:
fail-fast: true
fail-fast: false
matrix:
platform: [ubuntu-latest]
include:
- platform: ubuntu-latest
tools_url: https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
platform: [ubuntu-latest, macos-13, macos-14, windows-latest]

runs-on: ${{ matrix.platform }}

steps:
- name: Set up JDK 11 for toolchains
uses: actions/setup-java@v1.4.3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11

- name: Set up JDK 8 for toolchains
uses: actions/setup-java@v1.4.3
with:
java-version: 8

- name: Set runner-specific environment variables
shell: bash
run: |
echo "ANDROID_HOME=${RUNNER_TEMP}/android-sdk" >> $GITHUB_ENV
echo "TONGSUO_HOME=${RUNNER_TEMP}/install" >> $GITHUB_ENV
echo "SDKMANAGER=${RUNNER_TEMP}/android-sdk/tools/bin/sdkmanager" >> $GITHUB_ENV
echo "TONGSUO_SRC=${{ runner.temp }}/Tongsuo" >> $GITHUB_ENV
echo "TONGSUO_HOME=${{ runner.temp }}/ts" >> $GITHUB_ENV
- name: checkout Tongsuo 8.3.1
uses: actions/checkout@v2
- name: Fetch Tongsuo source
uses: actions/download-artifact@v1
with:
repository: Tongsuo-Project/Tongsuo
ref: 8.3-stable
path: Tongsuo831
name: tongsuo-source
path: ${{ runner.temp }}/Tongsuo

- name: Build Tongsuo831 on Linux
working-directory: ./Tongsuo831
- uses: actions/checkout@v2

- name: Build Tongsuo on Linux or macOS
if: runner.os == 'Linux' || runner.os == 'macOS'
run: |
./config --prefix=$TONGSUO_HOME enable-weak-ssl-ciphers enable-ntls
pushd ${{ runner.temp }}/Tongsuo
perl ./Configure --banner=Configured --prefix=$TONGSUO_HOME --libdir=$TONGSUO_HOME/lib enable-weak-ssl-ciphers enable-ntls no-shared
make -s -j4
make install
popd
- uses: actions/checkout@v2
- uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows'
- uses: ilammy/setup-nasm@v1
if: runner.os == 'Windows'
- uses: shogo82148/actions-setup-perl@v1
if: runner.os == 'Windows'

- name: Setup Linux environment
if: runner.os == 'Linux'
run: |
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
sudo dpkg --add-architecture i386
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get -qq update
sudo apt-get -qq install -y --no-install-recommends \
gcc-multilib \
g++-multilib \
ninja-build \
openjdk-8-jdk-headless \
openjdk-11-jre-headless
- name: Setup Android environment
shell: bash
if: runner.os == 'Linux'
- name: Build Tongsuo on Windows
if: runner.os == 'Windows'
run: |
cd "${{ runner.temp }}"
curl -L "${{ matrix.tools_url }}" -o android-tools.zip
mkdir -p "$ANDROID_HOME"
unzip -q android-tools.zip -d "$ANDROID_HOME"
yes | "$SDKMANAGER" --licenses || true
"$SDKMANAGER" tools | tr '\r' '\n' | uniq
"$SDKMANAGER" platform-tools | tr '\r' '\n' | uniq
"$SDKMANAGER" 'build-tools;28.0.3' | tr '\r' '\n' | uniq
"$SDKMANAGER" 'platforms;android-26' | tr '\r' '\n' | uniq
"$SDKMANAGER" 'extras;android;m2repository' | tr '\r' '\n' | uniq
"$SDKMANAGER" 'ndk;21.3.6528147' | tr '\r' '\n' | uniq
"$SDKMANAGER" 'cmake;3.10.2.4988404' | tr '\r' '\n' | uniq
cd $Env:TONGSUO_SRC
perl .\Configure --banner=Configured --prefix=$Env:TONGSUO_HOME no-capieng no-makedepend enable-weak-ssl-ciphers enable-ntls no-shared
nmake /S
nmake install
Get-ChildItem -Force -LiteralPath $Env:TONGSUO_HOME\lib
- name: Build with Gradle
shell: bash
run: ./gradlew assemble -PcheckErrorQueue
run: |
./gradlew --version
./gradlew assemble -PcheckErrorQueue
- name: Test with Gradle
shell: bash
Expand All @@ -103,3 +99,11 @@ jobs:
if: runner.os == 'Linux'
shell: bash
run: ./gradlew :tongsuo-openjdk:testJar -PcheckErrorQueue

- name: Upload test JAR with dependencies
if: runner.os == 'Linux'
uses: actions/upload-artifact@v2
with:
name: testjar
path: openjdk/build/libs/tongsuo-openjdk-*-tests.jar
if-no-files-found: error
38 changes: 0 additions & 38 deletions .github/workflows/vsenv.ps1

This file was deleted.

17 changes: 9 additions & 8 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ described below.
Then to build, run:

```bash
$ ./gradlew build -PtongsuoHome=/opt/tongsuo -PjdkHome=/path/to/jdk
$ ./gradlew build -PtongsuoHome=/opt/tongsuo
```

To publish the artifacts to your Maven local repository for use in your own project, run:

```bash
$ ./gradlew publishToMavenLocal -PtongsuoHome=/opt/tongsuo -PjdkHome=/path/to/jdk
$ ./gradlew publishToMavenLocal -PtongsuoHome=/opt/tongsuo
```

Prerequisites
Expand All @@ -29,10 +29,11 @@ The build requires that you have the `JAVA_HOME` environment variable pointing t
Download Tongsuo and then build as follows:

```bash
wget https://github.com/Tongsuo-Project/Tongsuo/releases/download/8.3.2/BabaSSL-8.3.2.tar.gz
tar xzvf BabaSSL-8.3.2.tar.gz
cd Tongsuo-8.3.2
./config no-shared enable-ntls enable-weak-ssl-ciphers --release --prefix=/opt/tongsuo
git clone https://github.com/Tongsuo-Project/Tongsuo.git
cd Tongsuo
git checkout 8.4-stable

./config no-shared enable-ntls enable-weak-ssl-ciphers --release --prefix=/opt/tongsuo --libdir=/opt/tongsuo/lib
make -j
make install
```
Expand All @@ -41,15 +42,15 @@ Running tests
-------------------------

```bash
./gradlew test -PtongsuoHome=/opt/tongsuo -PjdkHome=/path/to/jdk
./gradlew test -PtongsuoHome=/opt/tongsuo
```

Coverage
--------
To see coverage numbers, run the tests and then execute the jacocoTestReport rule

```bash
./gradlew check jacocoTestReport -PtongsuoHome=/opt/tongsuo -PjdkHome=/path/to/jdk
./gradlew check jacocoTestReport -PtongsuoHome=/opt/tongsuo
```

The report will be placed in `openjdk/build/reports/jacoco/test/html/index.html`
36 changes: 0 additions & 36 deletions android-stub/src/main/java/javax/net/ssl/ExtendedSSLSession.java

This file was deleted.

30 changes: 0 additions & 30 deletions android-stub/src/main/java/javax/net/ssl/SNIHostName.java

This file was deleted.

30 changes: 0 additions & 30 deletions android-stub/src/main/java/javax/net/ssl/SNIServerName.java

This file was deleted.

28 changes: 0 additions & 28 deletions android-stub/src/main/java/javax/net/ssl/StandardConstants.java

This file was deleted.

Loading

0 comments on commit 9fbdd8d

Please sign in to comment.