-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into eskatos/2024-11
- Loading branch information
Showing
21 changed files
with
416 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Delete preview on PR close | ||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
delete_preview: | ||
runs-on: ubuntu-20.04 | ||
env: | ||
PR_PATH: pull/${{github.event.number}} | ||
DOMAIN: gradle.github.io | ||
PREVIEW_REPO: community-site-preview | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
steps: | ||
- name: make empty dir | ||
run: mkdir public | ||
|
||
- name: delete folder | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
deploy_key: ${{ secrets.PREVIEW_DEPLOYMENT_KEY }} | ||
external_repository: gradle/${{ env.PREVIEW_REPO }} | ||
publish_dir: ./public | ||
destination_dir: ${{ env.PR_PATH }} | ||
|
||
- name: Comment on PR | ||
uses: hasura/comment-progress@v2.2.0 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
repository: ${{ github.repository }} | ||
number: ${{ github.event.number }} | ||
id: deploy-preview | ||
message: > | ||
🪓 PR closed, deleted preview at https://github.com/${{ env.PREVIEW_REPO }}/tree/gh-pages/${{ env.PR_PATH }}/ |
8 changes: 8 additions & 0 deletions
8
.../integTest/groovy/org/gradle/api/experimental/android/AndroidApplicationAgpPreview.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.gradle.api.experimental.android | ||
|
||
class AndroidApplicationAgpPreview extends AbstractAndroidBuildInitSpec { | ||
@Override | ||
protected String getProjectSpecType() { | ||
return "android-application-agp-preview" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...oid-init/src/main/resources/templates/android-application-agp-preview/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# declarative-samples-android-app | ||
A sample Android application written in the Declarative Gradle DSL, using the official Android Software Types Preview `androidApplication` and `androidLibrary` defined in the `com.android.ecosystem` ecosystem plugin. | ||
|
||
## Building and Running | ||
|
||
This sample shows the definition of a multiproject Android application implemented using Kotlin source code. | ||
|
||
To build the project without running, use: | ||
|
||
```shell | ||
./gradlew build | ||
``` | ||
|
||
To run the application, first install it on a connected Android device using: | ||
|
||
```shell | ||
./gradlew :app:installDebug | ||
``` | ||
|
||
In IntelliJ IDEA or Android Studio you can use the `app` run configuration to launch the app in an emulator to see a hello world message. |
7 changes: 7 additions & 0 deletions
7
...id-init/src/main/resources/templates/android-application-agp-preview/app/build.gradle.dcl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
androidApp { | ||
namespace = "org.example.app" | ||
dependenciesDcl { | ||
implementation("org.apache.commons:commons-text:1.11.0") | ||
implementation(project(":utilities")) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...main/resources/templates/android-application-agp-preview/app/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<application android:label="@string/app_name"> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
</manifest> |
28 changes: 28 additions & 0 deletions
28
...lates/android-application-agp-preview/app/src/main/kotlin/org/example/app/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.example.app | ||
|
||
import org.apache.commons.text.WordUtils | ||
|
||
import org.example.list.LinkedList | ||
import org.example.utilities.SplitUtils | ||
import org.example.utilities.StringUtils | ||
|
||
import android.widget.TextView | ||
import android.os.Bundle | ||
import android.app.Activity | ||
|
||
class MainActivity : Activity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
|
||
val textView = findViewById(R.id.textView) as TextView | ||
textView.text = buildMessage() | ||
} | ||
|
||
private fun buildMessage(): String { | ||
val tokens: LinkedList | ||
tokens = SplitUtils.split(MessageUtils.message()) | ||
val result: String = StringUtils.join(tokens) | ||
return WordUtils.capitalize(result) | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
...lates/android-application-agp-preview/app/src/main/kotlin/org/example/app/MessageUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.example.app | ||
|
||
internal object MessageUtils { | ||
fun message() = "Hello World!" | ||
} |
12 changes: 12 additions & 0 deletions
12
...urces/templates/android-application-agp-preview/app/src/main/res/layout/activity_main.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".MainActivity"> | ||
<TextView | ||
android:id="@+id/textView" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_centerHorizontal="true" | ||
android:layout_centerVertical="true" /> | ||
</RelativeLayout> |
3 changes: 3 additions & 0 deletions
3
...n/resources/templates/android-application-agp-preview/app/src/main/res/values/strings.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<resources> | ||
<string name="app_name">Sample Declarative Gradle Android App</string> | ||
</resources> |
12 changes: 12 additions & 0 deletions
12
...s/android-application-agp-preview/app/src/test/kotlin/org/example/app/MessageUtilsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.example.app | ||
|
||
import org.junit.jupiter.api.Test | ||
|
||
import org.junit.jupiter.api.Assertions.assertEquals | ||
|
||
class MessageUtilsTest { | ||
@Test | ||
fun testGetMessage() { | ||
assertEquals("Hello World!", MessageUtils.message()) | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...droid-init/src/main/resources/templates/android-application-agp-preview/gradle.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
org.gradle.caching=true | ||
org.gradle.parallel=true | ||
org.gradle.configuration-cache=true | ||
kotlin.code.style=official | ||
android.experimental.declarative=true | ||
android.useAndroidX=true |
3 changes: 3 additions & 0 deletions
3
...d-init/src/main/resources/templates/android-application-agp-preview/list/build.gradle.dcl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
androidLibrary { | ||
namespace = "org.gradle.experimental.android.list" | ||
} |
86 changes: 86 additions & 0 deletions
86
...lates/android-application-agp-preview/list/src/main/kotlin/org/example/list/LinkedList.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package org.example.list | ||
|
||
class LinkedList { | ||
private var head: Node? = null | ||
|
||
fun add(element: String?) { | ||
val newNode = Node(element) | ||
|
||
val it = tail(head) | ||
if (it == null) { | ||
head = newNode | ||
} else { | ||
it.next = newNode | ||
} | ||
} | ||
|
||
fun remove(element: String): Boolean { | ||
var result = false | ||
var previousIt: Node? = null | ||
var it: Node? | ||
it = head | ||
while (!result && it != null) { | ||
if (0 == element.compareTo(it.data!!)) { | ||
result = true | ||
unlink(previousIt, it) | ||
break | ||
} | ||
previousIt = it | ||
it = it.next | ||
} | ||
|
||
return result | ||
} | ||
|
||
private fun unlink(previousIt: Node?, currentIt: Node) { | ||
if (currentIt === head) { | ||
head = currentIt.next | ||
} else { | ||
previousIt!!.next = currentIt.next | ||
} | ||
} | ||
|
||
fun size(): Int { | ||
var size = 0 | ||
|
||
var it = head | ||
while (it != null) { | ||
++size | ||
it = it.next | ||
} | ||
|
||
return size | ||
} | ||
|
||
fun get(index: Int): String? { | ||
var currIdx = index | ||
var it = head | ||
while (currIdx > 0 && it != null) { | ||
it = it.next | ||
currIdx-- | ||
} | ||
|
||
if (it == null) { | ||
throw java.lang.IndexOutOfBoundsException("Index is out of range") | ||
} | ||
|
||
return it.data | ||
} | ||
|
||
private class Node(val data: String?) { | ||
var next: Node? = null | ||
} | ||
|
||
companion object { | ||
private fun tail(head: Node?): Node? { | ||
var it: Node? | ||
|
||
it = head | ||
while (it?.next != null) { | ||
it = it.next | ||
} | ||
|
||
return it | ||
} | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
...oid-init/src/main/resources/templates/android-application-agp-preview/settings.gradle.dcl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
pluginManagement { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
maven { | ||
url = uri("https://androidx.dev/studio/builds/12648882/artifacts/artifacts/repository") | ||
} | ||
} | ||
} | ||
|
||
plugins { | ||
id("com.android.ecosystem").version("8.9.0-dev") | ||
} | ||
|
||
dependencyResolutionManagement { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
maven { | ||
url = uri("https://androidx.dev/studio/builds/12648882/artifacts/artifacts/repository") | ||
} | ||
} | ||
} | ||
|
||
rootProject.name = "example-android-app" | ||
|
||
include("app") | ||
include("list") | ||
include("utilities") | ||
|
||
defaults { | ||
androidApp { | ||
compileSdk = 34 | ||
compileOptions { | ||
sourceCompatibility = VERSION_17 | ||
targetCompatibility = VERSION_17 | ||
} | ||
defaultConfig { | ||
minSdk = 30 | ||
versionCode = 1 | ||
versionName = "0.1" | ||
applicationId = "org.gradle.experimental.android.app" | ||
} | ||
dependenciesDcl { | ||
implementation("org.jetbrains.kotlin:kotlin-stdlib:2.0.21") | ||
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2") | ||
testImplementation("org.junit.platform:junit-platform-launcher") | ||
androidTestImplementation("org.jetbrains.kotlin:kotlin-stdlib:2.0.21") | ||
} | ||
} | ||
|
||
androidLibrary { | ||
compileSdk = 34 | ||
compileOptions { | ||
sourceCompatibility = VERSION_17 | ||
targetCompatibility = VERSION_17 | ||
} | ||
defaultConfig { | ||
minSdk = 30 | ||
} | ||
dependenciesDcl { | ||
implementation("org.jetbrains.kotlin:kotlin-stdlib:2.0.21") | ||
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2") | ||
testImplementation("org.junit.platform:junit-platform-launcher") | ||
androidTestImplementation("org.jetbrains.kotlin:kotlin-stdlib:2.0.21") | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...t/src/main/resources/templates/android-application-agp-preview/utilities/build.gradle.dcl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
androidLibrary { | ||
namespace = "org.gradle.experimental.android.utilities" | ||
dependenciesDcl { | ||
api(project(":list")) | ||
} | ||
} |
Oops, something went wrong.