Skip to content

Commit

Permalink
TOOL-317 (#55)
Browse files Browse the repository at this point in the history
* TOOL-317 #comment Added test case for a project with androidx dependencies. Fixed support lib regex.

* TOOL-317 #comment Review fixes added.
  • Loading branch information
richard-bogdan-bitrise authored and BirmacherAkos committed Jul 4, 2019
1 parent 983c641 commit ae54ed0
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 72 deletions.
8 changes: 4 additions & 4 deletions androidcomponents/androidcomponents.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ func Ensure(androidSdk *sdk.Model, gradlewPath string) error {

func (i installer) getDependencyCases() map[string]func(match string) error {
return map[string]func(match string) error{
`(Observed package id 'ndk-bundle' in inconsistent location)`: i.ndkInconsistentLocation,
`(NDK not configured)`: i.ndkNotConfigured,
`(Observed package id 'ndk-bundle' in inconsistent location)`: i.ndkInconsistentLocation,
`(NDK not configured)`: i.ndkNotConfigured,
`failed to find target with hash string 'android-(.*)'\s*`: i.target,
`failed to find Build Tools revision ([0-9.]*)\s*`: i.buildTool,
`Could not find (com\.android\.support\..*)\.`: i.extrasLib,
`Could not find any version that matches (com\.android\.support.*)\.`: i.extrasLib,
`Could not find (com\.android\.support:.*)\.`: i.extrasLib,
`Could not find any version that matches (com\.android\.support:*)\.`: i.extrasLib,
}
}

Expand Down
120 changes: 54 additions & 66 deletions bitrise.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
format_version: "2"
format_version: "8"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git

app:
envs:
- STEP_VERSION: "2.2.0"

# define these in your .bitrise.secrets.yml
- SAMPLE_APP_URL: https://github.com/bitrise-samples/sample-apps-android-sdk22.git
- SAMPLE_APP_URL: https://github.com/bitrise-io/sample-apps-android-sdk22.git
- BRANCH: master

workflows:
Expand Down Expand Up @@ -53,6 +51,8 @@ workflows:
- golint:
- errcheck:
- go-test:
before_run:
- audit-this-step
after_run:
- test_ndk
- test_old_gradle
Expand All @@ -61,11 +61,11 @@ workflows:
- test_android-sdk22-subdir
- test_react_native
- test_ndk_install

- test_support_library

test_ndk:
envs:
- SAMPLE_APP_URL: https://github.com/bitrise-samples/android-ndk-sample-project.git
- SAMPLE_APP_URL: https://github.com/bitrise-io/android-ndk-sample-project.git
- BRANCH: master
- GRADLE_BUILD_FILE_PATH: ./build.gradle
- GRADLEW_PATH: ./gradlew
Expand Down Expand Up @@ -111,7 +111,7 @@ workflows:

test_react_native:
envs:
- SAMPLE_APP_URL: https://github.com/bitrise-samples/ChainReactApp.git
- SAMPLE_APP_URL: https://github.com/bitrise-io/ChainReactApp.git
- BRANCH: master
- GRADLE_BUILD_FILE_PATH: android/build.gradle
- GRADLEW_PATH: android/gradlew
Expand Down Expand Up @@ -154,7 +154,7 @@ workflows:

test_ndk_install:
envs:
- SAMPLE_APP_URL: https://github.com/bitrise-samples/android-ndk-sample-project.git
- SAMPLE_APP_URL: https://github.com/bitrise-io/android-ndk-sample-project.git
- BRANCH: master
- GRADLE_BUILD_FILE_PATH: build.gradle
- GRADLEW_PATH: ./gradlew
Expand Down Expand Up @@ -205,7 +205,44 @@ workflows:

test_android-sdk21-tools-21.0.1:
envs:
- SAMPLE_APP_URL: https://github.com/bitrise-samples/android-sdk21-tools-21.0.1.git
- SAMPLE_APP_URL: https://github.com/bitrise-io/android-sdk21-tools-21.0.1.git
- BRANCH: master
- GRADLE_BUILD_FILE_PATH: build.gradle
- GRADLEW_PATH: ./gradlew
steps:
- script:
inputs:
- content: |-
#!/usr/bin/env bash
set -e
rm -rf ./_tmp
- change-workdir:
title: Switch working dir to test / _tmp dir
run_if: true
inputs:
- path: ./_tmp
- is_create_path: true
- script:
inputs:
- content: |-
#!/usr/bin/env bash
if [[ -z "${SAMPLE_APP_URL}" ]]; then
echo "error: there is no SAMPLE_APP_URL env var specified"
exit 1
elif [[ -z "${COMMIT}" && -z "${BRANCH}" ]]; then
echo "error: can't checkout: there is no BRANCH or COMMIT env var specified"
exit 1
fi
git init
git remote add origin "${SAMPLE_APP_URL}"
git fetch || exit 1
[[ -n "${COMMIT}" ]] && git checkout "${COMMIT}" || git checkout "${BRANCH}"
- path::./:
title: Step test

test_support_library:
envs:
- SAMPLE_APP_URL: https://github.com/bitrise-io/sample-apps-android-x.git
- BRANCH: master
- GRADLE_BUILD_FILE_PATH: build.gradle
- GRADLEW_PATH: ./gradlew
Expand All @@ -216,6 +253,11 @@ workflows:
#!/usr/bin/env bash
set -e
rm -rf ./_tmp
- script:
inputs:
- content: |-
#!/usr/bin/env bash
sdkmanager --uninstall "extras;android;m2repository"
- change-workdir:
title: Switch working dir to test / _tmp dir
run_if: true
Expand All @@ -242,7 +284,7 @@ workflows:

test_old_gradle:
envs:
- SAMPLE_APP_URL: https://github.com/bitrise-samples/2048-android.git
- SAMPLE_APP_URL: https://github.com/bitrise-io/2048-android.git
- BRANCH: master
- GRADLE_BUILD_FILE_PATH: build.gradle
- GRADLEW_PATH: ./gradlew
Expand Down Expand Up @@ -279,7 +321,7 @@ workflows:

test_android-sdk20:
envs:
- SAMPLE_APP_URL: https://github.com/bitrise-samples/sample-apps-android-sdk20.git
- SAMPLE_APP_URL: https://github.com/bitrise-io/sample-apps-android-sdk20.git
- BRANCH: master
- GRADLE_BUILD_FILE_PATH: build.gradle
- GRADLEW_PATH: ./gradlew
Expand Down Expand Up @@ -316,7 +358,7 @@ workflows:

test_android-sdk22-subdir:
envs:
- SAMPLE_APP_URL: https://github.com/bitrise-samples/sample-apps-android-sdk22-subdir.git
- SAMPLE_APP_URL: https://github.com/bitrise-io/sample-apps-android-sdk22-subdir.git
- BRANCH: master
- GRADLE_BUILD_FILE_PATH: src/build.gradle
- GRADLEW_PATH: src/gradlew
Expand Down Expand Up @@ -365,20 +407,6 @@ workflows:
go get -u -v github.com/golang/dep/cmd/dep
dep ensure -update -v
# ----------------------------------------------------------------
# --- workflows to create Release
create-release:
steps:
- script:
title:
inputs:
- content: |
#!/usr/bin/env bash
set -e
export CI=true
releaseman create --version $STEP_VERSION
# ----------------------------------------------------------------
# --- workflows to Share this step into a Step Library
audit-this-step:
Expand All @@ -389,43 +417,3 @@ workflows:
#!/usr/bin/env bash
set -ex
stepman audit --step-yml ./step.yml
share-this-step:
envs:
# if you want to share this step into a StepLib
- MY_STEPLIB_REPO_FORK_GIT_URL: $MY_STEPLIB_REPO_FORK_GIT_URL
- STEP_ID_IN_STEPLIB: install-missing-android-tools
- STEP_GIT_VERION_TAG_TO_SHARE: $STEP_VERSION
- STEP_GIT_CLONE_URL: https://github.com/bitrise-steplib/steps-install-missing-android-tools.git
description: |-
If this is the first time you try to share a Step you should
first call: $ bitrise share
This will print you a guide, and information about how Step sharing
works. Please read it at least once!
As noted in the Step sharing guide you'll have to fork the
StepLib you want to share this step into. Once you're done with forking
the repository you should set your own fork's git clone URL
in the `.bitrise.secrets.yml` file, or here in the `envs` section,
as the value of the `MY_STEPLIB_REPO_FORK_GIT_URL` environment.
You're now ready to share this Step, just make sure that
the `STEP_ID_IN_STEPLIB` and `STEP_GIT_VERION_TAG_TO_SHARE`
environments are set to the desired values!
To share this Step into a StepLib you can just run: $ bitrise run share-this-step
Once it finishes the only thing left is to actually create a Pull Request,
the way described in the guide printed at the end of the process.
before_run:
- audit-this-step
steps:
- script:
inputs:
- content: |-
#!/usr/bin/env bash
set -ex
bitrise share start -c ${MY_STEPLIB_REPO_FORK_GIT_URL}
bitrise share create --stepid ${STEP_ID_IN_STEPLIB} --tag ${STEP_GIT_VERION_TAG_TO_SHARE} --git ${STEP_GIT_CLONE_URL}
bitrise share finish
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func updateNDK(revision string) error {
return err
}

if err := updateNDKPathIfNeeded(ndkHome); err != nil {
if err := ensureNDKPath(ndkHome); err != nil {
return err
}

Expand All @@ -159,7 +159,7 @@ func updateNDK(revision string) error {
return nil
}

func updateNDKPathIfNeeded(ndkHome string) error {
func ensureNDKPath(ndkHome string) error {
log.Printf("searching for platforms dir in %s", ndkHome)
var foundPDPath string
if err := filepath.Walk(ndkHome, func(currentPath string, info os.FileInfo, err error) error {
Expand Down

0 comments on commit ae54ed0

Please sign in to comment.