Skip to content

Commit

Permalink
Publish all artifacts locally. (#327)
Browse files Browse the repository at this point in the history
* Publish all artifacts locally.

* Fix issues with artifact publishing.

* Only run the build once.

* Fix doc publishing.
  • Loading branch information
Laimiux authored Jan 4, 2024
1 parent 8a4fcf6 commit 66404c6
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 64 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/build-workflow.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: Build
on: [pull_request, push]
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -27,7 +33,7 @@ jobs:
- name: Run Formula Android Instrumentation Tests
run: ./gradlew :formula-android-tests:testRelease
- name: Run Formula Lint Tests
run: ./gradlew :formula-lint:test
run: ./gradlew :formula-lint:build
- name: Generate Jacoco Report
run: ./gradlew jacocoTestReportMerged
- name: Save Jacoco Report
Expand Down Expand Up @@ -67,4 +73,12 @@ jobs:
- name: Assemble Stopwatch Compose Sample
run: ./gradlew :samples:stopwatch-compose:assembleDebug
- name: Assemble Stopwatch Kotlin Coroutine Sample
run: ./gradlew :samples:stopwatch-coroutines:assembleDebug
run: ./gradlew :samples:stopwatch-coroutines:assembleDebug
- name: Publish all artifacts locally
run: |
./gradlew :formula:build
./gradlew :formula-android:build
./gradlew :formula-test:build
./gradlew :formula-android-compose:build
./gradlew :formula-lint:build
./gradlew publishToMavenLocal --no-parallel --no-daemon
12 changes: 12 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,16 @@ tasks.register("install") {
dependsOn(publishTasks)
}

// We disable jacoco report when running buildTask
val isBuild = gradle.startParameter.taskNames.any { it.contains("build") }
if (isBuild) {
subprojects {
plugins.withType<JacocoPlugin> {
tasks.withType<JacocoReport> {
enabled = false
}
}
}
}

apply(from = "gradle/merge-reports.gradle")
28 changes: 3 additions & 25 deletions formula-android-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,10 @@ android {
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.compose.get()
}
}

task<Jar>("sourcesJar") {
from(android.sourceSets["main"].java.srcDirs)
archiveClassifier.set("sources")
}

task<Javadoc>("javadoc") {
isFailOnError = false
source(android.sourceSets["main"].java.getSourceFiles())
classpath = project.files(
android.bootClasspath.joinToString(separator = File.pathSeparator),
configurations.api,
configurations.implementation
)
}

task<Jar>("javadocJar") {
dependsOn("javadoc")
archiveClassifier.set("javadoc")
from(tasks["javadoc"].path)
}

artifacts {
archives(tasks["sourcesJar"])
archives(tasks["javadocJar"])
publishing {
singleVariant("release")
}
}

dependencies {
Expand Down
32 changes: 6 additions & 26 deletions formula-android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import org.jetbrains.dokka.gradle.DokkaTask

plugins {
id("com.android.library")
id("kotlin-android")
id("kotlin-kapt")
id("kotlin-parcelize")
}

Expand All @@ -16,32 +17,10 @@ android {
testOptions {
unitTests.isReturnDefaultValues = true
}
}

task<Jar>("sourcesJar") {
from(android.sourceSets["main"].java.srcDirs)
archiveClassifier.set("sources")
}

task<Javadoc>("javadoc") {
isFailOnError = false
source(android.sourceSets["main"].java.getSourceFiles())
classpath = project.files(
android.bootClasspath.joinToString(separator = File.pathSeparator),
configurations.api,
configurations.implementation
)
}

task<Jar>("javadocJar") {
dependsOn("javadoc")
archiveClassifier.set("javadoc")
from(tasks["javadoc"].path)
}

artifacts {
archives(tasks["sourcesJar"])
archives(tasks["javadocJar"])
publishing {
singleVariant("release")
}
}

dependencies {
Expand All @@ -60,3 +39,4 @@ dependencies {
testImplementation(libs.mockito.kotlin)
testImplementation(libs.kotlin.reflect)
}

9 changes: 0 additions & 9 deletions formula-lint/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,3 @@ dependencies {
testImplementation(libs.lint.tests)
testImplementation(libs.junit)
}

// Need to register direct task dependencies since jacocoTestReport is
// accessing the files produced by those lint tasks
plugins.withId("jacoco") {
tasks.named("jacocoTestReport") {
dependsOn(tasks.withType<AndroidLintAnalysisTask>())
dependsOn(tasks.withType<LintModelWriterTask>())
}
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
android-gradle = "8.2.0"
dokka-gradle = "1.4.32"
dokka-gradle = "1.9.10"

kotlin = "1.9.10"
coroutines = "1.5.2"
Expand Down

0 comments on commit 66404c6

Please sign in to comment.