File: update.sh

package info (click to toggle)
bazel-bootstrap 4.2.3%2Bds-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 85,704 kB
  • sloc: java: 721,717; sh: 55,859; cpp: 35,360; python: 12,139; xml: 295; objc: 269; makefile: 113; ansic: 106; ruby: 3
file content (46 lines) | stat: -rwxr-xr-x 1,021 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash -e

readonly SDK_VERSION='1.11.297'
readonly MVN_REPO='repo1.maven.org/maven2'

fetch_artifact() {
  local artifact="$1"
  local src_jar="$artifact-$SDK_VERSION-sources.jar"

  wget "https://$MVN_REPO/com/amazonaws/$artifact/$SDK_VERSION/$src_jar"
  echo "$src_jar"
}

fetch_and_unpack() {
  local out_dir="$1"
  local core_jar
  local s3_jar

  core_jar="$(fetch_artifact 'aws-java-sdk-core')"
  s3_jar="$(fetch_artifact 'aws-java-sdk-s3')"

  # Unpack the core source first
  unzip "$core_jar" -x 'META-INF/*' -d "$out_dir"
  rm "$core_jar"

  # Grab Region from the S3 jar
  unzip "$s3_jar" 'com/amazonaws/services/s3/model/Region.java' -d "$out_dir"
  rm "$s3_jar"
}

patch_upstream() {
  echo "Applying (or attempting to apply) bazel patches against AWS SDK"

  while read -r patch; do
    echo "Patch: $patch"
    patch -p0 < "$patch"
  done < <(find patches-vs-$SDK_VERSION -name '*.patch')
}

update_sdk() {
  mkdir -p ./src/main/java
  fetch_and_unpack ./src/main/java
  patch_upstream
}

update_sdk