@Test public void getArtifactsForCompilation() { final AppcacheLinker linker = new AppcacheLinker(); final ArtifactSet artifacts1 = new ArtifactSet(); final PermutationArtifact artifact1 = new PermutationArtifact( AppcacheLinker.class, new Permutation( "1" ) ); final PermutationArtifact artifact2 = new PermutationArtifact( AppcacheLinker.class, new Permutation( "2" ) ); artifacts1.add( artifact1 ); artifacts1.add( new StandardGeneratedResource( "path1", new byte[ 0 ] ) ); artifacts1.add( new StandardGeneratedResource( "path2", new byte[ 0 ] ) ); final StandardGeneratedResource resource = new StandardGeneratedResource( "path3", new byte[ 0 ] ); resource.setVisibility( Visibility.Private ); artifacts1.add( resource ); artifacts1.add( new StandardGeneratedResource( "compilation-mappings.txt", new byte[ 0 ] ) ); artifacts1.add( new StandardGeneratedResource( "myapp.devmode.js", new byte[ 0 ] ) ); artifacts1.add( artifact2 ); final LinkerContext linkerContext = mock( LinkerContext.class ); when( linkerContext.getModuleName() ).thenReturn( "myapp" ); final Set<String> files = linker.getArtifactsForCompilation( linkerContext, artifacts1 ); assertEquals( files.size(), 2 ); assertTrue( files.contains( "myapp/path1" ) ); assertTrue( files.contains( "myapp/path2" ) ); }
@Nonnull final Set<String> getArtifactsForCompilation( @Nonnull final LinkerContext context, @Nonnull final ArtifactSet artifacts ) { final Set<String> artifactNames = new HashSet<>(); for ( final EmittedArtifact artifact : artifacts.find( EmittedArtifact.class ) ) { if ( Visibility.Public == artifact.getVisibility() && shouldAddToManifest( artifact.getPartialPath() ) ) { artifactNames.add( context.getModuleName() + "/" + artifact.getPartialPath() ); } } return artifactNames; }
AppcacheLinker extends AbstractLinker { @Nonnull final Set<String> getArtifactsForCompilation( @Nonnull final LinkerContext context, @Nonnull final ArtifactSet artifacts ) { final Set<String> artifactNames = new HashSet<>(); for ( final EmittedArtifact artifact : artifacts.find( EmittedArtifact.class ) ) { if ( Visibility.Public == artifact.getVisibility() && shouldAddToManifest( artifact.getPartialPath() ) ) { artifactNames.add( context.getModuleName() + "/" + artifact.getPartialPath() ); } } return artifactNames; } }
AppcacheLinker extends AbstractLinker { @Nonnull final Set<String> getArtifactsForCompilation( @Nonnull final LinkerContext context, @Nonnull final ArtifactSet artifacts ) { final Set<String> artifactNames = new HashSet<>(); for ( final EmittedArtifact artifact : artifacts.find( EmittedArtifact.class ) ) { if ( Visibility.Public == artifact.getVisibility() && shouldAddToManifest( artifact.getPartialPath() ) ) { artifactNames.add( context.getModuleName() + "/" + artifact.getPartialPath() ); } } return artifactNames; }  }
AppcacheLinker extends AbstractLinker { @Nonnull final Set<String> getArtifactsForCompilation( @Nonnull final LinkerContext context, @Nonnull final ArtifactSet artifacts ) { final Set<String> artifactNames = new HashSet<>(); for ( final EmittedArtifact artifact : artifacts.find( EmittedArtifact.class ) ) { if ( Visibility.Public == artifact.getVisibility() && shouldAddToManifest( artifact.getPartialPath() ) ) { artifactNames.add( context.getModuleName() + "/" + artifact.getPartialPath() ); } } return artifactNames; }  @Override String getDescription(); @Override ArtifactSet link( @Nonnull final TreeLogger logger,
                           @Nonnull final LinkerContext context,
                           @Nonnull final ArtifactSet artifacts,
                           final boolean onePermutation ); }
AppcacheLinker extends AbstractLinker { @Nonnull final Set<String> getArtifactsForCompilation( @Nonnull final LinkerContext context, @Nonnull final ArtifactSet artifacts ) { final Set<String> artifactNames = new HashSet<>(); for ( final EmittedArtifact artifact : artifacts.find( EmittedArtifact.class ) ) { if ( Visibility.Public == artifact.getVisibility() && shouldAddToManifest( artifact.getPartialPath() ) ) { artifactNames.add( context.getModuleName() + "/" + artifact.getPartialPath() ); } } return artifactNames; }  @Override String getDescription(); @Override ArtifactSet link( @Nonnull final TreeLogger logger,
                           @Nonnull final LinkerContext context,
                           @Nonnull final ArtifactSet artifacts,
                           final boolean onePermutation );  }