Skip to content

Commit

Permalink
adds basic reachability integeration in cli
Browse files Browse the repository at this point in the history
  • Loading branch information
meghfossa committed Jan 17, 2024
1 parent ca9f7d9 commit 3ca673f
Show file tree
Hide file tree
Showing 11 changed files with 335 additions and 7 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/build-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ jobs:
find . -type f -path '*/fossa/fossa.exe' -exec cp {} release \;
cp target/release/diagnose.exe release
cp target/release/millhone.exe release
cp target/release/reachability.exe release
- name: Find and move binaries (non-Windows)
if: ${{ !contains(matrix.os, 'windows') }}
Expand All @@ -210,6 +211,7 @@ jobs:
find . -type f -path '*/fossa/fossa' -exec cp {} release \;
cp target/release/diagnose release
cp target/release/millhone release
cp target/release/reachability release
- name: Strip binaries
run: |
Expand Down Expand Up @@ -247,6 +249,7 @@ jobs:
codesign --options runtime -s 'FOSSA, Inc.' release/fossa
codesign --options runtime -s 'FOSSA, Inc.' release/diagnose
codesign --options runtime -s 'FOSSA, Inc.' release/millhone
codesign --options runtime -s 'FOSSA, Inc.' release/reachability
# Perform notarization
zip -rj notarization-archive.zip release
Expand Down Expand Up @@ -316,13 +319,15 @@ jobs:
cosign sign-blob --yes --bundle "Linux-binaries/fossa.bundle" "Linux-binaries/fossa"
cosign sign-blob --yes --bundle "Linux-binaries/diagnose.bundle" "Linux-binaries/diagnose"
cosign sign-blob --yes --bundle "Linux-binaries/millhone.bundle" "Linux-binaries/millhone"
cosign sign-blob --yes --bundle "Linux-binaries/reachability.bundle" "Linux-binaries/reachability"
- name: Verify Signatures
if: ${{ github.ref_type == 'tag' }}
run: |
cosign verify-blob --bundle "Linux-binaries/fossa.bundle" --certificate-oidc-issuer "https://token.actions.githubusercontent.com" --certificate-identity "https://github.com/$GITHUB_WORKFLOW_REF" "Linux-binaries/fossa"
cosign verify-blob --bundle "Linux-binaries/diagnose.bundle" --certificate-oidc-issuer "https://token.actions.githubusercontent.com" --certificate-identity "https://github.com/$GITHUB_WORKFLOW_REF" "Linux-binaries/diagnose"
cosign verify-blob --bundle "Linux-binaries/millhone.bundle" --certificate-oidc-issuer "https://token.actions.githubusercontent.com" --certificate-identity "https://github.com/$GITHUB_WORKFLOW_REF" "Linux-binaries/millhone"
cosign verify-blob --bundle "Linux-binaries/reachability.bundle" --certificate-oidc-issuer "https://token.actions.githubusercontent.com" --certificate-identity "https://github.com/$GITHUB_WORKFLOW_REF" "Linux-binaries/reachability"
# This uses names compatible with our install script.
#
Expand All @@ -339,6 +344,8 @@ jobs:
LINUX_DIAGNOSE_ZIP_PATH: "release/diagnose_${{ steps.get-version.outputs.VERSION }}_linux_amd64.zip"
LINUX_MILLHONE_TAR_PATH: "release/millhone_${{ steps.get-version.outputs.VERSION }}_linux_amd64.tar"
LINUX_MILLHONE_ZIP_PATH: "release/millhone_${{ steps.get-version.outputs.VERSION }}_linux_amd64.zip"
LINUX_REACHABILITY_TAR_PATH: "release/reachability_${{ steps.get-version.outputs.VERSION }}_linux_amd64.tar"
LINUX_REACHABILITY_ZIP_PATH: "release/reachability_${{ steps.get-version.outputs.VERSION }}_linux_amd64.zip"
run: |
mkdir release
Expand All @@ -348,32 +355,39 @@ jobs:
zip -j "$LINUX_FOSSA_ZIP_PATH" Linux-binaries/fossa
zip -j "$LINUX_DIAGNOSE_ZIP_PATH" Linux-binaries/diagnose
zip -j "$LINUX_MILLHONE_ZIP_PATH" Linux-binaries/millhone
zip -j "$LINUX_REACHABILITY_ZIP_PATH" Linux-binaries/reachability
tar --create --verbose --file "$LINUX_FOSSA_TAR_PATH" --directory Linux-binaries fossa
tar --create --verbose --file "$LINUX_DIAGNOSE_TAR_PATH" --directory Linux-binaries diagnose
tar --create --verbose --file "$LINUX_MILLHONE_TAR_PATH" --directory Linux-binaries millhone
tar --create --verbose --file "$LINUX_REACHABILITY_TAR_PATH" --directory Linux-binaries reachability
if [ "$GITHUB_REF_TYPE" = "tag" ]; then
tar --append --file "$LINUX_FOSSA_TAR_PATH" --directory Linux-binaries fossa.bundle
tar --append --file "$LINUX_DIAGNOSE_TAR_PATH" --directory Linux-binaries diagnose.bundle
tar --append --file "$LINUX_MILLHONE_TAR_PATH" --directory Linux-binaries millhone.bundle
tar --append --file "$LINUX_REACHABILITY_TAR_PATH" --directory Linux-binaries reachability.bundle
zip -j "$LINUX_FOSSA_ZIP_PATH" Linux-binaries/fossa.bundle
zip -j "$LINUX_DIAGNOSE_ZIP_PATH" Linux-binaries/diagnose.bundle
zip -j "$LINUX_MILLHONE_ZIP_PATH" Linux-binaries/millhone.bundle
zip -j "$LINUX_REACHABILITY_ZIP_PATH" Linux-binaries/reachability.bundle
fi
gzip "$LINUX_FOSSA_TAR_PATH"
gzip "$LINUX_DIAGNOSE_TAR_PATH"
gzip "$LINUX_MILLHONE_TAR_PATH"
gzip "$LINUX_REACHABILITY_TAR_PATH"
chmod +x macOS-binaries/*
zip -j release/fossa_${{ steps.get-version.outputs.VERSION }}_darwin_amd64.zip macOS-binaries/fossa
zip -j release/diagnose_${{ steps.get-version.outputs.VERSION }}_darwin_amd64.zip macOS-binaries/diagnose
zip -j release/millhone_${{ steps.get-version.outputs.VERSION }}_darwin_amd64.zip macOS-binaries/millhone
zip -j release/reachability_${{ steps.get-version.outputs.VERSION }}_darwin_amd64.zip macOS-binaries/reachability
chmod +x Windows-binaries/*
zip -j release/fossa_${{ steps.get-version.outputs.VERSION }}_windows_amd64.zip Windows-binaries/fossa.exe
zip -j release/diagnose_${{ steps.get-version.outputs.VERSION }}_windows_amd64.zip Windows-binaries/diagnose.exe
zip -j release/millhone_${{ steps.get-version.outputs.VERSION }}_windows_amd64.zip Windows-binaries/millhone.exe
zip -j release/reachability_${{ steps.get-version.outputs.VERSION }}_darwin_amd64.zip macOS-binaries/reachability.exe
- name: Create checksums
# We have to run from within the release dir so that "release" isn't prepended to the relative path of the zip file.
Expand Down
105 changes: 98 additions & 7 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
members = [
"extlib/berkeleydb",
"extlib/millhone",
"extlib/reachability",
"tools/diagnose",
]

Expand Down
17 changes: 17 additions & 0 deletions extlib/reachability/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "reachability"
version = "0.0.1"
edition = "2021"

[features]
default = []

[dependencies]
tikv-jemallocator = { version = "0.5.4", optional = true }
clap = { version = "4.0.0", features = ["derive"] }
simple_logger = { version = "4.3.3", features = ["stderr", "colors"], default-features = false }
log = "0.4.17"
snippets = { git = "https://github.com/fossas/lib-snippets", version = "0.2.0", features = ["lang-java-11"] }
stable-eyre = "0.2.2"
serde = { version = "1.0.144", features = ["derive"] }
serde_json = "1.0.85"
21 changes: 21 additions & 0 deletions extlib/reachability/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# reachability

Parses source code, and produces call graphs for
set of source code files.

## usage

```shell
; reachability --target {directory}
; reachability --target {path_to_file}

# with stdin
; cat {file} | reachability
```

## building

In the root directory, run `cargo build --bin reachability`.
If release mode is desired, append `--release`.

Output symbols are found in `target/debug/reachability` or `target/release/reachability`.
33 changes: 33 additions & 0 deletions extlib/reachability/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//! Parses language source code to create call graphs.
//!
//! # Supported Parser
//! - Java
use log::debug;
use serde::Serialize;
use snippets::content::Content;
use stable_eyre::{eyre::Context, Result};
use std::io::{self, Read};
use std::path::PathBuf;

#[derive(Debug, Serialize)]
pub struct Reachability {}

impl Reachability {
pub fn from_stdin() -> Result<Self> {
let mut stdin = String::new();
io::stdin()
.read_to_string(&mut stdin)
.context("buffer stdin")?;
Reachability::from_string(&stdin)
}

pub fn from_string(s: &str) -> Result<Self> {
let _content = Content::new(s.into());
todo!();
}

pub fn from_fs(path: &PathBuf) -> Result<Self> {
debug!("Parsing file system: {path:?}");
todo!();
}
}
Loading

0 comments on commit 3ca673f

Please sign in to comment.