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 2 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
29 changes: 4 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,11 @@
name: ci
name: Verify

on:
push:
branches:
- master
pull_request:

jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Stop old builds
if: github.ref != 'refs/heads/master'
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

build:
strategy:
fail-fast: false
matrix:
java-version: [8,11]
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java-version }}
- name: Build & Test
run: ./mvnw -B verify
name: Verify
uses: takari/takari-gh-actions/.github/workflows/ci.yml@v1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is almost identically to what we had before, except the newer version of the action/cehckout action. As we want to keep Java 8 coverage, I suggest to either drop that change or pass a changed java-version-matrix to that re-used job.

Maybe the following works. If not, the takari-gh-actions might need to be changed to support changing that value.

Suggested change
name: Verify
uses: takari/takari-gh-actions/.github/workflows/ci.yml@v1
strategy:
matrix:
java-version: ['8', '11', '17']
name: Verify
uses: takari/takari-gh-actions/.github/workflows/ci.yml@v1
with:
java-version: ${{ matrix.java-version }}

See also this docuemntation: https://docs.github.com/en/actions/using-workflows/reusing-workflows#using-a-matrix-strategy-with-a-reusable-workflow

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
10 changes: 9 additions & 1 deletion polyglot-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@
</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>3.5.0</version>
</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;

/**
* Polyglot model processor.
Expand All @@ -40,7 +43,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 @@ -54,10 +58,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