Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declarativize NiA without custom software types #16

Merged
merged 31 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
13428b5
Minimum changes to sync project
tresat Apr 17, 2024
749e3d6
Update Gradle wrapper to latest nightly
tresat Apr 17, 2024
3da321d
Convert old buildscript to inline all conventions
tresat Apr 19, 2024
881c3d7
Add support for deps added in converted buildscript
tresat Apr 19, 2024
40fcbbd
Attempt to constrain javapoet
tresat Apr 19, 2024
053a95d
Try replacing lower versions of javapoet
tresat Apr 19, 2024
d2b5bf0
More cleanup, remove need to comment out plugin declaration at root
tresat Apr 19, 2024
d6ca22e
More progress, remove unnecessary constraints
tresat Apr 19, 2024
df21c19
Add project dependency on core/domain using DCL
tresat Apr 19, 2024
c7c60d8
Continue declarativizing
tresat Apr 19, 2024
c9be778
Mark remaining TODOs
tresat Apr 22, 2024
486d785
Marked all non-converted pieces of old build in core/common
tresat Apr 22, 2024
51ca5cb
Converted Kotlin configuration
tresat Apr 22, 2024
9d55d4f
Add test deps in core/common
tresat Apr 22, 2024
3ba3e4f
Testing deps added
tresat Apr 22, 2024
2e1c8f6
Update with latest additions
tresat Apr 22, 2024
8fffc38
Update for lint
tresat Apr 22, 2024
c298fab
Don't thrash on Project.xml contents
tresat Apr 22, 2024
ba3b89a
Attempt fix benchmark error
tresat Apr 22, 2024
88f7daf
Restore project to remove from PR change
tresat Apr 23, 2024
e17e005
Align on AGP 8.3.0 for tools
tresat Apr 23, 2024
2b1122a
Restore benchmarks
tresat Apr 23, 2024
a459a32
Mark additional removals
tresat Apr 23, 2024
b4ebf9c
Add and correct more test dependencies
tresat Apr 23, 2024
9b8da3c
Mark more test converstion
tresat Apr 23, 2024
ac198fc
Add testOptions, remove libs added by default NiaSupport
tresat Apr 23, 2024
e8bbefa
Mark all jacoco fully supported
tresat Apr 24, 2024
042fceb
Update gradle wrapper and use .dcl extension
tresat Apr 24, 2024
4433ed2
Delete old build scripts
tresat Apr 24, 2024
e67b323
Update to kotlin 1.9.23
tresat Apr 24, 2024
0061157
Add testing notes to README
tresat Apr 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
# Declarative Gradle DSL

This branch has been modified to work with the prototype of the Declarative Gradle DSL.

## Running

First, checkout the `declarative-no-conventions-nia` branch of the [declarative-gradle](https://github.com/gradle/declarative-gradle) project into a **sibling directory** of this project:

```
declarative-gradle/
nowinandroid/
```

then run the following command in the `nowinandroid` directory to build the project:

```shell
./gradlew buildDemoDebug
```

### Running tests
**Note:** See the note in [Screenshot tests](#screenshot-tests) about setting up Roborazzi for non-Linux test runs.

```shell
./gradlew testDemoDebug :lint:test
```

```shell
./gradlew testDemoDebugUnitTest -Proborazzi.test.verify=false
```

After starting a local Android emulator in Android Studio:
```shell
./gradlew connectedDemoDebugAndroidTest --daemon
````

![Now in Android](docs/images/nia-splash.jpg "Now in Android")

<a href="https://play.google.com/store/apps/details?id=com.google.samples.apps.nowinandroid"><img src="https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png" height="70"></a>
Expand Down
9 changes: 9 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ buildscript {
dependencies {
classpath(libs.google.oss.licenses.plugin) {
exclude(group = "com.google.protobuf")

constraints {
add("classpath", "com.android.tools.build:gradle:8.3.0") {
because("Aligns the resolved versions of the com.android plugins, prevents: \n" +
"Script compilation errors:\n" +
" Line 62: packaging {\n" +
" ^ Unresolved reference: packaging\n")
}
}
}
}

Expand Down
16 changes: 16 additions & 0 deletions core/common/build.gradle.dcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
androidLibrary {
namespace = "com.google.samples.apps.nowinandroid.core.common"

dependencies {
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
testImplementation("app.cash.turbine:turbine:1.0.0")
}

buildTypes {
buildTypes {
// Need the empty closure to avoid "dangling pure expression" error
debug {}
release {}
}
}
}
29 changes: 0 additions & 29 deletions core/common/build.gradle.kts

This file was deleted.

32 changes: 32 additions & 0 deletions core/data/build.gradle.dcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
androidLibrary {
namespace = "com.google.samples.apps.nowinandroid.core.data"

includeKotlinSerialization = true
configureJacoco = true

dependencies {
api(projects.core.common)
api(projects.core.database)
api(projects.core.datastore)
api(projects.core.network)

implementation(projects.core.analytics)
implementation(projects.core.notifications)

testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3")
testImplementation(projects.core.datastoreTest)
testImplementation(projects.core.testing)
testImplementation(projects.core.network)
}

testOptions {
includeAndroidResources = true
returnDefaultValues = true
}

buildTypes {
// Need the empty closure to avoid "dangling pure expression" error
debug {}
release {}
}
}
46 changes: 0 additions & 46 deletions core/data/build.gradle.kts

This file was deleted.

20 changes: 20 additions & 0 deletions core/domain/build.gradle.dcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
androidLibrary {
namespace = "com.google.samples.apps.nowinandroid.core.domain"

configureJacoco = true

dependencies {
implementation("javax.inject:javax.inject:1")

api(projects.core.data)
api(projects.core.model)

testImplementation(projects.core.testing)
}

buildTypes {
// Need the empty closure to avoid "dangling pure expression" error
debug {}
release {}
}
}
33 changes: 0 additions & 33 deletions core/domain/build.gradle.kts

This file was deleted.

18 changes: 9 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ androidxActivity = "1.8.0"
androidxAppCompat = "1.6.1"
androidxBrowser = "1.8.0"
androidxComposeBom = "2024.02.02"
androidxComposeCompiler = "1.5.8"
androidxComposeCompiler = "1.5.12"
androidxComposeUiTest = "1.7.0-alpha06"
androidxComposeMaterial3Adaptive = "1.0.0-alpha10"
androidxComposeRuntimeTracing = "1.0.0-beta01"
Expand Down Expand Up @@ -42,7 +42,7 @@ hilt = "2.51"
hiltExt = "1.1.0"
jacoco = "0.8.7"
junit4 = "4.13.2"
kotlin = "1.9.22"
kotlin = "1.9.23"
kotlinxCoroutines = "1.8.0"
kotlinxDatetime = "0.5.0"
kotlinxSerializationJson = "1.6.3"
Expand Down Expand Up @@ -152,18 +152,18 @@ room-gradlePlugin = { group = "androidx.room", name = "room-gradle-plugin", vers
work-testing = { group = "androidx.work", name = "work-testing", version = "2.9.0" }

[plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
android-test = { id = "com.android.test", version.ref = "androidGradlePlugin" }
android-application = { id = "com.android.application" }
android-library = { id = "com.android.library" }
android-test = { id = "com.android.test" }
baselineprofile = { id = "androidx.baselineprofile", version.ref = "androidxMacroBenchmark"}
dependencyGuard = { id = "com.dropbox.dependency-guard", version.ref = "dependencyGuard" }
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebaseCrashlyticsPlugin" }
firebase-perf = { id = "com.google.firebase.firebase-perf", version.ref = "firebasePerfPlugin" }
gms = { id = "com.google.gms.google-services", version.ref = "gmsPlugin" }
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
hilt = { id = "com.google.dagger.hilt.android" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
ksp = { id = "com.google.devtools.ksp" }
module-graph = { id = "com.jraska.module.graph.assertion", version.ref = "moduleGraph" }
protobuf = { id = "com.google.protobuf", version.ref = "protobufPlugin" }
roborazzi = { id = "io.github.takahirom.roborazzi", version.ref = "roborazzi" }
Expand All @@ -184,4 +184,4 @@ nowinandroid-android-library-jacoco = { id = "nowinandroid.android.library.jacoc
nowinandroid-android-lint = { id = "nowinandroid.android.lint", version = "unspecified" }
nowinandroid-android-room = { id = "nowinandroid.android.room", version = "unspecified" }
nowinandroid-android-test = { id = "nowinandroid.android.test", version = "unspecified" }
nowinandroid-jvm-library = { id = "nowinandroid.jvm.library", version = "unspecified" }
nowinandroid-jvm-library = { id = "nowinandroid.jvm.library", version = "unspecified" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-8.9-20240424122219+0000-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
4 changes: 3 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
5 changes: 5 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@

pluginManagement {
includeBuild("build-logic")
includeBuild("../declarative-gradle/unified-prototype/unified-plugin")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

plugins {
id("org.gradle.experimental.android-ecosystem")
}

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
Expand Down