Skip to content

Commit

Permalink
Using libgoast instead of manually compiling the Go library (#1466)
Browse files Browse the repository at this point in the history
This also removes the extra macOS build step and should help with Jitpack Go builds.
  • Loading branch information
oxisto authored Mar 19, 2024
1 parent bcaee5c commit 6c2a509
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 1,066 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,8 @@ on:
- "docs/**"

jobs:
build-cpgo-osx:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: cpg-language-go/src/main/golang/go.mod
cache-dependency-path: cpg-language-go/src/main/golang/go.sum
- name: Build
run: |
cd cpg-language-go/src/main/golang
./build.sh
- name: Archive cpgo library (amd64)
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: libcpgo-amd64.dylib
path: cpg-language-go/src/main/resources/libcpgo-amd64.dylib
- name: Archive cpgo library (arm64)
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: libcpgo-arm64.dylib
path: cpg-language-go/src/main/resources/libcpgo-arm64.dylib

build:
runs-on: [self-hosted, linux, x64, faster]
needs: build-cpgo-osx
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -94,14 +67,6 @@ jobs:
if [ -d "/opt/hostedtoolcache/Python" ]; then
find /opt/hostedtoolcache/Python/ -name libjep.so -exec sudo cp '{}' /usr/lib/ \;
fi
- uses: actions/download-artifact@v4
with:
name: libcpgo-arm64.dylib
path: cpg-language-go/src/main/resources/
- uses: actions/download-artifact@v4
with:
name: libcpgo-amd64.dylib
path: cpg-language-go/src/main/resources/
- name: Build ${{ env.version }}
run: |
if [ "$SONAR_TOKEN" != "" ]
Expand Down
22 changes: 10 additions & 12 deletions cpg-language-go/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,16 @@ dependencies {
testImplementation(project(":cpg-analysis"))
}

if (!project.hasProperty("skipGoBuild")) {
val compileGolang = tasks.register("compileGolang") {
doLast {
project.exec {
commandLine("./build.sh")
.setStandardOutput(System.out)
.workingDir("src/main/golang")
}
val downloadLibGoAST = tasks.register("downloadLibGoAST") {
doLast {
project.exec {
commandLine("./download.sh")
.setStandardOutput(System.out)
.workingDir("src/main/resources")
}
}
}

tasks.compileJava {
dependsOn(compileGolang)
}
}
tasks.processResources {
dependsOn(downloadLibGoAST)
}
17 changes: 0 additions & 17 deletions cpg-language-go/src/main/golang/.vscode/tasks.json

This file was deleted.

16 changes: 0 additions & 16 deletions cpg-language-go/src/main/golang/build.sh

This file was deleted.

8 changes: 0 additions & 8 deletions cpg-language-go/src/main/golang/go.mod

This file was deleted.

4 changes: 0 additions & 4 deletions cpg-language-go/src/main/golang/go.sum

This file was deleted.

Loading

0 comments on commit 6c2a509

Please sign in to comment.