Skip to content

Commit

Permalink
Use files for long strings.
Browse files Browse the repository at this point in the history
  • Loading branch information
dean-long committed Nov 14, 2018
1 parent 3392c8c commit 07f3f3b
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 65 deletions.
20 changes: 20 additions & 0 deletions compiler/mx.compiler/gplv2_substring.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
* 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.
*/
73 changes: 8 additions & 65 deletions compiler/mx.compiler/mx_updategraalinopenjdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@
from collections import namedtuple
from argparse import ArgumentParser
from os.path import join, exists
from os.path import join, exists, dirname

import mx
import mx_compiler

def _read_sibling_file(basename):
path = join(dirname(__file__), basename)
with open(path, 'r') as fp:
return fp.read()

def _find_version_base_project(versioned_project):
extended_packages = versioned_project.extended_java_packages()
if not extended_packages:
Expand Down Expand Up @@ -98,71 +104,8 @@ def updategraalinopenjdk(args):

# Strings to be replaced in files copied to OpenJDK.
replacements = {
' * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n'
' *\n'
' * The Universal Permissive License (UPL), Version 1.0\n'
' *\n'
' * Subject to the condition set forth below, permission is hereby granted to any\n'
' * person obtaining a copy of this software, associated documentation and/or\n'
' * data (collectively the "Software"), free of charge and under any and all\n'
' * copyright rights in the Software, and any and all patent rights owned or\n'
' * freely licensable by each licensor hereunder covering either (i) the\n'
' * unmodified Software as contributed to or provided by such licensor, or (ii)\n'
' * the Larger Works (as defined below), to deal in both\n'
' *\n'
' * (a) the Software, and\n'
' *\n'
' * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if\n'
' * one is included with the Software each a "Larger Work" to which the Software\n'
' * is contributed by such licensors),\n'
' *\n'
' * without restriction, including without limitation the rights to copy, create\n'
' * derivative works of, display, perform, and distribute the Software and make,\n'
' * use, sell, offer for sale, import, export, have made, and have sold the\n'
' * Software and the Larger Work(s), and to sublicense the foregoing rights on\n'
' * either these or other terms.\n'
' *\n'
' * This license is subject to the following condition:\n'
' *\n'
' * The above copyright notice and either this complete permission notice or at a\n'
' * minimum a reference to the UPL must be included in all copies or substantial\n'
' * portions of the Software.\n'
' *\n'
' * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n'
' * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n'
' * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n'
' * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n'
' * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n'
' * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n'
' * SOFTWARE.\n'
' */\n'
:
' * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n'
' *\n'
' * This code is free software; you can redistribute it and/or modify it\n'
' * under the terms of the GNU General Public License version 2 only, as\n'
' * published by the Free Software Foundation.\n'
' *\n'
' * This code is distributed in the hope that it will be useful, but WITHOUT\n'
' * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n'
' * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n'
' * version 2 for more details (a copy is included in the LICENSE file that\n'
' * accompanied this code).\n'
' *\n'
' * You should have received a copy of the GNU General Public License version\n'
' * 2 along with this work; if not, write to the Free Software Foundation,\n'
' * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n'
' *\n'
' * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n'
' * or visit www.oracle.com if you need additional information or have any\n'
' * questions.\n'
' */\n'
,
'published by the Free Software Foundation. Oracle designates this\n'
' * particular file as subject to the "Classpath" exception as provided\n'
' * by Oracle in the LICENSE file that accompanied this code.'
:
'published by the Free Software Foundation.'
'published by the Free Software Foundation. Oracle designates this\n * particular file as subject to the "Classpath" exception as provided\n * by Oracle in the LICENSE file that accompanied this code.' : 'published by the Free Software Foundation.',
_read_sibling_file('upl_substring.txt') : _read_sibling_file('gplv2_substring.txt')
}

# Strings that must not exist in OpenJDK source files. This is applied after replacements are made.
Expand Down
38 changes: 38 additions & 0 deletions compiler/mx.compiler/upl_substring.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
*
* Subject to the condition set forth below, permission is hereby granted to any
* person obtaining a copy of this software, associated documentation and/or
* data (collectively the "Software"), free of charge and under any and all
* copyright rights in the Software, and any and all patent rights owned or
* freely licensable by each licensor hereunder covering either (i) the
* unmodified Software as contributed to or provided by such licensor, or (ii)
* the Larger Works (as defined below), to deal in both
*
* (a) the Software, and
*
* (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
* one is included with the Software each a "Larger Work" to which the Software
* is contributed by such licensors),
*
* without restriction, including without limitation the rights to copy, create
* derivative works of, display, perform, and distribute the Software and make,
* use, sell, offer for sale, import, export, have made, and have sold the
* Software and the Larger Work(s), and to sublicense the foregoing rights on
* either these or other terms.
*
* This license is subject to the following condition:
*
* The above copyright notice and either this complete permission notice or at a
* minimum a reference to the UPL must be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

0 comments on commit 07f3f3b

Please sign in to comment.