common/conf/jib-profiles.js
author amurillo
Fri, 06 May 2016 06:23:29 -0700
changeset 37966 f8ee56e64197
parent 37964 cd007c0a0cb5
parent 37765 d65d7bda43ce
child 37972 e1fa5c2e62a0
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
     1
/*
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
     4
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    10
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    15
 * accompanied this code).
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    16
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    20
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    23
 * questions.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    24
 */
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    25
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    26
/*
34496
b05757ebc035 8145185: Rename JAB the build tool to JIB
erikj
parents: 34491
diff changeset
    27
 * This file defines build profiles for the JIB tool and others.
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    28
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    29
 * A build profile defines a set of configuration options and external
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    30
 * dependencies that we for some reason or other care about specifically.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    31
 * Typically, build profiles are defined for the build configurations we
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    32
 * build regularly.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    33
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    34
 * Contract against this file from the tools that use it, is to provide
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    35
 * a function on the form:
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    36
 *
34496
b05757ebc035 8145185: Rename JAB the build tool to JIB
erikj
parents: 34491
diff changeset
    37
 * getJibProfiles(input)
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    38
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    39
 * which returns an object graph describing the profiles and their
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    40
 * dependencies. The name of the function is based on the name of this
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    41
 * file, minus the extension and the '-', camel cased and prefixed with
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    42
 * 'get'.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    43
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    44
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    45
 * The parameter 'input' is an object that optionally contains  some data.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    46
 * Optionally because a tool may read the configuration for different purposes.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    47
 * To initially get a list of available profiles, the active profile may not
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    48
 * yet be known for instance.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    49
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    50
 * Data that may be set on the input object:
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    51
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    52
 * input.profile = <name of active profile>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    53
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    54
 * If the active profile is set, the following data from it must also
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    55
 * be provided:
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    56
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    57
 * input.profile
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    58
 * input.target_os
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    59
 * input.target_cpu
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    60
 * input.build_os
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    61
 * input.build_cpu
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    62
 * input.target_platform
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    63
 * input.build_platform
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    64
 * // The build_osenv_* variables describe the unix layer on Windows systems,
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    65
 * // i.e. Cygwin, which may also be 32 or 64 bit.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    66
 * input.build_osenv
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    67
 * input.build_osenv_cpu
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    68
 * input.build_osenv_platform
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    69
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    70
 * For more complex nested attributes, there is a method "get":
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    71
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    72
 * input.get("<dependency>", "<attribute>")
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    73
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    74
 * Valid attributes are:
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    75
 * install_path
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    76
 * download_path
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    77
 * download_dir
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    78
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    79
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    80
 * The output data generated by this configuration file has the following
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    81
 * format:
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    82
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    83
 * data: {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    84
 *   // Identifies the version of this format to the tool reading it
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    85
 *   format_version: "1.0",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    86
 *
34496
b05757ebc035 8145185: Rename JAB the build tool to JIB
erikj
parents: 34491
diff changeset
    87
 *   // Name of base outputdir. JIB assumes the actual output dir is formed
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    88
 *   // by adding the configuration name: <output_basedir>/<config-name>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    89
 *   output_basedir: "build",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    90
 *   // Configure argument to use to specify configuration name
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    91
 *   configuration_configure_arg:
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    92
 *   // Make argument to use to specify configuration name
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    93
 *   configuration_make_arg:
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    94
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    95
 *   profiles: {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    96
 *     <profile-name>: {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    97
 *       // Name of os the profile is built to run on
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    98
 *       target_os; <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
    99
 *       // Name of cpu the profile is built to run on
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   100
 *       target_cpu; <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   101
 *       // Combination of target_os and target_cpu for convenience
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   102
 *       target_platform; <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   103
 *       // Name of os the profile is built on
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   104
 *       build_os; <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   105
 *       // Name of cpu the profile is built on
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   106
 *       build_cpu; <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   107
 *       // Combination of build_os and build_cpu for convenience
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   108
 *       build_platform; <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   109
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   110
 *       // List of dependencies needed to build this profile
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   111
 *       dependencies: <Array of strings>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   112
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   113
 *       // List of configure args to use for this profile
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   114
 *       configure_args: <Array of strings>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   115
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   116
 *       // List of free form labels describing aspects of this profile
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   117
 *       labels: <Array of strings>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   118
 *     }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   119
 *   }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   120
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   121
 *   // Dependencies use a Maven like deployment structure
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   122
 *   dependencies: {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   123
 *     <dependency-name>: {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   124
 *       // Organization part of path defining this dependency
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   125
 *       organization: <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   126
 *       // File extension for this dependency
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   127
 *       ext: <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   128
 *       // Module part of path for defining this dependency,
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   129
 *       // defaults to <dependency-name>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   130
 *       module: <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   131
 *       // Revision part of path for defining this dependency
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   132
 *       revision: <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   133
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   134
 *       // List of configure args to add when using this dependency,
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   135
 *       // defaults to
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   136
 *       // "--with-<dependency-name>=input.get("<dependency-name", "install_path")"
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   137
 *       configure_args: <array of strings>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   138
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   139
 *       // Name of environment variable to set when using this dependency
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   140
 *       // when running make
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   141
 *       environment_name: <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   142
 *       // Value of environment variable to set when using this dependency
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   143
 *       // when running make
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   144
 *       environment_value: <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   145
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   146
 *       // Value to add to the PATH variable when using this dependency,
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   147
 *       // applies to both make and configure
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   148
 *       environment_path: <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   149
 *     }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   150
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   151
 *     <dependency-name>: {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   152
 *       // For certain dependencies where a legacy distribution mechanism is
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   153
 *       // already in place, the "javare" server layout is also supported
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   154
 *       // Indicate that an alternate server source and layout should be used
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   155
 *       server: "javare"
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   156
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   157
 *       // For "javare", a combination of module, revision,
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   158
 *       // build number (optional), files and checksum file is possible for
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   159
 *       // artifacts following the standard layout.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   160
 *       module: <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   161
 *       revision: <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   162
 *       build_number: <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   163
 *       checksum_file: <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   164
 *       file: <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   165
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   166
 *       // For other files, use checksum path and path instead
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   167
 *       checksum_path: <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   168
 *       path: <string>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   169
 *     }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   170
 *   }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   171
 * }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   172
 */
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   173
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   174
/**
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   175
 * Main entry to generate the profile configuration
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   176
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   177
 * @param input External data to use for generating the configuration
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   178
 * @returns {{}} Profile configuration
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   179
 */
34496
b05757ebc035 8145185: Rename JAB the build tool to JIB
erikj
parents: 34491
diff changeset
   180
var getJibProfiles = function (input) {
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   181
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   182
    var data = {};
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   183
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   184
    // Identifies the version of this format to the tool reading it
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   185
    data.format_version = "1.0";
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   186
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   187
    // Organization is used when uploading/publishing build results
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   188
    data.organization = "com.oracle.jpg.jdk";
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   189
34496
b05757ebc035 8145185: Rename JAB the build tool to JIB
erikj
parents: 34491
diff changeset
   190
    // The base directory for the build output. JIB will assume that the
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   191
    // actual build directory will be <output_basedir>/<configuration>
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   192
    data.output_basedir = "build";
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   193
    // The configure argument to use to specify the name of the configuration
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   194
    data.configuration_configure_arg = "--with-conf-name=";
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   195
    // The make argument to use to specify the name of the configuration
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   196
    data.configuration_make_arg = "CONF_NAME=";
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   197
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   198
    // Define some common values
34496
b05757ebc035 8145185: Rename JAB the build tool to JIB
erikj
parents: 34491
diff changeset
   199
    var common = getJibProfilesCommon(input);
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   200
    // Generate the profiles part of the configuration
34496
b05757ebc035 8145185: Rename JAB the build tool to JIB
erikj
parents: 34491
diff changeset
   201
    data.profiles = getJibProfilesProfiles(input, common);
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   202
    // Generate the dependencies part of the configuration
34496
b05757ebc035 8145185: Rename JAB the build tool to JIB
erikj
parents: 34491
diff changeset
   203
    data.dependencies = getJibProfilesDependencies(input, common);
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   204
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   205
    return data;
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   206
};
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   207
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   208
/**
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   209
 * Generates some common values
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   210
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   211
 * @param input External data to use for generating the configuration
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   212
 * @returns Common values
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   213
 */
34496
b05757ebc035 8145185: Rename JAB the build tool to JIB
erikj
parents: 34491
diff changeset
   214
var getJibProfilesCommon = function (input) {
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   215
    var common = {};
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   216
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   217
    common.dependencies = ["boot_jdk", "gnumake", "jtreg"],
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   218
    common.default_make_targets = ["product-images", "test-image"],
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   219
    common.default_make_targets_debug = common.default_make_targets;
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   220
    common.default_make_targets_slowdebug = common.default_make_targets;
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   221
    common.configure_args = ["--enable-jtreg-failure-handler"],
37964
cd007c0a0cb5 8155950: Add minimal VM in JIB profile on linux-x86
lmesnik
parents: 37649
diff changeset
   222
    common.configure_args_32bit = ["--with-target-bits=32"],
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   223
    common.configure_args_debug = ["--enable-debug"],
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   224
    common.configure_args_slowdebug = ["--with-debug-level=slowdebug"],
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   225
    common.organization = "jpg.infra.builddeps"
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   226
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   227
    return common;
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   228
};
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   229
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   230
/**
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   231
 * Generates the profiles part of the configuration.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   232
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   233
 * @param input External data to use for generating the configuration
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   234
 * @param common The common values
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   235
 * @returns {{}} Profiles part of the configuration
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   236
 */
34496
b05757ebc035 8145185: Rename JAB the build tool to JIB
erikj
parents: 34491
diff changeset
   237
var getJibProfilesProfiles = function (input, common) {
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   238
    var profiles = {};
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   239
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   240
    // Main SE profiles
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   241
    var mainProfiles = {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   242
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   243
        "linux-x64": {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   244
            target_os: "linux",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   245
            target_cpu: "x64",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   246
            dependencies: concat(common.dependencies, "devkit"),
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   247
            configure_args: concat(common.configure_args, "--with-zlib=system"),
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   248
            default_make_targets: concat(common.default_make_targets, "docs-image")
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   249
        },
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   250
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   251
        "linux-x86": {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   252
            target_os: "linux",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   253
            target_cpu: "x86",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   254
            build_cpu: "x64",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   255
            dependencies: concat(common.dependencies, "devkit"),
36727
a86a1a1cae13 8153303: Jib profiles config broken after JDK-8153257 after JDK-8031767
tbell
parents: 36724
diff changeset
   256
            configure_args: concat(common.configure_args, common.configure_args_32bit,
37964
cd007c0a0cb5 8155950: Add minimal VM in JIB profile on linux-x86
lmesnik
parents: 37649
diff changeset
   257
                "--with-jvm-variants=minimal,client,server", "--with-zlib=system"),
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   258
            default_make_targets: common.default_make_targets
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   259
        },
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   260
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   261
        "macosx-x64": {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   262
            target_os: "macosx",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   263
            target_cpu: "x64",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   264
            dependencies: concat(common.dependencies, "devkit"),
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   265
            configure_args: concat(common.configure_args, "--with-zlib=system"),
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   266
            default_make_targets: common.default_make_targets
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   267
        },
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   268
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   269
        "solaris-x64": {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   270
            target_os: "solaris",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   271
            target_cpu: "x64",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   272
            dependencies: concat(common.dependencies, "devkit", "cups"),
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   273
            configure_args: concat(common.configure_args, "--with-zlib=system"),
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   274
            default_make_targets: common.default_make_targets
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   275
        },
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   276
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   277
        "solaris-sparcv9": {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   278
            target_os: "solaris",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   279
            target_cpu: "sparcv9",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   280
            dependencies: concat(common.dependencies, "devkit", "cups"),
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   281
            configure_args: concat(common.configure_args, "--with-zlib=system"),
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   282
            default_make_targets: common.default_make_targets
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   283
        },
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   284
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   285
        "windows-x64": {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   286
            target_os: "windows",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   287
            target_cpu: "x64",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   288
            dependencies: concat(common.dependencies, "devkit", "freetype"),
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   289
            configure_args: concat(common.configure_args),
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   290
            default_make_targets: common.default_make_targets
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   291
        },
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   292
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   293
        "windows-x86": {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   294
            target_os: "windows",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   295
            target_cpu: "x86",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   296
            build_cpu: "x64",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   297
            dependencies: concat(common.dependencies, "devkit", "freetype"),
37964
cd007c0a0cb5 8155950: Add minimal VM in JIB profile on linux-x86
lmesnik
parents: 37649
diff changeset
   298
            configure_args: concat(common.configure_args,
cd007c0a0cb5 8155950: Add minimal VM in JIB profile on linux-x86
lmesnik
parents: 37649
diff changeset
   299
                "--with-jvm-variants=client,server", common.configure_args_32bit),
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   300
            default_make_targets: common.default_make_targets
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   301
        }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   302
    };
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   303
    profiles = concatObjects(profiles, mainProfiles);
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   304
    // Generate debug versions of all the main profiles
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   305
    profiles = concatObjects(profiles, generateDebugProfiles(common, mainProfiles));
36532
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   306
    // Generate slowdebug versions of all the main profiles
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   307
    profiles = concatObjects(profiles, generateSlowdebugProfiles(common, mainProfiles));
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   308
36532
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   309
    // Generate open only profiles for all the main profiles for JPRT and reference
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   310
    // implementation builds.
36534
b74ff34537ac 8151800: Jib profile for open linux should produce compact profiles images by default
erikj
parents: 36532
diff changeset
   311
    var openOnlyProfiles = generateOpenOnlyProfiles(common, mainProfiles);
b74ff34537ac 8151800: Jib profile for open linux should produce compact profiles images by default
erikj
parents: 36532
diff changeset
   312
    // The open only profiles on linux are used for reference builds and should
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   313
    // produce the compact profile images by default. This adds "profiles" as an
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   314
    // extra default target.
36534
b74ff34537ac 8151800: Jib profile for open linux should produce compact profiles images by default
erikj
parents: 36532
diff changeset
   315
    var openOnlyProfilesExtra = {
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   316
        "linux-x64-open": {
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   317
            default_make_targets: "profiles"
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   318
        },
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   319
36170
d493c08255eb 8150504: JIB profiles for reference implementation builds
erikj
parents: 35036
diff changeset
   320
        "linux-x86-open": {
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   321
            default_make_targets: "profiles"
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   322
        }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   323
    };
36534
b74ff34537ac 8151800: Jib profile for open linux should produce compact profiles images by default
erikj
parents: 36532
diff changeset
   324
    var openOnlyProfiles = concatObjects(openOnlyProfiles, openOnlyProfilesExtra);
b74ff34537ac 8151800: Jib profile for open linux should produce compact profiles images by default
erikj
parents: 36532
diff changeset
   325
b74ff34537ac 8151800: Jib profile for open linux should produce compact profiles images by default
erikj
parents: 36532
diff changeset
   326
    profiles = concatObjects(profiles, openOnlyProfiles);
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   327
    // Generate debug profiles for the open jprt profiles
36534
b74ff34537ac 8151800: Jib profile for open linux should produce compact profiles images by default
erikj
parents: 36532
diff changeset
   328
    profiles = concatObjects(profiles, generateDebugProfiles(common, openOnlyProfiles));
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   329
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   330
    // Profiles used to run tests. Used in JPRT.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   331
    var testOnlyProfiles = {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   332
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   333
        "run-test": {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   334
            target_os: input.build_os,
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   335
            target_cpu: input.build_cpu,
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   336
            dependencies: [ "jtreg", "gnumake" ],
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   337
            labels: "test"
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   338
        }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   339
    };
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   340
    profiles = concatObjects(profiles, testOnlyProfiles);
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   341
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   342
    // Generate the missing platform attributes
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   343
    profiles = generatePlatformAttributes(profiles);
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   344
    profiles = generateDefaultMakeTargetsConfigureArg(common, profiles);
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   345
    return profiles;
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   346
};
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   347
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   348
/**
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   349
 * Generate the dependencies part of the configuration
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   350
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   351
 * @param input External data to use for generating the configuration
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   352
 * @param common The common values
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   353
 * @returns {{}} Dependencies part of configuration
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   354
 */
34496
b05757ebc035 8145185: Rename JAB the build tool to JIB
erikj
parents: 34491
diff changeset
   355
var getJibProfilesDependencies = function (input, common) {
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   356
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   357
    var boot_jdk_platform = input.build_os + "-"
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   358
        + (input.build_cpu == "x86" ? "i586" : input.build_cpu);
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   359
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   360
    var devkit_platform_revisions = {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   361
        linux_x64: "gcc4.9.2-OEL6.4+1.0",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   362
        macosx_x64: "Xcode6.3-MacOSX10.9+1.0",
34595
09596fe63e2d 8145391: Updated jprt.properties, devtools, jib and readme with SS12u4
erikj
parents: 34496
diff changeset
   363
        solaris_x64: "SS12u4-Solaris11u1+1.0",
09596fe63e2d 8145391: Updated jprt.properties, devtools, jib and readme with SS12u4
erikj
parents: 34496
diff changeset
   364
        solaris_sparcv9: "SS12u4-Solaris11u1+1.0",
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   365
        windows_x64: "VS2013SP4+1.0"
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   366
    };
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   367
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   368
    var devkit_platform = (input.target_cpu == "x86"
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   369
        ? input.target_os + "_x64"
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   370
        : input.target_platform);
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   371
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   372
    var dependencies = {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   373
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   374
        boot_jdk: {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   375
            server: "javare",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   376
            module: "jdk",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   377
            revision: "8",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   378
            checksum_file: boot_jdk_platform + "/MD5_VALUES",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   379
            file: boot_jdk_platform + "/jdk-8-" + boot_jdk_platform + ".tar.gz",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   380
            configure_args: (input.build_os == "macosx"
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   381
                ? "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk1.8.0.jdk/Contents/Home"
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   382
                : "--with-boot-jdk=" + input.get("boot_jdk", "install_path") + "/jdk1.8.0")
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   383
        },
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   384
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   385
        devkit: {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   386
            organization: common.organization,
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   387
            ext: "tar.gz",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   388
            module: "devkit-" + devkit_platform,
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   389
            revision: devkit_platform_revisions[devkit_platform]
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   390
        },
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   391
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   392
        build_devkit: {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   393
            organization: common.organization,
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   394
            ext: "tar.gz",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   395
            module: "devkit-" + input.build_platform,
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   396
            revision: devkit_platform_revisions[input.build_platform]
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   397
        },
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   398
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   399
        cups: {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   400
            organization: common.organization,
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   401
            ext: "tar.gz",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   402
            revision: "1.0118+1.0"
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   403
        },
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   404
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   405
        jtreg: {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   406
            server: "javare",
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36170
diff changeset
   407
            revision: "4.2",
37764
63e0379dd186 8154956: Module system implementation refresh (4/2016)
alanb
parents: 37407
diff changeset
   408
            build_number: "b02",
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   409
            checksum_file: "MD5_VALUES",
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36170
diff changeset
   410
            file: "jtreg_bin-4.2.zip",
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   411
            environment_name: "JT_HOME"
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   412
        },
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   413
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   414
        gnumake: {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   415
            organization: common.organization,
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   416
            ext: "tar.gz",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   417
            revision: "4.0+1.0",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   418
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   419
            module: (input.build_os == "windows"
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   420
                ? "gnumake-" + input.build_osenv_platform
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   421
                : "gnumake-" + input.build_platform),
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   422
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   423
            configure_args: (input.build_os == "windows"
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   424
                ? "MAKE=" + input.get("gnumake", "install_path") + "/cygwin/bin/make"
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   425
                : "MAKE=" + input.get("gnumake", "install_path") + "/bin/make"),
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   426
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   427
            environment_path: (input.build_os == "windows"
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   428
                ? input.get("gnumake", "install_path") + "/cygwin/bin"
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   429
                : input.get("gnumake", "install_path") + "/bin")
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   430
        },
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   431
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   432
        freetype: {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   433
            organization: common.organization,
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   434
            ext: "tar.gz",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   435
            revision: "2.3.4+1.0",
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   436
            module: "freetype-" + input.target_platform
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   437
        }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   438
    };
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   439
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   440
    return dependencies;
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   441
};
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   442
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   443
/**
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   444
 * Generate the missing platform attributes for profiles
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   445
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   446
 * @param profiles Profiles map to generate attributes on
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   447
 * @returns {{}} New profiles map with platform attributes fully filled in
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   448
 */
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   449
var generatePlatformAttributes = function (profiles) {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   450
    var ret = concatObjects(profiles, {});
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   451
    for (var profile in profiles) {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   452
        if (ret[profile].build_os == null) {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   453
            ret[profile].build_os = ret[profile].target_os;
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   454
        }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   455
        if (ret[profile].build_cpu == null) {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   456
            ret[profile].build_cpu = ret[profile].target_cpu;
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   457
        }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   458
        ret[profile].target_platform = ret[profile].target_os + "_" + ret[profile].target_cpu;
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   459
        ret[profile].build_platform = ret[profile].build_os + "_" + ret[profile].build_cpu;
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   460
    }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   461
    return ret;
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   462
};
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   463
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   464
/**
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   465
 * Generates debug versions of profiles. Clones the given profiles and adds
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   466
 * debug metadata.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   467
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   468
 * @param common Common values
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   469
 * @param profiles Profiles map to generate debug profiles for
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   470
 * @returns {{}} New map of profiles containing debug profiles
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   471
 */
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   472
var generateDebugProfiles = function (common, profiles) {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   473
    var newProfiles = {};
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   474
    for (var profile in profiles) {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   475
        var debugProfile = profile + "-debug";
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   476
        newProfiles[debugProfile] = clone(profiles[profile]);
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   477
        newProfiles[debugProfile].debug_level = "fastdebug";
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   478
        newProfiles[debugProfile].default_make_targets
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   479
            = common.default_make_targets_debug;
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   480
        newProfiles[debugProfile].labels
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   481
            = concat(newProfiles[debugProfile].labels || [], "debug"),
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   482
            newProfiles[debugProfile].configure_args
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   483
                = concat(newProfiles[debugProfile].configure_args,
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   484
                common.configure_args_debug);
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   485
    }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   486
    return newProfiles;
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   487
};
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   488
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   489
/**
36532
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   490
 * Generates slowdebug versions of profiles. Clones the given profiles and adds
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   491
 * debug metadata.
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   492
 *
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   493
 * @param common Common values
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   494
 * @param profiles Profiles map to generate debug profiles for
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   495
 * @returns {{}} New map of profiles containing debug profiles
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   496
 */
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   497
var generateSlowdebugProfiles = function (common, profiles) {
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   498
    var newProfiles = {};
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   499
    for (var profile in profiles) {
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   500
        var debugProfile = profile + "-slowdebug";
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   501
        newProfiles[debugProfile] = clone(profiles[profile]);
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   502
        newProfiles[debugProfile].debug_level = "slowdebug";
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   503
        newProfiles[debugProfile].default_make_targets
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   504
            = common.default_make_targets_slowdebug;
36532
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   505
        newProfiles[debugProfile].labels
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   506
            = concat(newProfiles[debugProfile].labels || [], "slowdebug"),
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   507
            newProfiles[debugProfile].configure_args
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   508
                = concat(newProfiles[debugProfile].configure_args,
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   509
                common.configure_args_slowdebug);
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   510
    }
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   511
    return newProfiles;
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   512
};
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   513
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   514
/**
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   515
 * Generates open only versions of profiles. Clones the given profiles and adds
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   516
 * open metadata.
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   517
 *
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   518
 * @param common Common values
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   519
 * @param profiles Profiles map to generate open only profiles for
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   520
 * @returns {{}} New map of profiles containing open only profiles
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   521
 */
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   522
var generateOpenOnlyProfiles = function (common, profiles) {
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   523
    var newProfiles = {};
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   524
    for (var profile in profiles) {
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   525
        var openProfile = profile + "-open";
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   526
        newProfiles[openProfile] = clone(profiles[profile]);
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   527
        newProfiles[openProfile].labels
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   528
            = concat(newProfiles[openProfile].labels || [], "open"),
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   529
            newProfiles[openProfile].configure_args
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   530
                = concat(newProfiles[openProfile].configure_args,
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   531
                "--enable-openjdk-only");
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   532
    }
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   533
    return newProfiles;
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   534
};
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   535
2f10ab82d0a8 8151726: Introduce a JPRT testset buildinfra
erikj
parents: 36170
diff changeset
   536
/**
37649
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   537
 * The default_make_targets attribute on a profile is not a real Jib attribute.
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   538
 * This function rewrites that attribute into the corresponding configure arg.
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   539
 * Calling this function multiple times on the same profiles object is safe.
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   540
 *
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   541
 * @param common Common values
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   542
 * @param profiles Profiles map to rewrite profiles for
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   543
 * @returns {{}} New map of profiles with the make targets converted
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   544
 */
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   545
var generateDefaultMakeTargetsConfigureArg = function (common, profiles) {
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   546
    var ret = concatObjects(profiles, {});
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   547
    for (var profile in ret) {
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   548
        if (ret[profile]["default_make_targets"] != null) {
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   549
            var targetsString = concat(ret[profile].default_make_targets).join(" ");
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   550
            // Iterate over all configure args and see if --with-default-make-target
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   551
            // is already there and change it, otherwise add it.
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   552
            var found = false;
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   553
            for (var arg in ret[profile].configure_args) {
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   554
                if (arg.startsWith("--with-default-make-target")) {
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   555
                    found = true;
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   556
                    arg.replace(/=.*/, "=" + targetsString);
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   557
                }
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   558
            }
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   559
            if (!found) {
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   560
                ret[profile].configure_args = concat(
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   561
                    ret[profile].configure_args,
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   562
                    "--with-default-make-target=" + targetsString);
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   563
            }
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   564
        }
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   565
    }
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   566
    return ret;
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   567
}
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   568
3809534d4531 8154841: Let different Jib profiles have different default make targets
erikj
parents: 37407
diff changeset
   569
/**
34491
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   570
 * Deep clones an object tree.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   571
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   572
 * @param o Object to clone
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   573
 * @returns {{}} Clone of o
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   574
 */
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   575
var clone = function (o) {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   576
    return JSON.parse(JSON.stringify(o));
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   577
};
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   578
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   579
/**
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   580
 * Concatenates all arguments into a new array
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   581
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   582
 * @returns {Array.<T>} New array containing all arguments
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   583
 */
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   584
var concat = function () {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   585
    return Array.prototype.concat.apply([], arguments);
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   586
};
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   587
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   588
/**
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   589
 * Copies all elements in an array into a new array but replacing all
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   590
 * occurrences of original with replacement.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   591
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   592
 * @param original Element to look for
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   593
 * @param replacement Element to replace with
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   594
 * @param a Array to copy
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   595
 * @returns {Array} New array with all occurrences of original replaced
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   596
 *                  with replacement
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   597
 */
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   598
var replace = function (original, replacement, a) {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   599
    var newA = [];
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   600
    for (var i in a) {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   601
        if (original == a[i]) {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   602
            newA.push(replacement);
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   603
        } else {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   604
            newA.push(a[i]);
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   605
        }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   606
    }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   607
    return newA;
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   608
};
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   609
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   610
/**
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   611
 * Deep concatenation of two objects. For each node encountered, merge
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   612
 * the contents with the corresponding node in the other object tree,
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   613
 * treating all strings as array elements.
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   614
 *
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   615
 * @param o1 Object to concatenate
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   616
 * @param o2 Object to concatenate
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   617
 * @returns {{}} New object tree containing the concatenation of o1 and o2
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   618
 */
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   619
var concatObjects = function (o1, o2) {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   620
    var ret = {};
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   621
    for (var a in o1) {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   622
        if (o2[a] == null) {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   623
            ret[a] = o1[a];
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   624
        }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   625
    }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   626
    for (var a in o2) {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   627
        if (o1[a] == null) {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   628
            ret[a] = o2[a];
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   629
        } else {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   630
            if (typeof o1[a] == 'string') {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   631
                ret[a] = [o1[a]].concat(o2[a]);
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   632
            } else if (Array.isArray(o1[a])) {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   633
                ret[a] = o1[a].concat(o2[a]);
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   634
            } else if (typeof o1[a] == 'object') {
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   635
                ret[a] = concatObjects(o1[a], o2[a]);
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   636
            }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   637
        }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   638
    }
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   639
    return ret;
307c28cb36c2 8136782: Introduce a build/configure wrapper
erikj
parents:
diff changeset
   640
};