2017-05-31 71 views
0

我有一個CircleCI問題,我無法工作,因爲我的gradlew文件不在我的資源庫的根目錄中。由於我的倉庫,這裏就是剝奪他的體系結構的概括:CircleCI遇到另一個文件夾中的gradlew問題

root 
-----> app_folder 
------------> some folders 
------------> some files 
------------> gradlew 
------> some files and folders 
------> circle.yml 

我試圖進入app_folder文件夾使用cd命令,改變路徑變量,但沒有它的工作

circle.yml

# 
# Build configuration for Circle CI 
# 

machine: 
    environment: 
     PATH: "~/$CIRCLE_PROJECT_REPONAME/app_folder:$PATH" 
     ANDROID_HOME: /usr/local/android-sdk-linux 
     GRADLE_OPTS: '-Dorg.gradle.jvmargs="-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError"' 
     _JAVA_OPTIONS: "-Xms512m -Xmx1024m" 
     ADB_INSTALL_TIMEOUT: "10" 
     ANDROID_API_LEVEL: 25 
     ANDROID_BUILD_TOOLS_VERSION: 25.0.2 
    java: 
     version: oraclejdk7 

dependencies: 
    cache_directories: 
     - ~/.gradle 
     - ~/.android 
     - /usr/local/android-sdk-linux/extras 

    pre: 
     - if [ ! -d "$ANDROID_HOME/tools" ]; then echo y | android update sdk --no-ui --all --filter "tools"; fi 
     - if [ ! -d "$ANDROID_HOME/platforms/android-$ANDROID_API_LEVEL" ]; then echo y | android update sdk --no-ui --all --filter "android-$ANDROID_API_LEVEL"; fi 
     - if [ ! -d "$ANDROID_HOME/build-tools/$ANDROID_BUILD_TOOLS_VERSION" ]; then echo y | android update sdk --no-ui --all --filter "build-tools-$ANDROID_BUILD_TOOLS_VERSION"; fi 
     - if [ ! -d "$ANDROID_HOME/add-ons/addon-google_apis-google-$ANDROID_API_LEVEL" ]; then echo y | android update sdk --no-ui --all --filter "addon-google_apis-google-$ANDROID_API_LEVEL"; fi 
     - echo y | android update sdk --no-ui --all --filter "extra-google-m2repository" 
     - echo y | android update sdk --no-ui --all --filter "extra-google-google_play_services" 
     - echo y | android update sdk --no-ui --all --filter "extra-android-m2repository" 

test: 
    override: 
    # start the emulator 
    - emulator -avd circleci-android24 -no-audio -no-window: 
     background: true 
     parallel: true 
    # wait for it to have booted 
    - circle-android wait-for-boot 
    # unlock the emulator screen 
    - sleep 30 
    - adb shell input keyevent 82 
    # run tests against the emulator. 
    - echo $PATH 
    - cd app_folder && .\gradlew connectedAndroidTest -PdisablePreDex 
- .\\app_folder\\gradlew connectedAndroidTest -PdisablePreDex 
- .\app_folder\\gradlew connectedAndroidTest -PdisablePreDex 
- .\gradlew connectedAndroidTest -PdisablePreDex ~/github_name/app_folder 
    # copy the build outputs to artifacts 
    - cp -r app_folder/app/build/outputs $CIRCLE_ARTIFACTS 
    # copy the test results to the test results directory. 
    - cp -r app_folder/app/build/outputs/androidTest-results/* $CIRCLE_TEST_REPORTS 

回答

0

這裏有兩個選項。最快的是指定一個custom build directory。使用你的榜樣,這將是:

general: 
    build_dir: app_folder 

這是因爲每CircleCI文檔:

CircleCI將運行的推理,以及所有來自 該目錄中生成命令。

第二種選擇是不依賴CircleCI的推理命令,而是運行一切,如Gradle自己。您已經重寫了test階段,因此您需要重寫dependencies階段,並自行運行gradle dependencies

例如:

dependencies: 
    override: 
    - gradle --project-dir app_folder dependencies 

-RicardoÑ費利西亞諾
開發傳播者,CircleCI

1

你只需要添加此頂部:

general: 
    build_dir: your_folder 
相關問題