diff options
Diffstat (limited to 'bin')
-rw-r--r-- | bin/blessed-modifier-order.sh | 60 | ||||
-rw-r--r-- | bin/idea.sh | 248 | ||||
-rw-r--r-- | bin/jib.sh | 154 | ||||
-rw-r--r-- | bin/print-config.js | 45 | ||||
-rw-r--r-- | bin/unshuffle_list.txt | 192 | ||||
-rw-r--r-- | bin/unshuffle_patch.sh | 237 |
6 files changed, 936 insertions, 0 deletions
diff --git a/bin/blessed-modifier-order.sh b/bin/blessed-modifier-order.sh new file mode 100644 index 0000000..4e999e0 --- /dev/null +++ b/bin/blessed-modifier-order.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# +# Copyright 2015 Google, Inc. 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 +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. + +usage() { + ( + echo "$0 DIR ..." + echo "Modifies in place all the java source files found" + echo "in the given directories so that all java language modifiers" + echo "are in the canonical order given by Modifier#toString()." + echo "Tries to get it right even within javadoc comments," + echo "and even if the list of modifiers spans 2 lines." + echo + echo "See:" + echo "https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Modifier.html#toString-int-" + echo + echo "Example:" + echo "$0 jdk/src/java.base jdk/test/java/{util,io,lang}" + ) >&2 + exit 1 +} + +set -eu +declare -ar dirs=("$@") +[[ "${#dirs[@]}" > 0 ]] || usage +for dir in "${dirs[@]}"; do [[ -d "$dir" ]] || usage; done + +declare -ar modifiers=( + public protected private + abstract static final transient + volatile synchronized native strictfp +) +declare -r SAVE_IFS="$IFS" +for ((i = 3; i < "${#modifiers[@]}"; i++)); do + IFS='|'; x="${modifiers[*]:0:i}" y="${modifiers[*]:i}"; IFS="$SAVE_IFS" + if [[ -n "$x" && -n "$y" ]]; then + find "${dirs[@]}" -name '*.java' -type f -print0 | \ + xargs -0 perl -0777 -p -i -e \ + "do {} while s/^([A-Za-z@* ]*)\b($y)(\s|(?:\s|\n\s+\*)*\s)($x)\b/\1\4\3\2/mg" + fi +done diff --git a/bin/idea.sh b/bin/idea.sh new file mode 100644 index 0000000..49c6ee4 --- /dev/null +++ b/bin/idea.sh @@ -0,0 +1,248 @@ +#!/bin/sh +# +# Copyright (c) 2009, 2020, 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 +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# 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]+" + exit 1 +} + +SCRIPT_DIR=`dirname $0` +#assume TOP is the dir from which the script has been called +TOP=`pwd` +cd $SCRIPT_DIR; SCRIPT_DIR=`pwd` +cd $TOP; + +IDEA_OUTPUT=$TOP/.idea +VERBOSE="false" +while [ $# -gt 0 ] +do + case $1 in + -h | --help ) + usage + ;; + + -v | --vebose ) + VERBOSE="true" + ;; + + -o | --output ) + IDEA_OUTPUT=$2/.idea + shift + ;; + + -*) # bad option + usage + ;; + + * ) # non option + break + ;; + esac + shift +done + +mkdir -p $IDEA_OUTPUT || exit 1 +cd $IDEA_OUTPUT; IDEA_OUTPUT=`pwd` + +if [ "x$TOPLEVEL_DIR" = "x" ] ; then + cd $SCRIPT_DIR/.. + TOPLEVEL_DIR=`pwd` + cd $IDEA_OUTPUT +fi + +MAKE_DIR="$SCRIPT_DIR/../make" +IDEA_MAKE="$MAKE_DIR/ide/idea/jdk" +IDEA_TEMPLATE="$IDEA_MAKE/template" + +cp -r "$IDEA_TEMPLATE"/* "$IDEA_OUTPUT" + +#override template +if [ -d "$TEMPLATES_OVERRIDE" ] ; then + for file in `ls -p "$TEMPLATES_OVERRIDE" | grep -v /`; do + cp "$TEMPLATES_OVERRIDE"/$file "$IDEA_OUTPUT"/ + done +fi + +if [ "$VERBOSE" = "true" ] ; then + echo "output dir: $IDEA_OUTPUT" + echo "idea template dir: $IDEA_TEMPLATE" +fi + +cd $TOP ; make -f "$IDEA_MAKE/idea.gmk" -I $MAKE_DIR/.. idea MAKEOVERRIDES= OUT=$IDEA_OUTPUT/env.cfg MODULES="$*" || exit 1 +cd $SCRIPT_DIR + +. $IDEA_OUTPUT/env.cfg + +# Expect MODULE_ROOTS, MODULE_NAMES, BOOT_JDK & SPEC to be set +if [ "x$MODULE_ROOTS" = "x" ] ; then + echo "FATAL: MODULE_ROOTS is empty" >&2; exit 1 +fi + +if [ "x$MODULE_NAMES" = "x" ] ; then + echo "FATAL: MODULE_NAMES is empty" >&2; exit 1 +fi + +if [ "x$BOOT_JDK" = "x" ] ; then + echo "FATAL: BOOT_JDK is empty" >&2; exit 1 +fi + +if [ "x$SPEC" = "x" ] ; then + echo "FATAL: SPEC is empty" >&2; exit 1 +fi + +if [ -d "$TOPLEVEL_DIR/.hg" ] ; then + VCS_TYPE="hg4idea" +fi + +if [ -d "$TOPLEVEL_DIR/.git" ] ; then + VCS_TYPE="Git" +fi + +### Replace template variables + +NUM_REPLACEMENTS=0 + +replace_template_file() { + for i in $(seq 1 $NUM_REPLACEMENTS); do + eval "sed \"s|\${FROM${i}}|\${TO${i}}|g\" $1 > $1.tmp" + mv $1.tmp $1 + done +} + +replace_template_dir() { + for f in `find $1 -type f` ; do + replace_template_file $f + done +} + +add_replacement() { + NUM_REPLACEMENTS=`expr $NUM_REPLACEMENTS + 1` + eval FROM$NUM_REPLACEMENTS='$1' + eval TO$NUM_REPLACEMENTS='$2' +} + +add_replacement "###MODULE_NAMES###" "$MODULE_NAMES" +add_replacement "###VCS_TYPE###" "$VCS_TYPE" +SPEC_DIR=`dirname $SPEC` +if [ "x$CYGPATH" != "x" ]; then + add_replacement "###BUILD_DIR###" "`cygpath -am $SPEC_DIR`" + add_replacement "###IMAGES_DIR###" "`cygpath -am $SPEC_DIR`/images/jdk" + add_replacement "###ROOT_DIR###" "`cygpath -am $TOPLEVEL_DIR`" + add_replacement "###IDEA_DIR###" "`cygpath -am $IDEA_OUTPUT`" + if [ "x$JT_HOME" = "x" ]; then + add_replacement "###JTREG_HOME###" "" + else + add_replacement "###JTREG_HOME###" "`cygpath -am $JT_HOME`" + fi +elif [ "x$WSL_DISTRO_NAME" != "x" ]; then + add_replacement "###BUILD_DIR###" "`wslpath -am $SPEC_DIR`" + add_replacement "###IMAGES_DIR###" "`wslpath -am $SPEC_DIR`/images/jdk" + add_replacement "###ROOT_DIR###" "`wslpath -am $TOPLEVEL_DIR`" + add_replacement "###IDEA_DIR###" "`wslpath -am $IDEA_OUTPUT`" + if [ "x$JT_HOME" = "x" ]; then + add_replacement "###JTREG_HOME###" "" + else + add_replacement "###JTREG_HOME###" "`wslpath -am $JT_HOME`" + fi +else + add_replacement "###BUILD_DIR###" "$SPEC_DIR" + add_replacement "###JTREG_HOME###" "$JT_HOME" + add_replacement "###IMAGES_DIR###" "$SPEC_DIR/images/jdk" + add_replacement "###ROOT_DIR###" "$TOPLEVEL_DIR" + add_replacement "###IDEA_DIR###" "$IDEA_OUTPUT" +fi + +SOURCE_PREFIX="<sourceFolder url=\"file://" +SOURCE_POSTFIX="\" isTestSource=\"false\" />" + +for root in $MODULE_ROOTS; do + if [ "x$CYGPATH" != "x" ]; then + root=`cygpath -am $root` + elif [ "x$WSL_DISTRO_NAME" != "x" ]; then + root=`wslpath -am $root` + fi + + VM_CI="jdk.internal.vm.ci/share/classes" + VM_COMPILER="src/jdk.internal.vm.compiler/share/classes" + if test "${root#*$VM_CI}" != "$root" || test "${root#*$VM_COMPILER}" != "$root"; then + for subdir in "$root"/*; do + if [ -d "$subdir" ]; then + SOURCES=$SOURCES" $SOURCE_PREFIX""$subdir"/src"$SOURCE_POSTFIX" + fi + done + else + SOURCES=$SOURCES" $SOURCE_PREFIX""$root""$SOURCE_POSTFIX" + fi +done + +add_replacement "###SOURCE_ROOTS###" "$SOURCES" + +replace_template_dir "$IDEA_OUTPUT" + +### Compile the custom Logger + +CLASSES=$IDEA_OUTPUT/classes + +if [ "x$ANT_HOME" = "x" ] ; then + # try some common locations, before giving up + if [ -f "/usr/share/ant/lib/ant.jar" ] ; then + ANT_HOME="/usr/share/ant" + elif [ -f "/usr/local/Cellar/ant/1.9.4/libexec/lib/ant.jar" ] ; then + ANT_HOME="/usr/local/Cellar/ant/1.9.4/libexec" + else + echo "FATAL: cannot find ant. Try setting ANT_HOME." >&2; exit 1 + fi +fi +CP=$ANT_HOME/lib/ant.jar +rm -rf $CLASSES; mkdir $CLASSES + +if [ "x$CYGPATH" != "x" ] ; then ## CYGPATH may be set in env.cfg + JAVAC_SOURCE_FILE=`cygpath -am $IDEA_OUTPUT/src/idea/IdeaLoggerWrapper.java` + JAVAC_SOURCE_PATH=`cygpath -am $IDEA_OUTPUT/src` + JAVAC_CLASSES=`cygpath -am $CLASSES` + JAVAC_CP=`cygpath -am $CP` + JAVAC=javac +elif [ "x$WSL_DISTRO_NAME" != "x" ]; then + JAVAC_SOURCE_FILE=`realpath --relative-to=./ $IDEA_OUTPUT/src/idea/IdeaLoggerWrapper.java` + JAVAC_SOURCE_PATH=`realpath --relative-to=./ $IDEA_OUTPUT/src` + JAVAC_CLASSES=`realpath --relative-to=./ $CLASSES` + ANT_TEMP=`mktemp -d -p ./` + cp $ANT_HOME/lib/ant.jar $ANT_TEMP/ant.jar + JAVAC_CP=$ANT_TEMP/ant.jar + JAVAC=javac.exe +else + JAVAC_SOURCE_FILE=$IDEA_OUTPUT/src/idea/IdeaLoggerWrapper.java + JAVAC_SOURCE_PATH=$IDEA_OUTPUT/src + JAVAC_CLASSES=$CLASSES + JAVAC_CP=$CP + JAVAC=javac +fi + +$BOOT_JDK/bin/$JAVAC -d $JAVAC_CLASSES -sourcepath $JAVAC_SOURCE_PATH -cp $JAVAC_CP $JAVAC_SOURCE_FILE + +if [ "x$WSL_DISTRO_NAME" != "x" ]; then + rm -rf $ANT_TEMP +fi
\ No newline at end of file diff --git a/bin/jib.sh b/bin/jib.sh new file mode 100644 index 0000000..aab1989 --- /dev/null +++ b/bin/jib.sh @@ -0,0 +1,154 @@ +#!/bin/bash +# +# Copyright (c) 2015, 2016, 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 +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# This script installs the JIB tool into it's own local repository and +# puts a wrapper scripts into <source-root>/.jib + +mydir="$(dirname "${BASH_SOURCE[0]}")" +myname="$(basename "${BASH_SOURCE[0]}")" + +installed_jib_script=${mydir}/../.jib/jib +install_data=${mydir}/../.jib/.data + +setup_url() { + if [ -f ~/.config/jib/jib.conf ]; then + source ~/.config/jib/jib.conf + fi + + jib_repository="jdk-virtual" + jib_organization="jpg/infra/builddeps" + jib_module="jib" + jib_revision="3.0-SNAPSHOT" + jib_ext="jib.sh.gz" + + closed_script="${mydir}/../../closed/make/conf/jib-install.conf" + if [ -f "${closed_script}" ]; then + source "${closed_script}" + fi + + if [ -n "${JIB_SERVER}" ]; then + jib_server="${JIB_SERVER}" + fi + if [ -n "${JIB_SERVER_MIRRORS}" ]; then + jib_server_mirrors="${JIB_SERVER_MIRRORS}" + fi + if [ -n "${JIB_REPOSITORY}" ]; then + jib_repository="${JIB_REPOSITORY}" + fi + if [ -n "${JIB_ORGANIZATION}" ]; then + jib_organization="${JIB_ORGANIZATION}" + fi + if [ -n "${JIB_MODULE}" ]; then + jib_module="${JIB_MODULE}" + fi + if [ -n "${JIB_REVISION}" ]; then + jib_revision="${JIB_REVISION}" + fi + if [ -n "${JIB_EXTENSION}" ]; then + jib_extension="${JIB_EXTENSION}" + fi + + if [ -n "${JIB_URL}" ]; then + jib_url="${JIB_URL}" + data_string="${jib_url}" + else + jib_path="${jib_repository}/${jib_organization}/${jib_module}/${jib_revision}/${jib_module}-${jib_revision}.${jib_ext}" + data_string="${jib_path}" + jib_url="${jib_server}/${jib_path}" + fi +} + +install_jib() { + if [ -z "${jib_server}" -a -z "${JIB_URL}" ]; then + echo "No jib server or URL provided, set either" + echo "JIB_SERVER=<base server address>" + echo "or" + echo "JIB_URL=<full path to install script>" + exit 1 + fi + + if command -v curl > /dev/null; then + getcmd="curl -s -L --retry 3 --retry-delay 5" + elif command -v wget > /dev/null; then + getcmd="wget --quiet -O -" + else + echo "Could not find either curl or wget" + exit 1 + fi + + if ! command -v gunzip > /dev/null; then + echo "Could not find gunzip" + exit 1 + fi + + echo "Downloading JIB bootstrap script" + mkdir -p "${installed_jib_script%/*}" + rm -f "${installed_jib_script}.gz" + ${getcmd} ${jib_url} > "${installed_jib_script}.gz" + if [ ! -s "${installed_jib_script}.gz" ]; then + echo "Failed to download ${jib_url}" + if [ -n "${jib_path}" -a -n "${jib_server_mirrors}" ]; then + OLD_IFS="${IFS}" + IFS=" ," + for mirror in ${jib_server_mirrors}; do + echo "Trying mirror ${mirror}" + jib_url="${mirror}/${jib_path}" + ${getcmd} ${jib_url} > "${installed_jib_script}.gz" + if [ -s "${installed_jib_script}.gz" ]; then + echo "Download from mirror successful" + break + else + echo "Failed to download ${jib_url}" + fi + done + IFS="${OLD_IFS}" + fi + if [ ! -s "${installed_jib_script}.gz" ]; then + exit 1 + fi + fi + echo "Extracting JIB bootstrap script" + rm -f "${installed_jib_script}" + gunzip "${installed_jib_script}.gz" + chmod +x "${installed_jib_script}" + echo "${data_string}" > "${install_data}" +} + +# Main body starts here + +setup_url + +if [ ! -x "${installed_jib_script}" ]; then + install_jib +elif [ ! -e "${install_data}" ] || [ "${data_string}" != "$(cat "${install_data}")" ]; then + echo "Install url changed since last time, reinstalling" + install_jib +fi + +# Provide a reasonable default for the --src-dir parameter if run out of tree +if [ -z "${JIB_SRC_DIR}" ]; then + export JIB_SRC_DIR="${mydir}/../" +fi + +${installed_jib_script} "$@" diff --git a/bin/print-config.js b/bin/print-config.js new file mode 100644 index 0000000..1abb206 --- /dev/null +++ b/bin/print-config.js @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2015, 2016, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * This little utility can be used to expand the jib-profiles configuration + * files into plain json. + * + * Usage: + * + * jjs -scripting print-config.js -- [<jib-profiles.js>] + * + */ + +var file = $ARG[0]; +if (file == null) { + file = new java.io.File(__DIR__, "../conf/jib-profiles.js").getCanonicalPath(); +} +load(file); +var input = {}; +input.get = function(dependencyName, attribute) { + return "\${" + dependencyName + "." + attribute + "}"; +}; +print(JSON.stringify(getJibProfiles(input), null, 2)); diff --git a/bin/unshuffle_list.txt b/bin/unshuffle_list.txt new file mode 100644 index 0000000..36ad8fe --- /dev/null +++ b/bin/unshuffle_list.txt @@ -0,0 +1,192 @@ +# +# Copyright (c) 2014, 2020, 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 +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +src/bsd : jdk/src/bsd +src/demo : jdk/src/demo +src/java.activation : jaxws/src/java.activation +src/java.base : jdk/src/java.base +src/java.compiler : langtools/src/java.compiler +src/java.corba : corba/src/java.corba +src/java.datatransfer : jdk/src/java.datatransfer +src/java.desktop : jdk/src/java.desktop +src/java.instrument : jdk/src/java.instrument +src/java.logging : jdk/src/java.logging +src/java.management : jdk/src/java.management +src/java.management.rmi : jdk/src/java.management.rmi +src/java.naming : jdk/src/java.naming +src/java.prefs : jdk/src/java.prefs +src/java.rmi : jdk/src/java.rmi +src/java.scripting : jdk/src/java.scripting +src/java.se : jdk/src/java.se +src/java.security.jgss : jdk/src/java.security.jgss +src/java.security.sasl : jdk/src/java.security.sasl +src/java.se.ee : jdk/src/java.se.ee +src/java.smartcardio : jdk/src/java.smartcardio +src/java.sql : jdk/src/java.sql +src/java.sql.rowset : jdk/src/java.sql.rowset +src/java.transaction : jdk/src/java.transaction +src/java.xml : jaxp/src/java.xml +src/java.xml.bind : jaxws/src/java.xml.bind +src/java.xml.crypto : jdk/src/java.xml.crypto +src/java.xml.ws : jaxws/src/java.xml.ws +src/java.xml.ws.annotation : jaxws/src/java.xml.ws.annotation +src/jdk.accessibility : jdk/src/jdk.accessibility +src/jdk.aot : hotspot/src/jdk.aot +src/jdk.attach : jdk/src/jdk.attach +src/jdk.charsets : jdk/src/jdk.charsets +src/jdk.compiler : jdk/src/jdk.compiler langtools/src/jdk.compiler +src/jdk.crypto.cryptoki : jdk/src/jdk.crypto.cryptoki +src/jdk.crypto.ec : jdk/src/jdk.crypto.ec +src/jdk.crypto.mscapi : jdk/src/jdk.crypto.mscapi +src/jdk.dynalink : nashorn/src/jdk.dynalink +src/jdk.editpad : jdk/src/jdk.editpad +src/jdk.hotspot.agent : hotspot/src/jdk.hotspot.agent +src/jdk.httpserver : jdk/src/jdk.httpserver +src/jdk.incubator.httpclient : jdk/src/jdk.incubator.httpclient +src/jdk.internal.ed : jdk/src/jdk.internal.ed +src/jdk.internal.jvmstat : jdk/src/jdk.internal.jvmstat +src/jdk.internal.le : jdk/src/jdk.internal.le +src/jdk.internal.opt : jdk/src/jdk.internal.opt +src/jdk.internal.vm.ci : hotspot/src/jdk.internal.vm.ci +src/jdk.internal.vm.compiler : hotspot/src/jdk.internal.vm.compiler +src/jdk.jartool : jdk/src/jdk.jartool +src/jdk.javadoc : langtools/src/jdk.javadoc +src/jdk.jcmd : jdk/src/jdk.jcmd +src/jdk.jconsole : jdk/src/jdk.jconsole +src/jdk.jdeps : langtools/src/jdk.jdeps +src/jdk.jdi : jdk/src/jdk.jdi +src/jdk.jdwp.agent : jdk/src/jdk.jdwp.agent +src/jdk.jlink : jdk/src/jdk.jlink +src/jdk.jshell : langtools/src/jdk.jshell +src/jdk.jsobject : jdk/src/jdk.jsobject +src/jdk.jstatd : jdk/src/jdk.jstatd +src/jdk.localedata : jdk/src/jdk.localedata +src/jdk.management : jdk/src/jdk.management +src/jdk.management.agent : jdk/src/jdk.management.agent +src/jdk.naming.dns : jdk/src/jdk.naming.dns +src/jdk.naming.rmi : jdk/src/jdk.naming.rmi +src/jdk.net : jdk/src/jdk.net +src/jdk.pack : jdk/src/jdk.pack +src/jdk.scripting.nashorn : nashorn/src/jdk.scripting.nashorn +src/jdk.scripting.nashorn.shell : nashorn/src/jdk.scripting.nashorn.shell +src/jdk.sctp : jdk/src/jdk.sctp +src/jdk.security.auth : jdk/src/jdk.security.auth +src/jdk.security.jgss : jdk/src/jdk.security.jgss +src/jdk.unsupported : jdk/src/jdk.unsupported +src/jdk.xml.bind : jaxws/src/jdk.xml.bind +src/jdk.xml.dom : jaxp/src/jdk.xml.dom +src/jdk.xml.ws : jaxws/src/jdk.xml.ws +src/jdk.zipfs : jdk/src/jdk.zipfs +src/langtools/sample : langtools/src/sample +src/linux : jdk/src/linux +src/sample : jdk/src/sample +src/hotspot/share : hotspot/src/share/vm +src/hotspot/cpu/aarch64 : hotspot/src/cpu/aarch64/vm +src/hotspot/cpu/arm : hotspot/src/cpu/arm/vm +src/hotspot/cpu/ppc : hotspot/src/cpu/ppc/vm +src/hotspot/cpu/s390 : hotspot/src/cpu/s390/vm +src/hotspot/cpu/x86 : hotspot/src/cpu/x86/vm +src/hotspot/cpu/zero : hotspot/src/cpu/zero/vm +src/hotspot/os/aix : hotspot/src/os/aix/vm +src/hotspot/os/bsd : hotspot/src/os/bsd/vm +src/hotspot/os/linux : hotspot/src/os/linux/vm +src/hotspot/os/posix/dtrace : hotspot/src/os/posix/dtrace +src/hotspot/os/posix : hotspot/src/os/posix/vm +src/hotspot/os/windows : hotspot/src/os/windows/vm +src/hotspot/os_cpu/aix_ppc : hotspot/src/os_cpu/aix_ppc/vm +src/hotspot/os_cpu/bsd_x86 : hotspot/src/os_cpu/bsd_x86/vm +src/hotspot/os_cpu/bsd_zero : hotspot/src/os_cpu/bsd_zero/vm +src/hotspot/os_cpu/linux_aarch64 : hotspot/src/os_cpu/linux_aarch64/vm +src/hotspot/os_cpu/linux_arm : hotspot/src/os_cpu/linux_arm/vm +src/hotspot/os_cpu/linux_ppc : hotspot/src/os_cpu/linux_ppc/vm +src/hotspot/os_cpu/linux_s390 : hotspot/src/os_cpu/linux_s390/vm +src/hotspot/os_cpu/linux_x86 : hotspot/src/os_cpu/linux_x86/vm +src/hotspot/os_cpu/linux_zero : hotspot/src/os_cpu/linux_zero/vm +src/hotspot/os_cpu/windows_x86 : hotspot/src/os_cpu/windows_x86/vm +src/hotspot : hotspot/src +src/utils/IdealGraphVisualizer : hotspot/src/share/tools/IdealGraphVisualizer +src/utils/LogCompilation : hotspot/src/share/tools/LogCompilation +src/utils/hsdis : hotspot/src/share/tools/hsdis +src/utils/reorder : jdk/make/non-build-utils/reorder +src/utils/src/build : jdk/make/non-build-utils/src/build +make/BuildNashorn.gmk : nashorn/make/BuildNashorn.gmk +make/CompileDemos.gmk : jdk/make/CompileDemos.gmk +make/CompileInterimLangtools.gmk : langtools/make/CompileInterim.gmk +make/CompileModuleTools.gmk : jdk/make/CompileModuleTools.gmk +make/CompileToolsHotspot.gmk : hotspot/make/CompileTools.gmk +make/CompileToolsJdk.gmk : jdk/make/CompileTools.gmk +make/CopyInterimCLDRConverter.gmk : jdk/make/CopyInterimCLDRConverter.gmk +make/GenerateModuleSummary.gmk : jdk/make/GenerateModuleSummary.gmk +make/ModuleTools.gmk : jdk/make/ModuleTools.gmk +make/ToolsJdk.gmk : jdk/make/Tools.gmk +make/ToolsLangtools.gmk : langtools/make/Tools.gmk +make/UnpackSecurity.gmk : jdk/make/UnpackSecurity.gmk +make/autoconf : common/autoconf +make/conf : common/conf +make/copy : jdk/make/copy +make/copy/Copy-java.corba.gmk : corba/make/copy/Copy-java.corba.gmk +make/corba : corba/make +make/data : jdk/make/data +make/gendata : jdk/make/gendata +make/gendata/Gendata-jdk.compiler.gmk : langtools/make/gendata/Gendata-jdk.compiler.gmk +make/gensrc : jdk/make/gensrc +make/gensrc/Gensrc-java.corba.gmk : corba/make/gensrc/Gensrc-java.corba.gmk +make/gensrc/Gensrc-jdk.compiler.gmk : langtools/make/gensrc/Gensrc-jdk.compiler.gmk +make/gensrc/Gensrc-jdk.hotspot.agent.gmk : hotspot/make/gensrc/Gensrc-jdk.hotspot.agent.gmk +make/gensrc/Gensrc-jdk.internal.vm.compiler.gmk : hotspot/make/gensrc/Gensrc-jdk.internal.vm.compiler.gmk +make/gensrc/Gensrc-jdk.javadoc.gmk : langtools/make/gensrc/Gensrc-jdk.javadoc.gmk +make/gensrc/Gensrc-jdk.jdeps.gmk : langtools/make/gensrc/Gensrc-jdk.jdeps.gmk +make/gensrc/Gensrc-jdk.jshell.gmk : langtools/make/gensrc/Gensrc-jdk.jshell.gmk +make/gensrc/GensrcCommonLangtools.gmk : langtools/make/gensrc/GensrcCommon.gmk +make/hotspot : hotspot/make +make/jdk : jdk/make +make/langtools : langtools/make +make/launcher : jdk/make/launcher +make/lib : jdk/make/lib +make/lib/Lib-jdk.hotspot.agent.gmk : hotspot/make/lib/Lib-jdk.hotspot.agent.gmk +make/mapfiles : jdk/make/mapfiles +make/mapfiles/libjsig : hotspot/make/mapfiles/libjsig +make/mapfiles/libjvm_db : hotspot/make/mapfiles/libjvm_db +make/mapfiles/libjvm_dtrace : hotspot/make/mapfiles/libjvm_dtrace +make/mapfiles/libsaproc : hotspot/make/mapfiles/libsaproc +make/nashorn : nashorn/make +make/nb_native : common/nb_native +make/scripts/addNotices.sh : jdk/make/scripts/addNotices.sh +make/scripts/compare.sh : common/bin/compare.sh +make/scripts/compare_exceptions.sh.incl : common/bin/compare_exceptions.sh.incl +make/scripts/genExceptions.sh : jdk/make/scripts/genExceptions.sh +make/scripts/hide_important_warnings_from_javac.sh : common/bin/hide_important_warnings_from_javac.sh +make/scripts/logger.sh : common/bin/logger.sh +make/src/native/fixpath.c : common/src/fixpath.c +make/test/JtregNativeHotspot.gmk : hotspot/make/test/JtregNative.gmk +make/test/JtregNativeJdk.gmk : jdk/make/test/JtregNative.gmk +test/jdk : jdk/test +test/langtools : langtools/test +test/nashorn : nashorn/test +test/jaxp : jaxp/test +test/hotspot/gtest : hotspot/test/native +test/hotspot/jtreg : hotspot/test +bin : common/bin +bin/nashorn : nashorn/bin +doc : common/doc +doc/nashorn : nashorn/docs diff --git a/bin/unshuffle_patch.sh b/bin/unshuffle_patch.sh new file mode 100644 index 0000000..c5cdc38 --- /dev/null +++ b/bin/unshuffle_patch.sh @@ -0,0 +1,237 @@ +#!/bin/bash +# +# 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 +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# Script for updating a patch file as per the shuffled/unshuffled source location. + +usage() { + 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` +UNSHUFFLE_LIST=$SCRIPT_DIR"/unshuffle_list.txt" + +if [ ! -f "$UNSHUFFLE_LIST" ] ; then + echo "FATAL: cannot find $UNSHUFFLE_LIST" >&2 + exit 1 +fi + +vflag="false" +while [ $# -gt 0 ] +do + case $1 in + -h | --help ) + usage + ;; + + -v | --verbose ) + vflag="true" + ;; + + -r) + repo="$2" + shift + ;; + + -to9) + shuffle_to=9 + ;; + + -to10) + shuffle_to=10 + ;; + + -*) # bad option + usage + ;; + + * ) # non option + break + ;; + esac + shift +done + +# Make sure we have the right number of arguments +if [ ! $# -eq 2 ] ; then + echo "ERROR: Invalid number of arguments." >&2 + usage +fi + +# Check the given repo +repos="top corba jaxp jaxws jdk langtools nashorn hotspot" +found="false" +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 +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="$1" +if [ "x$input" = "x-" ] ; then + input="/dev/stdin" +fi + +if [ ! -f $input -a "x$input" != "x/dev/stdin" ] ; then + echo "ERROR: Cannot find input patch file: $input" >&2 + exit 1 +fi + +output="$2" +if [ "x$output" = "x-" ] ; then + output="/dev/stdout" +fi +base_output="$output" + +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 + +verbose() { + if [ ${vflag} = "true" ] ; then + echo "$@" >&2 + fi +} + +unshuffle() { + line=$@ + verbose "Attempting to rewrite: \"$line\"" + + # Retrieve the file name + path= + if echo "$line" | egrep '^diff' > /dev/null ; then + if ! echo "$line" | egrep '\-\-git' > /dev/null ; then + echo "ERROR: Only git patches supported. Please use 'hg export --git ...'." >&2 + exit 1 + fi + path="`echo "$line" | sed -e s@'diff --git a/'@@ -e s@' b/.*$'@@`" + elif echo "$line" | egrep '^\-\-\-' > /dev/null ; then + path="`echo "$line" | sed -e s@'--- a/'@@`" + elif echo "$line" | egrep '^\+\+\+' > /dev/null ; then + path="`echo "$line" | sed s@'+++ b/'@@`" + fi + verbose "Extracted path: \"$path\"" + + # Find the most specific matches in the shuffle list + matches= + 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 [ "$shuffle_to" = "10" ] ; then + pattern=": $matchpath$" + else + pattern="^$matchpath :" + fi + verbose "Attempting to find \"$matchpath\"" + matches=`egrep "$pattern" "$UNSHUFFLE_LIST"` + if ! [ "x${matches}" = "x" ] ; then + verbose "Got matches: [$matches]" + break; + fi + + if ! echo "$matchpath" | egrep '.*/.*' > /dev/null ; then + break; + fi + done + + # Rewrite the line, if we have a match + if ! [ "x${matches}" = "x" ] ; 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 + else + echo "WARNING: no match found for $path" + echo "$line" >> $output + fi +} + +while IFS= read -r line +do + if echo "$line" | egrep '^diff|^\-\-\-|^\+\+\+' > /dev/null ; then + unshuffle "$line" + else + printf "%s\n" "$line" >> $output + fi +done < "$input" |