Skip to content

Commit

Permalink
Merge tag 'v1.25.0' into jenkinsfiles
Browse files Browse the repository at this point in the history
# Conflicts:
#	core/src/main/java/com/devonfw/tools/solicitor/InventoryProcessor.java
#	core/src/main/java/com/devonfw/tools/solicitor/Solicitor.java
#	core/src/main/java/com/devonfw/tools/solicitor/common/LicenseTextHelper.java
#	core/src/main/java/com/devonfw/tools/solicitor/common/LogMessages.java
#	core/src/main/java/com/devonfw/tools/solicitor/config/RuleConfig.java
#	core/src/main/java/com/devonfw/tools/solicitor/model/ModelImporterExporter.java
#	core/src/main/java/com/devonfw/tools/solicitor/model/impl/ModelFactoryImpl.java
#	core/src/main/java/com/devonfw/tools/solicitor/model/impl/inventory/ApplicationComponentImpl.java
#	core/src/main/java/com/devonfw/tools/solicitor/model/impl/inventory/NormalizedLicenseImpl.java
#	core/src/main/java/com/devonfw/tools/solicitor/model/inventory/ApplicationComponent.java
#	core/src/main/java/com/devonfw/tools/solicitor/reader/yarn/YarnReader.java
#	core/src/main/java/com/devonfw/tools/solicitor/ruleengine/drools/DroolsRuleEngine.java
#	core/src/main/resources/application.properties
#	core/src/main/resources/com/devonfw/tools/solicitor/config/solicitor_base.cfg
#	core/src/main/resources/com/devonfw/tools/solicitor/rules/LicenseAssignmentV2Sample.xls
#	core/src/main/resources/com/devonfw/tools/solicitor/rules/rule_templates/LicenseAssignmentV2.drt
#	core/src/main/resources/com/devonfw/tools/solicitor/sql/applicationcomponents_with_noncommerciallicenses.sql
#	core/src/main/resources/com/devonfw/tools/solicitor/sql/applicationcomponents_with_noncommerciallicenses_with_licenses.sql
#	core/src/main/resources/com/devonfw/tools/solicitor/sql/noticefiles.sql
#	core/src/main/resources/com/devonfw/tools/solicitor/sql/ossapplicationcomponents.sql
#	core/src/main/resources/com/devonfw/tools/solicitor/sql/uniquelicenses_with_application_components.sql
#	core/src/main/resources/com/devonfw/tools/solicitor/templates/Attributions.vm
#	core/src/main/resources/com/devonfw/tools/solicitor/templates/ScancodeScanScript.vm
#	documentation/files/application.properties
#	documentation/master-solicitor.asciidoc
  • Loading branch information
chrimih committed Aug 16, 2024
2 parents 5b21c42 + 5b73c05 commit fe69fcd
Show file tree
Hide file tree
Showing 231 changed files with 19,101 additions and 512 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./core/target/solicitor.jar
asset_path: ./app/target/solicitor.jar
asset_name: solicitor.jar
asset_content_type: application/octet-stream
- name: Upload Userguide
Expand Down
3 changes: 3 additions & 0 deletions .spellcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ matrix:
aspell:
lang: en
d: en_US
run-together: true
run-together-limit: 5
run-together-min: 2
sources:
- documentation/*.asciidoc
dictionary:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ for the project. Text or spreadsheet (Excel) based reports might be created to d
* Yarn
* Pip
* CSV (e.g. for manual entry of data)
* OSS Review Toolkit - Analyzer (ORT)
* Rules processing (using Drools Rule Engine) controls the the different phases:
* Normalizing / Enhancing of license information
* Handling of multilicensing (including selection of applicable licenses) and re-licensing
Expand Down
64 changes: 64 additions & 0 deletions app/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.17</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>

<groupId>com.devonfw.tools</groupId>
<artifactId>solicitor-app</artifactId>
<version>1.25.0</version>

<name>Solicitor App (Main Application)</name>
<description>A tool for rule based checking of license conditions in software projects.</description>
<licenses>
<license>
<name>Apache Software License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments/>
</license>
</licenses>

<scm>
<connection>scm:git:file://.</connection>
<developerConnection>scm:git:file://.</developerConnection>
<url>scm:git:file://.</url>
</scm>

<properties>
<java.version>1.8</java.version>
<maven.build.timestamp.format>dd-MM-yy_HH:mm</maven.build.timestamp.format>
<builddate>${maven.build.timestamp}</builddate>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>solicitor-core</artifactId>
<version>${project.version}</version>
</dependency>

</dependencies>

<build>
<finalName>solicitor</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.devonfw.tools.solicitor.SolicitorApplication</mainClass>
<layout>ZIP</layout>
</configuration>
</plugin>
</plugins>
</build>
</project>
45 changes: 28 additions & 17 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

<groupId>com.devonfw.tools</groupId>
<artifactId>solicitor-core</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.25.0</version>

<name>Solicitor Core (Main Application)</name>
<name>Solicitor Core (Main Library)</name>
<description>A tool for rule based checking of license conditions in software projects.</description>
<licenses>
<license>
Expand Down Expand Up @@ -49,6 +49,10 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
Expand All @@ -69,17 +73,17 @@
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-ci</artifactId>
<version>8.16.1.Beta</version>
<version>8.27.0.Beta</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-decisiontables</artifactId>
<version>8.16.1.Beta</version>
<version>8.27.0.Beta</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-xml-support</artifactId>
<version>8.16.1.Beta</version>
<version>8.27.0.Beta</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
Expand All @@ -94,7 +98,12 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.9.0</version>
<version>1.10.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.16.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
Expand Down Expand Up @@ -126,7 +135,7 @@
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.5.0</version>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
Expand Down Expand Up @@ -154,17 +163,26 @@
<artifactId>packageurl-java</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>4.4.0</version>
</dependency>
<dependency>
<groupId>org.spdx</groupId>
<artifactId>java-spdx-library</artifactId>
<version>1.1.10</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>solicitor-documentation</artifactId>
<version>${project.version}</version>
<type>pdf</type>
<scope>provided</scope>
</dependency>

</dependencies>

<build>
<finalName>solicitor</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
Expand Down Expand Up @@ -220,17 +238,10 @@
</configuration>
</plugin>

<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<layout>ZIP</layout>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.0.0</version>
<version>2.3.0</version>
<executions>
<execution>
<phase>validate</phase>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
*/
public interface InventoryProcessor {

/**
* Processing order: After the readers have read the raw data. Use in {@link Order} annotation of the implementing
* spring bean.
*/
public static final int AFTER_READERS = 50;

/**
* Processing order: Execute before rule engine. Use in {@link Order} annotation of the implementing spring bean.
*/
Expand Down
31 changes: 30 additions & 1 deletion core/src/main/java/com/devonfw/tools/solicitor/Solicitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@

import com.devonfw.tools.solicitor.SolicitorCliProcessor.CommandLineOptions;
import com.devonfw.tools.solicitor.SolicitorSetup.ReaderSetup;
import com.devonfw.tools.solicitor.common.DeprecationChecker;
import com.devonfw.tools.solicitor.common.LogMessages;
import com.devonfw.tools.solicitor.common.MavenVersionHelper;
import com.devonfw.tools.solicitor.common.ResourceToFileCopier;
import com.devonfw.tools.solicitor.common.ResourceToFileCopier.ResourceGroup;
import com.devonfw.tools.solicitor.common.SolicitorRuntimeException;
import com.devonfw.tools.solicitor.config.ConfigFactory;
import com.devonfw.tools.solicitor.lifecycle.LifecycleListenerHolder;
import com.devonfw.tools.solicitor.model.ModelImporterExporter;
import com.devonfw.tools.solicitor.model.ModelRoot;
import com.devonfw.tools.solicitor.model.inventory.ApplicationComponent;
Expand Down Expand Up @@ -62,6 +64,12 @@ public class Solicitor {
@Autowired
private ModelImporterExporter modelImporterExporter;

@Autowired
private LifecycleListenerHolder lifecycleListenerHolder;

@Autowired
private DeprecationChecker deprecationChecker;

private boolean tolerateMissingInput = false;

@Value("${solicitor.tolerate-missing-input}")
Expand Down Expand Up @@ -107,14 +115,18 @@ private void extractConfig(String targetDir) {
*/
private void mainProcessing(CommandLineOptions clo) {

checkJavaVersion();
ModelRoot modelRoot = this.configFactory.createConfig(clo.configUrl);
this.lifecycleListenerHolder.modelRootInitialized(modelRoot);
if (clo.load) {
LOG.info(LogMessages.LOADING_DATAMODEL.msg(), clo.pathForLoad);
modelRoot = this.modelImporterExporter.loadModel(clo.pathForLoad);
} else {
readInventory();
this.lifecycleListenerHolder.afterReadingInventory(modelRoot);
runInventoryProcessors(modelRoot);
modelRoot.completeData();
this.lifecycleListenerHolder.afterModelProcessing(modelRoot);
}
if (clo.save) {
LOG.info(LogMessages.SAVING_DATAMODEL.msg(), clo.pathForSave);
Expand All @@ -126,6 +138,21 @@ private void mainProcessing(CommandLineOptions clo) {
oldModelRoot = this.modelImporterExporter.loadModel(clo.pathForDiff);
}
this.writerFacade.writeResult(modelRoot, oldModelRoot);
this.lifecycleListenerHolder.endOfMainProcessing(modelRoot);
}

/**
* Checks the java version and possibly issue deprecation error or warning.
*/
private void checkJavaVersion() {

String javaVersion = System.getProperty("java.version");
// we just check for the prefix "1." because from Java 9 on the version number does no longer start with "1."
if (javaVersion.startsWith("1.")) {
this.deprecationChecker.check(true,
"Running Solicitor on Java 8 is deprecated. Yours is '" + javaVersion + "'. Switch to Java 11!");
}

}

/**
Expand All @@ -137,7 +164,7 @@ private void readInventory() {
Reader reader = this.readerFactory.readerFor(readerSetup.getType());
try {
reader.readInventory(readerSetup.getType(), readerSetup.getSource(), readerSetup.getApplication(),
readerSetup.getUsagePattern(), readerSetup.getRepoType(), readerSetup.getConfiguration());
readerSetup.getUsagePattern(), readerSetup.getRepoType(), readerSetup.getPackageType(), readerSetup.getConfiguration());
} catch (SolicitorRuntimeException sre) {
if (this.tolerateMissingInput && sre.getCause() instanceof FileNotFoundException) {
Application app = readerSetup.getApplication();
Expand All @@ -153,6 +180,8 @@ private void readInventory() {

/**
* Execute the inventoryProcessors.
*
* @param modelRoot the root of the data model
*/
private void runInventoryProcessors(ModelRoot modelRoot) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,39 +13,38 @@
import com.devonfw.tools.solicitor.common.LogMessages;

/**
* The main class. Triggers command line processing and bootstraps the Spring
* application context. It delegates to class {@link Solicitor} for further
* processing.
* The main class. Triggers command line processing and bootstraps the Spring application context. It delegates to class
* {@link Solicitor} for further processing.
*/
@SpringBootApplication
public class SolicitorApplication {

private static final Logger LOG = LoggerFactory.getLogger(SolicitorApplication.class);

/**
* The standard java main method.
*
* @param args command line arguments
*/
public static void main(String[] args) {

try {
SolicitorCliProcessor scp = new SolicitorCliProcessor();
CommandLineOptions clo = scp.parse(args);
if (clo == null) {
System.exit(3);
}
// only continue processing if help option was not selected
if (!clo.help) {
ApplicationContext context = SpringApplication.run(SolicitorApplication.class, args);
Solicitor solicitor = context.getBean(Solicitor.class);
solicitor.run(clo, String.join(" ", args));
}
} catch (RuntimeException e) {
LOG.error(LogMessages.ABORTED.msg(), e);
System.exit(3);
}

private static final Logger LOG = LoggerFactory.getLogger(SolicitorApplication.class);

/**
* The standard java main method.
*
* @param args command line arguments
*/
public static void main(String[] args) {

try {
SolicitorCliProcessor scp = new SolicitorCliProcessor();
CommandLineOptions clo = scp.parse(args);
if (clo == null) {
System.exit(3);
}
// only continue processing if help option was not selected
if (!clo.help) {
ApplicationContext context = SpringApplication.run(SolicitorApplication.class, args);
Solicitor solicitor = context.getBean(Solicitor.class);
solicitor.run(clo, String.join(" ", args));
}
} catch (RuntimeException e) {
LOG.error(LogMessages.ABORTED.msg(), e);
System.exit(3);
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ public CommandLineOptions parse(String[] commandLineArgs) {
builder = Option.builder("l");
builder.longOpt("loadModel");
builder.hasArg();
builder.optionalArg(false);
builder.argName("filename");
description = "instead of reading raw license data and processing rules load the already "
+ "processed model from a previously saved file";
Expand All @@ -134,7 +133,6 @@ public CommandLineOptions parse(String[] commandLineArgs) {
builder = Option.builder("d");
builder.longOpt("diff");
builder.hasArg();
builder.optionalArg(false);
builder.argName("filename");
description = "create a diff report to the already processed model given by this filename";
builder.desc(description);
Expand Down Expand Up @@ -204,7 +202,7 @@ public CommandLineOptions parse(String[] commandLineArgs) {

/**
* Prints help information to standard output.
*
*
* @param options the {@link Options} object which describes the command line syntax
*/
private void printHelp(Options options) {
Expand Down
Loading

0 comments on commit fe69fcd

Please sign in to comment.