diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2c7db0f156ce6176e3fd2b8a445f8d826eca6b43..ee0b9bb720b2fb92e5395710f78fbb7568b30e37 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,7 @@ stages: - update-from-upstream - build-sdk + - publish include: - project: 'e/priv/os/build' @@ -18,4 +19,11 @@ build-sdk: - ./buildSdk.sh artifacts: paths: - - e-ui-sdk.jar \ No newline at end of file + - e-ui-sdk.jar + +publish: + only: + - v1-pie + stage: publish + script: + - 'gradle publish' diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000000000000000000000000000000000000..549464ee3c6bb29a1b9af891271aabb2a5bc7662 --- /dev/null +++ b/build.gradle @@ -0,0 +1,46 @@ +plugins { + id 'maven-publish' +} + +publishing { + publications { + maven(MavenPublication) { + groupId = 'foundation.e' + artifactId = 'e-ui-sdk' + version = '1.0-pie' + artifact ("e-ui-sdk.jar") + pom { + name = '/e/ UI SDK Library' + description = 'A design library to be used specifically for /e/ OS to have common themes across the apps.' + url = 'https://gitlab.e.foundation/e/os/android_lineage-sdk' + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id = 'amitkumar' + name = 'Amit Kumar' + email = 'amitkma@e.email' + } + } + } + } + } + + repositories { + maven { + url "https://gitlab.e.foundation/api/v4/projects/185/packages/maven" + name "GitLab" + credentials(HttpHeaderCredentials) { + name = 'Job-Token' + value = System.getenv("CI_JOB_TOKEN") + } + authentication { + header(HttpHeaderAuthentication) + } + } + } +} diff --git a/buildSdk.sh b/buildSdk.sh index ae2640696db1bbf4d750efa996677b98aa15f543..d7f6fb3df6205d823cdcd6dca038e3585ce0f061 100755 --- a/buildSdk.sh +++ b/buildSdk.sh @@ -8,10 +8,27 @@ if [[ -z "${ANDROID_HOME}" ]]; then echo "{ANDROID_HOME} path variable is not set. Set it to point Android SDK." exit 1 else - build_tools_dir=$ANDROID_HOME/build-tools/29.0.2/ + build_tools_dir=$ANDROID_HOME/build-tools/ + declare -a build_tools + for f in $build_tools_dir*; + do + if [ -d "$f" ]; then + build_tools+=($(basename $f)) + fi + done + if [ ${#build_tools[@]} -eq 0 ]; then + echo "No build-tools found at $build_tools_dir. Make sure you've atleast one build tools downloaded." + exit 1 + else + sorted_build_tools=($(for l in ${build_tools[@]}; do echo $l; done | sort)) + echo "Available build-tools are ${sorted_build_tools[@]}" + latest_build_tool=${sorted_build_tools[${#sorted_build_tools[@]}-1]} + echo "Using latest build tool available: $latest_build_tool" + fi fi -aapt2="${build_tools_dir}/aapt2" +latest_build_tool_dir="$build_tools_dir$latest_build_tool" +aapt2="${latest_build_tool_dir}/aapt2" echo "Compiling resources" $aapt2 compile --dir lineage/res/res -o intermediates/resources.zip @@ -43,4 +60,4 @@ jar cvf e-ui-sdk.jar -C obj . -C intermediates resources.arsc echo "Clearing intermediate sources" rm -rf intermediates rm -rf obj -echo "e-ui-sdk.jar generated successully." \ No newline at end of file +echo "e-ui-sdk.jar generated successully."