Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Commit

Permalink
removing js and java implementations
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Hoang <[email protected]>
  • Loading branch information
mike-hoang committed Apr 19, 2023
1 parent 894ac41 commit b903c3c
Show file tree
Hide file tree
Showing 106 changed files with 52 additions and 7,817 deletions.
63 changes: 1 addition & 62 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,75 +1,14 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java/Js CI
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build-java:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: mvn -B verify -f java

build-native:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Graalvm
# 4.0
uses: DeLaGuardo/setup-graalvm@a766aa7b5fcc0a801fa3d4fd521ca299c03c9c00
with:
graalvm: '21.0.0.2'
java: java11
- name: Install native-image
run: |
gu install native-image
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build with Maven
run: mvn -B verify -Pnative -f java

build-js:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 14
- name: Install dependencies
run: npm install
working-directory: js
- name: Build
run: npm run test
working-directory: js

build-go:
runs-on: ubuntu-latest
steps:
Expand Down
86 changes: 0 additions & 86 deletions .github/workflows/release.yml

This file was deleted.

33 changes: 15 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,47 @@
# Alizer

[release-svg]: https://img.shields.io/nexus/r/com.redhat.devtools.alizer/alizer?server=https%3A%2F%2Frepository.jboss.org%2Fnexus
[nightly-svg]: https://img.shields.io/nexus/s/com.redhat.devtools.alizer/alizer?server=https%3A%2F%2Frepository.jboss.org%2Fnexus

![Build status](https://github.com/redhat-developer/alizer/actions/workflows/CI.yml/badge.svg)
![Release][release-svg]
![Nightly][nightly-svg]

## Overview

Alizer (which stands for Application Analyzer) is a utilily whose goal is to extract informations about an application source code.
Such informations are:

* Programming languages.
* Frameworks.
* Tools used to build the application.
- Programming languages.
- Frameworks.
- Tools used to build the application.

Additionaly, Alizer can also select one devfile (cloud workspace file) from a list of available devfiles and/or
detect components (the concept of component is taken from Odo and its definition can be read on [odo.dev](https://odo.dev/docs/getting-started/basics/#component)).

In order to be easily intergrated in other projects, comes in 3 different implementations:

* Go library & CLI
* **[Deprecated]** Java library & CLI
* **[Deprecated]** NPM package

*NOTE: Not all implementations support the same features. Please check the table at [alizer-spec](docs/public/alizer-spec.md#feature-table) for a detailed overview.*

## Usage
As mentioned above Alizer comes with 3 different implementations. Each one has a different usage guide:

* [Go library & CLI](go/README.md#Usage)
* **[Deprecated]** [Java library & CLI](java/README.md#Usage)
* **[Deprecated]** [NPM package](js/README.md#Usage)
- [Go library & CLI](go/README.md#Usage)

## Contributing

This is an open source project open to anyone. This project welcomes contributions and suggestions!

For information on getting started, refer to the [CONTRIBUTING instructions](CONTRIBUTING.md).

## Release process

The release process of `alizer` is very straightforward. You can create a new release [here](https://github.com/redhat-developer/alizer/releases/new).

* The *title* of the release has to be the new version. `Alizer` follows the `{major}.{minor}.{bugfix}` format (e.g `0.1.0`)
* The *description* of the release is optional. You may add a description if there were outstanding updates in the project, not mentioned in the issues or PRs of this release.
- The _title_ of the release has to be the new version. `Alizer` follows the `{major}.{minor}.{bugfix}` format (e.g `0.1.0`)
- The _description_ of the release is optional. You may add a description if there were outstanding updates in the project, not mentioned in the issues or PRs of this release.

## Feedback & Questions

If you discover an issue please file a bug and we will fix it as soon as possible.
* File a bug in [GitHub Issues](https://github.com/redhat-developer/alizer/issues).

- File a bug in [GitHub Issues](https://github.com/redhat-developer/alizer/issues).

## License

EPL 2.0, See [LICENSE](LICENSE) for more information.
86 changes: 36 additions & 50 deletions docs/public/alizer-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@ This document outlines the features Alizer offers and how they actually work.

Currently, Alizer provides 3 detection options:

- *Language Detection* (Language/Tools/Frameworks)
- *DevFile Detection*
- *Component Detection*

in 3 different implementations:

- Golang library & CLI.
- **[Deprecated]**: Java library & CLI.
- **[Deprecated]**: NPM package.
- _Language Detection_ (Language/Tools/Frameworks)
- _DevFile Detection_
- _Component Detection_

## Language Detection

Expand All @@ -33,26 +27,26 @@ presence (>2% total files) are taken into account for further calculations. If a

### Java

The first step in our deeper Java detection is finding the configuration file used. If a `pom.xml` file is discovered,
The first step in our deeper Java detection is finding the configuration file used. If a `pom.xml` file is discovered,
Alizer assumes is a Maven project. The same for a `build.gradle` file which is a Gradle Project or a `build.xml` for an
Ant project.

NOTE: Maven, Gradle and Ant are saved as Tools inside the data structure returned by the analyze primitive

By reading the content of its configuration file and mainly its dependencies section, Alizer is also able to detect
By reading the content of its configuration file and mainly its dependencies section, Alizer is also able to detect
frameworks. Currently, it recognizes:

- Micronaut
- OpenLiberty
- OpenLiberty
- Quarkus
- SpringBoot
- Vertx

```
{
name: 'java',
tools: [ 'maven' ],
frameworks: [ 'quarkus' ]
{
name: 'java',
tools: [ 'maven' ],
frameworks: [ 'quarkus' ]
}
```

Expand All @@ -72,28 +66,28 @@ At this point, it reads its content looking for dependencies to discover framewo
- Vue

```
{
name: 'javascript',
tools: [ 'nodejs' ],
frameworks: [ 'express' ]
{
name: 'javascript',
tools: [ 'nodejs' ],
frameworks: [ 'express' ]
}
```

### Python

Currently, the only Python framework Alizer is able to detect is Django.
To recognize it, it scans all files within the source looking for a file such as `manage.py`, `urls.py`, `wsgi.py`,
To recognize it, it scans all files within the source looking for a file such as `manage.py`, `urls.py`, `wsgi.py`,
`asgi.py`. If at least one of them if discovered, it checks its content looking for a django import.

```
{
name: 'python',
tools: [],
frameworks: [ 'django' ]
{
name: 'python',
tools: [],
frameworks: [ 'django' ]
}
```

### GoLang
### GoLang

The detection for GoLang works similar to Java. The first thing Alizer does is to check if a `go.mod`
file is in the project. If so, Alizer assumes it is a GoLang project.
Expand All @@ -108,34 +102,35 @@ At this point, it reads its content looking for dependencies to discover framewo
- Mux

```
{
name: 'go',
tools: [ '1.17' ],
frameworks: [ 'gin' ]
{
name: 'go',
tools: [ '1.17' ],
frameworks: [ 'gin' ]
}
```

NOTE: The Go version is saved as Tools inside the data structure returned by the analyze primitive

## DevFile detection

It is possible to select a devfile from a list of devfile metadatas provided by the caller based on information that
It is possible to select a devfile from a list of devfile metadatas provided by the caller based on information that
Alizer extracts from the source.

Alizer searches for a component in the root folder and uses its information to select a devfile. If nothing is found in the root,
a full components detection is performed and the first component in the resulting list is used to select a devfile.
Alizer searches for a component in the root folder and uses its information to select a devfile. If nothing is found in the root,
a full components detection is performed and the first component in the resulting list is used to select a devfile.
If no component is found in the whole source tree, a generic Language detection is run and the first language in the resulting list is used to select a devfile.

The CLI, through the registry-support module, also works with URLS. If a registry URL is fed to Alizer, it will try to
The CLI, through the registry-support module, also works with URLS. If a registry URL is fed to Alizer, it will try to
download all devfiles from it and select the one which fits best the source, by prioritizing frameworks over tools and languages.
For example, if the source is a Java Maven Quarkus project and the devfiles list contains a Quarkus devfile and a Maven
For example, if the source is a Java Maven Quarkus project and the devfiles list contains a Quarkus devfile and a Maven
one, the Quarkus devfile will be selected.

## Component detection

The concept of component is taken from Odo and its definition can be read on [odo.dev](https://odo.dev/docs/getting-started/basics/#component).

Component detection is only enabled for a subset of programming languages

- Java
- Go
- .NET (C#, F#, VB.NET)
Expand All @@ -144,22 +139,13 @@ Component detection is only enabled for a subset of programming languages
- Rust

To perform component detection Alizer splits the languages in two sets: `languages with a configuration file` (like Java
which can have a pom.xml or a build.gradle) and `languages without a configuration file` (such as Python which does not have a
default config file).
which can have a pom.xml or a build.gradle) and `languages without a configuration file` (such as Python which does not have a
default config file).

It first scans all files from the source tree looking for a file that matches the name of a known
config file. If found, it checks if this is a valid configuration file (e.g. for a multi-module Maven project only single
It first scans all files from the source tree looking for a file that matches the name of a known
config file. If found, it checks if this is a valid configuration file (e.g. for a multi-module Maven project only single
modules pom.xml are taken into account). If true, a component is found. This step gets repeated for all configuration files found in the source tree.
Only one component per folder is possible.

Once the first step ends up, if there are other free subfolders (free = folders that do not belong to any component) Alizer tries to search for
a `language without a configuration file` in them. A simple Language detection is performed and the first language is taken into account for further calculations.

## Feature table

| | Java API | Javascript | Go |
|----------------------------------|----------|------------|----|
| Language/Framework detection | X | X | X |
| Devfile detection (metadata) | X | X | X |
| Devfile detection (registry URL) | | | X |
| Component detection | X | | X |
Once the first step ends up, if there are other free subfolders (free = folders that do not belong to any component) Alizer tries to search for
a `language without a configuration file` in them. A simple Language detection is performed and the first language is taken into account for further calculations.
Loading

0 comments on commit b903c3c

Please sign in to comment.