Exclude processing a folder (but copy it) with fmpp

80 Views Asked by At

I am using FMPP to build my website and recently have run into an issue. When trying to build my project (with gradle) it bombs out reading a file within PHPMailer. Is there a way to ignore processing that folder with FMPP but still copy it to my build directory? I know I can add the ignoredir.fmpp file to that folder but it would completely ignore it from copying over and I can't have that. Here is a snippet of my code

task build_website {
    group 'csWebsite'
    description 'Task for compiling the website implementing the fmpp templates'
    dependsOn gzipCss
    finalizedBy minifyJs
    ant.taskdef(name: 'fmpp', classname:'fmpp.tools.AntTask') {
        classpath {
            fileset(dir: 'lib', includes: '*.jar')
        }
    }
    doLast {
        ant.fmpp(sourceRoot: "src", outputRoot :"build") {
            data(expandProperties: 'yes',
            """
            base_url: $project.base_url
            google_analytics_number : $project.google_analytics_number
            mail_user : $project.mail_user
            mail_password : $project.mail_password
            mail_recipient : $project.mail_recipient
            upload_folder : $project.upload_folder
            host : $project.host
            port : $project.port
            """
            )
        }        
    }
}
2

There are 2 best solutions below

0
Ed Dunn On

I actually really over thought this issue and after taking a step back found a simple solution. My updated code below works fine

task build_website {
    group 'csWebsite'
    description 'Task for compiling the website implementing the fmpp templates'
    dependsOn gzipCss
    finalizedBy minifyJs
    ant.taskdef(name: 'fmpp', classname:'fmpp.tools.AntTask') {
        classpath {
            fileset(dir: 'lib', includes: '*.jar')
        }
    }
    doLast {
        ant.fmpp(sourceRoot: "src", outputRoot :"build", excludes: "**/vendor/**") {
            data(expandProperties: 'yes',
            """
            base_url: $project.base_url
            google_analytics_number : $project.google_analytics_number
            mail_user : $project.mail_user
            mail_password : $project.mail_password
            mail_recipient : $project.mail_recipient
            upload_folder : $project.upload_folder
            host : $project.host
            port : $project.port
            """
            )
        }  
        copy{
            from "${projectDir}/src/scripts/vendor"
            into "${buildDir}/scripts/vendor"
        }
    }
}

Simply ignoring the folder from being processed by FMPP and then issuing a gradle copy after FMPP completes was simple enough

0
ddekany On

You can set copy processing mode for all files inside that directory, and leave others on the default processing mode, like this: modes: [ copy(/scripts/vendor/) ]. Note the / at the end of that path; it's important. See also in the documentation: http://fmpp.sourceforge.net/settings.html#processingMode