diff --git a/.github/workflows/commcare-android-pr-workflow.yml b/.github/workflows/commcare-android-pr-workflow.yml index 576f7a5525..05b788110b 100644 --- a/.github/workflows/commcare-android-pr-workflow.yml +++ b/.github/workflows/commcare-android-pr-workflow.yml @@ -28,29 +28,13 @@ jobs: uses: actions/checkout@v6 with: path: commcare-android - - name: Install python - if: ${{ github.event_name == 'pull_request' }} - uses: actions/setup-python@v6 - with: - python-version: '3.9' - - name: Download cross request script - if: ${{ github.event_name == 'pull_request' }} - run: | - curl https://raw.githubusercontent.com/dimagi/mobile-deploy/master/requirements.txt -o requirements.txt - curl https://raw.githubusercontent.com/dimagi/mobile-deploy/master/checkout_cross_request_repo.py -o checkout_cross_request_repo.py - - name: Install Python dependencies - if: ${{ github.event_name == 'pull_request' }} - run: python -m pip install -r requirements.txt - - name: Run cross request script - if: ${{ github.event_name == 'pull_request' }} - run: python checkout_cross_request_repo.py commcare-android ${{ github.event.number }} commcare-core + submodules: true - name: Checkout commcare-core for cross-repo CI if: ${{ inputs.commcare_core_sha }} - uses: actions/checkout@v6 - with: - repository: dimagi/commcare-core - ref: ${{ inputs.commcare_core_sha }} - path: commcare-core + run: | + cd commcare-android/libs/commcare-core + git fetch origin ${{ inputs.commcare_core_sha }} + git checkout ${{ inputs.commcare_core_sha }} - name: Generate GitHub App token if: ${{ always() && inputs.commcare_core_check_name && inputs.commcare_core_sha }} id: app-token diff --git a/.gitmodules b/.gitmodules index e69de29bb2..b658e768af 100644 --- a/.gitmodules +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "libs/commcare-core"] + path = libs/commcare-core + url = https://github.com/dimagi/commcare-core.git + branch = master diff --git a/AGENTS.md b/AGENTS.md index cd8e1f49d3..fd40598a1d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -46,7 +46,7 @@ This task auto-formats the file and then verifies it is clean. If any violations - Instrumentation tests: `app/instrumentation-tests/` ## Project Structure Notes -- CommCare Core is in `../commcare-core/`, always include it to the working directory for the current session +- CommCare Core is in `libs/commcare-core/` (a git submodule), always include it to the working directory for the current session - Connect and PersonalID share `org.commcare.connect` package - PersonalID Fragments are in `org.commcare.fragments.personalId` package - This is a multi-module Android project. When asked to find a file or class, search across all modules (commcare-android, commcare-core, commcare-support-library) rather than assuming the default module. diff --git a/README.md b/README.md index c2d74f8999..683fa757f9 100644 --- a/README.md +++ b/README.md @@ -21,15 +21,16 @@ Go ahead and open Android Studio if this is your first time using it; it may take you through some sort of setup wizard, and it's nice to get that out of the way. If it's not the first time, ensure that there are no references to [removed Java options](https://docs.oracle.com/en/java/javase/17/docs/specs/man/java.html#removed-java-options) in your environment, most commonly found are *MaxPermSize* and *PermSize* Android Studio's default project space is `~/AndroidStudioProjects` so I'm going to use that in the example. -CommCare Android depends on CommCare Core, and CommCare Android expects the core directory to live side by side -in your directory structure. You can acheive this with the following commands (in Bash): +CommCare Android includes CommCare Core as a git submodule. Clone with: ```bash cd ~/AndroidStudioProjects -mkdir CommCare -cd CommCare -git clone https://github.com/dimagi/commcare-android.git -git clone https://github.com/dimagi/commcare-core.git +git clone --recurse-submodules https://github.com/dimagi/commcare-android.git +``` + +If you already cloned without `--recurse-submodules`, run: +```bash +git submodule update --init ``` - Open Android Studio diff --git a/app/build.gradle b/app/build.gradle index f32e379890..4f8a7071d0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,14 +1,5 @@ import org.apache.tools.ant.filters.ReplaceTokens -//////////// -// README // -//////////// - -// This build script assumes the following directory structure: -// - somewhere/your/code/directory/is -// -- commcare-android (github: https://github.com/dimagi/commcare-android/) -// -- commcare-core (github: https://github.com/dimagi/commcare-core/) -// these directories MUST be named like this, or it won't work apply plugin: 'com.android.application' apply plugin: 'kotlin-android' diff --git a/app/unit-tests/src/org/commcare/CommCareTestApplication.java b/app/unit-tests/src/org/commcare/CommCareTestApplication.java index 9b2fb309da..7aff1865c3 100644 --- a/app/unit-tests/src/org/commcare/CommCareTestApplication.java +++ b/app/unit-tests/src/org/commcare/CommCareTestApplication.java @@ -167,7 +167,7 @@ private static void initFactoryClassList() { + "/intermediates/javac/commcareDebug/compileCommcareDebugJavaWithJavac/classes/" , BuildConfig.BUILD_DIR + "/intermediates/javac/commcareDebug/classes/" , BuildConfig.BUILD_DIR + "/tmp/kotlin-classes/commcareDebug/"}; - String baseCC = BuildConfig.PROJECT_DIR + "/../../commcare-core/build/classes/java/main/"; + String baseCC = BuildConfig.PROJECT_DIR + "/../libs/commcare-core/build/classes/java/main/"; for(String variant : baseODK) { diff --git a/libs/commcare-core b/libs/commcare-core new file mode 160000 index 0000000000..25fc5efcbd --- /dev/null +++ b/libs/commcare-core @@ -0,0 +1 @@ +Subproject commit 25fc5efcbda75fafca31355c16ea9dc935be5c30 diff --git a/settings.gradle b/settings.gradle index 3b54905253..bbaf7a460d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ include ':app' include ':commcare-core' include ':commcare-support-library' -project(':commcare-core').projectDir = new File('../commcare-core') +project(':commcare-core').projectDir = new File('libs/commcare-core')