Skip to content

Commit 8b3942b

Browse files
committed
Initial code commit
Signed-off-by: Maximilian Huber <maximilian.huber@tngtech.com>
1 parent b30ec93 commit 8b3942b

File tree

319 files changed

+1081204
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

319 files changed

+1081204
-0
lines changed

.circleci/build_opossum_frontend.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
# SPDX-FileCopyrightText: Facebook, Inc. and its affiliates
4+
# SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com>
5+
#
6+
# SPDX-License-Identifier: Apache-2.0
7+
8+
set -euo pipefail
9+
10+
curr_branch=$(git rev-parse --abbrev-ref HEAD)
11+
commit=$(git rev-parse --short HEAD)
12+
echo "Current branch is $curr_branch"
13+
14+
echo "Building the application."
15+
sudo dpkg --add-architecture i386 && sudo apt-get update && sudo apt-get install wine wine32
16+
yarn ship-linux
17+
yarn ship-mac
18+
yarn ship-win
19+
cd release/macOS/
20+
zip -r -q "opossum-ui-mac.zip" "opossum-ui-darwin-x64/"
21+
mkdir "/home/circleci/project/release/builds"
22+
mv "/home/circleci/project/release/linux_and_windows/opossum-ui-0.1.0.AppImage" "/home/circleci/project/release/builds/opossum-ui-linux-${commit}.AppImage"
23+
mv "/home/circleci/project/release/macOS/opossum-ui-mac.zip" "/home/circleci/project/release/builds/opossum-ui-mac-${commit}.zip"
24+
mv "/home/circleci/project/release/linux_and_windows/opossum-ui Setup 0.1.0.exe" "/home/circleci/project/release/builds/opossum-ui-windows-${commit}.exe"
25+
test -e "/home/circleci/project/release/builds/opossum-ui-linux-${commit}.AppImage"
26+
test -e "/home/circleci/project/release/builds/opossum-ui-mac-${commit}.zip"
27+
test -e "/home/circleci/project/release/builds/opossum-ui-windows-${commit}.exe"

.circleci/config.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# SPDX-FileCopyrightText: Facebook, Inc. and its affiliates
2+
# SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com>
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
version: 2.1
7+
8+
jobs:
9+
reuse-lint:
10+
docker:
11+
- image: cimg/python:3.9.7
12+
steps:
13+
- checkout
14+
- run: pip3 install --user reuse
15+
- run: reuse lint
16+
build-and-test:
17+
docker:
18+
- image: cimg/node:16.8.0
19+
steps:
20+
- checkout
21+
22+
- restore_cache:
23+
name: Restore Yarn Package Cache
24+
keys:
25+
- yarn-packages-{{ checksum "yarn.lock" }}
26+
- run:
27+
name: Install Dependencies
28+
command: yarn install --pure-lockfile --non-interactive
29+
- save_cache:
30+
name: Save Yarn Package Cache
31+
key: yarn-packages-{{ checksum "yarn.lock" }}
32+
paths:
33+
- ~/.cache/yarn
34+
35+
- run: yarn lint-check
36+
- run: yarn compile-all
37+
38+
- when:
39+
condition:
40+
equal: [ main, << pipeline.git.branch >> ]
41+
steps:
42+
- run: yarn unit-test
43+
- run: yarn build
44+
45+
- when:
46+
condition:
47+
and:
48+
- equal: [ main, << pipeline.git.branch >> ]
49+
- matches: { pattern: "^OpossumUI-.+$", value: << pipeline.git.tag >> }
50+
steps:
51+
- run:
52+
name: Build applications if on master
53+
command: .circleci/build_opossum_frontend.sh
54+
- store_artifacts:
55+
path: /home/circleci/project/notices/
56+
- store_artifacts:
57+
path: /home/circleci/project/README.md
58+
- store_artifacts:
59+
path: /home/circleci/project/release/builds
60+
destination: opossum-ui
61+
62+
workflows:
63+
workflow:
64+
jobs:
65+
- reuse-lint
66+
- build-and-test

.eslintrc.js

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// SPDX-FileCopyrightText: Facebook, Inc. and its affiliates
2+
// SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com>
3+
//
4+
// SPDX-License-Identifier: Apache-2.0
5+
6+
module.exports = {
7+
env: {
8+
browser: true,
9+
es6: true,
10+
node: true,
11+
jest: true,
12+
},
13+
parser: '@typescript-eslint/parser',
14+
extends: [
15+
'plugin:react/recommended',
16+
'plugin:@typescript-eslint/recommended',
17+
'plugin:prettier/recommended',
18+
'prettier',
19+
'plugin:react-hooks/recommended',
20+
],
21+
globals: {
22+
Atomics: 'readonly',
23+
SharedArrayBuffer: 'readonly',
24+
},
25+
parserOptions: {
26+
ecmaFeatures: {
27+
jsx: true,
28+
},
29+
ecmaVersion: 2018,
30+
sourceType: 'module',
31+
project: ['tsconfig.json', 'src/ElectronBackend/tsconfig.json'],
32+
},
33+
plugins: ['react', 'prettier', 'testing-library'],
34+
settings: {
35+
react: {
36+
version: 'detect',
37+
},
38+
},
39+
rules: {
40+
'@typescript-eslint/ban-ts-ignore': 0,
41+
'@typescript-eslint/ban-ts-comment': 0,
42+
'@typescript-eslint/no-empty-function': 0,
43+
'@typescript-eslint/no-explicit-any': 2,
44+
'@typescript-eslint/no-unused-vars': 2,
45+
'@typescript-eslint/explicit-function-return-type': 2,
46+
'@typescript-eslint/await-thenable': 2,
47+
'@typescript-eslint/require-await': 2,
48+
'react/prop-types': 'off',
49+
quotes: [2, 'single', { avoidEscape: true }],
50+
},
51+
};

.github/workflows/build.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# SPDX-FileCopyrightText: Facebook, Inc. and its affiliates
2+
# SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com>
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
name: Build
7+
8+
on: push
9+
10+
jobs:
11+
build:
12+
runs-on: ${{ matrix.os }}
13+
14+
env:
15+
USE_SYSTEM_7ZA: 'true'
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-latest, macos-latest] # add windows-latest to os array
21+
include:
22+
- os: ubuntu-latest
23+
SHIP: ship-linux
24+
- os: macos-latest
25+
SHIP: ship-mac
26+
# - os: windows-latest
27+
# SHIP: ship-win
28+
29+
steps:
30+
- name: Check out Git repository
31+
uses: actions/checkout@v1
32+
33+
- name: Install Node.js, NPM and Yarn
34+
uses: actions/setup-node@v1
35+
with:
36+
node-version: 16
37+
38+
- run: yarn install
39+
- run: yarn lint-check
40+
- run: yarn compile-all
41+
- run: yarn test
42+
43+
- run: yarn ${{matrix.SHIP}}

.gitignore

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# dependencies
2+
/node_modules
3+
4+
# testing
5+
/coverage
6+
/src/commitInfo.json
7+
/example-files/*_attributions.json
8+
/example-files/*_follow_up.csv
9+
/example-files/*_component_list.csv
10+
/example-files/*.spdx.yaml
11+
/example-files/*.spdx.json
12+
/example-files/performance_tests/*_attributions.json
13+
/example-files/performance_tests/*_follow_up.csv
14+
/example-files/performance_tests/*_component_list.csv
15+
16+
# production
17+
/build
18+
19+
# release
20+
/release
21+
22+
# misc
23+
.DS_Store
24+
.env.local
25+
.env.development.local
26+
.env.test.local
27+
.env.production.local
28+
29+
yarn-debug.log*
30+
yarn-error.log*
31+
32+
.idea
33+
/opossumUI.iml
34+
/notices

.prettierrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"singleQuote": true
3+
}

.reuse/dep5

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2+
Source: https://github.com/opossum-tool/opossumUI
3+
4+
Files: *.json
5+
*.json.gz
6+
.prettierrc
7+
**.gitignore
8+
**yarn.lock
9+
Copyright: Facebook, Inc. and its affiliates
10+
TNG Technology Consulting GmbH <https://www.tngtech.com>
11+
License: Apache-2.0
12+
13+
Files: docs/*
14+
src/ElectronBackend/logo/*
15+
Copyright: Facebook, Inc. and its affiliates
16+
TNG Technology Consulting GmbH <https://www.tngtech.com>
17+
License: CC0-1.0

CONTRIBUTING.md

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
<!--
2+
SPDX-FileCopyrightText: Facebook, Inc. and its affiliates
3+
SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com>
4+
5+
SPDX-License-Identifier: CC0-1.0
6+
-->
7+
8+
# Contributing
9+
10+
Contributions are very welcome. The following will provide some helpful guidelines.
11+
12+
## How to contribute
13+
14+
### Commits
15+
16+
Commit messages should be clear and fully elaborate the context and the reason of a change.
17+
If your commit refers to an issue, please post-fix it with the issue number, e.g.
18+
19+
```
20+
Issue: #123
21+
```
22+
23+
Furthermore, commits should be signed off according to the [DCO](DCO.md).
24+
25+
### Pull Requests
26+
27+
If your Pull Request resolves an issue, please add a respective line to the end, like
28+
29+
```
30+
Resolves #123
31+
```
32+
33+
## Developer's guide
34+
35+
OpossumUI is an Electron app written in TypeScript.
36+
The frontend uses React (where functional components are used whenever possible) with Redux for state management.
37+
38+
All useful scripts are listed in the package.json and can be run through `yarn` and can be called after cloning the repository and installing all dependencies.
39+
To start the app based on the current state of the code, including automatic updates after changes to the frontend, execute:
40+
41+
```
42+
yarn start
43+
```
44+
45+
Unit tests are provided for all features, aided by integration tests when helpful. The testing framework is jest + react
46+
testing library. They can be run locally by executing:
47+
48+
```
49+
yarn test
50+
```
51+
52+
Prettier is used as a code formatter.
53+
54+
### Requirements
55+
56+
The following software is required for working on the repository:
57+
58+
- a Unix-based OS,
59+
- [git](https://git-scm.com/),
60+
- [node.js](https://nodejs.org/) 14+,
61+
- [yarn](https://yarnpkg.com/en/),
62+
- [reuse.software](https://reuse.software/) (to check that copyright information is provided),
63+
- [wine](https://www.winehq.org/) (only to build the Windows version).
64+
65+
### How to build the project
66+
67+
See the [user's quick start guide](README.md#user_quick_start_guide).
68+
69+
### <a id="file_formats"></a> File formats
70+
71+
JSON schemas for both the [input](src/ElectronBackend/input/OpossumInputFileSchema.json)
72+
and [output](src/ElectronBackend/input/OpossumOutputFileSchema.json) files are available. Example files can be found
73+
under [example files](example-files/).
74+
75+
#### Input file
76+
77+
It has to be generated through external tools and provided to the app. Contains 5 main fields:
78+
79+
- `metadata`: contains some project-level information,
80+
- `resources`: defines the file tree,
81+
- `externalAttributions`: contains all attributions which are provided as signals (preselected signals will be
82+
automatically used by the app to create attributions in the output file),
83+
- `resourcesToAttributions`: links attributions to file paths,
84+
- `frequentlicenses`: A list of licenses that can be selected in a dropdown when the user enters a license name.
85+
86+
There are additional fields which are optional:
87+
88+
- `attributionBreakpoints`: a list of folder paths where attribution inference stops, e.g. `node_modules`."
89+
- `filesWithChildren`: a list of folders that are treated as files. This can be used to attach another file tree to files like `package.json`, usually also setting an attribution breakpoint.
90+
- `baseUrlsForSources`: a map from paths to the respective base url. The base url should contain a {path} placeholder. E.g. `"baseUrlsForSources": {
91+
"/": "https://github.com/opossum-tool/opossumUI/blob/main/{path}"
92+
}`
93+
94+
#### Output file
95+
96+
Contains 4 main fields:
97+
98+
- `metadata`: contains some project-level information,
99+
- `manualAttributions`: contains all attributions created by the user or preselected,
100+
- `resourcesToAttributions`: links attributions to file paths,
101+
- `resolvedExternalAttributions`: used to store which signal attributions have been resolved, as they are hidden in the
102+
UI.

CONTRIBUTORS.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!--
2+
SPDX-FileCopyrightText: Facebook, Inc. and its affiliates
3+
SPDX-FileCopyrightText: TNG Technology Consulting GmbH <https://www.tngtech.com>
4+
5+
SPDX-License-Identifier: CC0-1.0
6+
-->
7+
8+
# Contributors (sorted alphabetically)
9+
10+
* **[Anton Bauhofer](https://github.com/antonbauhofer)** (<anton.bauhofer@tngtech.com>)
11+
* **[Benedikt Richter](https://github.com/benedikt-richter)**
12+
* **[Benjamin Petek](https://github.com/b-petek)**
13+
* **[Indira Bhatt](https://github.com/indirabhatt)** (<Indira.bhatt@gmail.com>)
14+
* **[Jakob Schubert](https://github.com/JakobSchubert)**
15+
* **[Jonas Tai](https://github.com/jonas-tai)**
16+
* **[Leslie Lazzarino](https://github.com/leslielazzarino)** (<leslie.lazzarino@tngtech.com>)
17+
* **[Maximilian Huber](https://github.com/maxhbr)** (<maximilian.huber@tngtech.com>)
18+
* **[Michael Cheng](https://github.com/syotfs)** (<m@priorart.io>)
19+
* **[Nico Carl](https://github.com/nicarl)**
20+
* **[Sebastian Thomas](https://github.com/sebathomas)** (<sebastian.thomas@tngtech.com>)
21+
22+
[Full contributors list](https://github.com/opossum-tool/OpossumUI/contributors).
23+

0 commit comments

Comments
 (0)