Skip to content

Commit

Permalink
Scripts for building Kotlin repository
Browse files Browse the repository at this point in the history
(cherry picked from commit 41d16b1)
  • Loading branch information
goodwinnk committed Nov 25, 2022
1 parent 7784d10 commit cb51803
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
25 changes: 25 additions & 0 deletions scripts/build-kotlin-compiler.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

#
# Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
# Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
#

# Script for building kotlin-compiler.zip from sources.
# Run the script in the root Kotlin directory.

set -e

if [ $# -lt 2 ]; then
echo "Not enough arguments provided. Usage: $0 DEPLOY_VERSION BUILD_NUMBER"
exit 1
fi

DEPLOY_VERSION=$1
BUILD_NUMBER=$2

echo "DEPLOY_VERSION=$DEPLOY_VERSION"
echo "BUILD_NUMBER=$BUILD_NUMBER"

# Build dist/kotlin-compiler.zip
./gradlew -PdeployVersion=$DEPLOY_VERSION -Pbuild.number=$BUILD_NUMBER -Pteamcity=true zipCompiler -Dfile.encoding=UTF-8
53 changes: 53 additions & 0 deletions scripts/build-kotlin-maven.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

#
# Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
# Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
#

# Script for building reproducible-maven.zip from sources. This is a full set of artifacts published to maven central during
# the Kotlin release process.

# Run the script in the root Kotlin directory.

set -e

if [ $# -lt 3 ]; then
echo "Not enough arguments provided. Usage: $0 DEPLOY_VERSION BUILD_NUMBER KOTLIN_NATIVE_VERSION"
exit 1
fi

DEPLOY_VERSION=$1
BUILD_NUMBER=$2
KOTLIN_NATIVE_VERSION=$3

echo "DEPLOY_VERSION=$DEPLOY_VERSION"
echo "BUILD_NUMBER=$BUILD_NUMBER"
echo "KOTLIN_NATIVE_VERSION=$KOTLIN_NATIVE_VERSION"

# Update versions in pom.xml
mvn -DnewVersion=$DEPLOY_VERSION -DgenerateBackupPoms=false -DprocessAllModules=true -f libraries/pom.xml versions:set

# Build part of kotlin and publish it to the local maven repository and to build/repo directory
./gradlew \
-PdeployVersion=$DEPLOY_VERSION \
-Pbuild.number=$BUILD_NUMBER \
-Pversions.kotlin-native=$KOTLIN_NATIVE_VERSION \
-Pteamcity=true \
publish

# Build maven part and publish it to the same build/repo
mvn \
-f libraries/pom.xml \
clean deploy \
-Ddeploy-url=file://$(pwd)/build/repo \
-DskipTests

# Prepare for reproducibility check
mkdir -p build/repo-reproducible
cp -R build/repo/. build/repo-reproducible
# maven-metadata contains lastUpdated section with the build time
find build/repo-reproducible -name "maven-metadata.xml*" -exec rm -rf {} \;
# Each file has own timestamp that would affect zip file hash if not aligned
find build/repo-reproducible -exec touch -t "198001010000" {} \;
cd build/repo-reproducible && zip -rX reproducible-maven-$DEPLOY_VERSION.zip . && cd -

0 comments on commit cb51803

Please sign in to comment.