Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8187444: Forest Consolidation: Make build work
Co-authored-by: Maurizio Cimadamore <maurizio.cimadamore@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Reviewed-by: darcy, ihse
  • Loading branch information
4 people committed Sep 12, 2017
1 parent 3789983 commit 72c4ec5
Show file tree
Hide file tree
Showing 238 changed files with 1,499 additions and 2,878 deletions.
3 changes: 3 additions & 0 deletions .hgignore
Expand Up @@ -8,3 +8,6 @@ nbproject/private/
\.DS_Store
\.metadata/
\.recommenders/
test/nashorn/script/external
test/nashorn/lib
NashornProfile.txt
4 changes: 2 additions & 2 deletions README
Expand Up @@ -4,7 +4,7 @@ Welcome to OpenJDK!
For information about building OpenJDK, including how to fully retrieve all
source code, please see either of these:

* common/doc/building.html (html version)
* common/doc/building.md (markdown version)
* doc/building.html (html version)
* doc/building.md (markdown version)

See http://openjdk.java.net/ for more information about OpenJDK.
54 changes: 37 additions & 17 deletions bin/idea.sh
Expand Up @@ -25,14 +25,14 @@
# Shell script for generating an IDEA project from a given list of modules

usage() {
echo "usage: $0 [-h|--help] [-v|--verbose] [-o|--output <path>] [modules]+"
echo "usage: $0 [-h|--help] [-v|--verbose] [-o|--output <path>] [modules]+"
exit 1
}

SCRIPT_DIR=`dirname $0`
PWD=`pwd`
cd $SCRIPT_DIR; SCRIPT_DIR=`pwd`
cd ../../; TOP=`pwd`; cd $PWD
cd ../; TOP=`pwd`; cd $PWD

IDEA_OUTPUT=$TOP/.idea
VERBOSE="false"
Expand Down Expand Up @@ -70,8 +70,10 @@ IDEA_MAKE="$TOP/make/idea"
IDEA_TEMPLATE="$IDEA_MAKE/template"
IML_TEMPLATE="$IDEA_TEMPLATE/jdk.iml"
ANT_TEMPLATE="$IDEA_TEMPLATE/ant.xml"
MISC_TEMPLATE="$IDEA_TEMPLATE/misc.xml"
IDEA_IML="$IDEA_OUTPUT/jdk.iml"
IDEA_ANT="$IDEA_OUTPUT/ant.xml"
IDEA_MISC="$IDEA_OUTPUT/misc.xml"

if [ "$VERBOSE" = "true" ] ; then
echo "output dir: $IDEA_OUTPUT"
Expand Down Expand Up @@ -120,20 +122,16 @@ addSourceFolder() {
}

### Generate project iml
RELATIVE_BUILD_DIR="`dirname $SPEC | sed -e s@"$TOP/\(.*$\)"@"\1"@`"
rm -f $IDEA_IML
while IFS= read -r line
do
if echo "$line" | egrep "^ .* <sourceFolder.*####" > /dev/null ; then
if [ "$SOURCE_FOLDERS_DONE" = "false" ] ; then
if [ "$SOURCE_FOLDERS_DONE" = "false" ] ; then
SOURCE_FOLDERS_DONE="true"
for root in $MODULE_ROOTS; do
addSourceFolder $root
done
fi
elif echo "$line" | egrep "^ .* <excludeFolder.*####" > /dev/null ; then
ul="`echo "$line" | sed -e s@"\(.*/\)####\(.*\)"@"\1$RELATIVE_BUILD_DIR\2"@`"
printf "%s\n" "$ul" >> $IDEA_IML
else
printf "%s\n" "$line" >> $IDEA_IML
fi
Expand All @@ -155,30 +153,52 @@ addBuildDir() {
printf "%s\n" "$mn" >> $IDEA_ANT
}

JTREG_HOME=" <property name=\"jtreg.home\" value=\"####\" />"

addJtregHome() {
DIR=`dirname $SPEC`
mn="`echo "$JTREG_HOME" | sed -e s@"\(.*\)####\(.*\)"@"\1$JT_HOME\2"@`"
printf "%s\n" "$mn" >> $IDEA_ANT
}

### Generate ant.xml

rm -f $IDEA_ANT
while IFS= read -r line
do
if echo "$line" | egrep "^ .* <property name=\"module.name\"" > /dev/null ; then
addModuleName
elif echo "$line" | egrep "^ .* <property name=\"jtreg.home\"" > /dev/null ; then
addJtregHome
elif echo "$line" | egrep "^ .* <property name=\"build.target.dir\"" > /dev/null ; then
addBuildDir
else
printf "%s\n" "$line" >> $IDEA_ANT
fi
done < "$ANT_TEMPLATE"

### Generate misc.xml

rm -f $IDEA_MISC

JTREG_HOME=" <path>####</path>"

IMAGES_DIR=" <jre alt=\"true\" value=\"####\" />"

addImagesDir() {
DIR=`dirname $SPEC`/images/jdk
mn="`echo "$IMAGES_DIR" | sed -e s@"\(.*\)####\(.*\)"@"\1$DIR\2"@`"
printf "%s\n" "$mn" >> $IDEA_MISC
}

addJtregHome() {
DIR=`dirname $SPEC`
mn="`echo "$JTREG_HOME" | sed -e s@"\(.*\)####\(.*\)"@"\1$JT_HOME\2"@`"
printf "%s\n" "$mn" >> $IDEA_MISC
}

rm -f $MISC_ANT
while IFS= read -r line
do
if echo "$line" | egrep "^ .*<path>jtreg_home</path>" > /dev/null ; then
addJtregHome
elif echo "$line" | egrep "^ .*<jre alt=\"true\" value=\"images_jdk\"" > /dev/null ; then
addImagesDir
else
printf "%s\n" "$line" >> $IDEA_MISC
fi
done < "$MISC_TEMPLATE"

### Compile the custom Logger

CLASSES=$IDEA_OUTPUT/classes
Expand Down
2 changes: 1 addition & 1 deletion bin/jib.sh
Expand Up @@ -42,7 +42,7 @@ setup_url() {
jib_revision="2.0-SNAPSHOT"
jib_ext="jib.sh.gz"

closed_script="${mydir}/../../closed/conf/jib-install.conf"
closed_script="${mydir}/../../../closed/conf/jib-install.conf"
if [ -f "${closed_script}" ]; then
source "${closed_script}"
fi
Expand Down
1,656 changes: 180 additions & 1,476 deletions bin/unshuffle_list.txt

Large diffs are not rendered by default.

137 changes: 86 additions & 51 deletions bin/unshuffle_patch.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#!/bin/bash
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
Expand All @@ -25,14 +25,17 @@
# Script for updating a patch file as per the shuffled/unshuffled source location.

usage() {
echo "Usage: $0 [-h|--help] [-v|--verbose] <repo> <input_patch> <output_patch>"
echo "where:"
echo " <repo> is one of: corba, jaxp, jaxws, jdk, langtools, nashorn"
echo " [Note: patches from other repos do not need updating]"
echo " <input_patch> is the input patch file, that needs shuffling/unshuffling"
echo " <output_patch> is the updated patch file "
echo " "
exit 1
echo "Usage: $0 [-h|--help] [-v|--verbose] [-to9|-to10] [-r <repo>] <input_patch> <output_patch>"
echo "where:"
echo " -to9 create patches appropriate for a JDK 9 source tree"
echo " When going to 9, the output patches will be suffixed with the"
echo " repo name"
echo " -to10 create patches appropriate for a JDK 10 source tree"
echo " -r <repo> specify repo for source patch, set to 'top' for top repo"
echo " <input_patch> is the input patch file, that needs shuffling/unshuffling"
echo " <output_patch> is the updated patch file "
echo " "
exit 1
}

SCRIPT_DIR=`dirname $0`
Expand All @@ -55,40 +58,65 @@ do
vflag="true"
;;

-r)
repo="$2"
shift
;;

-to9)
shuffle_to=9
;;

-to10)
shuffle_to=10
;;

-*) # bad option
usage
;;

* ) # non option
* ) # non option
break
;;
esac
shift
done

# Make sure we have the right number of arguments
if [ ! $# -eq 3 ] ; then
if [ ! $# -eq 2 ] ; then
echo "ERROR: Invalid number of arguments." >&2
usage
fi

# Check the given repo
repos="corba jaxp jaxws jdk langtools nashorn"
repo="$1"
repos="top corba jaxp jaxws jdk langtools nashorn hotspot"
found="false"
for r in $repos ; do
if [ $repo = "$r" ] ; then
found="true"
break;
if [ -n "$repo" ]; then
for r in $repos ; do
if [ $repo = "$r" ] ; then
found="true"
break;
fi
done
if [ $found = "false" ] ; then
echo "ERROR: Unknown repo: $repo. Should be one of [$repos]." >&2
usage
fi
done
if [ $found = "false" ] ; then
echo "ERROR: Unknown repo: $repo. Should be one of [$repos]." >&2
usage
fi

if [ "$shuffle_to" != "9" -a "$shuffle_to" != "10" ]; then
echo "ERROR: Must pick either -to9 or -to10"
exit 1
fi

# When going to 10, a repo must be specified for the source patch
if [ "$shuffle_to" = "10" -a -z "$repo" ]; then
echo "ERROR: Must specify src repo for JDK 9 patch"
exit 1
fi

# Check given input/output files
input="$2"
input="$1"
if [ "x$input" = "x-" ] ; then
input="/dev/stdin"
fi
Expand All @@ -98,18 +126,26 @@ if [ ! -f $input -a "x$input" != "x/dev/stdin" ] ; then
exit 1
fi

output="$3"
output="$2"
if [ "x$output" = "x-" ] ; then
output="/dev/stdout"
fi
base_output="$output"

if [ -f $output -a "x$output" != "x/dev/stdout" ] ; then
echo "ERROR: Output patch already exists: $output" >&2
exit 1
if [ "$shuffle_to" = "10" ]; then
if [ -f $output -a "x$output" != "x/dev/stdout" ] ; then
echo "ERROR: Output patch already exists: $output" >&2
exit 1
fi
else
for r in $repos; do
if [ -f "$output.$r" ]; then
echo "ERROR: Output patch already exists: $output.$r" >&2
exit 1
fi
done
fi

what="" ## shuffle or unshuffle

verbose() {
if [ ${vflag} = "true" ] ; then
echo "$@" >&2
Expand All @@ -135,30 +171,17 @@ unshuffle() {
fi
verbose "Extracted path: \"$path\""

# Only source can be shuffled, or unshuffled
if ! echo "$path" | egrep '^src/.*' > /dev/null ; then
verbose "Not a src path, skipping."
echo "$line" >> $output
return
fi

# Shuffle or unshuffle?
if [ "${what}" = "" ] ; then
if echo "$path" | egrep '^src/java\..*|^src/jdk\..*' > /dev/null ; then
what="unshuffle"
else
what="shuffle"
fi
verbose "Shuffle or unshuffle: $what"
fi

# Find the most specific matches in the shuffle list
matches=
matchpath="$repo"/"$path"/x
if [ -n "$repo" -a "$repo" != "top" ]; then
matchpath="$repo"/"$path"/x
else
matchpath="$path"/x
fi
while [ "$matchpath" != "" ] ; do
matchpath="`echo $matchpath | sed s@'\(.*\)/.*$'@'\1'@`"

if [ "${what}" = "shuffle" ] ; then
if [ "$shuffle_to" = "10" ] ; then
pattern=": $matchpath$"
else
pattern="^$matchpath :"
Expand All @@ -177,12 +200,24 @@ unshuffle() {

# Rewrite the line, if we have a match
if ! [ "x${matches}" = "x" ] ; then
shuffled="`echo "$matches" | sed -e s@' : .*'@@g -e s@'^[a-z]*\/'@@`"
unshuffled="`echo "$matches" | sed -e s@'.* : '@@g -e s@'^[a-z]*\/'@@`"
if [ "${what}" = "shuffle" ] ; then
shuffled="${matches%% : *}"
unshuffled="${matches#* : }"
patch_suffix_9=""
for r in $repos; do
if [ "$unshuffled" != "${unshuffled#$r}" ]; then
unshuffled="${unshuffled#$r\/}"
patch_suffix_9=".$r"
fi
done
verbose "shuffled: $shuffled"
verbose "unshuffled: $unshuffled"
verbose "patch_suffix_9: $patch_suffix_9"
if [ "$shuffle_to" = "10" ] ; then
newline="`echo "$line" | sed -e s@"$unshuffled"@"$shuffled"@g`"
else
newline="`echo "$line" | sed -e s@"$shuffled"@"$unshuffled"@g`"
output=$base_output$patch_suffix_9
verbose "Writing to $output"
fi
verbose "Rewriting to \"$newline\""
echo "$newline" >> $output
Expand Down
2 changes: 1 addition & 1 deletion configure
Expand Up @@ -32,4 +32,4 @@ this_script_dir=`cd $this_script_dir > /dev/null && pwd`
# Delegate to wrapper, forcing wrapper to believe $0 is this script by using -c.
# This trick is needed to get autoconf to co-operate properly.
# The ${-:+-$-} construction passes on bash options.
bash ${-:+-$-} -c ". $this_script_dir/common/autoconf/configure" $this_script_dir/configure CHECKME $this_script_dir "$@"
bash ${-:+-$-} -c ". $this_script_dir/make/autoconf/configure" $this_script_dir/configure CHECKME $this_script_dir "$@"

0 comments on commit 72c4ec5

Please sign in to comment.