Hello

I'd rather like to have the creation of the zip files back in the
package phase. After all that's what "package" is intended for.

If you want the phpdoc be contained in the zip, it should be
run in the package phase as well. The maven-javadoc-plugin suggests
this as well if one wants to distribute javadoc as downloadable package.

Building it this way would have the advantage that we could later
start doing fancy stuff in the "validate" and "deploy" phases as well.

Attached is a patch that does exactly this. If it's ok for you, I
commit.

BTW, phpunit was started twice, once for code coverage and once for
surefire, I merged those two runs into one. 

bye,

-christian-




Am Sun, 25 Oct 2009 12:56:45 +0100
schrieb Christian Grobmeier <[email protected]>:

> Hi,
> 
> > If I understood Maven life cycles correctly, the default lifecycle
> > with compile and package is supposed to run without having to run
> > the site lifecycle in between....
> > The problematic line is:
> >          <includeSiteDirectory>true</includeSiteDirectory>
> 
> No, its because I appended the assembly to the package phase. We
> should delete this line:
> 
> <phase>package</phase>
> 
> I will do that later
> That way assembly and package is independent again
> 
> 
> > Then there is the pear-assembly.xml which does also packages the
> > sources but is no PEAR package because the package.xml is not
> > generated anymore.
> 
> Yes thats why I asked for your help - i have the lines in the
> execution  block in the pom, but commented out. We would need to
> generate this while building. But now I can do this myself :-)
> 
> > I would propose to have the following:
> >
> > * src/assembly/src.xml
> >        Creates log4php-2.0.0-incubating-src.zip/tgz with everything
> >        that survives "mvn clean".
> >
> > * src/assembly/bin.xml
> >        Creates log4php-2.0.0-incubating.zip/tgz with just the
> >        src/main/php/ directory, renamed to log4php/ together
> >        with the CHANGELOGs + READMEs. It's for users who just want
> > to copy one directoy to their /usr/local/share/php/
> >
> > * src/assembly/pear-package.xml
> >        Creates log4php-2.0.0incubating.tgz (no zip necessary) that
> >        contains src/main/php/, src/main/examples/, the toplevel
> >        READMEs and a valid package.xml which has to be produced
> > using the pacakge-* scripts as ant task. The latter should be bound
> >        to the maven "prepare-package" phase and stay in pom.xml.
> >
> > What do you think?
> 
> 
> I agree to the pear-package with having package.xml of course and
> everything which is needed by pear (means: no test-php).
> 
> But for the other, I think we need a simple package with everything
> included, tests and code, license and stuff. I don't see to separate
> between bin and src, since php doesn't have binaries. I also don't
> like to touch the directory structure - one can easily copy from
> src/main/php what he needs. Everything else could lead to confusion
> with bugreporting.
> 
> With the fix above goals should work again.
> 
> Cheers,
> Christian
> 
> 
> >
> > bye,
> >
> > -christian-
> >
> >
> >
> > Am Fri, 23 Oct 2009 08:56:55 +0200
> > schrieb Christian Grobmeier <[email protected]>:
> >
> >> Hi Christian
> >>
> >> its not necessary to add this one here. The file in question is
> >> src/assembly/bin.xml were it's already included.
> >> I have added the pear-assembly file, but can you help going through
> >> it? There is some execution missing, which we need to create in the
> >> pom :-)
> >>
> >> Cheers
> >>
> >> On Fri, Oct 23, 2009 at 12:28 AM,  <[email protected]> wrote:
> >> > Author: chammers
> >> > Date: Thu Oct 22 22:28:53 2009
> >> > New Revision: 828879
> >> >
> >> > URL: http://svn.apache.org/viewvc?rev=828879&view=rev
> >> > Log:
> >> > Create .zip file with identical content as the PEAR .tgz.
> >> > Too bad that the PEAR version number may not (it's validated)
> >> > contain the -SNAPSHOT so the it has to be specified separately. I
> >> > could not find out how to elegantly use sed or a regex in the
> >> > pom.xml.
> >> >
> >> > Modified:
> >> >    incubator/log4php/trunk/pom.xml
> >> >
> >> > Modified: incubator/log4php/trunk/pom.xml
> >> > URL:
> >> > http://svn.apache.org/viewvc/incubator/log4php/trunk/pom.xml?rev=828879&r1=828878&r2=828879&view=diff
> >> > ==============================================================================
> >> > --- incubator/log4php/trunk/pom.xml (original) +++
> >> > incubator/log4php/trunk/pom.xml Thu Oct 22 22:28:53 2009 @@
> >> > -117,6 +117,7 @@ <properties>
> >> >                
> >> > <surefire.reports>target/surefire-reports</surefire.reports>
> >> >                
> >> > <coverage.report>target/site/coverage-report</coverage.report>
> >> > +               <pear.version>2.0</pear.version>
> >> >        </properties>
> >> >
> >> >        <build>
> >> > @@ -190,6 +191,14 @@
> >> >                                 <exec executable="pear"
> >> > dir="target/pear"> <arg line="package"/>
> >> >                                 </exec>
> >> > +                                <!-- Create zip archive with
> >> > identical contents as the .tgz -->
> >> > +                                <!-- The version number of the
> >> > pear package does never contain -SNAPSHOT. -->
> >> > +                                <untar dest="target/zip">
> >> > +                                    <gzipresource>
> >> > +                                        <file
> >> > file="target/pear/log4php-${pear.version}.tgz"/>
> >> > +                                    </gzipresource>
> >> > +                                </untar>
> >> > +                                <zip
> >> > destfile="target/pear/log4php-${pear.version}.zip"
> >> > basedir="target/zip/" /> </tasks> </configuration>
> >> >                     </execution>
> >> >
> >> >
> >> >
> >
Index: src/assembly/bin.xml
===================================================================
--- src/assembly/bin.xml	(Revision 830030)
+++ src/assembly/bin.xml	(Arbeitskopie)
@@ -26,7 +26,7 @@
                 <format>tar.gz</format>
         </formats>
         <baseDirectory>apache-log4php-${project.version}</baseDirectory>
-        <includeSiteDirectory>true</includeSiteDirectory>
+        <!-- code-coverage etc. should be excluded includeSiteDirectory>true</includeSiteDirectory -->
         <fileSets>
                 <fileSet>
                         <includes>
@@ -39,5 +39,9 @@
                                 <include>src/**</include>
                         </includes>
                 </fileSet>
+                <fileSet>
+                        <directory>target/site/apidocs/</directory>
+                        <outputDirectory>apidocs/</outputDirectory>
+                </fileSet>       
         </fileSets>
 </assembly>
Index: pom.xml
===================================================================
--- pom.xml	(Revision 829997)
+++ pom.xml	(Arbeitskopie)
@@ -185,7 +185,7 @@
                         +--> 
 				    <execution>
 						<id>phpdoc</id>
-						<phase>pre-site</phase>
+						<phase>package</phase> <!-- docs are included in distributed .zip -->
 						<goals>
 							<goal>run</goal>
 						</goals>
@@ -206,18 +206,21 @@
 						</configuration>
 					</execution>
 					<!--+
-                        | PHPUnit must be installed for this execution 
+                        | PHPUnit (and XDebug for the coverage report) must be installed for this execution 
                         +-->      
 					<execution>
-                        <phase>test</phase>
                         <id>test</id>
+                        <phase>test</phase>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>                        
                         <configuration>
-                            
                             <tasks>
                                 <mkdir dir="${surefire.reports}" />
+                                <mkdir dir="${coverage.report}" />
                                 <exec executable="phpunit" dir="src/test/php">
-                                    <arg
-                                        line=" --log-junit ../../../${surefire.reports}/phpunit-testresults.xml ." />
+                                    <arg line=" --log-junit ../../../${surefire.reports}/phpunit-testresults.xml" />
+                                    <arg line=" --coverage-html ../../../${coverage.report}" />
                                 </exec>
 
                                 <xslt in="${surefire.reports}/phpunit-testresults.xml" out="${surefire.reports}/xslt.info"
@@ -226,28 +229,8 @@
                                 </xslt>
                             </tasks>
                         </configuration>
-                        <goals>
-                            <goal>run</goal>
-                        </goals>
                     </execution>
-                    
-                    <!-- This execution depends on XDebug -->
-                    <execution>
-                        <phase>pre-site</phase>
-                        <id>codecoverage</id>
-                        <configuration>
-                            <tasks>
-                                <mkdir dir="${coverage.report}" />
-                                <exec executable="phpunit" dir="src/test/php">
-                                    <arg line=" --report ../../../${coverage.report} ." />
-                                </exec>
-                            </tasks>
-                        </configuration>
-                        <goals>
-                            <goal>run</goal>
-                        </goals>
-                    </execution>
-				</executions>
+                </executions>                    
 			</plugin>
 
 			<plugin>
@@ -262,9 +245,10 @@
 				<executions>
 					<execution>
 						<id>make-assembly</id> <!-- this is used for inheritance merges -->
-            			<goals>
-							<goal>assembly</goal>
-						</goals>
+                        <phase>package</phase> <!-- append to the packaging phase. -->
+                        <goals>
+                            <goal>single</goal> <!-- goals == mojos -->
+                        </goals>
 					</execution>
 				</executions>
 			</plugin>

Reply via email to