-
Notifications
You must be signed in to change notification settings - Fork 570
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
268 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
plugins { | ||
id("com.android.library") | ||
id("org.jetbrains.kotlin.android") | ||
id("com.squareup.wire") | ||
} | ||
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
google() | ||
} | ||
dependencies { | ||
classpath(libs.pluginz.android) | ||
classpath("com.squareup.wire:wire-gradle-plugin") | ||
} | ||
} | ||
|
||
android { | ||
namespace = "com.squareup.wire.android.app.multi.dinosaurs" | ||
} | ||
|
||
dependencies { | ||
implementation(libs.androidx.appcompat) | ||
implementation(libs.androidx.constraintLayout) | ||
implementation(libs.androidMaterial) | ||
testImplementation(libs.junit) | ||
} | ||
|
||
wire { | ||
sourcePath { | ||
srcDir("src/main/proto") | ||
} | ||
|
||
sourcePath { | ||
srcProject(":samples:android-multi-module:location") | ||
include("squareup/location/continent.proto") | ||
} | ||
|
||
kotlin { | ||
out = "src/main/kotlin" | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
samples/android-multi-module/dinosaurs/src/main/proto/squareup/dinosaurs/dinosaur.proto
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,21 @@ | ||
syntax = "proto2"; | ||
|
||
package squareup.dinosaurs; | ||
|
||
option java_package = "com.squareup.dinosaurs"; | ||
|
||
import "squareup/geology/period.proto"; | ||
import "squareup/location/continent.proto"; | ||
|
||
message Dinosaur { | ||
/** Common name of this dinosaur, like "Stegosaurus". */ | ||
optional string name = 1; | ||
|
||
/** URLs with images of this dinosaur. */ | ||
repeated string picture_urls = 2; | ||
|
||
optional double length_meters = 3; | ||
optional double mass_kilograms = 4; | ||
optional squareup.geology.Period period = 5; | ||
optional squareup.location.Continent continent = 6; | ||
} |
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,34 @@ | ||
plugins { | ||
id("com.android.library") | ||
id("org.jetbrains.kotlin.android") | ||
id("com.squareup.wire") | ||
} | ||
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
google() | ||
} | ||
dependencies { | ||
classpath(libs.pluginz.android) | ||
classpath("com.squareup.wire:wire-gradle-plugin") | ||
} | ||
} | ||
|
||
android { | ||
namespace = "com.squareup.wire.android.app.multi.geology" | ||
} | ||
|
||
dependencies { | ||
implementation(libs.androidx.appcompat) | ||
implementation(libs.androidx.constraintLayout) | ||
implementation(libs.androidMaterial) | ||
testImplementation(libs.junit) | ||
} | ||
|
||
wire { | ||
protoLibrary = true | ||
|
||
kotlin { | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
samples/android-multi-module/geology/src/main/proto/squareup/geology/period.proto
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,16 @@ | ||
syntax = "proto2"; | ||
|
||
package squareup.geology; | ||
|
||
option java_package = "com.squareup.geology"; | ||
|
||
enum Period { | ||
/** 145.5 million years ago — 66.0 million years ago. */ | ||
CRETACEOUS = 1; | ||
|
||
/** 201.3 million years ago — 145.0 million years ago. */ | ||
JURASSIC = 2; | ||
|
||
/** 252.17 million years ago — 201.3 million years ago. */ | ||
TRIASSIC = 3; | ||
} |
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,55 @@ | ||
plugins { | ||
id("com.android.library") | ||
id("org.jetbrains.kotlin.android") | ||
id("com.squareup.wire") | ||
id("maven-publish") | ||
} | ||
|
||
buildscript { | ||
repositories { | ||
mavenCentral() | ||
google() | ||
} | ||
dependencies { | ||
classpath(libs.pluginz.android) | ||
classpath("com.squareup.wire:wire-gradle-plugin") | ||
} | ||
} | ||
|
||
android { | ||
namespace = "com.squareup.wire.android.app.multi.location" | ||
|
||
publishing { | ||
singleVariant("debug") { | ||
withSourcesJar() | ||
} | ||
} | ||
} | ||
|
||
publishing { | ||
publications { | ||
create("debug", MavenPublication::class.java) { | ||
groupId = "com.my-company" | ||
artifactId = "my-library" | ||
version = "1.0" | ||
|
||
afterEvaluate { | ||
from(components.getByName("debug")) | ||
} | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(libs.androidx.appcompat) | ||
implementation(libs.androidx.constraintLayout) | ||
implementation(libs.androidMaterial) | ||
testImplementation(libs.junit) | ||
} | ||
|
||
wire { | ||
protoLibrary = true | ||
|
||
kotlin { | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
samples/android-multi-module/location/src/main/kotlin/london/Main.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,20 @@ | ||
/* | ||
* Copyright (C) 2024 Square, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package london | ||
|
||
fun main() { | ||
println("hello") | ||
} |
14 changes: 14 additions & 0 deletions
14
samples/android-multi-module/location/src/main/proto/squareup/location/continent.proto
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,14 @@ | ||
syntax = "proto2"; | ||
|
||
package squareup.location; | ||
|
||
option java_package = "com.squareup.location"; | ||
|
||
enum Continent { | ||
AFRICA = 0; | ||
AMERICA = 1; | ||
ANTARCTICA = 2; | ||
ASIA = 3; | ||
AUSTRALIA = 4; | ||
EUROPE = 5; | ||
} |
16 changes: 16 additions & 0 deletions
16
samples/android-multi-module/location/src/main/proto/squareup/location/planet.proto
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,16 @@ | ||
syntax = "proto2"; | ||
|
||
package squareup.location; | ||
|
||
option java_package = "com.squareup.location"; | ||
|
||
enum Planet { | ||
MERCURY = 0; | ||
VENUS = 1; | ||
EARTH = 2; | ||
MARS = 3; | ||
JUPITER = 4; | ||
SATURN = 5; | ||
URANUS = 6; | ||
NEPTUNE = 7; | ||
} |
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
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