public BundlePathMapping build ( ) { if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Creating bundle path List for " + this . bundle . getId ( ) ) ; } BundlePathMapping bundlePathMapping = new BundlePathMapping ( this . bundle ) ; bundlePathMapping . setPathMappings ( strPathMappings ) ; List < PathMapping > pathMappings = bundlePathMapping . getPathMappings ( ) ; Map < String , VariantSet > variants = new TreeMap <> ( ) ; if ( pathMappings != null ) { for ( PathMapping pathMapping : pathMappings ) { boolean isGeneratedPath = generatorRegistry . isPathGenerated ( pathMapping . getPath ( ) ) ; // Handle generated resources // path ends in /, the folder is included without subfolders if ( pathMapping . isDirectory ( ) ) { addItemsFromDir ( bundlePathMapping , pathMapping , false ) ; } // path ends in /, the folder is included with all subfolders else if ( pathMapping . isRecursive ( ) ) { addItemsFromDir ( bundlePathMapping , pathMapping , true ) ; } else if ( pathMapping . getPath ( ) . endsWith ( fileExtension ) ) { addPathMapping ( bundlePathMapping , asPath ( pathMapping . getPath ( ) , isGeneratedPath ) ) ; } else if ( generatorRegistry . isPathGenerated ( pathMapping . getPath ( ) ) ) { addPathMapping ( bundlePathMapping , pathMapping . getPath ( ) ) ; } else if ( pathMapping . getPath ( ) . endsWith ( LICENSES_FILENAME ) ) { bundlePathMapping . getLicensesPathList ( ) . add ( asPath ( pathMapping . getPath ( ) , isGeneratedPath ) ) ; } else { throw new BundlingProcessException ( "Wrong mapping [" + pathMapping + "] for bundle [" + this . bundle . getName ( ) + "]. Please check configuration. " ) ; } if ( isGeneratedPath ) { // Add variants variants = VariantUtils . concatVariants ( variants , generatorRegistry . getAvailableVariants ( pathMapping . getPath ( ) ) ) ; } } } bundle . setVariants ( variants ) ; if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "Finished creating bundle path List for " + this . bundle . getId ( ) ) ; } return bundlePathMapping ; }
Detects all files that belong to the bundle and adds them to the bundle path mapping .