qickrooms / flex-mojos

Automatically exported from code.google.com/p/flex-mojos
0 stars 0 forks source link

Add option for Html-wrapper to set outputdir , final name of html file and use directories relative to project for template files #120

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. use html-wrapper
2. define location files as folder:html-templates
2. output is stored in target directory, html file is called 
${build.finalName}.html

What is the expected output? What do you see instead?
- allow setting of different output directory for easy usage with 
maven-assembly-plugin
- allow changing final name of html file to something like index.xhtml
- allow usage of relative folder name (without folder: URI schema)

What version of the product are you using? On what operating system?
2.0M6 , linux

Please provide any additional information below.

the attach patch will add 2 parameters to Html-Wrapper mojo
outputDir = optional location where the result is stored (relative to 
$basedir)
htmlName = optional final name of html file

example usage :
<plugin>
   <groupId>info.flex-mojos</groupId>
   <artifactId>html-wrapper-mojo</artifactId>
   <configuration>
       <templateURI>html-template</templateURI>
       <outputDir>target/flex-html</outputDir>
       <htmlName>index.html</htmlName>
       <parameters>
          <swf>${build.finalName}</swf>
       </parameters>
   </configuration>
</plugin>

this will convert the ${basedir}/html-template to target/flex-html
with final name of index.html and application name ${build.finalName}

i also included a option so that templateURI can be used as normal 
relative directory like all other options. this is maybe mis using
if URI but it was very confusing on how to use it and Folder:/
isn't really a standard uri  according to our friend wiki
http://en.wikipedia.org/wiki/URI_scheme
option would be to create 2 parameters templateURI adn templateDir
and use on of them.

this patch addresses also issue 102

luc

Original issue reported on code.google.com by luc.w...@gmail.com on 10 Oct 2008 at 6:36

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed at revision 787.

I didn't put this normal relative directory idea.  I wanna the user specifying 
the
template kind (embed, zip, folder).

Original comment by velo...@gmail.com on 10 Oct 2008 at 11:33

GoogleCodeExporter commented 9 years ago

Original comment by velo...@gmail.com on 10 Oct 2008 at 11:34

GoogleCodeExporter commented 9 years ago
the relative path thing is there because i needed in my current project.

i'm converting existing ANT project into maven. the ant script builds de 1 
source 
tree in 2 swf files. 1 with and 1 without debug info (app.swf and app-debug.swf)
i also need to support the flexbuilder environment for my flex developers.
this means  1 html-template folder just below the project folder.

so, after doing some test i came to this solution:

<project folder>
  |
  +- pom.xml            <-- main pom , package=pom
  +- html-template 
  +- src -- main --flex
  +- release -- pom.xml      <--- package=swf
  +- debug -- pom.xml        <--- package=swf

my main pom.xml defines src & html-template directory as ../src/main/flex 
& ../template-directory and basic flex-mojo configuration via <pluginManagement>

the main pom.xml is the parent pom for release\pom.xml and debug\pom.xml
and has both pom's in its modules list

when i run install on the main pom.xml , it will run release\pom.xml which will 
compile without debug and debug\pom.xml which will compile with debug code
and both pom will use the SAME directory for src & html-templates

at the end i have 2 artifacts  app-release and app-debug with finalName app.swf 
and 
app-debug.swf. the html-template also gives me a app.html and app-debug.html

keep in mind that i also must have the html-template folder as subdirectory
of project folder because flexbuilder seems to require this. I don't won't
to duplicate these files because they are changed by developers for 
customisation.

so at the end , i added this option. as mention before it's not a URI anymore
but i see that most plugins allow this so don't feel this is bad.

this Zip,Embed is not an option for me (not workable with flexbuilder)
my initial patch work via cli but broke in continuum. so i update my internal
version a bit. i'm now testing this more with other projects.

i need todo 5 project this way and our flex developers really need this 
debug/normal
versions of the apps. I feel that this can be
 usefull for more people , so i hoop you could include this feature back in.

luc

Original comment by luc.w...@gmail.com on 11 Oct 2008 at 7:45

GoogleCodeExporter commented 9 years ago
And 
<templateURI>folder:../template-directory</templateURI>

Didn't work?

Original comment by velo...@gmail.com on 11 Oct 2008 at 9:33

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
No :-(

using folder:../html-template and some extra logging in my version i got

[INFO] [html-wrapper-mojo:wrapper {execution: default}]
[INFO] Extracting template
[INFO] basedir: /home/luc/src/luma/lw2pcconfig/debug
[INFO] 
copy :../html-template -> 
/home/luc/src/luma/lw2pcconfig/debug/target/flex-compiler/html-template
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Template folder doesn't exists. ../html-template
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 21 seconds
[INFO] Finished at: Sun Oct 12 13:24:14 CEST 2008
[INFO] Final Memory: 39M/262M
[INFO] ------------------------------------------------------------------------

Note: this run is started from a higher level pom.xml that will build all 
project
related sub modules (the flex project is a submodule ) . running from flex
project it seems to work.

the toplevel pom is used to build ALL java/flex/webapp modules and for release
management.

i think by "just" using ../html-template it will use the current working 
directory
of the maven process. this is NOT the basedir of the flex project 
but /home/luc/src/luma

this is fixed by using project.getBasedir() when using relative "folder:../" 
uri 
like :

else if ( "folder".equals( scheme ) )
        {
          if (uri.getSchemeSpecificPart().startsWith('../')) {
           //relative path must be based on basedir

copyFolderTemplate(project.getBasedir()+'/'+uri.getSchemeSpecificPart(),outputDi
r );
          } else {
              copyFolderTemplate(uri.getSchemeSpecificPart(),outputDir );
          }
        }

after this change , the folder:../path will work

[INFO] [html-wrapper-mojo:wrapper {execution: default}]
[INFO] Extracting template
[INFO] basedir: /home/luc/src/luma/lw2pcconfig/debug
[INFO] 
copy :/home/luc/src/luma/lw2pcconfig/debug/../html-template -> 
/home/luc/src/luma/lw2pcconfig/debug/target/flex-compiler/html-template
[INFO] [flex-compiler-mojo:compile-swf]
[INFO] Using configuration 
file /home/luc/src/luma/lw2pcconfig/debug/target/flex-compiler/config.xml

so should i send a new patch or can you add this to the HtmlWrapper mojo

  luc

Original comment by luc.w...@gmail.com on 12 Oct 2008 at 11:45

GoogleCodeExporter commented 9 years ago
I can't add based to user path.  He can be providing a resolved path, like
c:\myfolder\template....

But, you can add it to your URI.

Instead of 
folder:../html-template 

user
folder:${basedir}/../html-template 

Original comment by velo...@gmail.com on 12 Oct 2008 at 12:53

GoogleCodeExporter commented 9 years ago
Indead , solution is so "simple" ;-)
i rest my case ..

luc

Original comment by luc.w...@gmail.com on 12 Oct 2008 at 2:47