Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

Commit

Permalink
Merge pull request #89 from rnc/BR38
Browse files Browse the repository at this point in the history
Fix ReadOnlyDependency issue where it was not fully read-only. Remove mi...
  • Loading branch information
jdcasey committed Jul 23, 2013
2 parents 216d115 + 990f716 commit 894f5ce
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 43 deletions.
12 changes: 6 additions & 6 deletions src/main/java/com/redhat/rcm/version/mgr/session/ChangeInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class ChangeInfo

private final Set<Project> missingParents = new HashSet<Project>();

private final Map<VersionlessProjectKey, Set<File>> missingVersions =
new HashMap<VersionlessProjectKey, Set<File>>();
private final Map<FullProjectKey, Set<File>> missingVersions =
new HashMap<FullProjectKey, Set<File>>();

private final Map<VersionlessProjectKey, Set<VersionlessProjectKey>> missingVersionsByProject =
new HashMap<VersionlessProjectKey, Set<VersionlessProjectKey>>();
Expand Down Expand Up @@ -102,12 +102,13 @@ void addMissingParent( final Project project )
void addMissingDependency( final Project project, final Dependency dep )
{
final VersionlessProjectKey depKey = new VersionlessProjectKey( dep );
final FullProjectKey versionedDepKey = new FullProjectKey( dep );

Set<File> poms = missingVersions.get( depKey );
Set<File> poms = missingVersions.get( versionedDepKey );
if ( poms == null )
{
poms = new HashSet<File>();
missingVersions.put( depKey, poms );
missingVersions.put( versionedDepKey, poms );
}

poms.add( project.getPom() );
Expand All @@ -127,7 +128,6 @@ void addMissingDependency( final Project project, final Dependency dep )
deps = new HashSet<Dependency>();
missingDeps.put( depKey, deps );
}

deps.add( new ReadOnlyDependency( dep ) );
}

Expand Down Expand Up @@ -166,7 +166,7 @@ Set<Dependency> getMissingDependencies( final VersionlessProjectKey key )
return missingDeps.get( key );
}

Map<VersionlessProjectKey, Set<File>> getMissingVersions()
Map<FullProjectKey, Set<File>> getMissingVersions()
{
return missingVersions;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public Set<Dependency> getMissingDependencies( final VersionlessProjectKey key )
return changeInfo.getMissingDependencies( key );
}

public Map<VersionlessProjectKey, Set<File>> getMissingVersions()
public Map<FullProjectKey, Set<File>> getMissingVersions()
{
return changeInfo.getMissingVersions();
}
Expand Down Expand Up @@ -330,13 +330,6 @@ public VersionManagerSession addBOM( final File bom, final MavenProject project
return this;
}

public VersionManagerSession mapDependency( final File srcBom, final Dependency dep )
{
managedInfo.mapDependency( srcBom, dep );

return this;
}

public CoordinateRelocations getRelocations()
{
return managedInfo.getRelocations();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public final class ReadOnlyDependency

public ReadOnlyDependency( final Dependency dep )
{
this.dep = dep;
this.dep = dep.clone();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
public class MappedDependenciesReport
extends AbstractReport
{
public static final String ID = "mapped-dependencies.txt";
public static final String ID = "mapped-dependencies.md";

@Override
public String getId()
Expand All @@ -62,27 +62,28 @@ public void generate( final File reportsDir, final VersionManagerSession session
final Map<DependencyManagementKey, String> deps =
new TreeMap<DependencyManagementKey, String>( bomEntry.getValue() );

writer.write( "# " );
writer.write( bom.getPath() );
writer.write( " (" + deps.size() + " entries):" );

writer.newLine();
writer.write( "------------------------------------------------------" );
writer.newLine();
writer.newLine();

for ( final Map.Entry<DependencyManagementKey, String> depEntry : deps.entrySet() )
{
final DependencyManagementKey key = depEntry.getKey();
final String version = depEntry.getValue();

writer.write( key.toString() );
writer.write( " = " );
writer.write( version );
writer.newLine();

/* @formatter:off */
// NOTE: Using Markdown format...
final String out = String.format(
" - %s = %s\n",
key.toString(), version
);
/* @formatter:on */

writer.write( out );
}

writer.newLine();
writer.newLine();
writer.newLine();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,19 @@
import java.util.Set;
import java.util.TreeMap;

import org.apache.maven.mae.project.key.FullProjectKey;
import org.apache.maven.mae.project.key.VersionlessProjectKey;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.IOUtil;

import com.redhat.rcm.version.VManException;
import com.redhat.rcm.version.mgr.session.VersionManagerSession;

@Component( role = Report.class, hint = MissingVersionsReport.ID )
public class MissingVersionsReport
@Component( role = Report.class, hint = UnmappedDependenciesReport.ID )
public class UnmappedDependenciesReport
extends AbstractReport
{
public static final String ID = "missing-versions.log";
public static final String ID = "unmapped-dependencies.md";

@Override
public String getId()
Expand All @@ -56,10 +57,14 @@ public void generate( final File reportsDir, final VersionManagerSession session
{
writer = new BufferedWriter( new FileWriter( reportFile ) );

final Map<VersionlessProjectKey, Set<File>> missing =
new TreeMap<VersionlessProjectKey, Set<File>>( sessionData.getMissingVersions() );
for ( final Map.Entry<VersionlessProjectKey, Set<File>> entry : missing.entrySet() )
// NOTE: Using Markdown format...
writer.write( "# Unmapped Dependencies\n\n\n" );

final Map<FullProjectKey, Set<File>> missing =
new TreeMap<FullProjectKey, Set<File>>( sessionData.getMissingVersions() );
for ( final Map.Entry<FullProjectKey, Set<File>> entry : missing.entrySet() )
{
writer.write( " - " );
writer.write( entry.getKey()
.toString() );
writer.newLine();
Expand All @@ -68,26 +73,21 @@ public void generate( final File reportsDir, final VersionManagerSession session
if ( !missing.isEmpty() )
{
writer.newLine();
writer.write( "Details:" );
writer.newLine();
writer.write( "--------" );
writer.write( "## Details:");
writer.newLine();
writer.newLine();
}

for ( final Map.Entry<VersionlessProjectKey, Set<File>> entry : missing.entrySet() )
for ( final Map.Entry<FullProjectKey, Set<File>> entry : missing.entrySet() )
{
writer.write( entry.getKey()
.toString() );
writer.write( ":" );
writer.newLine();
writer.write( "-----------------------------------------------------------" );
writer.write( "### " );
writer.write( new VersionlessProjectKey (entry.getKey()).toString() );
writer.newLine();
writer.newLine();

for ( final File pom : entry.getValue() )
{
writer.write( "\t- " );
writer.write( " - " );
writer.write( pom.getPath() );
writer.newLine();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/redhat/rcm/version/util/InputUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static String[] getIncludedSubpaths( final File basedir, final String inc

final String[] includedSubpaths = scanner.getIncludedFiles();

logger.debug( "Scanning from " + basedir + " and got included files " + Arrays.toString( includedSubpaths )
logger.info( "Scanning from " + basedir + " and got included files " + Arrays.toString( includedSubpaths )
+ " and got excluded files " + Arrays.toString( scanner.getExcludedFiles() ) );

return includedSubpaths;
Expand Down

0 comments on commit 894f5ce

Please sign in to comment.