Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revive the project #257

Merged
merged 16 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ci
name: Verify

on:
push:
Expand All @@ -12,21 +12,22 @@ jobs:
steps:
- name: Stop old builds
if: github.ref != 'refs/heads/master'
uses: styfle/cancel-workflow-action@0.9.1
uses: styfle/cancel-workflow-action@0.11.0
with:
access_token: ${{ github.token }}

build:
needs: setup
strategy:
fail-fast: false
matrix:
java-version: [8,11]
needs: setup
java: [ 8, 11, 17 ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/checkout@v3
- name: "Set up JDK ${{ matrix.java }}"
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
java-version: ${{ matrix.java }}
distribution: 'temurin'
- name: Build & Test
run: ./mvnw -B verify
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ end

# Requirements

* [Maven](http://maven.apache.org) 3.3.1+
* [Java](http://java.sun.com/) 7+
* [Maven](http://maven.apache.org) 3.6.3+
* [Java](http://java.sun.com/) 8+

# Usage

Expand Down
2 changes: 1 addition & 1 deletion polyglot-atom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</parent>

<artifactId>polyglot-atom</artifactId>
<packaging>takari-jar</packaging>
<packaging>takari-maven-component</packaging>
<name>Polyglot :: Atom</name>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@
*/
package org.sonatype.maven.polyglot.atom;

import org.codehaus.plexus.component.annotations.Component;
import org.sonatype.maven.polyglot.mapping.Mapping;
import javax.inject.Named;
import javax.inject.Singleton;

import org.sonatype.maven.polyglot.mapping.MappingSupport;

/**
* Atom compact grammar model mapping.
*
* @author [email protected] (Dhanji R. Prasanna)
*/
@Component(role = Mapping.class, hint = "atom")
@Singleton
@Named( "atom" )
public class AtomMapping extends MappingSupport {
public AtomMapping() {
super("atom");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
*/
package org.sonatype.maven.polyglot.atom;

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.IOException;
import java.io.Reader;
import java.util.Map;

import org.apache.maven.model.Model;
import org.apache.maven.model.building.ModelProcessor;
import org.apache.maven.model.building.ModelSource;
import org.apache.maven.model.io.ModelReader;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.IOUtil;
import org.sonatype.maven.polyglot.atom.parsing.AtomParser;
import org.sonatype.maven.polyglot.atom.parsing.Project;
Expand All @@ -27,7 +28,8 @@
*
* @author [email protected] (Dhanji R. Prasanna)
*/
@Component(role = ModelReader.class,hint="atom")
@Singleton
@Named( "atom" )
public class AtomModelReader extends ModelReaderSupport {

public Model read(final Reader input, final Map<String, ?> options) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
*/
package org.sonatype.maven.polyglot.atom;

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;
Expand All @@ -19,15 +22,14 @@
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.Repository;
import org.apache.maven.model.io.ModelWriter;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonatype.maven.polyglot.atom.parsing.Token;
import org.sonatype.maven.polyglot.io.ModelWriterSupport;

@Component(role = ModelWriter.class, hint = "atom")
@Singleton
@Named( "atom" )
public class AtomModelWriter extends ModelWriterSupport {
private static final Pattern ATOM_REGEX = Pattern.compile("\\d+|true|false");

Expand Down
2 changes: 1 addition & 1 deletion polyglot-clojure/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</parent>

<artifactId>polyglot-clojure</artifactId>
<packaging>takari-jar</packaging>
<packaging>takari-maven-component</packaging>
<name>Polyglot :: Clojure</name>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
*/
package org.sonatype.maven.polyglot.clojure;

import org.codehaus.plexus.component.annotations.Component;
import org.sonatype.maven.polyglot.mapping.Mapping;
import javax.inject.Named;
import javax.inject.Singleton;

import org.sonatype.maven.polyglot.mapping.MappingSupport;

/**
Expand All @@ -19,7 +20,8 @@
*
* @since 0.7
*/
@Component(role=Mapping.class, hint="clojure")
@Singleton
@Named( "clojure" )
public class ClojureMapping
extends MappingSupport
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
*/
package org.sonatype.maven.polyglot.clojure;

import javax.inject.Named;
import javax.inject.Singleton;

import clojure.lang.Atom;
import clojure.lang.Namespace;
import clojure.lang.RT;
import clojure.lang.Symbol;
import clojure.lang.Var;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.ModelReader;
import org.codehaus.plexus.component.annotations.Component;
import org.sonatype.maven.polyglot.PolyglotModelUtil;
import org.sonatype.maven.polyglot.io.ModelReaderSupport;

Expand All @@ -30,7 +31,8 @@

* @since 0.7
*/
@Component(role = ModelReader.class, hint = "clojure")
@Singleton
@Named( "clojure" )
public class ClojureModelReader extends ModelReaderSupport {

public Model read(final Reader input, final Map<String, ?> options) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
*/
package org.sonatype.maven.polyglot.clojure;

import javax.inject.Named;
import javax.inject.Singleton;

import clojure.lang.Namespace;
import clojure.lang.RT;
import clojure.lang.Symbol;
import clojure.lang.Var;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.ModelWriter;
import org.codehaus.plexus.component.annotations.Component;
import org.sonatype.maven.polyglot.io.ModelWriterSupport;

import java.io.IOException;
Expand All @@ -28,7 +29,8 @@
*
* @since 0.7
*/
@Component(role = ModelWriter.class, hint = "clojure")
@Singleton
@Named( "clojure" )
public class ClojureModelWriter extends ModelWriterSupport {

public void write(Writer writer, Map<String, Object> stringObjectMap, Model model) throws IOException {
Expand Down
11 changes: 10 additions & 1 deletion polyglot-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,18 @@
</parent>

<artifactId>polyglot-common</artifactId>
<packaging>takari-jar</packaging>
<packaging>takari-maven-component</packaging>
<name>Polyglot :: Common</name>

<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>${plexusUtilsVersion}</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<resources>
<resource>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
*/
package org.sonatype.maven.polyglot;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;

import java.io.File;
import java.util.ArrayList;
import java.util.Comparator;
Expand All @@ -16,9 +20,8 @@

import org.apache.maven.model.io.ModelReader;
import org.apache.maven.model.io.ModelWriter;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sonatype.maven.polyglot.mapping.Mapping;

/**
Expand All @@ -28,12 +31,13 @@
*
* @since 0.7
*/
@Component(role = PolyglotModelManager.class)
@Singleton
@Named
public class PolyglotModelManager {
@Requirement
protected Logger log;

@Requirement(role = Mapping.class)
protected Logger log = LoggerFactory.getLogger( PolyglotModelManager.class );

@Inject
protected List<Mapping> mappings;

public void addMapping(final Mapping mapping) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
*/
package org.sonatype.maven.polyglot;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
Expand All @@ -26,11 +30,10 @@
import org.apache.maven.model.io.ModelParseException;
import org.apache.maven.model.io.ModelReader;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.codehaus.plexus.util.ReaderFactory;

/**
Expand All @@ -41,7 +44,8 @@
* @since 0.7
*/
//@Component(role = ModelProcessor.class, hint = "tesla-polyglot")
@Component(role = ModelProcessor.class)
@Singleton
@Named
public class TeslaModelProcessor implements ModelProcessor {

private static final String DEFAULT_POM_FILE = "pom.xml";
Expand All @@ -55,10 +59,10 @@ public class TeslaModelProcessor implements ModelProcessor {
NEW_LINE + "-->";
private static final String POM_FILE_PREFIX = ".polyglot.";

@Requirement
@Inject
private PolyglotModelManager manager;
@Requirement
private Logger log;

private Logger log = LoggerFactory.getLogger( TeslaModelProcessor.class );

@Override
public File locatePom(final File dir) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
*/
package org.sonatype.maven.polyglot;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;

import org.apache.maven.model.Model;
import org.apache.maven.model.building.ModelProcessor;
import org.apache.maven.model.io.ModelParseException;
import org.apache.maven.model.io.ModelReader;
import org.apache.maven.model.io.ModelWriter;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.BufferedOutputStream;
import java.io.File;
Expand All @@ -35,12 +38,13 @@
*
* @since 0.7
*/
@Component(role = TeslaModelTranslator.class)
@Singleton
@Named
public class TeslaModelTranslator {
@Requirement
protected Logger log;

@Requirement
protected Logger log = LoggerFactory.getLogger( TeslaModelTranslator.class );

@Inject
private PolyglotModelManager manager;

public void translate(final File input, final File output) throws IOException, ModelParseException {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
package org.sonatype.maven.polyglot;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;

import java.io.File;
import java.util.List;
import java.util.stream.Collectors;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.building.ModelProblem;
import org.apache.maven.model.building.ModelProcessor;
import org.apache.maven.model.building.ModelSource;
import org.apache.maven.project.*;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;

@Component(role = ProjectBuilder.class)
@Singleton
@Named
public class TeslaProjectBuilder extends DefaultProjectBuilder {

@Requirement(role = ModelProcessor.class)
@Inject
private TeslaModelProcessor teslaModelProcessor; // Must be named differently than the one in the superclass

@Override
Expand Down
Loading