diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000000..4d02673e5e4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,37 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +Thank you for taking the time to help improve OpenJDK and Corretto. + +If your request concerns a security vulnerability then please report it by email to aws-security@amazon.com instead of here. (You can find more information regarding security issues at https://aws.amazon.com/security/vulnerability-reporting/.) + +Otherwise, if your issue concerns OpenJDK and is not specific to Corretto we ask that you raise it to the OpenJDK community. Depending on your contributor status for OpenJDK, please use the [JDK bug system](https://bugs.openjdk.java.net/) or the appropriate [mailing list](http://mail.openjdk.java.net/mailman/listinfo) for the given problem area or [update project](http://mail.openjdk.java.net/mailman/listinfo/jdk-updates-dev). + +If your issue is specific to Corretto, then you are in the right place. Please proceed with the following. + +### Describe the bug +A clear and concise description of what the bug is. + +### To Reproduce +Steps and (source) code to reproduce the behavior. + +### Expected behavior +A clear and concise description of what you expected to happen. + +### Screenshots +If applicable, add screenshots to help explain your problem. + +### Platform information + OS: [e.g. Amazon Linux 2] + Version [e.g. "Corretto-15.0.1.9.1" (output from "java -version")] + +### Additional context +Add any other context about the problem here. + +For VM crashes, please attach the error report file. By default the file name is `hs_err_pidpid.log`, where pid is the process ID of the process. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000000..adce5c697cc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,38 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +Thank you for taking the time to help improve OpenJDK and Corretto. + +If your request concerns a security vulnerability then please report it by email to aws-security@amazon.com instead of here. +(You can find more information regarding security issues at https://aws.amazon.com/security/vulnerability-reporting/.) + +Otherwise, if your idea concerns OpenJDK +and is not specific to Corretto +we ask that you propose it to the OpenJDK community. +Depending on your contributor status for OpenJDK, +please use the [JDK bug system](https://bugs.openjdk.java.net/) or +the appropriate [mailing list](http://mail.openjdk.java.net/mailman/listinfo) +for the given problem area or [update project](http://mail.openjdk.java.net/mailman/listinfo/jdk-updates-dev)). + +If your proposal is specific to Corretto, +then you are in the right place. +Please proceed with the following. + +### Is your feature request related to a problem? +Please provide a clear and concise description of what the problem is. + +### Describe a solution you would like +Please provide a clear and concise description of what you want to happen. + +### Describe alternatives you have considered +Please provide a clear and concise description +of any alternative solutions or features you have considered. + +### Additional context +Add any other context or screenshots about the feature request here. diff --git a/.github/actions/fetch-repo/action.yml b/.github/actions/fetch-repo/action.yml new file mode 100644 index 00000000000..74f1494b8bc --- /dev/null +++ b/.github/actions/fetch-repo/action.yml @@ -0,0 +1,21 @@ +name: 'Fetch upstream repository' +description: 'Fetch the upstream openjdk repository and update the corresponding branches' + +inputs: + upstream: + description: 'Upstream repository https git url' + required: true + local-branch: + description: 'Local branch tracking the remote upstream' + required: true +outputs: + status: + description: 'Status of the upstream fetch and merge' +runs: + using: "composite" + steps: + - run: $GITHUB_ACTION_PATH/refresh.sh ${{ inputs.upstream }} ${{ inputs.local-branch }} + shell: bash + id: fetch-and-update-repo + + \ No newline at end of file diff --git a/.github/actions/fetch-repo/refresh.sh b/.github/actions/fetch-repo/refresh.sh new file mode 100755 index 00000000000..8003bf23bb6 --- /dev/null +++ b/.github/actions/fetch-repo/refresh.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -x + +UPSTREAM=$1 +LOCAL_BRANCH=$2 + +REMOTE_NAME=upstream-${LOCAL_BRANCH} +git remote add ${REMOTE_NAME} ${UPSTREAM} +git fetch origin ${LOCAL_BRANCH}:${LOCAL_BRANCH} || exit 1 +git fetch ${REMOTE_NAME} master:${LOCAL_BRANCH} || exit 1 +git push origin ${LOCAL_BRANCH} diff --git a/.github/actions/merge-repo/action.yml b/.github/actions/merge-repo/action.yml new file mode 100644 index 00000000000..d86c9afafcd --- /dev/null +++ b/.github/actions/merge-repo/action.yml @@ -0,0 +1,19 @@ +name: 'Merge Upstream branch' +description: 'Merge Upstream branch to Develop branch.' + +inputs: + upstream: + description: 'Upstream branch in repository' + required: true + merge-branch: + description: 'Merge branch in local repository' + required: true +outputs: + status: + description: 'Status of the upstream fetch and merge' +runs: + using: "composite" + steps: + - run: $GITHUB_ACTION_PATH/merge.sh ${{ inputs.upstream }} ${{ inputs.merge-branch }} + shell: bash + id: merge-upstream-to-develop \ No newline at end of file diff --git a/.github/actions/merge-repo/merge.sh b/.github/actions/merge-repo/merge.sh new file mode 100755 index 00000000000..9784700d79d --- /dev/null +++ b/.github/actions/merge-repo/merge.sh @@ -0,0 +1,13 @@ +#!/bin/bash +set -x + +UPSTREAM_BRANCH=$1 +MERGE_BRANCH=$2 + +git config user.email "no-reply@amazon.com" +git config user.name "corretto-github-robot" + +git checkout ${MERGE_BRANCH} +git merge -m "Merge ${UPSTREAM_BRANCH}" ${UPSTREAM_BRANCH} || exit 1 + +git push origin ${MERGE_BRANCH} \ No newline at end of file diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 00000000000..1a3bdf85729 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,33 @@ +Thank you for taking the time to help improve OpenJDK and Corretto 11. + +If your pull request concerns a security vulnerability then please do not file it here. +Instead, report the problem by email to aws-security@amazon.com. +(You can find more information regarding security issues at https://aws.amazon.com/security/vulnerability-reporting/.) + +Otherwise, if your pull request concerns OpenJDK 11 +and is not specific to Corretto 11, +then we ask you to redirect your contribution to the OpenJDK project. +See http://openjdk.java.net/contribute/ for details on how to do that. + +If your issue is specific to Corretto 11, +then you are in the right place. +Please fill in the following information about your pull request. + +### Description + + +### Related issues + + +### Motivation and context + + +### How has this been tested? + + +### Platform information + Works on OS: [e.g. Amazon Linux 2 only] + Applies to version [e.g. "11.0.1+13-1" (see output from "java -version")] + + +### Additional context diff --git a/.github/workflows/refresh-jdk16.yml b/.github/workflows/refresh-jdk16.yml new file mode 100644 index 00000000000..2ce20bb595a --- /dev/null +++ b/.github/workflows/refresh-jdk16.yml @@ -0,0 +1,26 @@ +name: "Refresh jdk16 from Upstream" +on: + schedule: + - cron: '0 8 * * *' + workflow_dispatch: + +jobs: + refresh-jdk16: + runs-on: ubuntu-latest + name: "Update Corretto-16" + if: github.repository_owner == 'corretto' + steps: + - name: "Checkout code" + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: "Fetch Corretto-16" + uses: ./.github/actions/fetch-repo + with: + upstream: 'https://github.com/openjdk/jdk16u.git' + local-branch: 'upstream-jdk16' + - name: "Merge Corretto-16" + uses: ./.github/actions/merge-repo + with: + upstream: 'upstream-jdk16' + merge-branch: 'develop-jdk16' \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000000..2107070f2bd --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +# Change Log for Amazon Corretto 16 + +The following sections describe the changes for each release of Amazon Corretto 16. diff --git a/README.md b/README.md index 399e7cc311f..b483617038d 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,42 @@ -# Welcome to the JDK! +## Corretto JDK -For build instructions please see the -[online documentation](https://openjdk.java.net/groups/build/doc/building.html), -or either of these files: +Amazon Corretto is a no-cost, multiplatform, +production-ready distribution of the Open Java Development Kit (OpenJDK). +Corretto is used internally at Amazon for production services. +With Corretto, you can develop and run Java applications +on operating systems such as Linux, Windows, and macOS. -- [doc/building.html](doc/building.html) (html version) -- [doc/building.md](doc/building.md) (markdown version) +This repository is used to track [OpenJDK upstream tip](https://github.com/openjdk/jdk). +Please look at the branches section for more information on Feature Releases. -See for more information about +Documentation is available at [https://docs.aws.amazon.com/corretto](https://docs.aws.amazon.com/corretto). + +### Licenses and Trademarks + +Please read these files: "LICENSE", "ADDITIONAL_LICENSE_INFO", "ASSEMBLY_EXCEPTION", "TRADEMARKS.md". + +### Branches + +_develop-jdk16_ +: The default branch. The branch that consumes development and patches to upstream jdk16u. Corretto 16 builds are generated from this branch. + +_upstream-jdk16_ +: The branch is similar to master at [openjdk/jdk16u](https://github.com/openjdk/jdk16u). This branch merges into develop-jdk16. + +_upstream_ +: The branch is similar to master at [openjdk/jdk](https://github.com/openjdk/jdk). This branch merges into develop. + +### OpenJDK Readme +``` + +Welcome to the JDK! +=================== + +For build instructions, please see either of these files: + + * doc/building.html (html version) + * doc/building.md (markdown version) + +See https://openjdk.java.net/ for more information about the OpenJDK Community and the JDK. +``` \ No newline at end of file diff --git a/TRADEMARKS.md b/TRADEMARKS.md new file mode 100644 index 00000000000..f0ac051764d --- /dev/null +++ b/TRADEMARKS.md @@ -0,0 +1,37 @@ +# TRADEMARK POLICY + +This policy of Amazon.com, Inc. or its affiliates ("Amazon") provides guidelines for use of the "Corretto" and “Amazon Corretto” trademarks (“Corretto Trademarks") to identify Amazon's Corretto software. Use of the Corretto Trademarks must be in accordance with this policy. Our goal is to ensure that Amazon’s trademarks remain reliable indicators of quality and security while also permitting community members, software distributors and others we work with to discuss Amazon's products and to accurately describe such products’ affiliation with Amazon. Note that this policy only applies to use of the Corretto Trademarks. Use of any other Amazon trademarks is not included or covered by this policy. + +## OVERALL GUIDELINES + +You may use the Corretto and Amazon Corretto word marks in plain text to refer to Amazon’s Corretto software in compliance with this policy. Any other use of our trademarks, including any logos, requires prior written permission. + +Overall, your use of the Corretto Trademarks must not be confusing or damaging to Amazon or to the Corretto Trademarks themselves. + +People should always know who they are dealing with, and where the software they are downloading came from. You may not use the Corretto Trademarks in any manner that implies approval or endorsement by or association with Amazon. You may not use the Corretto Trademarks to refer to a product other than Amazon’s Corretto software. Following the guidelines below for modifications will help avoid confusion. + +You may not use the Corretto Trademarks as a vehicle to damage the reputation of Amazon or our Corretto software or to make any false or misleading statements. You may not use the Corretto Trademarks in a manner that may diminish or otherwise damage Amazon's goodwill in the trademarks. The Corretto Trademarks should be used in their exact form and not abbreviated or combined with any other word or words (e.g., "Corretto" software rather than "CRTO" or "Correttofied"). + +Amazon owns all rights in the Corretto Trademarks, and your use of them does not transfer rights to you. Any goodwill generated by your use of our Corretto Trademarks will belong to Amazon. + +## MODIFICATIONS + +Those taking full advantage of the open source nature of the Amazon Corretto code and making modifications may not redistribute the modified software under the Corretto Trademarks. Additionally, to avoid misleading a user into believing the modified software is a native Amazon product, if you modify any file where the file name contains a Corretto Trademark or the Amazon name, you must rename that file (except files that contain only an Amazon copyright that is part of an open source license header). + +## RELATED SOFTWARE + +Amazon recognizes that community members writing related software need some way to identify the Amazon product to which that software pertains. Users should not be confused as to whether the related software is an official Amazon product or otherwise approved by Amazon. The name of such software may not include, in whole or in part, the Corretto Trademarks in a way that suggests a connection between Amazon and the extension. + +## QUESTIONS + +If you are unsure whether your use of the Corretto Trademarks would run afoul of this policy, feel free to contact us and ask. If you have questions about these guidelines or use of any other Amazon trademark, please contact trademarks@amazon.com for assistance, or write to us at: + +**Amazon.com, Inc., Attention: Trademarks, +PO Box 81226 Seattle, WA 98108-1226** + +This policy is based in part on the open source trademark policy defined by the Mozilla organization, available [here](https://www.mozilla.org/en-US/foundation/trademarks/policy/), as adapted to Amazon’s Carbonado policy, available [here](http://carbonado.sourceforge.net/trademark.html). Thus, the text of this policy (and not the Corretto Trademarks themselves) is licensed under the Creative Commons "Attribution-ShareAlike 2.0" license. + +### FAQ: + +**1. Can I create and redistribute my own builds of Amazon Corretto?** +: If you build Amazon Corretto from source and redistribute the results, you may use the Corretto Trademarks only if it is clear in both the name of your distribution and the content associated with it that your distribution is your build of Amazon Corretto and not the official build, and you must identify the commit from which it is built, including the commit date. diff --git a/amazon-cacerts b/amazon-cacerts new file mode 100644 index 00000000000..e87df2722c7 Binary files /dev/null and b/amazon-cacerts differ diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000000..c1b21d03c53 --- /dev/null +++ b/build.gradle @@ -0,0 +1,272 @@ +/* +* Copyright (c) 2019, Amazon.com, Inc. or its affiliates. All Rights Reserved. +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 only, as +* published by the Free Software Foundation. Amazon designates this +* particular file as subject to the "Classpath" exception as provided +* by Oracle in the LICENSE file that accompanied this code. +* +* This code is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* version 2 for more details (a copy is included in the LICENSE file that +* accompanied this code). +* +* You should have received a copy of the GNU General Public License version +* 2 along with this work; if not, write to the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +// Tasks can refer to version information using the project.version +// property. For an example of its usage, see ':installers:linux:rpm:buildLogic' +// where the version numbers are used to populate a templated RPM spec file. + +import org.apache.tools.ant.taskdefs.condition.Os + +allprojects { + apply plugin: 'base' + + configurations { + compile { + transitive = false + } + } + + version = { + def full = file('version.txt').text.trim() + def tokens = full.tokenize(".") + [full : full, + major : tokens[0], + minor : tokens[1], + security: tokens[2], + build : tokens[3], + revision: tokens[4], + upstream: "${tokens[0]}.${tokens[1]}.${tokens[2]}.${tokens[3]}".toString()] + }.call() + buildDir = 'corretto-build' + + ext { + buildRoot = file("$buildDir/buildRoot") + distributionDir = file("$buildDir/distributions") + packageInfo = [ + url : "https://github.com/corretto/corretto-${project.version.major}", + vendor : 'Amazon', + packager : 'Amazon', + description : 'Amazon Corretto\'s packaging of the runtime core elements of the OpenJDK 11 code.', + license : 'ASL 1.1 and ASL 2.0 and BSD and BSD with advertising and GPL+ and GPLv2 and GPLv2 with ' + + 'exceptions and IJG and LGPLv2+ and MIT and MPLv2.0 and Public Domain and W3C and zlib and ' + + 'ISC and FTL and RSA.', + maintainer: 'Amazon Corretto Team ', + buildHost : 'build.amazon.com' + ] + jdkTools = ['java', 'keytool', 'rmid', 'rmiregistry', 'jjs', 'pack200', 'unpack200', 'javac', 'jaotc', 'jlink', + 'jmod', 'jhsdb', 'jar', 'jarsigner', 'javadoc', 'javap', 'jcmd', 'jconsole', 'jdb', 'jdeps', 'jdeprscan', + 'jimage', 'jinfo', 'jmap', 'jps', 'jrunscript', 'jshell', 'jstack', 'jstat', 'jstatd', 'rmic', 'serialver'] + // artifact names + caCerts = "cacerts" + sourceTar = "amazon-corretto-source-${project.version.full}.tar.gz" + + correttoCommonFlags = [ + "--with-freetype=bundled", + '--with-jvm-features=zgc', + "--with-version-build=${project.version.build}", + '--with-version-pre=', + "--with-version-string=${version.major}.${version.minor}.${version.security}", + "--with-vendor-bug-url=https://github.com/corretto/corretto-jdk/issues/", + '--with-vendor-vm-bug-url=https://github.com/corretto/corretto-jdk/issues/', + '--with-vendor-name=Amazon.com Inc.', + '--with-vendor-url=https://aws.amazon.com/corretto/', + "--with-vendor-version-string=Corretto-${project.version.full}" + ] + + def versionOpt = project.findProperty("corretto.versionOpt") + if (versionOpt) { + correttoCommonFlags += ["--with-version-opt=${versionOpt}"] + } + + def versionDate = project.findProperty("corretto.versionDate") + if (versionDate) { + correttoCommonFlags += ["--with-version-date=${versionDate}"] + } + + // Valid value: null, release, debug, fastdebug, slowdebug + def correttoDebugLevel = "release" // Default: release + switch(project.findProperty("corretto.debug_level")) { + case null: + case "release": + correttoCommonFlags += ['--with-debug-level=release', '--with-native-debug-symbols=none'] + break + case "fastdebug": + correttoDebugLevel = "fastdebug" + correttoCommonFlags += ['--with-debug-level=fastdebug', '--with-native-debug-symbols=zipped'] + break + case "debug": + case "slowdebug": + correttoDebugLevel = "slowdebug" + correttoCommonFlags += ['--with-debug-level=slowdebug', '--with-native-debug-symbols=external'] + break + default: + throw new RuntimeException("Invalid corretto.debug_level") + } + + // customized flags. Identify the index of double dashes as the start of a flag + String extraConfig = project.findProperty("corretto.extra_config") + def lastIndex = -1 + if (extraConfig != null) { + for (int index = extraConfig.indexOf("--"); index >= 0; index = extraConfig.indexOf("--", index + 1)) { + if (lastIndex != -1) { + correttoCommonFlags += extraConfig.substring(lastIndex, index).trim() + } + lastIndex = index + } + if (lastIndex != -1) { + correttoCommonFlags += extraConfig.substring(lastIndex).trim() + } + } + + // Determine the system architecture + def jdkArch = "" + def os = "" + if (Os.isFamily(Os.FAMILY_MAC)) { + os = 'macosx' + jdkArch = "x86_64" + } else if (Os.isFamily(Os.FAMILY_UNIX)) { + os = 'linux' + jdkArch = ['uname', '-m'].execute().text.trim() + // `uname -m` returns the host arch in a linux x86 docker instance. Pass a flag + // to enable + if (project.hasProperty("x86") && Boolean.parseBoolean(project.getProperty('x86'))) { + jdkArch = "x86" + } + } else if (Os.isFamily(Os.FAMILY_WINDOWS)) { + os = 'windows' + def arch = System.getenv('PROCESSOR_ARCHITECTURE') + if (arch == 'AMD64') { + jdkArch = "x86_64" + } else { //x86 + throw new GradleException("${arch} is not suported") + } + } else { + throw new GradleException("OS is not supported") + } + + // Ext property: correttoArch + switch (jdkArch) { + case 'x86': + case 'aarch64': + correttoArch = jdkArch + break + case 'x86_64': + correttoArch = 'x64' + break + default: + throw new GradleException("${jdkArch} is not supported") + } + + // Call toString explicitly to avoid lazy evaluation + jdkImageName = "${os}-${jdkArch}-server-${correttoDebugLevel}".toString() + // no debug level suffix for release build + if (correttoDebugLevel == "release") { + correttoJdkArchiveName = "amazon-corretto-${project.version.full}-${os}-${correttoArch}".toString() + } else { + correttoJdkArchiveName = + "amazon-corretto-${project.version.full}-${os}-${correttoArch}-${correttoDebugLevel}".toString() + } + correttoTestImageArchiveName = "amazon-corretto-testimage-${project.version.full}-${os}-${correttoArch}".toString() + } +} + +project(':prebuild') { + apply plugin: 'java' + + configurations { + cacerts + } + + ext { + cacertDir = "$distributionDir/${project.caCerts}" + } + + def preBuildSrc = "src" + def classPath = "classes" + def generateToolMain = "build.tools.generatecacerts.GenerateCacerts" + + task copyToolSrc(type: Copy) { + description 'Copy utility tool source to the project root' + from fileTree("$rootDir/make/jdk/src/classes") { + include 'build/tools/generatecacerts/*' + } + into preBuildSrc + } + + task buildTool(type: JavaCompile) { + dependsOn copyToolSrc + source = fileTree(dir: preBuildSrc, include: '**/*.java') + destinationDir = file(classPath) + classpath = files(classPath) + } + + task generateJdkCacerts(type: JavaExec) { + dependsOn buildTool + def jdkCaDir = "$rootDir/make/data/cacerts" + + description = 'Generate Cacerts from JDK source' + classpath = files(classPath) + main = generateToolMain + args = [jdkCaDir, project.caCerts] + } + + task importAmazonCacerts(type: Exec) { + dependsOn generateJdkCacerts + // Default password for JSSE key store + def keystore_password = "changeit" + commandLine 'keytool', '-importkeystore', '-noprompt', + '-srckeystore', "$rootDir/amazon-cacerts", + '-srcstorepass', keystore_password, + '-destkeystore', caCerts, + '-deststorepass', keystore_password + } + + task copyCacerts(type: Copy) { + dependsOn importAmazonCacerts + from caCerts + into distributionDir + } + + artifacts { + cacerts file: file("$distributionDir/${caCerts}"), builtBy: copyCacerts + } +} + +project(':openjdksrc') { + /** + * Compresses a snapshot of the source code used to perform the build. + */ + task sourceDistributionTarball(type: Tar) { + description 'Assemble source files required for building and distributing Corretto.' + compression Compression.GZIP + archiveName sourceTar + from fileTree(rootDir) { + include 'LICENSE', + 'ADDITIONAL_LICENSE_INFO', + 'README', + 'ASSEMBLY_EXCEPTION', + 'version.txt', + 'amazon-cacerts', + 'configure', + 'Makefile', + 'bin/**', + 'doc/**', + 'make/**', + 'src/**', + 'test/**' + } + } + + artifacts { + archives sourceDistributionTarball + } +} + diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000000..f97ebb7d334 --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +org.gradle.parallel=true diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000000..5c2d1cf016b Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000000..bb8b2fc26b2 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 00000000000..83f2acfdc31 --- /dev/null +++ b/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000000..24467a141f7 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/installers/linux/alpine/tar/build.gradle b/installers/linux/alpine/tar/build.gradle new file mode 100644 index 00000000000..be47de31e97 --- /dev/null +++ b/installers/linux/alpine/tar/build.gradle @@ -0,0 +1,152 @@ +/* +* Copyright (c) 2019, Amazon.com, Inc. or its affiliates. All Rights Reserved. +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 only, as +* published by the Free Software Foundation. Amazon designates this +* particular file as subject to the "Classpath" exception as provided +* by Oracle in the LICENSE file that accompanied this code. +* +* This code is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* version 2 for more details (a copy is included in the LICENSE file that +* accompanied this code). +* +* You should have received a copy of the GNU General Public License version +* 2 along with this work; if not, write to the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + + +dependencies { + compile project(path: ':openjdksrc', configuration: 'archives') + compile project(path: ':prebuild', configuration: 'cacerts') +} + +ext { + // all linux distros and macos support 'uname -m' + arch = ['uname', '-m'].execute().text.trim() + + switch (arch) { + case 'aarch64': + arch_alias = arch + break; + case 'x86_64': + arch_alias = 'x64' + break; + default: + throw new GradleException("${arch} is not suported") + } +} + +def jdkResultingImage = "$buildRoot/build/linux-${arch}-server-release/images/jdk" +def testResultingImage = "$buildRoot/build/linux-${arch}-server-release/images/test" + +// deps +def depsMap = [:] +project.configurations.compile.getFiles().each { depsMap[it.getName()] = it } +/** + * Create a local copy of the source tree in our + * build root -- this is required since OpenJDK's + * build wants to occur inside the source tree, + * and we don't want to tamper with someone + * else's tree. + */ +task copySource(type: Exec) { + if (!file(buildRoot).exists()) { + file(buildRoot).mkdirs() + } + workingDir '/usr/bin' + commandLine 'rsync', '-am', + '--exclude=pre-build', + '--exclude=installers', + '--exclude=corretto-build', + "${project.rootDir}/", buildRoot +} + +/** + * Scan the patches folder for any .patch that needs + * to be applied before start building. + */ +task applyPatches() { + dependsOn copySource + doLast { + fileTree('patches').matching { + include '*.patch' + }.each { f -> + ant.patch(patchfile: f, dir: "$buildRoot", strip: 0) + } + } +} + +task configureBuild(type: Exec) { + + dependsOn project.configurations.compile + dependsOn applyPatches + workingDir "$buildRoot" + + // Platform specific flags + def command = ['bash', 'configure', + "--with-cacerts-file=${depsMap[caCerts]}" + ] + // Common flags + command += project.correttoCommonFlags + commandLine command.flatten() +} + +task executeBuild(type: Exec) { + dependsOn configureBuild + workingDir "$buildRoot" + commandLine 'make', 'images' + outputs.dir jdkResultingImage +} + +task createTestImage(type: Exec) { + dependsOn executeBuild + workingDir "$buildRoot" + commandLine 'make','test-image-hotspot-jtreg-native','test-image-jdk-jtreg-native' +} + +task packageTestImage(type: Tar) { + dependsOn createTestImage + description 'Package test results' + archiveName "amazon-corretto-testimage-${project.version.full}-alpine-linux-${arch_alias}.tar.gz" + compression Compression.GZIP + from(testResultingImage) { + include '**' + } + into "amazon-corretto-testimage-${project.version.full}-alpine-linux-${arch_alias}" + +} + +task packageBuildResults(type: Tar) { + description 'Compresses the JDK image and puts the results in build/distributions.' + dependsOn packageTestImage + dependsOn executeBuild + archiveName "amazon-corretto-${project.version.full}-alpine-linux-${arch_alias}.tar.gz" + compression Compression.GZIP + from(buildRoot) { + include 'ADDITIONAL_LICENSE_INFO' + include 'ASSEMBLY_EXCEPTION' + include 'LICENSE' + include 'README.md' + include 'version.txt' + } + from(jdkResultingImage) { + include 'bin/**' + include 'conf/**' + include 'include/**' + include 'jmods/**' + include 'legal/**' + include 'lib/**' + include 'man/man1/**' + include 'release' + } + into "amazon-corretto-${project.version.full}-alpine-linux-${arch_alias}" +} + +artifacts { + archives packageBuildResults +} diff --git a/installers/linux/alpine/tar/patches/zlib.patch b/installers/linux/alpine/tar/patches/zlib.patch new file mode 100644 index 00000000000..98136dab4dd --- /dev/null +++ b/installers/linux/alpine/tar/patches/zlib.patch @@ -0,0 +1,149 @@ +This patch is applied to disable implicit-fallthrough warnings on gcc7 or +higher when building the bundled version of zlib. + +diff --git src/java.base/share/native/libzip/zlib/infback.c src/java.base/share/native/libzip/zlib/infback.c +index 4c8283909..1a9cc6b60 100644 +--- src/java.base/share/native/libzip/zlib/infback.c ++++ src/java.base/share/native/libzip/zlib/infback.c +@@ -501,7 +501,7 @@ void FAR *out_desc; + } + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN; +- ++ /* FALLTHROUGH */ + case LEN: + /* use inflate_fast() if we have enough input and output */ + if (have >= 6 && left >= 258) { +diff --git src/java.base/share/native/libzip/zlib/inflate.c src/java.base/share/native/libzip/zlib/inflate.c +index ca904e744..4abfe84a5 100644 +--- src/java.base/share/native/libzip/zlib/inflate.c ++++ src/java.base/share/native/libzip/zlib/inflate.c +@@ -764,6 +764,7 @@ int flush; + CRC2(state->check, hold); + INITBITS(); + state->mode = EXLEN; ++ /* FALLTHROUGH */ + case EXLEN: + if (state->flags & 0x0400) { + NEEDBITS(16); +@@ -777,6 +778,7 @@ int flush; + else if (state->head != Z_NULL) + state->head->extra = Z_NULL; + state->mode = EXTRA; ++ /* FALLTHROUGH */ + case EXTRA: + if (state->flags & 0x0400) { + copy = state->length; +@@ -799,6 +801,7 @@ int flush; + } + state->length = 0; + state->mode = NAME; ++ /* FALLTHROUGH */ + case NAME: + if (state->flags & 0x0800) { + if (have == 0) goto inf_leave; +@@ -820,6 +823,7 @@ int flush; + state->head->name = Z_NULL; + state->length = 0; + state->mode = COMMENT; ++ /* FALLTHROUGH */ + case COMMENT: + if (state->flags & 0x1000) { + if (have == 0) goto inf_leave; +@@ -840,6 +844,7 @@ int flush; + else if (state->head != Z_NULL) + state->head->comment = Z_NULL; + state->mode = HCRC; ++ /* FALLTHROUGH */ + case HCRC: + if (state->flags & 0x0200) { + NEEDBITS(16); +@@ -863,6 +868,7 @@ int flush; + strm->adler = state->check = ZSWAP32(hold); + INITBITS(); + state->mode = DICT; ++ /* FALLTHROUGH */ + case DICT: + if (state->havedict == 0) { + RESTORE(); +@@ -870,8 +876,10 @@ int flush; + } + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = TYPE; ++ /* FALLTHROUGH */ + case TYPE: + if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; ++ /* FALLTHROUGH */ + case TYPEDO: + if (state->last) { + BYTEBITS(); +@@ -922,8 +930,10 @@ int flush; + INITBITS(); + state->mode = COPY_; + if (flush == Z_TREES) goto inf_leave; ++ /* FALLTHROUGH */ + case COPY_: + state->mode = COPY; ++ /* FALLTHROUGH */ + case COPY: + copy = state->length; + if (copy) { +@@ -1063,8 +1073,10 @@ int flush; + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN_; + if (flush == Z_TREES) goto inf_leave; ++ /* FALLTHROUGH */ + case LEN_: + state->mode = LEN; ++ /* FALLTHROUGH */ + case LEN: + if (have >= 6 && left >= 258) { + RESTORE(); +@@ -1114,6 +1126,7 @@ int flush; + } + state->extra = (unsigned)(here.op) & 15; + state->mode = LENEXT; ++ /* FALLTHROUGH */ + case LENEXT: + if (state->extra) { + NEEDBITS(state->extra); +@@ -1124,6 +1137,7 @@ int flush; + Tracevv((stderr, "inflate: length %u\n", state->length)); + state->was = state->length; + state->mode = DIST; ++ /* FALLTHROUGH */ + case DIST: + for (;;) { + here = state->distcode[BITS(state->distbits)]; +@@ -1151,6 +1165,7 @@ int flush; + state->offset = (unsigned)here.val; + state->extra = (unsigned)(here.op) & 15; + state->mode = DISTEXT; ++ /* FALLTHROUGH */ + case DISTEXT: + if (state->extra) { + NEEDBITS(state->extra); +@@ -1167,6 +1182,7 @@ int flush; + #endif + Tracevv((stderr, "inflate: distance %u\n", state->offset)); + state->mode = MATCH; ++ /* FALLTHROUGH */ + case MATCH: + if (left == 0) goto inf_leave; + copy = out - left; +@@ -1242,6 +1258,7 @@ int flush; + } + #ifdef GUNZIP + state->mode = LENGTH; ++ /* FALLTHROUGH */ + case LENGTH: + if (state->wrap && state->flags) { + NEEDBITS(32); +@@ -1255,6 +1272,7 @@ int flush; + } + #endif + state->mode = DONE; ++ /* FALLTHROUGH */ + case DONE: + ret = Z_STREAM_END; + goto inf_leave; diff --git a/installers/linux/universal/deb/build.gradle b/installers/linux/universal/deb/build.gradle new file mode 100644 index 00000000000..5f4848c64bb --- /dev/null +++ b/installers/linux/universal/deb/build.gradle @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2019, Amazon.com, Inc. or its affiliates. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Amazon designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +plugins { + id 'nebula.ospackage' version '8.4.1' +} + +dependencies { + compile project(path: ':installers:linux:universal:tar', configuration: 'archives') +} + +ext { + switch (project.correttoArch) { + case 'aarch64': + arch_deb = 'arm64' + break; + case 'x86': + arch_deb = "i386" + break + case 'x64': + arch_deb = 'amd64' + break + } +} + +def jvmDir = '/usr/lib/jvm' +def jdkInstallationDirName = "java-${project.version.major}-amazon-corretto" +def jdkHome = "${jvmDir}/${jdkInstallationDirName}".toString() +def jdkBinaryDir = "${buildRoot}/${project.correttoJdkArchiveName}" +def jdkPackageName = "java-${project.version.major}-amazon-corretto-jdk" + +def alternativesPriority = String.format("1%2s%2s%3s", project.version.major, project.version.minor, project.version.security).replace(' ', '0') + +def jinfoName = ".${jdkInstallationDirName}.jinfo" + +ospackage { + // Valid version must start with a digit and only contain [A-Za-z0-9.+:~-] + // See http://manpages.ubuntu.com/manpages/artful/en/man5/deb-version.5.html + version project.version.upstream + release project.version.revision + + url "${packageInfo.url}" + vendor "${packageInfo.vendor}" + packager "${packageInfo.packager}" + license "${packageInfo.license}" + buildHost "${packageInfo.buildHost}" + maintainer "${packageInfo.maintainer}" + packageGroup 'java' + priority 'optional' + user 'root' + permissionGroup 'root' + epoch 1 + arch arch_deb + multiArch SAME +} + +/** + * Uncompress and copy the universal Corretto artifact + * tar for DEB packaging. + */ +task extractUniversalTar(type: Copy) { + dependsOn project.configurations.compile + from tarTree(project.configurations.compile.singleFile) + into buildRoot +} + +/** + * Populate version numbers, java home and alternatives + * priority to postin_jdk.sh.template and preun_jdk.sh.template. + * Create script copies under build root scripts folder. + */ +task inflateDebScriptTemplate(type: Copy) { + dependsOn extractUniversalTar + // In trusty repo, openjdk7 has priority 1071 and openjdk6 has 1061 + // Corretto uses the same priority in both rpm and deb + def priority = + from('scripts') { + include '**/*.template' + rename { file -> file.replace('.template', '') } + filter(org.apache.tools.ant.filters.ReplaceTokens, + tokens: project.version + [java_home: jdkHome, alternatives_priority: alternativesPriority, + jdk_tools: jdkTools.join(' ')]) + } + into "${buildRoot}/scripts" +} + +/** + * Inflate jinfo file used by update-java-alternatives command. + * Create script copy under buildRoot/jinfo folder. See + * http://manpages.ubuntu.com/manpages/xenial/man8/update-java-alternatives.8.html#files + */ +task inflateJinfoTemplate(type: Copy) { + from('jinfo') { + include '**/*.template' + rename('jinfo.template', jinfoName) + filter(org.apache.tools.ant.filters.ReplaceTokens, + tokens: project.version + [java_home : jdkHome, alternatives_priority: alternativesPriority, + directory_name: jdkInstallationDirName.toString()]) + expand(jdk_tools: jdkTools) + } + into "${buildRoot}/jinfo" +} + +/** + * Generate DEB for JDK, with package published under + * distributions folder. + */ +task generateJdkDeb(type: Deb) { + description 'Create the DEB package for Corretto JDK' + dependsOn inflateDebScriptTemplate + dependsOn inflateJinfoTemplate + + packageName jdkPackageName + packageDescription "Amazon Corretto\'s packaging of the OpenJDK ${project.version.major} code." + summary "Amazon Corretto ${project.version.major} development environment" + + postInstall file("$buildRoot/scripts/postin_jdk.sh") + preUninstall file("$buildRoot/scripts/preun_jdk.sh") + + requires('java-common') + // jdk + provides('java-compiler') + provides('java-sdk') + provides('java5-sdk') + provides('java6-sdk') + provides('java7-sdk') + provides('java7-jdk') + provides('java8-jdk') + provides('java11-sdk') + // TODO: Move this to the jre when splitting the fat deb + provides('java-runtime') + provides('java5-runtime') + provides('java6-runtime') + provides('java7-runtime') + provides('java8-runtime') + provides('java11-runtime') + // TODO: Move this to the headless jre when splitting the fat deb + provides('java-runtime-headless') + provides('java5-runtime-headless') + provides('java6-runtime-headless') + provides('java7-runtime-headless') + provides('java8-runtime-headless') + provides('java11-runtime-headless') + + from(jdkBinaryDir) { + into jdkHome + } + + from("$buildRoot/jinfo") { + include '**/*.jinfo' + into jvmDir + } +} + +artifacts { + archives generateJdkDeb +} diff --git a/installers/linux/universal/deb/jinfo/jinfo.template b/installers/linux/universal/deb/jinfo/jinfo.template new file mode 100644 index 00000000000..2827503f4b6 --- /dev/null +++ b/installers/linux/universal/deb/jinfo/jinfo.template @@ -0,0 +1,7 @@ +name=@directory_name@ +alias=@directory_name@ +priority=@alternatives_priority@ +section=main + +<% jdk_tools.each {%>jdk ${it} @java_home@/bin/${it} +<%}%> \ No newline at end of file diff --git a/installers/linux/universal/deb/scripts/postin_jdk.sh.template b/installers/linux/universal/deb/scripts/postin_jdk.sh.template new file mode 100644 index 00000000000..e883f0e5377 --- /dev/null +++ b/installers/linux/universal/deb/scripts/postin_jdk.sh.template @@ -0,0 +1,19 @@ +# postinst script for Corretto +# +# summary of how this script can be called: +# * `configure' +# for details, see https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html or +# the debian-policy package + + +# Note that Nebula gradle-ospackage-plugin default and only support `configure` option for post installation script. + +for i in @jdk_tools@; do + if [ -e @java_home@/bin/$i ]; then + cmd="update-alternatives --install /usr/bin/$i $i @java_home@/bin/$i @alternatives_priority@" + if [ -e @java_home@/man/man1/$i.1 ]; then + cmd="$cmd --slave /usr/share/man/man1/$i.1 $i.1 @java_home@/man/man1/$i.1" + fi + $cmd + fi +done diff --git a/installers/linux/universal/deb/scripts/preun_jdk.sh.template b/installers/linux/universal/deb/scripts/preun_jdk.sh.template new file mode 100644 index 00000000000..69865534105 --- /dev/null +++ b/installers/linux/universal/deb/scripts/preun_jdk.sh.template @@ -0,0 +1,18 @@ +# postrm script for Corretto +# +# summary of how this script can be called: +# * `remove' +# for details, see https://www.debian.org/doc/debian-policy/ch-maintainerscripts.html or +# the debian-policy package + +case "$1" in + remove | deconfigure) + for i in @jdk_tools@; do + if [ -e @java_home@/bin/$i ]; then + update-alternatives --remove $i @java_home@/bin/$i + fi + done + ;; +esac + +exit 0 diff --git a/installers/linux/universal/rpm/build.gradle b/installers/linux/universal/rpm/build.gradle new file mode 100644 index 00000000000..494662e2591 --- /dev/null +++ b/installers/linux/universal/rpm/build.gradle @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2019, Amazon.com, Inc. or its affiliates. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Amazon designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +plugins { + id 'nebula.ospackage' version '8.4.1' +} + +dependencies { + compile project(path: ':installers:linux:universal:tar', configuration: 'archives') +} + +ext { + switch (project.correttoArch) { + case 'aarch64': + arch_redline = 'AARCH64' + break; + case 'x86': + arch_redline = "i386" + break + case 'x64': + arch_redline = 'x86_64' + break + } +} + +def jvmDir = '/usr/lib/jvm' +def jdkInstallationDirName = "java-${project.version.major}-amazon-corretto" +def jdkHome = "${jvmDir}/${jdkInstallationDirName}" +def jdkBinaryDir = "${buildRoot}/${project.correttoJdkArchiveName}" +def jdkPackageName = "java-${project.version.major}-amazon-corretto-devel" + +ospackage { + version project.version.upstream + release project.version.revision + + url "${packageInfo.url}" + vendor "${packageInfo.vendor}" + packager "${packageInfo.packager}" + license "${packageInfo.license}" + buildHost "${packageInfo.buildHost}" + user 'root' + permissionGroup 'root' + epoch 1 + arch arch_redline + os LINUX + type BINARY +} + +/** + * Uncompress and copy the universal Corretto artifact + * tar for RPM packaging. + */ +task extractUniversalTar(type: Copy) { + dependsOn project.configurations.compile + from tarTree(project.configurations.compile.singleFile) + into buildRoot +} + +/** + * Populate version numbers, java home and alternatives + * priority to postin_javac.sh.template and preun_javac.sh.template. + * Create script copies under build root scripts folder. + */ +task inflateRpmScriptTemplate(type: Copy) { + dependsOn extractUniversalTar + // Use the same priority as IcedTea JDK RPM distribution, based on java version + def priority = String.format("1%2s%2s%3s", project.version.major, project.version.minor, project.version.security).replace(' ', '0') + from('scripts') { + include '**/*.template' + rename { file -> file.replace('.template', '') } + filter(org.apache.tools.ant.filters.ReplaceTokens, + tokens: project.version + [alternatives_priority: priority]) + } + into "${buildRoot}/scripts" +} + +/** + * Generate RPM for JDK, with package published under + * distributions folder. + */ +task generateJdkRpm(type: Rpm) { + description 'Create the RPM package for Corretto JDK' + dependsOn inflateRpmScriptTemplate + packageName jdkPackageName + packageDescription packageInfo.description + summary "Amazon Corretto ${project.version.major} development environment" + packageGroup 'Development/Tools' + prefix(jdkHome) + postInstall file("$buildRoot/scripts/postin_java.sh") + postInstall file("$buildRoot/scripts/postin_javac.sh") + preUninstall file("$buildRoot/scripts/preun_java.sh") + preUninstall file("$buildRoot/scripts/preun_javac.sh") + + provides(jdkPackageName, "${epoch}:${version}-${release}", EQUAL) + provides('java-11-devel', "${epoch}:${version}", EQUAL) + provides('java-11-openjdk-devel', "${epoch}:${version}", EQUAL) + provides('java-11-openjdk-devel', "${epoch}:${version}-${release}", EQUAL) + provides('java-sdk-11', "${epoch}:${version}", EQUAL) + provides('java-sdk-11-openjdk ', "${epoch}:${version}-${release}", EQUAL) + + from(jdkBinaryDir) { + into jdkHome + } +} + +artifacts { + archives generateJdkRpm +} diff --git a/installers/linux/universal/rpm/scripts/postin_java.sh.template b/installers/linux/universal/rpm/scripts/postin_java.sh.template new file mode 100644 index 00000000000..38faceace9b --- /dev/null +++ b/installers/linux/universal/rpm/scripts/postin_java.sh.template @@ -0,0 +1,17 @@ +if [ $1 -eq 1 ] ; then + alternatives --install /usr/bin/java java ${RPM_INSTALL_PREFIX}/bin/java @alternatives_priority@ \ + --slave /usr/lib/jvm/jre jre ${RPM_INSTALL_PREFIX} \ + --slave /usr/bin/jjs jjs ${RPM_INSTALL_PREFIX}/bin/jjs \ + --slave /usr/bin/keytool keytool ${RPM_INSTALL_PREFIX}/bin/keytool \ + --slave /usr/bin/pack200 pack200 ${RPM_INSTALL_PREFIX}/bin/pack200 \ + --slave /usr/bin/rmid rmid ${RPM_INSTALL_PREFIX}/bin/rmid \ + --slave /usr/bin/rmiregistry rmiregistry ${RPM_INSTALL_PREFIX}/bin/rmiregistry \ + --slave /usr/bin/unpack200 unpack200 ${RPM_INSTALL_PREFIX}/bin/unpack200 \ + --slave /usr/share/man/man1/java.1 java.1 ${RPM_INSTALL_PREFIX}/man/man1/java.1 \ + --slave /usr/share/man/man1/jjs.1 jjs.1 ${RPM_INSTALL_PREFIX}/man/man1/jjs.1 \ + --slave /usr/share/man/man1/keytool.1 keytool.1 ${RPM_INSTALL_PREFIX}/man/man1/keytool.1 \ + --slave /usr/share/man/man1/pack200.1 pack200.1 ${RPM_INSTALL_PREFIX}/man/man1/pack200.1 \ + --slave /usr/share/man/man1/rmid.1 rmid.1 ${RPM_INSTALL_PREFIX}/man/man1/rmid.1 \ + --slave /usr/share/man/man1/rmiregistry.1 rmiregistry.1 ${RPM_INSTALL_PREFIX}/man/man1/rmiregistry.1 \ + --slave /usr/share/man/man1/unpack200.1 unpack200.1 ${RPM_INSTALL_PREFIX}/man/man1/unpack200.1 +fi diff --git a/installers/linux/universal/rpm/scripts/postin_javac.sh.template b/installers/linux/universal/rpm/scripts/postin_javac.sh.template new file mode 100644 index 00000000000..afa79559e55 --- /dev/null +++ b/installers/linux/universal/rpm/scripts/postin_javac.sh.template @@ -0,0 +1,46 @@ +if [ $1 -eq 1 ] ; then + alternatives --install /usr/bin/javac javac ${RPM_INSTALL_PREFIX}/bin/javac @alternatives_priority@ \ + --slave /usr/lib/jvm/java java_sdk ${RPM_INSTALL_PREFIX} \ + --slave /usr/bin/jaotc jaotc ${RPM_INSTALL_PREFIX}/bin/jaotc \ + --slave /usr/bin/jlink jlink ${RPM_INSTALL_PREFIX}/bin/jlink \ + --slave /usr/bin/jmod jmod ${RPM_INSTALL_PREFIX}/bin/jmod \ + --slave /usr/bin/jhsdb jhsdb ${RPM_INSTALL_PREFIX}/bin/jhsdb \ + --slave /usr/bin/jar jar ${RPM_INSTALL_PREFIX}/bin/jar \ + --slave /usr/bin/jarsigner jarsigner ${RPM_INSTALL_PREFIX}/bin/jarsigner \ + --slave /usr/bin/javadoc javadoc ${RPM_INSTALL_PREFIX}/bin/javadoc \ + --slave /usr/bin/javap javap ${RPM_INSTALL_PREFIX}/bin/javap \ + --slave /usr/bin/jcmd jcmd ${RPM_INSTALL_PREFIX}/bin/jcmd \ + --slave /usr/bin/jconsole jconsole ${RPM_INSTALL_PREFIX}/bin/jconsole \ + --slave /usr/bin/jdb jdb ${RPM_INSTALL_PREFIX}/bin/jdb \ + --slave /usr/bin/jdeps jdeps ${RPM_INSTALL_PREFIX}/bin/jdeps \ + --slave /usr/bin/jdeprscan jdeprscan ${RPM_INSTALL_PREFIX}/bin/jdeprscan \ + --slave /usr/bin/jimage jimage ${RPM_INSTALL_PREFIX}/bin/jimage \ + --slave /usr/bin/jinfo jinfo ${RPM_INSTALL_PREFIX}/bin/jinfo \ + --slave /usr/bin/jmap jmap ${RPM_INSTALL_PREFIX}/bin/jmap \ + --slave /usr/bin/jps jps ${RPM_INSTALL_PREFIX}/bin/jps \ + --slave /usr/bin/jrunscript jrunscript ${RPM_INSTALL_PREFIX}/bin/jrunscript \ + --slave /usr/bin/jshell jshell ${RPM_INSTALL_PREFIX}/bin/jshell \ + --slave /usr/bin/jstack jstack ${RPM_INSTALL_PREFIX}/bin/jstack \ + --slave /usr/bin/jstat jstat ${RPM_INSTALL_PREFIX}/bin/jstat \ + --slave /usr/bin/jstatd jstatd ${RPM_INSTALL_PREFIX}/bin/jstatd \ + --slave /usr/bin/rmic rmic ${RPM_INSTALL_PREFIX}/bin/rmic \ + --slave /usr/bin/serialver serialver ${RPM_INSTALL_PREFIX}/bin/serialver \ + --slave /usr/share/man/man1/jar.1 jar.1 ${RPM_INSTALL_PREFIX}/man/man1/jar.1 \ + --slave /usr/share/man/man1/jarsigner.1 jarsigner.1 ${RPM_INSTALL_PREFIX}/man/man1/jarsigner.1 \ + --slave /usr/share/man/man1/javac.1 javac.1 ${RPM_INSTALL_PREFIX}/man/man1/javac.1 \ + --slave /usr/share/man/man1/javadoc.1 javadoc.1 ${RPM_INSTALL_PREFIX}/man/man1/javadoc.1 \ + --slave /usr/share/man/man1/javap.1 javap.1 ${RPM_INSTALL_PREFIX}/man/man1/javap.1 \ + --slave /usr/share/man/man1/jcmd.1 jcmd.1 ${RPM_INSTALL_PREFIX}/man/man1/jcmd.1 \ + --slave /usr/share/man/man1/jconsole.1 jconsole.1 ${RPM_INSTALL_PREFIX}/man/man1/jconsole.1 \ + --slave /usr/share/man/man1/jdb.1 jdb.1 ${RPM_INSTALL_PREFIX}/man/man1/jdb.1 \ + --slave /usr/share/man/man1/jdeps.1 jdeps.1 ${RPM_INSTALL_PREFIX}/man/man1/jdeps.1 \ + --slave /usr/share/man/man1/jinfo.1 jinfo.1 ${RPM_INSTALL_PREFIX}/man/man1/jinfo.1 \ + --slave /usr/share/man/man1/jmap.1 jmap.1 ${RPM_INSTALL_PREFIX}/man/man1/jmap.1 \ + --slave /usr/share/man/man1/jps.1 jps.1 ${RPM_INSTALL_PREFIX}/man/man1/jps.1 \ + --slave /usr/share/man/man1/jrunscript.1 jrunscript.1 ${RPM_INSTALL_PREFIX}/man/man1/jrunscript.1 \ + --slave /usr/share/man/man1/jstack.1 jstack.1 ${RPM_INSTALL_PREFIX}/man/man1/jstack.1 \ + --slave /usr/share/man/man1/jstat.1 jstat.1 ${RPM_INSTALL_PREFIX}/man/man1/jstat.1 \ + --slave /usr/share/man/man1/jstatd.1 jstatd.1 ${RPM_INSTALL_PREFIX}/man/man1/jstatd.1 \ + --slave /usr/share/man/man1/rmic.1 rmic.1 ${RPM_INSTALL_PREFIX}/man/man1/rmic.1 \ + --slave /usr/share/man/man1/serialver.1 serialver.1 ${RPM_INSTALL_PREFIX}/man/man1/serialver.1 +fi diff --git a/installers/linux/universal/rpm/scripts/preun_java.sh.template b/installers/linux/universal/rpm/scripts/preun_java.sh.template new file mode 100644 index 00000000000..6ee80c62528 --- /dev/null +++ b/installers/linux/universal/rpm/scripts/preun_java.sh.template @@ -0,0 +1,3 @@ +if [ $1 -eq 0 ] ; then + alternatives --remove java ${RPM_INSTALL_PREFIX}/bin/java +fi diff --git a/installers/linux/universal/rpm/scripts/preun_javac.sh.template b/installers/linux/universal/rpm/scripts/preun_javac.sh.template new file mode 100644 index 00000000000..b577074a5c0 --- /dev/null +++ b/installers/linux/universal/rpm/scripts/preun_javac.sh.template @@ -0,0 +1,3 @@ +if [ $1 -eq 0 ] ; then + alternatives --remove javac ${RPM_INSTALL_PREFIX}/bin/javac +fi diff --git a/installers/linux/universal/tar/build.gradle b/installers/linux/universal/tar/build.gradle new file mode 100644 index 00000000000..68fa2382f33 --- /dev/null +++ b/installers/linux/universal/tar/build.gradle @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2019, Amazon.com, Inc. or its affiliates. All Rights Reserved. +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 only, as +* published by the Free Software Foundation. Amazon designates this +* particular file as subject to the "Classpath" exception as provided +* by Oracle in the LICENSE file that accompanied this code. +* +* This code is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* version 2 for more details (a copy is included in the LICENSE file that +* accompanied this code). +* +* You should have received a copy of the GNU General Public License version +* 2 along with this work; if not, write to the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + + +dependencies { + compile project(path: ':openjdksrc', configuration: 'archives') + compile project(path: ':prebuild', configuration: 'cacerts') +} + +if (project.correttoArch == 'x86') { + project.correttoCommonFlags += '--with-target-bits=32' +} + +def imageDir= "$buildRoot/build/${project.jdkImageName}/images" +def jdkResultingImage = "${imageDir}/jdk" +def testResultingImage = "${imageDir}/test" + +// deps +def depsMap = [:] +project.configurations.compile.getFiles().each { depsMap[it.getName()] = it } +/** + * Create a local copy of the source tree in our + * build root -- this is required since OpenJDK's + * build wants to occur inside the source tree, + * and we don't want to tamper with someone + * else's tree. + */ +task copySource(type: Exec) { + if (!file(buildRoot).exists()) { + file(buildRoot).mkdirs() + } + workingDir '/usr/bin' + commandLine 'rsync', '-am', + '--exclude=pre-build', + '--exclude=installers', + '--exclude=corretto-build', + "${project.rootDir}/", buildRoot +} + +/** + * Scan the patches folder for any .patch that needs + * to be applied before start building. + */ +task applyPatches() { + dependsOn copySource + doLast { + fileTree('patches').matching { + include '*.patch' + }.each { f -> + ant.patch(patchfile: f, dir: "$buildRoot", strip: 0) + } + } +} + +task configureBuild(type: Exec) { + dependsOn project.configurations.compile + dependsOn applyPatches + workingDir "$buildRoot" + + // Platform specific flags + def command = ['bash', 'configure', + "--with-cacerts-file=${depsMap[caCerts]}", + "--with-zlib=bundled" + ] + // Common flags + command += project.correttoCommonFlags + commandLine command.flatten() + +} + +task executeBuild(type: Exec) { + dependsOn configureBuild + workingDir "$buildRoot" + commandLine 'make', 'images' + outputs.dir jdkResultingImage +} + +task createTestImage(type: Exec) { + dependsOn executeBuild + workingDir "$buildRoot" + commandLine 'make','test-image-hotspot-jtreg-native','test-image-jdk-jtreg-native' +} + +task packageTestImage(type: Tar) { + dependsOn createTestImage + description 'Package test results' + archiveName "${project.correttoTestImageArchiveName}.tar.gz" + compression Compression.GZIP + from(testResultingImage) { + include '**' + } + into project.correttoTestImageArchiveName + +} + +task packageBuildResults(type: Tar) { + description 'Compresses the JDK image and puts the results in build/distributions.' + dependsOn packageTestImage + archiveName "${project.correttoJdkArchiveName}.tar.gz" + compression Compression.GZIP + from(buildRoot) { + include 'ADDITIONAL_LICENSE_INFO' + include 'ASSEMBLY_EXCEPTION' + include 'LICENSE' + include 'README.md' + include 'version.txt' + } + from(jdkResultingImage) { + include 'bin/**' + include 'conf/**' + include 'include/**' + include 'jmods/**' + include 'legal/**' + include 'lib/**' + include 'man/man1/**' + include 'release' + } + into project.correttoJdkArchiveName +} + +artifacts { + archives packageBuildResults +} diff --git a/installers/linux/universal/tar/patches/zlib.patch b/installers/linux/universal/tar/patches/zlib.patch new file mode 100644 index 00000000000..98136dab4dd --- /dev/null +++ b/installers/linux/universal/tar/patches/zlib.patch @@ -0,0 +1,149 @@ +This patch is applied to disable implicit-fallthrough warnings on gcc7 or +higher when building the bundled version of zlib. + +diff --git src/java.base/share/native/libzip/zlib/infback.c src/java.base/share/native/libzip/zlib/infback.c +index 4c8283909..1a9cc6b60 100644 +--- src/java.base/share/native/libzip/zlib/infback.c ++++ src/java.base/share/native/libzip/zlib/infback.c +@@ -501,7 +501,7 @@ void FAR *out_desc; + } + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN; +- ++ /* FALLTHROUGH */ + case LEN: + /* use inflate_fast() if we have enough input and output */ + if (have >= 6 && left >= 258) { +diff --git src/java.base/share/native/libzip/zlib/inflate.c src/java.base/share/native/libzip/zlib/inflate.c +index ca904e744..4abfe84a5 100644 +--- src/java.base/share/native/libzip/zlib/inflate.c ++++ src/java.base/share/native/libzip/zlib/inflate.c +@@ -764,6 +764,7 @@ int flush; + CRC2(state->check, hold); + INITBITS(); + state->mode = EXLEN; ++ /* FALLTHROUGH */ + case EXLEN: + if (state->flags & 0x0400) { + NEEDBITS(16); +@@ -777,6 +778,7 @@ int flush; + else if (state->head != Z_NULL) + state->head->extra = Z_NULL; + state->mode = EXTRA; ++ /* FALLTHROUGH */ + case EXTRA: + if (state->flags & 0x0400) { + copy = state->length; +@@ -799,6 +801,7 @@ int flush; + } + state->length = 0; + state->mode = NAME; ++ /* FALLTHROUGH */ + case NAME: + if (state->flags & 0x0800) { + if (have == 0) goto inf_leave; +@@ -820,6 +823,7 @@ int flush; + state->head->name = Z_NULL; + state->length = 0; + state->mode = COMMENT; ++ /* FALLTHROUGH */ + case COMMENT: + if (state->flags & 0x1000) { + if (have == 0) goto inf_leave; +@@ -840,6 +844,7 @@ int flush; + else if (state->head != Z_NULL) + state->head->comment = Z_NULL; + state->mode = HCRC; ++ /* FALLTHROUGH */ + case HCRC: + if (state->flags & 0x0200) { + NEEDBITS(16); +@@ -863,6 +868,7 @@ int flush; + strm->adler = state->check = ZSWAP32(hold); + INITBITS(); + state->mode = DICT; ++ /* FALLTHROUGH */ + case DICT: + if (state->havedict == 0) { + RESTORE(); +@@ -870,8 +876,10 @@ int flush; + } + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = TYPE; ++ /* FALLTHROUGH */ + case TYPE: + if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; ++ /* FALLTHROUGH */ + case TYPEDO: + if (state->last) { + BYTEBITS(); +@@ -922,8 +930,10 @@ int flush; + INITBITS(); + state->mode = COPY_; + if (flush == Z_TREES) goto inf_leave; ++ /* FALLTHROUGH */ + case COPY_: + state->mode = COPY; ++ /* FALLTHROUGH */ + case COPY: + copy = state->length; + if (copy) { +@@ -1063,8 +1073,10 @@ int flush; + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN_; + if (flush == Z_TREES) goto inf_leave; ++ /* FALLTHROUGH */ + case LEN_: + state->mode = LEN; ++ /* FALLTHROUGH */ + case LEN: + if (have >= 6 && left >= 258) { + RESTORE(); +@@ -1114,6 +1126,7 @@ int flush; + } + state->extra = (unsigned)(here.op) & 15; + state->mode = LENEXT; ++ /* FALLTHROUGH */ + case LENEXT: + if (state->extra) { + NEEDBITS(state->extra); +@@ -1124,6 +1137,7 @@ int flush; + Tracevv((stderr, "inflate: length %u\n", state->length)); + state->was = state->length; + state->mode = DIST; ++ /* FALLTHROUGH */ + case DIST: + for (;;) { + here = state->distcode[BITS(state->distbits)]; +@@ -1151,6 +1165,7 @@ int flush; + state->offset = (unsigned)here.val; + state->extra = (unsigned)(here.op) & 15; + state->mode = DISTEXT; ++ /* FALLTHROUGH */ + case DISTEXT: + if (state->extra) { + NEEDBITS(state->extra); +@@ -1167,6 +1182,7 @@ int flush; + #endif + Tracevv((stderr, "inflate: distance %u\n", state->offset)); + state->mode = MATCH; ++ /* FALLTHROUGH */ + case MATCH: + if (left == 0) goto inf_leave; + copy = out - left; +@@ -1242,6 +1258,7 @@ int flush; + } + #ifdef GUNZIP + state->mode = LENGTH; ++ /* FALLTHROUGH */ + case LENGTH: + if (state->wrap && state->flags) { + NEEDBITS(32); +@@ -1255,6 +1272,7 @@ int flush; + } + #endif + state->mode = DONE; ++ /* FALLTHROUGH */ + case DONE: + ret = Z_STREAM_END; + goto inf_leave; diff --git a/installers/mac/pkg/README.md b/installers/mac/pkg/README.md new file mode 100644 index 00000000000..7e92b9e8165 --- /dev/null +++ b/installers/mac/pkg/README.md @@ -0,0 +1,26 @@ +### Instruction for generating Amazon Corretto 11 installer + +#### Prerequisites + +The generation of the Corretto installer depends on an open-source utility tool [Packages](http://s.sudre.free.fr/Software/Packages/about.html). +The application must be installed before running the installer generation task. + +There are two options to generate a Corretto installer. + +#### Option 1: Build Corretto 11 +* Under the root directory of the repository, run +``` +./gradlew :installers:mac:pkg:generateInstaller +``` + +#### Option 2: Use pre-built Corretto 8 artifacts +* Set the environment variable "CORRETTO_ARTIFACTS_PATH" to the path of the pre-built Corretto artifacts. +``` +export CORRETTO_ARTIFACTS_PATH=.../path/to/amazon-corretto-11.jdk +``` +* Under the root directory of the repository, run +``` +./gradlew :installers:mac:pkg:generateInstaller +``` + +The installer will be generated under "/installers/mac/pkg/corretto-build/distributions". diff --git a/installers/mac/pkg/build.gradle b/installers/mac/pkg/build.gradle new file mode 100644 index 00000000000..5f4af8de081 --- /dev/null +++ b/installers/mac/pkg/build.gradle @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2019, Amazon.com, Inc. or its affiliates. All Rights Reserved. +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 only, as +* published by the Free Software Foundation. Amazon designates this +* particular file as subject to the "Classpath" exception as provided +* by Oracle in the LICENSE file that accompanied this code. +* +* This code is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* version 2 for more details (a copy is included in the LICENSE file that +* accompanied this code). +* +* You should have received a copy of the GNU General Public License version +* 2 along with this work; if not, write to the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +dependencies { + compile project(path: ':installers:mac:tar', configuration: 'buildTar') +} + +// Copy task cannot be used here because Gradle does not preserve the symlink +task retrieveArtifacts(type: Exec) { + // Set environment variable CORRETTO_ARTIFACTS_PATH to the path of "amazon-corretto-8.jdk" to be packaged + def artifactsPath = System.getenv("CORRETTO_ARTIFACTS_PATH") + workingDir buildRoot + if (artifactsPath == null) { + dependsOn project.configurations.compile + commandLine "tar", "xf", project.configurations.compile.singleFile + } else { + commandLine "cp", "-Rf", "${artifactsPath}", buildRoot + } +} + +task copyResources(type: Copy) { + from "." + include 'resources/**' + into buildRoot +} + +task inflatePkgTemplate { + dependsOn copyResources + doLast { + copy { + from('templates/CorrettoPkg.pkgproj.template') { + rename { file -> file.replace('.template', '') } + filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: project.version) + } + into buildRoot + } + + copy { + from('templates/introduction.html.template') { + rename { file -> file.replace('.template', '') } + filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: project.version) + } + into "${buildRoot}/resources" + } + } + +} + +task generateInstaller { + dependsOn retrieveArtifacts + dependsOn copyResources + dependsOn inflatePkgTemplate + outputs.dir distributionDir + + doLast { + exec { + workingDir buildRoot + // Generation of the installer depends on the utility tool Packages: + // http://s.sudre.free.fr/Software/Packages/about.html + commandLine "packagesbuild", "-v", "--build-folder", distributionDir, "CorrettoPkg.pkgproj" + } + } +} + +build.dependsOn generateInstaller + +artifacts { + archives file: generateInstaller.outputs.getFiles().getSingleFile(), builtBy: generateInstaller +} diff --git a/installers/mac/pkg/resources/amazon.png b/installers/mac/pkg/resources/amazon.png new file mode 100644 index 00000000000..353b0f0399c Binary files /dev/null and b/installers/mac/pkg/resources/amazon.png differ diff --git a/installers/mac/pkg/resources/preinstall b/installers/mac/pkg/resources/preinstall new file mode 100755 index 00000000000..6460c546f47 --- /dev/null +++ b/installers/mac/pkg/resources/preinstall @@ -0,0 +1,9 @@ +#!/bin/bash +JDK_INSTALL_PATH="/Library/Java/JavaVirtualMachines" +MKDIR=`which mkdir` + +if [[ ! -d ${JDK_INSTALL_PATH} ]]; then + ${MKDIR} -p ${JDK_INSTALL_PATH} +fi + +exit 0 diff --git a/installers/mac/pkg/templates/CorrettoPkg.pkgproj.template b/installers/mac/pkg/templates/CorrettoPkg.pkgproj.template new file mode 100644 index 00000000000..09a0ad13bf0 --- /dev/null +++ b/installers/mac/pkg/templates/CorrettoPkg.pkgproj.template @@ -0,0 +1,574 @@ + + + + + + PACKAGES + + + MUST-CLOSE-APPLICATION-ITEMS + + MUST-CLOSE-APPLICATIONS + + PACKAGE_FILES + + DEFAULT_INSTALL_LOCATION + / + HIERARCHY + + CHILDREN + + + CHILDREN + + + CHILDREN + + + CHILDREN + + + BUNDLE_CAN_DOWNGRADE + + BUNDLE_POSTINSTALL_PATH + + PATH_TYPE + 0 + + BUNDLE_PREINSTALL_PATH + + PATH_TYPE + 0 + + CHILDREN + + GID + 0 + PATH + amazon-corretto-@major@.jdk + PATH_TYPE + 1 + PERMISSIONS + 493 + TYPE + 3 + UID + 0 + + + GID + 0 + PATH + JavaVirtualMachines + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + GID + 0 + PATH + Java + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + GID + 0 + PATH + Library + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + + GID + 0 + PATH + / + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 1 + UID + 0 + + PAYLOAD_TYPE + 0 + SHOW_INVISIBLE + + SPLIT_FORKS + + TREAT_MISSING_FILES_AS_WARNING + + VERSION + 5 + + PACKAGE_SCRIPTS + + POSTINSTALL_PATH + + PATH_TYPE + 0 + + PREINSTALL_PATH + + PATH + resources/preinstall + PATH_TYPE + 1 + + RESOURCES + + + PACKAGE_SETTINGS + + AUTHENTICATION + 1 + CONCLUSION_ACTION + 0 + FOLLOW_SYMBOLIC_LINKS + + IDENTIFIER + com.amazon.corretto.@major@ + LOCATION + 0 + NAME + amazon-corretto-@major@.jdk + OVERWRITE_PERMISSIONS + + PAYLOAD_SIZE + -1 + REFERENCE_PATH + + RELOCATABLE + + USE_HFS+_COMPRESSION + + VERSION + @full@ + + TYPE + 0 + UUID + 191C178B-0441-4E1C-9D79-D41E1E19B492 + + + PROJECT + + PROJECT_COMMENTS + + NOTES + + + + PROJECT_PRESENTATION + + BACKGROUND + + ALIGNMENT + 6 + APPAREANCES + + DARK_AQUA + + LIGHT_AQUA + + ALIGNMENT + 6 + BACKGROUND_PATH + + PATH + resources/amazon.png + PATH_TYPE + 1 + + CUSTOM + + LAYOUT_DIRECTION + 0 + SCALING + 0 + + + BACKGROUND_PATH + + PATH + resources/amazon.png + PATH_TYPE + 1 + + CUSTOM + + LAYOUT_DIRECTION + 0 + SCALING + 0 + SHARED_SETTINGS_FOR_ALL_APPAREANCES + + + INSTALLATION TYPE + + HIERARCHIES + + INSTALLER + + LIST + + + CHILDREN + + DESCRIPTION + + OPTIONS + + HIDDEN + + STATE + 1 + + PACKAGE_UUID + 191C178B-0441-4E1C-9D79-D41E1E19B492 + TITLE + + TYPE + 0 + UUID + B9E3C666-C319-4762-B695-8B3F20953825 + + + REMOVED + + + + MODE + 0 + + INSTALLATION_STEPS + + + ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS + ICPresentationViewIntroductionController + INSTALLER_PLUGIN + Introduction + LIST_TITLE_KEY + InstallerSectionTitle + + + ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS + ICPresentationViewReadMeController + INSTALLER_PLUGIN + ReadMe + LIST_TITLE_KEY + InstallerSectionTitle + + + ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS + ICPresentationViewLicenseController + INSTALLER_PLUGIN + License + LIST_TITLE_KEY + InstallerSectionTitle + + + ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS + ICPresentationViewDestinationSelectController + INSTALLER_PLUGIN + TargetSelect + LIST_TITLE_KEY + InstallerSectionTitle + + + ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS + ICPresentationViewInstallationTypeController + INSTALLER_PLUGIN + PackageSelection + LIST_TITLE_KEY + InstallerSectionTitle + + + ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS + ICPresentationViewInstallationController + INSTALLER_PLUGIN + Install + LIST_TITLE_KEY + InstallerSectionTitle + + + ICPRESENTATION_CHAPTER_VIEW_CONTROLLER_CLASS + ICPresentationViewSummaryController + INSTALLER_PLUGIN + Summary + LIST_TITLE_KEY + InstallerSectionTitle + + + INTRODUCTION + + LOCALIZATIONS + + + LANGUAGE + English + VALUE + + PATH + resources/introduction.html + PATH_TYPE + 1 + + + + + LICENSE + + LOCALIZATIONS + + MODE + 0 + + README + + LOCALIZATIONS + + + SUMMARY + + LOCALIZATIONS + + + TITLE + + LOCALIZATIONS + + + LANGUAGE + English + VALUE + Amazon Corretto @major@ + + + + + PROJECT_REQUIREMENTS + + LIST + + RESOURCES + + ROOT_VOLUME_ONLY + + + PROJECT_SETTINGS + + BUILD_FORMAT + 0 + BUILD_PATH + + PATH + build + PATH_TYPE + 1 + + EXCLUDED_FILES + + + PATTERNS_ARRAY + + + REGULAR_EXPRESSION + + STRING + .DS_Store + TYPE + 0 + + + PROTECTED + + PROXY_NAME + Remove .DS_Store files + PROXY_TOOLTIP + Remove ".DS_Store" files created by the Finder. + STATE + + + + PATTERNS_ARRAY + + + REGULAR_EXPRESSION + + STRING + .pbdevelopment + TYPE + 0 + + + PROTECTED + + PROXY_NAME + Remove .pbdevelopment files + PROXY_TOOLTIP + Remove ".pbdevelopment" files created by ProjectBuilder or Xcode. + STATE + + + + PATTERNS_ARRAY + + + REGULAR_EXPRESSION + + STRING + CVS + TYPE + 1 + + + REGULAR_EXPRESSION + + STRING + .cvsignore + TYPE + 0 + + + REGULAR_EXPRESSION + + STRING + .cvspass + TYPE + 0 + + + REGULAR_EXPRESSION + + STRING + .svn + TYPE + 1 + + + REGULAR_EXPRESSION + + STRING + .git + TYPE + 1 + + + REGULAR_EXPRESSION + + STRING + .gitignore + TYPE + 0 + + + PROTECTED + + PROXY_NAME + Remove SCM metadata + PROXY_TOOLTIP + Remove helper files and folders used by the CVS, SVN or Git Source Code Management systems. + STATE + + + + PATTERNS_ARRAY + + + REGULAR_EXPRESSION + + STRING + classes.nib + TYPE + 0 + + + REGULAR_EXPRESSION + + STRING + designable.db + TYPE + 0 + + + REGULAR_EXPRESSION + + STRING + info.nib + TYPE + 0 + + + PROTECTED + + PROXY_NAME + Optimize nib files + PROXY_TOOLTIP + Remove "classes.nib", "info.nib" and "designable.nib" files within .nib bundles. + STATE + + + + PATTERNS_ARRAY + + + REGULAR_EXPRESSION + + STRING + Resources Disabled + TYPE + 1 + + + PROTECTED + + PROXY_NAME + Remove Resources Disabled folders + PROXY_TOOLTIP + Remove "Resources Disabled" folders. + STATE + + + + SEPARATOR + + + + NAME + amazon-corretto-@full@-macosx-x64 + PAYLOAD_ONLY + + REFERENCE_FOLDER_PATH + build + TREAT_MISSING_PRESENTATION_DOCUMENTS_AS_WARNING + + + + TYPE + 0 + VERSION + 2 + + diff --git a/installers/mac/pkg/templates/introduction.html.template b/installers/mac/pkg/templates/introduction.html.template new file mode 100644 index 00000000000..d568469f65b --- /dev/null +++ b/installers/mac/pkg/templates/introduction.html.template @@ -0,0 +1,86 @@ +introduction

+Amazon Corretto @major@ Installer

+

You will be guided through the steps necessary to install Amazon Corretto @full@.

+
\ No newline at end of file diff --git a/installers/mac/tar/build.gradle b/installers/mac/tar/build.gradle new file mode 100644 index 00000000000..fe488ca59a8 --- /dev/null +++ b/installers/mac/tar/build.gradle @@ -0,0 +1,165 @@ +/* +* Copyright (c) 2019, Amazon.com, Inc. or its affiliates. All Rights Reserved. +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 only, as +* published by the Free Software Foundation. Amazon designates this +* particular file as subject to the "Classpath" exception as provided +* by Oracle in the LICENSE file that accompanied this code. +* +* This code is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* version 2 for more details (a copy is included in the LICENSE file that +* accompanied this code). +* +* You should have received a copy of the GNU General Public License version +* 2 along with this work; if not, write to the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +dependencies { + compile project(path: ':openjdksrc', configuration: 'archives') + compile project(path: ':prebuild', configuration: 'cacerts') +} + +// Two configurations for tgz & Jtreg native library respectively. +// Separate artifacts to simplify the artifacts fetching in :mac:pkg. +configurations { + buildTar + testLib +} +// consts +def imageDir= "$buildRoot/build/${project.jdkImageName}/images" +def jdkResultingImage = "${imageDir}/jdk-bundle" +def testResultingImage = "${imageDir}/test" +def correttoMacDir = "amazon-corretto-${project.version.major}.jdk" + + +// deps +def depsMap = [:] +project.configurations.compile.getFiles().each { depsMap[it.getName()] = it } + +/** + * Create a local copy of the source tree in our + * build root -- this is required since OpenJDK's + * build wants to occur inside the source tree, + * and we don't want to tamper with someone + * else's tree. + */ +task copySource(type: Exec) { + if (!file(buildRoot).exists()) { + file(buildRoot).mkdirs() + } + workingDir '/usr/bin' + commandLine 'rsync', '-am', + '--exclude=pre-build', + '--exclude=installers', + '--exclude=corretto-build', + "${project.rootDir}/", buildRoot +} + +task configureBuild(type: Exec) { + dependsOn project.configurations.compile + dependsOn copySource + workingDir "$buildRoot" + + // Platform specific flags + def command = ['bash', 'configure', + "--with-cacerts-file=${depsMap[caCerts]}" + ] + // Common flags + command += project.correttoCommonFlags + commandLine command.flatten() +} + +task executeBuild(type: Exec) { + dependsOn configureBuild + workingDir "$buildRoot" + commandLine 'make', 'images' +} + +task executeTestBuild(type: Exec) { + dependsOn executeBuild + workingDir "$buildRoot" + commandLine 'make','test-image-hotspot-jtreg-native','test-image-jdk-jtreg-native' +} + +task prepareArtifacts { + dependsOn executeBuild + doLast { + if(file("${jdkResultingImage}/${correttoMacDir}").exists()) { + delete "${jdkResultingImage}/${correttoMacDir}" + } + // Rename bundle + exec { + workingDir jdkResultingImage + commandLine 'bash', '-c', "\"\"mv jdk-${version.major}*.jdk ${correttoMacDir}\"\"" + } + // Replace Info.plist + copy { + from('templates/Info.plist.template') { + rename { file -> file.replace('.template', '') } + filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: project.version) + } + into "${jdkResultingImage}/${correttoMacDir}/Contents" + } + // Filter files + if(file("${buildDir}/${correttoMacDir}").exists()) { + delete "${buildDir}/${correttoMacDir}" + } + copy { + from("${jdkResultingImage}/${correttoMacDir}") { + include "Contents/Home/bin/**" + include "Contents/Home/conf/**" + include "Contents/Home/include/**" + include "Contents/Home/jmods/**" + include "Contents/Home/legal/**" + include "Contents/Home/lib/**" + include "Contents/Home/man/man1/**" + include "Contents/Home/release" + include "Contents/Info.plist" + include "Contents/MacOS/**" + } + into "${buildDir}/${correttoMacDir}" + } + // Set the directory as bundle + exec { + commandLine "SetFile", "-a", "B", "${buildDir}/${correttoMacDir}" + } + // Gradle does not preserve symlink, fix it before packaging + exec { + workingDir "${buildDir}/${correttoMacDir}/Contents" + commandLine "ln", "-sf", "../Home/lib/libjli.dylib", "MacOS/libjli.dylib" + } + } +} + +task packaging(type: Exec) { + dependsOn prepareArtifacts + String tarDir = "${distributionDir}/${project.correttoJdkArchiveName}.tar.gz" + workingDir buildDir + commandLine "tar", "czf", tarDir, correttoMacDir + outputs.file tarDir +} + +task packageTestResults(type: Tar) { + dependsOn executeTestBuild + description 'Package test results' + archiveName "${project.correttoTestImageArchiveName}.tar.gz" + compression Compression.GZIP + from(testResultingImage) { + include '**' + } + into project.correttoTestImageArchiveName + +} + +build.dependsOn packaging +build.dependsOn packageTestResults + +artifacts { + buildTar file: packaging.outputs.getFiles().getSingleFile(), builtBy: packaging + testLib packageTestResults +} diff --git a/installers/mac/tar/templates/Info.plist.template b/installers/mac/tar/templates/Info.plist.template new file mode 100644 index 00000000000..d74c7a8177a --- /dev/null +++ b/installers/mac/tar/templates/Info.plist.template @@ -0,0 +1,43 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + libjli.dylib + CFBundleGetInfoString + Amazon Corretto @full@-LTS + CFBundleIdentifier + com.amazon.corretto.@major@ + CFBundleInfoDictionaryVersion + 7.0 + CFBundleName + Amazon Corretto @major@ + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + @full@ + JavaVM + + JVMCapabilities + + CommandLine + + JVMMinimumFrameworkVersion + 13.2.9 + JVMMinimumSystemVersion + 10.6.0 + JVMPlatformVersion + @major@.@minor@ + JVMVendor + Amazon.com Inc. + JVMVersion + @major@.@minor@.@security@ + + + diff --git a/installers/windows/README.md b/installers/windows/README.md new file mode 100644 index 00000000000..f35fbe1cb51 --- /dev/null +++ b/installers/windows/README.md @@ -0,0 +1,31 @@ +## Instruction of Building Corretto11 on Windows + +Corretto11 on Windows includes one subproject. + +The `:zip` project builds and packages Corretto11 archive as zip file. Before executing +this project, you need to provide the following parameters: + +```$xslt +bootjdk_dir # Path of bootstrap JDK. To build Corretto11, JDK10 or JDK11 is required. + +ucrt_dll_dir # Path of ucrt library directory. + +jtreg_dir # Path of Jtreg. + +vcruntime_dir # Path of the latest vcruntime140.dll +``` + +To execute this, run: `./gradlew :installers:windows:zip:build` at `corretto-11` root directory. +The zip archive is located at `/installers/windows/zip/corretto-build/distributions` + +```$xslt +➜ ./gradlew :installers:windows:zip:build \ + -Pbootjdk_dir=... \ + -Pucrt_dll_dir=... \ + -Pjtreg_dir=... \ + -Pvcruntime_dir=... +➜ tree installers/windows/zip/corretto-build/distributions + installers/windows/zip/corretto-build/distributions + └── unsigned-jdk-image.zip +``` + diff --git a/installers/windows/zip/build.gradle b/installers/windows/zip/build.gradle new file mode 100644 index 00000000000..f39bde9abb3 --- /dev/null +++ b/installers/windows/zip/build.gradle @@ -0,0 +1,99 @@ +/* +* Copyright (c) 2019, Amazon.com, Inc. or its affiliates. All Rights Reserved. +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* This code is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License version 2 only, as +* published by the Free Software Foundation. Amazon designates this +* particular file as subject to the "Classpath" exception as provided +* by Oracle in the LICENSE file that accompanied this code. +* +* This code is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +* version 2 for more details (a copy is included in the LICENSE file that +* accompanied this code). +* +* You should have received a copy of the GNU General Public License version +* 2 along with this work; if not, write to the Free Software Foundation, +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +*/ + +dependencies { + compile project(path: ':openjdksrc', configuration: 'archives') + compile project(path: ':prebuild', configuration: 'cacerts') +} + +// deps +def depsMap = [:] +project.configurations.compile.getFiles().each { depsMap[it.getName()] = it } + +task copySource(type: Copy) { + dependsOn project.configurations.compile + from tarTree(depsMap[sourceTar]) + into buildRoot +} + + +task configureBuild(type: Exec) { + dependsOn copySource + workingDir buildRoot + + // Platform specific flags + def command = ['bash', 'configure', + "--with-cacerts-file=${depsMap[caCerts]}", + "--with-boot-jdk=${project.getProperty('bootjdk_dir')}", + "--with-ucrt-dll-dir=${project.getProperty('ucrt_dll_dir')}", + "--with-jtreg=${project.getProperty('jtreg_dir')}", + "--with-msvcr-dll=${project.getProperty('vcruntime_dir')}/vcruntime140.dll", + "--with-zlib=bundled" + ] + // Common flags + command += project.correttoCommonFlags + commandLine command.flatten() +} + +task executeBuild(type: Exec) { + dependsOn configureBuild + workingDir buildRoot + + commandLine 'make', 'clean', 'images', 'test-image-hotspot-jtreg-native', 'test-image-jdk-jtreg-native' +} + +task copyImage(type: Copy) { + dependsOn executeBuild + + from "${executeBuild.workingDir}/build/${project.jdkImageName}/images" + into "$buildRoot/build" +} + +task packageTestImage(type: Zip) { + dependsOn copyImage + archiveName "${project.correttoTestImageArchiveName}.zip" + from("${copyImage.destinationDir}/test") { + include '**' + } + into project.correttoTestImageArchiveName +} + +task packageBuildResults(type: Zip) { + dependsOn packageTestImage + archiveName = "unsigned-jdk-image.zip" + + from("${copyImage.destinationDir}/jdk") { + exclude 'demo' + } + from(buildRoot) { + include 'ASSEMBLY_EXCEPTION' + include 'LICENSE' + include 'version.txt' + include 'ADDITIONAL_LICENSE_INFO' + include 'README' + } +} + +build.dependsOn packageBuildResults + +artifacts { + archives packageBuildResults +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000000..cfece367c02 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,22 @@ +rootProject.name = 'corretto-jdk' + +import org.apache.tools.ant.taskdefs.condition.Os + +def subProjects = [':openjdksrc', ':prebuild'] + +if (Os.isFamily(Os.FAMILY_MAC)) { + subProjects += [':installers:mac:pkg', + ':installers:mac:tar'] +} else if (Os.isFamily(Os.FAMILY_UNIX)) { + subProjects += [':installers:linux:universal:tar', + ':installers:linux:universal:rpm', + ':installers:linux:universal:deb', + ':installers:linux:alpine:tar'] +} else if (Os.isFamily(Os.FAMILY_WINDOWS)) { + subProjects += [':installers:windows:zip'] +} + +include subProjects as String[] + +project(':openjdksrc').projectDir = file('source') +project(':prebuild').projectDir = file('pre-build') diff --git a/version.txt b/version.txt new file mode 100644 index 00000000000..22fe89380e4 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +16.0.0.36.1