1 #!/bin/sh
   2 #
   3 # Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
   4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5 #
   6 # This code is free software; you can redistribute it and/or modify it
   7 # under the terms of the GNU General Public License version 2 only, as
   8 # published by the Free Software Foundation.  Oracle designates this
   9 # particular file as subject to the "Classpath" exception as provided
  10 # by Oracle in the LICENSE file that accompanied this code.
  11 #
  12 # This code is distributed in the hope that it will be useful, but WITHOUT
  13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15 # version 2 for more details (a copy is included in the LICENSE file that
  16 # accompanied this code).
  17 #
  18 # You should have received a copy of the GNU General Public License version
  19 # 2 along with this work; if not, write to the Free Software Foundation,
  20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21 #
  22 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  23 # or visit www.oracle.com if you need additional information or have any
  24 # questions.
  25 #
  26 
  27 # This script allows to easily generate (add or update) "--release N" data for JDK N + 1.
  28 # N must be 11 or greater. This script works on Linux. To create new data, or update existing
  29 # data, it is necessary to:
  30 # - download a binary build of OpenJDK N for Linux, API of which will be recorded. It is strongly recommended
  31 #   to use an official build, not a custom build, to avoid any chance of including unofficial changes.
  32 #   The binary build should never be a build newer than the GA for JDK N. Install the build. The installation
  33 #   directory will be denoted as "${JDK_N_INSTALL}" in the further text.
  34 # - have a checkout the JDK to which the data should be added (or in which the data should be updated).
  35 #   The checkout directory will be denoted as "${JDK_CHECKOUT}" in the further text.
  36 #   The checkout must not have any local changes that could interfere with the new data. In particular,
  37 #   there must be absolutely no changed, new or removed files under the ${JDK_CHECKOUT}/make/data/symbols
  38 #   directory.
  39 # - open a terminal program and run these commands:
  40 #     cd "${JDK_CHECKOUT}"/make/data/symbols
  41 #     bash ../../scripts/generate-symbol-data.sh "${JDK_N_INSTALL}"
  42 # - this command will generate or update data for "--release N" into the ${JDK_CHECKOUT}/make/data/symbols
  43 #   directory, updating all registration necessary. If the goal was to update the data, and there are no
  44 #   new or changed files in the ${JDK_CHECKOUT}/make/data/symbols directory after running this script,
  45 #   there were no relevant changes and no further action is necessary. Note that version for N > 9 are encoded
  46 #   using capital letters, i.e. A represents version 10, B represents 11, and so on. The version numbers are in
  47 #   the names of the files in the ${JDK_CHECKOUT}/make/data/symbols directory, as well as in
  48 #   the ${JDK_CHECKOUT}/make/data/symbols/symbols file.
  49 # - if there are any changed/new files in the ${JDK_CHECKOUT}/make/data/symbols directory after running this script,
  50 #   then all the changes in this directory, including any new files, need to be sent for review and eventually pushed.
  51 #   The commit message should specify which binary build was installed in the ${JDK_N_INSTALL} directory and also
  52 #   include the SCM state that was used to build it, which can be found in ${JDK_N_INSTALL}/release,
  53 #   in property "SOURCE".
  54 
  55 if [ "$1x" = "x" ] ; then
  56     echo "Must provide the target JDK as a parameter:" >&2
  57     echo "$0 <target-jdk>" >&2
  58     exit 1
  59 fi;
  60 
  61 if [ ! -f symbols ] ; then
  62     echo "Must run inside the make/data/symbols directory" >&2
  63     exit 1
  64 fi;
  65 
  66 if [ "`hg status .`x" != "x" ] ; then
  67     echo "The make/data/symbols directory contains local changes!" >&2
  68     exit 1
  69 fi;
  70 
  71 $1/bin/java --add-exports jdk.jdeps/com.sun.tools.classfile=ALL-UNNAMED \
  72             --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \
  73             --add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED \
  74             --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
  75             --add-modules jdk.jdeps \
  76             ../../../make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java \
  77             build-description-incremental symbols include.list