https://github.com/alien-tools/maracas

Maracas is a source code and bytecode analysis framework⁠—written in Java with the help of Spoon—which analyzes how Java libraries evolve and how their evolution impacts their clients.

https://github.com/alien-tools/maracas

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.3%) to scientific vocabulary

Keywords

api breaking-changes java
Last synced: 6 months ago · JSON representation

Repository

Maracas is a source code and bytecode analysis framework⁠—written in Java with the help of Spoon—which analyzes how Java libraries evolve and how their evolution impacts their clients.

Basic Info
Statistics
  • Stars: 14
  • Watchers: 2
  • Forks: 2
  • Open Issues: 16
  • Releases: 3
Topics
api breaking-changes java
Created over 4 years ago · Last pushed about 1 year ago
Metadata Files
Readme Contributing License Code of conduct

README.md

Build & Test CodeQL License: MIT

You might want to check out Roseau for our latest work on breaking changes!

Maracas

Maracas is a source code and bytecode analysis framework—written in Java with the help of Spoon—that tracks how Java libraries evolve and how their evolution impacts their clients. In a nutshell, Maracas makes it easy to:

  • Track the introduction of backward-incompatible breaking changes in your own APIs or the APIs you rely on
  • Analyze the concrete impact of these breaking changes on the client code using these APIs
  • Analyze local Java artifacts (source code and JARs) or analyze commits, branches, and pull requests remotely hosted on software forges such as GitHub. if you'd like to automatically check your pull requests for the introduction of breaking changes and their impact, you should give a try to our GitHub App BreakBot :robot:!

Maracas consists of three main components:

  • The core API identifies breaking changes between two binary versions of a library (using japicmp under the hood) and the impact these changes have on client code
  • The forges API handles communication with software forges (currently GitHub only) and build systems (currently Maven and Gradle) to gather source code and build JARs that are then analyzed by the core API
  • The REST API makes it easy to ask Maracas to analyze library versions and clients. In particular, it is used by BreakBot to analyze pull requests on GitHub.

Content

Using Maracas

Dependency

maracas-core is deployed on GitHub Packages. First, configure Maven or Gradle to work with GitHub Package. Then, include the following dependency:

xml <dependency> <groupId>com.github.maracas</groupId> <artifactId>maracas-core</artifactId> <version>0.5.0</version> </dependency>

Analyzing local libraries and clients

One can use Maracas to compute the changes between two versions of a library as well as their impact on a particular client as follows.

Note that both versions of the library must be provided as binary JARs, while the client is provided as source code.

```java Maracas maracas = new Maracas();

// Setting up the library versions and clients LibraryJar v1 = LibraryJar.withSources(Path.of("v1.jar"), Path.of("v1-sources/")); LibraryJar v2 = LibraryJar.withoutSources(Path.of("v2.jar")); SourcesDirectory client = SourcesDirectory.of(Path.of("/path/to/client"));

// Option 1: using the query/result API AnalysisQuery query = AnalysisQuery.builder() .of(v1, v2) .client(client) .build();

AnalysisResult result = maracas.analyze(query); Delta delta = result.delta(); List breakingChanges = delta.getBreakingChanges(); Set brokenUses = result.allBrokenUses();

// Option 2: invoking the analyses directly Delta delta = maracas.computeDelta(v1, v2); Collection breakingChanges = delta.getBreakingChanges();

DeltaImpact deltaImpact = maracas.computeDeltaImpact(client, delta); Set brokenUses = deltaImpact.brokenUses(); ```

Analyzing GitHub repositories

Alternatively, one can use the forges API to analyze artifacts hosted on GitHub.

```java // See https://github-api.kohsuke.org/ to setup the GitHubBuilder GitHubForge forge = new GitHubForge(GitHubBuilder.fromEnvironment().build());

// Option 1: analyzing a pull request PullRequestAnalyzer analyzer = new PullRequestAnalyzer(forge); PullRequest pr = forge.fetchPullRequest("owner", "library", 42);

PullRequestAnalysisResult result = analyzer.analyze(pr, MaracasOptions.newDefault()); List breakingChanges = result.breakingChanges(); Set brokenUses = result.brokenUses();

// Option 2: analyzing two arbitrary commits CommitAnalyzer analyzer = new CommitAnalyzer(); Commit v1 = forge.fetchCommit("owner", "library", "sha-v1"); Commit v2 = forge.fetchCommit("owner", "library", "sha-v2"); Commit client = forge.fetchCommit("owner", "client", "sha-client");

AnalysisResult result = analyzer.analyzeCommits(new CommitBuilder(v1), new CommitBuilder(v2), List.of(new CommitBuilder(client)), MaracasOptions.newDefault());

List breakingChanges = result.delta().getBreakingChanges(); Set brokenUses = result.allBrokenUses(); ```

From the command line

Alternatively, one can invoke Maracas from the command line using the provided CLI. First, build a standalone JAR from Maracas Core, and then follow the --help guidelines:

bash $ cd core/ $ mvn clean compile assembly:single $ java -jar target/maracas-core-<version>-jar-with-dependencies.jar --help

The example above can be invoked from the CLI as follows:

bash $ java -jar target/maracas-core-<version>-jar-with-dependencies.jar --old v1.jar --new v2.jar --client /path/to/client/src/main/java

Deploying Maracas REST

Configuration

As Maracas REST needs to interact with the GitHub REST API, one must first configure a personal token to be used. To do so, a file named .github must be placed in the rest/src/main/resources/ directory with the following content:

bash $ cat rest/src/main/resources/.github oauth=<GITHUB_TOKEN>

Execution

The preferred way to run the Maracas REST server is using Docker: bash $ cd rest/ $ docker-compose build $ docker-compose up

The REST server listens on port 8080. Its documentation is exposed at http://localhost:8080/swagger-ui.html.

Documentation

To learn more about Maracas, please visit our GitHub page.

Support

If you would like to learn more about Maracas or you are a current user and you need some help, do not hesitate to ask questions in issues or to get in touch with Lina Ochoa or Thomas Degueule.

License

This repository—and all its content—is licensed under the MIT License.

Owner

  • Name: ALIEN
  • Login: alien-tools
  • Kind: organization

GitHub Events

Total
  • Watch event: 4
  • Push event: 1
Last Year
  • Watch event: 4
  • Push event: 1

Issues and Pull Requests

Last synced: over 2 years ago

All Time
  • Total issues: 55
  • Total pull requests: 30
  • Average time to close issues: 29 days
  • Average time to close pull requests: 19 days
  • Total issue authors: 4
  • Total pull request authors: 4
  • Average comments per issue: 1.22
  • Average comments per pull request: 0.33
  • Merged pull requests: 26
  • Bot issues: 0
  • Bot pull requests: 13
Past Year
  • Issues: 2
  • Pull requests: 13
  • Average time to close issues: 3 months
  • Average time to close pull requests: 29 days
  • Issue authors: 1
  • Pull request authors: 2
  • Average comments per issue: 1.0
  • Average comments per pull request: 0.38
  • Merged pull requests: 9
  • Bot issues: 0
  • Bot pull requests: 5
Top Authors
Issue Authors
  • lmove (41)
  • tdegueul (10)
  • KarinaMankevic (3)
  • jrfaller (1)
Pull Request Authors
  • dependabot[bot] (15)
  • tdegueul (11)
  • lmove (5)
  • jrfaller (1)
Top Labels
Issue Labels
bug (24) maracas-core (22) enhancement (15) maracas-validator (9) maracas-rest (7) question (5) investigation (1)
Pull Request Labels
dependencies (15) enhancement (3) bug (1)

Dependencies

.github/workflows/build.yml actions
  • ScaCap/action-surefire-report v1 composite
  • actions/checkout v3 composite
  • actions/setup-java v3 composite
  • actions/upload-artifact v3 composite
  • stCarolas/setup-maven v4.4 composite
.github/workflows/codeql-analysis.yml actions
  • actions/checkout v2 composite
  • actions/setup-java v2 composite
  • github/codeql-action/analyze v2 composite
  • github/codeql-action/autobuild v2 composite
  • github/codeql-action/init v2 composite
.github/workflows/release.yml actions
  • actions/checkout v3 composite
  • actions/setup-java v3 composite
rest/Dockerfile docker
  • openjdk 17-jdk-alpine build
core/pom.xml maven
  • com.fasterxml.jackson.core:jackson-databind 2.13.4.2
  • com.github.siom79.japicmp:japicmp 0.16.0
  • com.google.guava:guava
  • fr.inria.gforge.spoon:spoon-core 10.1.1
  • info.picocli:picocli 4.6.3
  • org.apache.logging.log4j:log4j-core
  • org.gradle:gradle-tooling-api 7.3.3
  • com.github.maracas:comp-changes-new 0.0.1 test
  • com.github.maracas:comp-changes-old 0.0.1 test
  • net.lingala.zip4j:zip4j 2.11.2 test
  • org.hamcrest:hamcrest test
  • org.junit.jupiter:junit-jupiter-api test
  • org.junit.jupiter:junit-jupiter-engine test
  • org.junit.jupiter:junit-jupiter-params test
  • org.junit.platform:junit-platform-launcher test
  • org.slf4j:slf4j-simple test
core/src/test/resources/jar-with-deps/pom.xml maven
  • redis.clients:jedis 4.2.3
experiments/pom.xml maven
  • com.fasterxml.jackson.core:jackson-databind 2.13.4.2
  • com.github.maracas:maracas-forges ${project.version}
  • com.opencsv:opencsv 5.7.1
  • com.squareup.okhttp3:okhttp 4.9.3
  • commons-io:commons-io
  • org.apache.commons:commons-csv 1.9.0
  • org.apache.logging.log4j:log4j-core
  • org.apache.maven:maven-model 3.8.5
  • org.jsoup:jsoup 1.15.3
  • org.springframework:spring-web 5.3.23
forges/pom.xml maven
  • org.junit:junit-bom ${junit.version} import
  • com.github.maracas:maracas-core ${project.version}
  • com.google.guava:guava
  • commons-io:commons-io
  • org.apache.logging.log4j:log4j-core
  • org.apache.logging.log4j:log4j-iostreams 2.17.1
  • org.apache.maven.shared:maven-invoker 3.2.0
  • org.apache.maven:maven-model 3.8.6
  • org.gradle:gradle-tooling-api 7.3.3
  • org.jsoup:jsoup 1.15.3
  • org.kohsuke:github-api
  • org.hamcrest:hamcrest test
  • org.junit.jupiter:junit-jupiter-api test
  • org.junit.jupiter:junit-jupiter-engine test
forges/src/test/resources/gradle-multi-project/core/build.gradle maven
  • org.apache.commons:commons-math3 3.6.1 api
  • com.google.guava:guava 30.1.1-jre implementation
  • junit:junit 4.13.2 testImplementation
forges/src/test/resources/gradle-multi-project/extra/build.gradle maven
  • org.apache.commons:commons-math3 3.6.1 api
  • com.google.guava:guava 30.1.1-jre implementation
  • junit:junit 4.13.2 testImplementation
forges/src/test/resources/gradle-project/build.gradle maven
  • org.junit.jupiter:junit-jupiter-api 5.8.2 testImplementation
  • org.junit.jupiter:junit-jupiter-engine 5.8.2 testRuntimeOnly
forges/src/test/resources/gradle-project-error/build.gradle maven
  • org.junit.jupiter:junit-jupiter-api 5.8.2 testImplementation
  • org.junit.jupiter:junit-jupiter-engine 5.8.2 testRuntimeOnly
forges/src/test/resources/maven-multi-project/core-module/pom.xml maven
  • junit:junit 4.13.1 test
forges/src/test/resources/maven-multi-project/extra-module/pom.xml maven
  • junit:junit 4.13.1 test
forges/src/test/resources/maven-multi-project/pom.xml maven
  • junit:junit 4.13.1 test
forges/src/test/resources/maven-project/pom.xml maven
  • org.junit.jupiter:junit-jupiter-api 5.8.2 test
  • org.junit.jupiter:junit-jupiter-engine 5.8.2 test
pom.xml maven
  • com.google.guava:guava-bom 31.1-jre import
  • org.junit:junit-bom 5.7.2 import
  • commons-io:commons-io 2.11.0
  • org.apache.logging.log4j:log4j-core 2.19.0
  • org.hamcrest:hamcrest 2.2
  • org.kohsuke:github-api 1.313
  • org.slf4j:slf4j-simple 1.7.36
rest/pom.xml maven
  • org.springframework.boot:spring-boot-dependencies 2.6.0 import
  • com.fasterxml.jackson.dataformat:jackson-dataformat-yaml
  • com.fasterxml.jackson.datatype:jackson-datatype-jsr310
  • com.github.maracas:maracas-forges 0.5.0-SNAPSHOT
  • org.apache.logging.log4j:log4j-api
  • org.apache.logging.log4j:log4j-core
  • org.kohsuke:github-api
  • org.springdoc:springdoc-openapi-ui 1.6.6
  • org.springframework.boot:spring-boot-devtools
  • org.springframework.boot:spring-boot-starter
  • org.springframework.boot:spring-boot-starter-web
  • org.junit.platform:junit-platform-suite-api test
  • org.junit.platform:junit-platform-suite-engine test
  • org.mock-server:mockserver-netty 5.13.0 test
  • org.springframework.boot:spring-boot-starter-test test
test-data/api-evolution-data-corpus/client/pom.xml maven
  • com.github.maracas:api-evolution-data-corpus-lib-v1 0.0.1
test-data/comp-changes/client/pom.xml maven
  • com.github.maracas:comp-changes-old 0.0.1
  • junit:junit 4.13.1
test-data/comp-changes/new/pom.xml maven
  • junit:junit 4.13.1
test-data/comp-changes/old/pom.xml maven
  • junit:junit 4.13.1
validator/pom.xml maven
  • com.github.maracas:maracas-core 0.5.0-SNAPSHOT
  • com.github.siom79.japicmp:japicmp 0.15.6
  • com.j2html:j2html 1.5.0
  • org.apache.logging.log4j:log4j-api 2.17.1
  • org.apache.logging.log4j:log4j-core 2.17.1
  • org.apache.maven.shared:maven-invoker 3.1.0
  • org.apache.maven:maven-model 3.8.4
.github/workflows/jekyll-gh-pages.yml actions
  • actions/checkout v3 composite
  • actions/configure-pages v3 composite
  • actions/deploy-pages v1 composite
  • actions/jekyll-build-pages v1 composite
  • actions/upload-pages-artifact v1 composite
rest/docker-compose.yml docker
forges/src/test/resources/maven-project-error/pom.xml maven
test-data/api-evolution-data-corpus/lib-v1/pom.xml maven
test-data/api-evolution-data-corpus/lib-v2/pom.xml maven
test-data/api-evolution-data-corpus/pom.xml maven
test-data/comp-changes/pom.xml maven
test-data/pom.xml maven