Skip to content

Commit

Permalink
Switch to java 21 (#110)
Browse files Browse the repository at this point in the history
* Switch to java 21

Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>

---------

Signed-off-by: Prabhu Subramanian <prabhu@appthreat.com>
  • Loading branch information
prabhu authored Jan 13, 2024
1 parent b8b2871 commit 3d2c1a7
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 252 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ jobs:
~/.coursier
key: ${{ runner.os }}-sbt-${{ hashfiles('**/build.sbt') }}
- run: |
git apply --ignore-space-change --ignore-whitespace contrib/java21.patch
if [ $? != 0 ]; then
echo "Unable to patch the codebase correctly."
exit 1
fi
sbt stage createDistribution
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -80,24 +75,3 @@ jobs:
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=atom
cache-to: type=gha,mode=max,scope=atom
- name: Upload atom to ghcr
run: |
cd target
cp atom.zip atom-java21.zip
sha512sum atom.zip > atom.zip.sha512
sha512sum atom-java21.zip > atom-java21.zip.sha512
echo $GITHUB_TOKEN | oras login ghcr.io -u $GITHUB_USERNAME --password-stdin
oras push ghcr.io/appthreat/atom-java21:v1 \
--annotation-file ../ci/annotations.json \
./atom.zip:application/vnd.appthreat.atom.layer.v1+tar \
./atom.zip.sha512:application/vnd.appthreat.atom.layer.v1+tar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_USERNAME: ${{ github.actor }}
- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
with:
files: |
target/atom-java21.zip
target/atom-java21.zip.sha512
8 changes: 4 additions & 4 deletions .github/workflows/nodejstests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
java-version: ['17', '19', '20', '21']
node-version: ['20.x']
java-version: ['21']
node-version: ['21.x']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -61,8 +61,8 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
java-version: ['17', '19', '20', '21']
node-version: ['20.x']
java-version: ['21']
node-version: ['21.x']
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '19'
java-version: '21'
- name: Release
run: |
sbt scalafmtCheck stage assembly createDistribution
Expand Down
61 changes: 2 additions & 59 deletions .github/workflows/repotests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,68 +6,11 @@ on:
- feature/*
workflow_dispatch:
jobs:
jvm21-testing:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
java-version: [ '21' ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/checkout@v4
with:
repository: 'HooliCorp/java-sec-code'
path: 'repotests/java-sec-code'
- uses: actions/checkout@v4
with:
repository: 'DefectDojo/django-DefectDojo'
path: 'repotests/django-DefectDojo'
- uses: actions/checkout@v4
with:
repository: 'nodejs/node'
path: 'repotests/nodejs'
- uses: actions/checkout@v4
with:
repository: 'awsdocs/aws-doc-sdk-examples'
path: 'repotests/aws-doc-sdk-examples'
- uses: actions/checkout@v4
with:
repository: 'friendica/friendica'
path: 'repotests/friendica'
- uses: coursier/cache-action@v6
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: '21.x'
- run: |
git apply --ignore-space-change --ignore-whitespace contrib/java21.patch
sbt stage astGenDlTask
npm install -g @cyclonedx/cdxgen --omit=optional
cdxgen -t java --deep -o $GITHUB_WORKSPACE/repotests/java-sec-code/bom.json $GITHUB_WORKSPACE/repotests/java-sec-code
./atom.sh reachables --remove-atom -o /tmp/java-sec-code.atom -l java $GITHUB_WORKSPACE/repotests/java-sec-code -Dlog4j.configurationFile=log4j2.xml --slice-outfile /tmp/java-sec-code.reachables.json
cdxgen -t python --deep -o $GITHUB_WORKSPACE/repotests/django-DefectDojo/bom.json $GITHUB_WORKSPACE/repotests/django-DefectDojo
./atom.sh reachables --remove-atom -o /tmp/django-DefectDojo.atom -l python $GITHUB_WORKSPACE/repotests/django-DefectDojo -Dlog4j.configurationFile=log4j2.xml --slice-outfile /tmp/django-DefectDojo.reachables.json
./atom.sh usages --remove-atom -o /tmp/v8.atom -l h $GITHUB_WORKSPACE/repotests/nodejs/deps/v8 -Dlog4j.configurationFile=log4j2.xml --slice-outfile /tmp/v8.slices.json
./atom.sh usages --remove-atom -o /tmp/uv.atom -l h $GITHUB_WORKSPACE/repotests/nodejs/deps/uv -Dlog4j.configurationFile=log4j2.xml --slice-outfile /tmp/uv.slices.json
./atom.sh usages --remove-atom -o /tmp/aws.atom -l h $GITHUB_WORKSPACE/repotests/aws-doc-sdk-examples/cpp -Dlog4j.configurationFile=log4j2.xml --slice-outfile /tmp/aws.slices.json
./atom.sh usages --remove-atom -o /tmp/friendica.atom -l h $GITHUB_WORKSPACE/repotests/friendica -Dlog4j.configurationFile=log4j2.xml --slice-outfile /tmp/friend.slices.json
cdxgen -t php -o $GITHUB_WORKSPACE/repotests/friendica/bom.json $GITHUB_WORKSPACE/repotests/friendica
./atom.sh reachables --remove-atom -o /tmp/friendica2.atom -l h $GITHUB_WORKSPACE/repotests/friendica -Dlog4j.configurationFile=log4j2.xml --slice-outfile /tmp/friend2.slices.json
env:
JAVA_TOOL_OPTIONS: "-Dfile.encoding=UTF-8"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jvm-testing:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
java-version: ['17', '19', '20']
java-version: ['21']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -118,7 +61,7 @@ jobs:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: '20.x'
node-version: '21.x'
- run: |
sbt stage astGenDlTask
./atom.sh --remove-atom -o /tmp/java.atom -l java $GITHUB_WORKSPACE/repotests/shiftleft-java-example -Dlog4j.configurationFile=log4j2.xml
Expand Down
10 changes: 5 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name := "atom"
ThisBuild / organization := "io.appthreat"
ThisBuild / version := "1.8.4"
ThisBuild / version := "2.0.0"
ThisBuild / scalaVersion := "3.3.1"

val chenVersion = "1.1.6"
val chenVersion = "2.0.0"

lazy val atom = Projects.atom

Expand Down Expand Up @@ -36,17 +36,17 @@ Compile / doc / scalacOptions ++= Seq("-doc-title", "atom apidocs", "-doc-versio
ThisBuild / scalacOptions ++= Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"--release",
"17",
"21",
)

ThisBuild / compile / javacOptions ++= Seq(
"-g", // debug symbols
"-Xlint",
"--release=17"
"--release=21"
) ++ {
// fail early if users with JDK11 try to run this
val javaVersion = sys.props("java.specification.version").toFloat
assert(javaVersion.toInt >= 17, s"this build requires JDK17+ - you're using $javaVersion")
assert(javaVersion.toInt >= 21, s"this build requires JDK21+ - you're using $javaVersion")
Nil
}

Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"downloadUrl": "https://github.com/AppThreat/atom",
"issueTracker": "https://github.com/AppThreat/atom/issues",
"name": "atom",
"version": "1.8.4",
"version": "2.0.0",
"description": "Atom is a novel intermediate representation for next-generation code analysis.",
"applicationCategory": "code-analysis",
"keywords": [
Expand Down
70 changes: 0 additions & 70 deletions contrib/Dockerfile-graalvm21

This file was deleted.

16 changes: 0 additions & 16 deletions contrib/README.md

This file was deleted.

64 changes: 0 additions & 64 deletions contrib/java21.patch

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ object DataFlowGraph:
private def DF_EDGES =
Set(EdgeTypes.REACHING_DEF, EdgeTypes.CALL, EdgeTypes.REF)
val exec: ExecutorService =
Executors.newWorkStealingPool(Runtime.getRuntime.availableProcessors / 2)
Executors.newVirtualThreadPerTaskExecutor()

def buildFromSlice(slice: DataFlowSlice): DataFlowGraph =
val dfNodes = slice.nodes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DataFlowSlicing:

implicit val resolver: ICallResolver = NoResolve
protected val exec: ExecutorService =
Executors.newWorkStealingPool(Runtime.getRuntime.availableProcessors() / 2)
Executors.newVirtualThreadPerTaskExecutor()
private val excludeOperatorCalls = new AtomicBoolean(true)
private val nodeCache = new TrieMap[Long, SliceNode]()
private var language: Option[String] = _
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object UsageSlicing:

private val resolver = NoResolve
val exec: ExecutorService =
Executors.newWorkStealingPool(Runtime.getRuntime.availableProcessors() / 2)
Executors.newVirtualThreadPerTaskExecutor()
private val constructorTypeMatcher = Pattern.compile(".*new (\\w+)\\(.*")
private val excludeOperatorCalls = new AtomicBoolean(true)
private val FRAMEWORK_ROUTE = "framework-route"
Expand Down
4 changes: 2 additions & 2 deletions wrapper/nodejs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wrapper/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@appthreat/atom",
"version": "1.8.4",
"version": "2.0.0",
"description": "Create atom (⚛) representation for your application, packages and libraries",
"exports": "./index.js",
"type": "module",
Expand Down

0 comments on commit 3d2c1a7

Please sign in to comment.