Skip to content

Commit

Permalink
Add channel flavor for publishing variant for Google Play (#3861)
Browse files Browse the repository at this point in the history
* Add channel flavor for publishing variant for Google Play

* Remove unused variants

* Build both on CI

* Tweak

* Fix conflicts

* Copy json into variant folder

* Rename foss to github

* Rename apk

* `ci.py` - Allow multiple files to be sent

* Fix `ci.py`

---------

Co-authored-by: SuperDragonXD <[email protected]>
  • Loading branch information
Goooler and SuperDragonXD authored Dec 18, 2023
1 parent d506f23 commit c2d59a6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 75 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ jobs:
echo ${{ secrets.KEYSTORE }} | base64 --decode > ${{ github.workspace }}/key.jks
fi
- name: Build debug APK
run: ./gradlew assembleLawnWithQuickstepDebug
run: ./gradlew assembleLawnWithQuickstepGithubDebug assembleLawnWithQuickstepMarketDebug
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Debug APK
path: build/outputs/apk/lawnWithQuickstep/debug/*.apk
path: build/outputs/apk/**/*.apk

check-style:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
with:
gradle-home-cache-cleanup: true
- name: Build release APK
run: ./gradlew assembleLawnWithQuickstepRelease
run: ./gradlew assembleLawnWithQuickstepMarketRelease
- name: Write sign info
if: github.repository_owner == 'LawnchairLauncher'
run: |
Expand Down
4 changes: 3 additions & 1 deletion baseline-profile/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ android {

targetProjectPath = ":"

flavorDimensions += ["app", "recents"]
flavorDimensions += ["app", "recents", "channel"]
productFlavors {
lawn { dimension = "app" }
withQuickstep { dimension = "recents" }
github { dimension = "channel" }
market { dimension = "channel" }
}

testOptions.managedDevices.devices {
Expand Down
85 changes: 16 additions & 69 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ android {
def copyArtifactsTask = tasks.register("copy${capName}Artifacts", Copy) {
dependsOn(licenseeTask)
from(licenseeTask.map { it.outputDir.file("artifacts.json") })
into(layout.buildDirectory.dir("generated/dependencyAssets"))
into(layout.buildDirectory.dir("generated/dependencyAssets/${variant.name}"))
}
variant.sources.assets?.addGeneratedSourceDirectory(licenseeTask) {
objects.directoryProperty().fileProvider(copyArtifactsTask.map { it.destinationDir })
Expand All @@ -155,7 +155,8 @@ android {

applicationVariants.configureEach { variant ->
variant.outputs.configureEach {
outputFileName = "Lawnchair ${variant.versionName}.apk"
def channel = variant.productFlavors.last().name
outputFileName = "Lawnchair ${variant.versionName} $channel ${variant.buildType.name}.apk"
}
}

Expand Down Expand Up @@ -227,38 +228,28 @@ android {
includeInBundle = false
}

// The flavor dimensions for build variants (e.g. aospWithQuickstep, aospWithoutQuickstep)
// See: https://developer.android.com/studio/build/build-variants#flavor-dimensions
flavorDimensions += ["app", "recents"]
flavorDimensions += ["app", "recents", "channel"]

productFlavors {
aosp {
dimension "app"
applicationId 'com.android.launcher3'
testApplicationId 'com.android.launcher3.tests'
}

l3go {
dimension "app"
applicationId 'com.android.launcher3'
testApplicationId 'com.android.launcher3.tests'
}

lawn {
dimension "app"
applicationId 'app.lawnchair'
testApplicationId 'com.android.launcher3.tests'
isDefault true
}

withQuickstep {
dimension "recents"
minSdk 26
isDefault true
}

withoutQuickstep {
dimension "recents"
github {
applicationId 'app.lawnchair'
dimension "channel"
}

market {
applicationId "ch.deletescape.lawnchair.plah"
dimension "channel"
isDefault true
}

configureEach {
Expand All @@ -276,42 +267,6 @@ android {
}
}

androidTest {
res.srcDirs = ['tests/res']
java.srcDirs = ['tests/src', 'tests/tapl']
manifest.srcFile "tests/AndroidManifest-common.xml"
}

androidTestDebug {
manifest.srcFile "tests/AndroidManifest.xml"
}

aosp {
java.srcDirs = ['src_flags', 'src_shortcuts_overrides']
}

aospWithoutQuickstep {
manifest.srcFile "AndroidManifest.xml"
}

aospWithQuickstep {
manifest.srcFile "quickstep/AndroidManifest-launcher.xml"
}

l3go {
res.srcDirs = ['go/res']
java.srcDirs = ['go/src']
manifest.srcFile "go/AndroidManifest.xml"
}

l3goWithoutQuickstepDebug {
manifest.srcFile "AndroidManifest.xml"
}

l3goWithQuickstepDebug {
manifest.srcFile "quickstep/AndroidManifest-launcher.xml"
}

lawn {
java.srcDirs = ['src_flags', 'src_shortcuts_overrides', 'lawnchair/src', 'tests/shared']
aidl.srcDirs = ['lawnchair/aidl']
Expand All @@ -325,17 +280,12 @@ android {
}
}

lawnWithoutQuickstep {
manifest.srcFile "AndroidManifest.xml"
}

lawnWithQuickstep {
lawnWithQuickstepGithub {
manifest.srcFile "quickstep/AndroidManifest-launcher.xml"
assets.srcDir layout.buildDirectory.dir("generated/dependencyAssets/")
}

withoutQuickstep {
java.srcDirs = ['src_ui_overrides']
lawnWithQuickstepMarket {
manifest.srcFile "quickstep/AndroidManifest-launcher.xml"
}

withQuickstep {
Expand Down Expand Up @@ -369,9 +319,6 @@ dependencies {
implementation fileTree(dir: FRAMEWORK_PREBUILTS_DIR, include: 'WindowManager-Shell-14.jar')
withQuickstepCompileOnly fileTree(dir: FRAMEWORK_PREBUILTS_DIR, include: 'framework-14.jar')

// Required for AOSP to compile. This is already included in the sysui_shared.jar
withoutQuickstepImplementation fileTree(dir: FRAMEWORK_PREBUILTS_DIR, include: 'plugin_core.jar')

coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.4'

implementation 'androidx.profileinstaller:profileinstaller:1.3.1'
Expand Down
7 changes: 5 additions & 2 deletions ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ def send_document_to_telegram_chat(chat_id, document):
)

def send_artifact_to_telegram_chat(chat_id):
with open(f"{artifact_directory}/{os.listdir(artifact_directory)[0]}", "rb") as artifact:
send_document_to_telegram_chat(chat_id=chat_id, document=artifact)
subdirectories = os.listdir(artifact_directory)
for each_directory in subdirectories:
full_path = f"{artifact_directory}/{each_directory}/debug"
with open(f"{full_path}/{os.listdir(full_path)[0]}", "rb") as artifact:
send_document_to_telegram_chat(chat_id=chat_id, document=artifact)

def send_internal_notifications():
repository = git.Repo(".")
Expand Down

0 comments on commit c2d59a6

Please sign in to comment.