@ Nullable final Permutation calculatePermutation ( @ Nonnull final TreeLogger logger , @ Nonnull final LinkerContext context , @ Nonnull final ArtifactSet artifacts ) throws UnableToCompleteException { Permutation permutation = null ; for ( final SelectionInformation result : artifacts . find ( SelectionInformation . class ) ) { final String strongName = result . getStrongName ( ) ; if ( null != permutation && ! permutation . getPermutationName ( ) . equals ( strongName ) ) { throw new UnableToCompleteException ( ) ; } if ( null == permutation ) { permutation = new Permutation ( strongName ) ; final Set < String > artifactsForCompilation = getArtifactsForCompilation ( context , artifacts ) ; permutation . getPermutationFiles ( ) . addAll ( artifactsForCompilation ) ; } final List < BindingProperty > list = new ArrayList <> ( ) ; for ( final SelectionProperty property : context . getProperties ( ) ) { if ( ! property . isDerived ( ) ) { final String name = property . getName ( ) ; final String value = result . getPropMap ( ) . get ( name ) ; if ( null != value ) { list . add ( new BindingProperty ( name , value ) ) ; } } } final SelectionDescriptor selection = new SelectionDescriptor ( strongName , list ) ; final List < SelectionDescriptor > selectors = permutation . getSelectors ( ) ; if ( ! selectors . contains ( selection ) ) { selectors . add ( selection ) ; } } if ( null != permutation ) { logger . log ( Type . DEBUG , "Calculated Permutation: " + permutation . getPermutationName ( ) + " Selectors: " + permutation . getSelectors ( ) ) ; } return permutation ; }
Return the permutation for a single link step .