Openembedded Devel Discussions
 help / color / mirror / Atom feed
* [meta-java][PATCH] libecj-bootstrap-native: simplify build
@ 2018-04-25 14:59 André Draszik
  2018-06-19  7:36 ` Richard Leitner
  2018-06-19  8:04 ` Richard Leitner
  0 siblings, 2 replies; 3+ messages in thread
From: André Draszik @ 2018-04-25 14:59 UTC (permalink / raw)
  To: openembedded-devel

From: André Draszik <andre.draszik@jci.com>

Piping 'find' output into multiple files to re-read
them seems inelegant and is error prone - just use a
pipe with appropriate options instead.

This avoids potential problems with funny file names,
and now also makes use of BB_NUMBER_THREADS to speed
up compilation.

This is a better example to copy from now...

Signed-off-by: André Draszik <andre.draszik@jci.com>
---
 recipes-core/ecj/libecj-bootstrap.inc | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/recipes-core/ecj/libecj-bootstrap.inc b/recipes-core/ecj/libecj-bootstrap.inc
index 9350550..04425f4 100644
--- a/recipes-core/ecj/libecj-bootstrap.inc
+++ b/recipes-core/ecj/libecj-bootstrap.inc
@@ -17,13 +17,8 @@ JAR = "ecj-bootstrap-${PV}.jar"
 
 do_unpackpost[dirs] = "${B}"
 do_unpackpost() {
-  if [ ! -d source ]; then
-    mkdir source
-  fi
-
-  if [ ! -d build ]; then
-    mkdir build
-  fi
+  mkdir -p source
+  mkdir -p build
 
   # Remove crap.
   rm -f about.html build.xml
@@ -44,24 +39,18 @@ do_unpackpost() {
   cp -R source/org build/
 
   # Remove source code and other stuff.
-  find build -name '*.java' -exec rm -f {} \;
-  find build -name '*.html' -exec rm -f {} \;
+  find build -depth \( -name '*.java' -o -name '*.html' \) -delete
 }
 
 addtask unpackpost after do_unpack before do_patch
 
 do_compile() {
-  find source -name '*.java' | LC_ALL=C sort > sourcefiles
-  split -l 25 sourcefiles ecj-sources.
-
   # Compiling in place is done because the sources contain
   # property files which need to be available at runtime.
-  for list in `find . -name 'ecj-sources.*'`; do
-      echo "building files in $list ...";
-      echo jikes-initial -d build -source 1.4 -sourcepath source `cat $list`;
-      jikes-initial \
-				-d build -source 1.4 -sourcepath source `cat $list`;
-  done
+  find source -name '*.java' -print0 \
+    | LC_ALL=C sort -z \
+    | xargs -0 -n25 -P ${BB_NUMBER_THREADS} \
+        jikes-initial -d build -source 1.4 -sourcepath source
 
   fastjar -c -C build . -f ${JAR}
 }
-- 
2.16.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [meta-java][PATCH] libecj-bootstrap-native: simplify build
  2018-04-25 14:59 [meta-java][PATCH] libecj-bootstrap-native: simplify build André Draszik
@ 2018-06-19  7:36 ` Richard Leitner
  2018-06-19  8:04 ` Richard Leitner
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Leitner @ 2018-06-19  7:36 UTC (permalink / raw)
  To: André Draszik, openembedded-devel


On 25.04.2018 16:59, André Draszik wrote:
> From: André Draszik <andre.draszik@jci.com>
> 
> Piping 'find' output into multiple files to re-read
> them seems inelegant and is error prone - just use a
> pipe with appropriate options instead.
> 
> This avoids potential problems with funny file names,
> and now also makes use of BB_NUMBER_THREADS to speed
> up compilation.
> 
> This is a better example to copy from now...
> 
> Signed-off-by: André Draszik <andre.draszik@jci.com>

Tested-by: Richard Leitner <richard.leitner@skidata.com>

> ---
>   recipes-core/ecj/libecj-bootstrap.inc | 25 +++++++------------------
>   1 file changed, 7 insertions(+), 18 deletions(-)
> 
> diff --git a/recipes-core/ecj/libecj-bootstrap.inc b/recipes-core/ecj/libecj-bootstrap.inc
> index 9350550..04425f4 100644
> --- a/recipes-core/ecj/libecj-bootstrap.inc
> +++ b/recipes-core/ecj/libecj-bootstrap.inc
> @@ -17,13 +17,8 @@ JAR = "ecj-bootstrap-${PV}.jar"
>   
>   do_unpackpost[dirs] = "${B}"
>   do_unpackpost() {
> -  if [ ! -d source ]; then
> -    mkdir source
> -  fi
> -
> -  if [ ! -d build ]; then
> -    mkdir build
> -  fi
> +  mkdir -p source
> +  mkdir -p build
>   
>     # Remove crap.
>     rm -f about.html build.xml
> @@ -44,24 +39,18 @@ do_unpackpost() {
>     cp -R source/org build/
>   
>     # Remove source code and other stuff.
> -  find build -name '*.java' -exec rm -f {} \;
> -  find build -name '*.html' -exec rm -f {} \;
> +  find build -depth \( -name '*.java' -o -name '*.html' \) -delete
>   }
>   
>   addtask unpackpost after do_unpack before do_patch
>   
>   do_compile() {
> -  find source -name '*.java' | LC_ALL=C sort > sourcefiles
> -  split -l 25 sourcefiles ecj-sources.
> -
>     # Compiling in place is done because the sources contain
>     # property files which need to be available at runtime.
> -  for list in `find . -name 'ecj-sources.*'`; do
> -      echo "building files in $list ...";
> -      echo jikes-initial -d build -source 1.4 -sourcepath source `cat $list`;
> -      jikes-initial \
> -				-d build -source 1.4 -sourcepath source `cat $list`;
> -  done
> +  find source -name '*.java' -print0 \
> +    | LC_ALL=C sort -z \
> +    | xargs -0 -n25 -P ${BB_NUMBER_THREADS} \
> +        jikes-initial -d build -source 1.4 -sourcepath source
>   
>     fastjar -c -C build . -f ${JAR}
>   }
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [meta-java][PATCH] libecj-bootstrap-native: simplify build
  2018-04-25 14:59 [meta-java][PATCH] libecj-bootstrap-native: simplify build André Draszik
  2018-06-19  7:36 ` Richard Leitner
@ 2018-06-19  8:04 ` Richard Leitner
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Leitner @ 2018-06-19  8:04 UTC (permalink / raw)
  To: André Draszik, openembedded-devel

Hi,
this is a note to let you know that I've just added this patch to the
master-next branch of the meta-java repository at
	git://git.yoctoproject.org/meta-java

As soon as it has gone through some more testing it will likely be
merged to the master branch.

If you have any questions, please let me know.

regards;Richard.L

On 25.04.2018 16:59, André Draszik wrote:
> From: André Draszik <andre.draszik@jci.com>
> 
> Piping 'find' output into multiple files to re-read
> them seems inelegant and is error prone - just use a
> pipe with appropriate options instead.
> 
> This avoids potential problems with funny file names,
> and now also makes use of BB_NUMBER_THREADS to speed
> up compilation.
> 
> This is a better example to copy from now...
> 
> Signed-off-by: André Draszik <andre.draszik@jci.com>
> ---
>   recipes-core/ecj/libecj-bootstrap.inc | 25 +++++++------------------
>   1 file changed, 7 insertions(+), 18 deletions(-)
> 
> diff --git a/recipes-core/ecj/libecj-bootstrap.inc b/recipes-core/ecj/libecj-bootstrap.inc
> index 9350550..04425f4 100644
> --- a/recipes-core/ecj/libecj-bootstrap.inc
> +++ b/recipes-core/ecj/libecj-bootstrap.inc
> @@ -17,13 +17,8 @@ JAR = "ecj-bootstrap-${PV}.jar"
>   
>   do_unpackpost[dirs] = "${B}"
>   do_unpackpost() {
> -  if [ ! -d source ]; then
> -    mkdir source
> -  fi
> -
> -  if [ ! -d build ]; then
> -    mkdir build
> -  fi
> +  mkdir -p source
> +  mkdir -p build
>   
>     # Remove crap.
>     rm -f about.html build.xml
> @@ -44,24 +39,18 @@ do_unpackpost() {
>     cp -R source/org build/
>   
>     # Remove source code and other stuff.
> -  find build -name '*.java' -exec rm -f {} \;
> -  find build -name '*.html' -exec rm -f {} \;
> +  find build -depth \( -name '*.java' -o -name '*.html' \) -delete
>   }
>   
>   addtask unpackpost after do_unpack before do_patch
>   
>   do_compile() {
> -  find source -name '*.java' | LC_ALL=C sort > sourcefiles
> -  split -l 25 sourcefiles ecj-sources.
> -
>     # Compiling in place is done because the sources contain
>     # property files which need to be available at runtime.
> -  for list in `find . -name 'ecj-sources.*'`; do
> -      echo "building files in $list ...";
> -      echo jikes-initial -d build -source 1.4 -sourcepath source `cat $list`;
> -      jikes-initial \
> -				-d build -source 1.4 -sourcepath source `cat $list`;
> -  done
> +  find source -name '*.java' -print0 \
> +    | LC_ALL=C sort -z \
> +    | xargs -0 -n25 -P ${BB_NUMBER_THREADS} \
> +        jikes-initial -d build -source 1.4 -sourcepath source
>   
>     fastjar -c -C build . -f ${JAR}
>   }
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-06-19  8:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-25 14:59 [meta-java][PATCH] libecj-bootstrap-native: simplify build André Draszik
2018-06-19  7:36 ` Richard Leitner
2018-06-19  8:04 ` Richard Leitner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox