summaryrefslogtreecommitdiff
path: root/init.sh
blob: 581ded12402012b85ce1dbe539b2d24aa0e79c59 (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
current_dir=$PWD;
if [ ! -e 'integration-tests' ] || [ ! -e 'extensions' ]; then
  echo "must run this under {src}/tools/data-binding"
  exit 1
fi
OLD_GRADLE="https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip"
tools_dir="$current_dir/..";
copy_gradle() {
  project_name=${PWD##*/}
  echo "PROJECT NAME:${project_name}"
  extra_dots=$1
    echo "copying $PWD"
  rm -rf gradle
  rm -rf gradlew
  cp -R "$tools_dir/gradle" .
  if  [[ $project_name == LibCompileWith* ]] ;
  then
    echo "copy old gradle"
    sed -i "/distributionUrl=/c\distributionUrl=$OLD_GRADLE" gradle/wrapper/gradle-wrapper.properties
  else
    echo "copy latest gradle"
    sed -i -e "s#distributionUrl\=#distributionUrl=$extra_dots/#g" gradle/wrapper/gradle-wrapper.properties
  fi
  cp "$tools_dir/gradlew" .
}
OIFS="$IFS"
IFS=$'\n'

cd extensions;
copy_gradle "../.."
cd ../extensions-support;
copy_gradle "../.."
echo "start in $current_dir"
cd $current_dir;
for line in `find integration-tests integration-tests-support -name 'settings.gradle'`
do
  echo "will prepare build for ${line}";
  cd $current_dir;
  dir_name=`(dirname ${line})`
  cd "$dir_name"
  copy_gradle "../../.."
done

linux_sdk="$current_dir/../../prebuilts/studio/sdk/linux"
mac_sdk="$current_dir/../../prebuilts/studio/sdk/darwin"
unamestr=`uname | tr '[:upper:]' '[:lower:]'`

create_local_properties() {
  echo "creating local properties in $PWD"
  if [ "${unamestr}" = "darwin"  ]; then
    echo "sdk.dir=$mac_sdk" > "local.properties"
  else
    echo "sdk.dir=$linux_sdk" > "local.properties"
  fi
}

cd $current_dir;
for line in `find integration-tests integration-tests-support -name 'settings.gradle'`
do
  cd $current_dir;
  dir_name=`(dirname ${line})`
  cd "$dir_name"
  create_local_properties
done

IFS="$OIFS"