-
Notifications
You must be signed in to change notification settings - Fork 185
Add initial version of Gradle build files #403
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f890796
Add initial version of Gradle build files
AndrewMBurke ed9c7d4
Bump minimum Auto Service version to rc2 to fix a Windows build issue
AndrewMBurke 409c2fa
Fix quotes in examples build file
AndrewMBurke 31bea74
Removed explicit gax dependency for annotation processor
AndrewMBurke 01bb8b7
Enable Gradle parallel build by default
AndrewMBurke 5bd6771
Set explicit target compatability to Java 1.8
AndrewMBurke 941ec47
Reformatted google-ads-examples/build.gradle
AndrewMBurke a351591
Restructure task code, add runMigrationExample task
AndrewMBurke 076950c
Remove extraneous comments
AndrewMBurke d39e24d
Added build artifacts to .gitignore, fixed extraneous whitespace
AndrewMBurke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,26 @@ | ||
| /* | ||
| * Copyright 2020 Google LLC | ||
| * | ||
| * 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. | ||
| * | ||
| * This configuration specifies gradle plugins for all Google Ads Java library | ||
| * subprojects. | ||
| */ | ||
|
|
||
| plugins { | ||
|
jradcliff marked this conversation as resolved.
|
||
| id 'groovy-gradle-plugin' | ||
|
nwbirnie marked this conversation as resolved.
|
||
| } | ||
|
|
||
| repositories { | ||
| gradlePluginPortal() | ||
| } | ||
123 changes: 123 additions & 0 deletions
123
buildSrc/src/main/groovy/com.google.api-ads.java-conventions.gradle
This file contains hidden or 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,123 @@ | ||
| /* | ||
| * Copyright 2020 Google LLC | ||
| * | ||
| * 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. | ||
| * | ||
| * These are shared settings common to all Google Ads Java library subprojects. | ||
| */ | ||
|
|
||
| plugins { | ||
| id 'java-library' | ||
| id 'maven-publish' | ||
| } | ||
|
|
||
| repositories { | ||
| mavenLocal() | ||
| mavenCentral() | ||
| } | ||
|
|
||
| group = 'com.google.api-ads' | ||
| version = '11.0.1-SNAPSHOT' | ||
| java.sourceCompatibility = JavaVersion.VERSION_1_8 | ||
| java.targetCompatibility = JavaVersion.VERSION_1_8 | ||
|
|
||
| java { | ||
| withSourcesJar() | ||
| } | ||
|
|
||
| publishing { | ||
| publications { | ||
| maven(MavenPublication) { | ||
| from(components.java) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| tasks.withType(JavaCompile) { | ||
| options.encoding = 'UTF-8' | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation 'com.google.guava:guava:26.0-android' | ||
| implementation 'com.google.auto.service:auto-service:1.0-rc2' | ||
| implementation 'com.google.api:gax:1.60.1' | ||
| implementation 'com.google.api:gax-grpc:1.60.1' | ||
| implementation 'com.google.protobuf:protobuf-java:3.14.0' | ||
| annotationProcessor 'com.google.auto.service:auto-service:1.0-rc2' | ||
| testImplementation 'junit:junit:4.13.1' | ||
| } | ||
|
|
||
| public class ExampleRunnerTask extends JavaExec { | ||
|
|
||
| @Input | ||
| public String basePackage = 'com.google.ads.googleads.examples.' | ||
|
|
||
| @Optional | ||
| @Input | ||
| private String exampleArguments | ||
|
|
||
| public ExampleRunnerTask() { | ||
| group = 'Execution' | ||
| description = 'Run a Google Ads API example.' | ||
| errorOutput = System.err | ||
| } | ||
|
|
||
| @Option(option = 'example', description = 'Sets the example to launch and' + | ||
| ' any arguments. Required for execution. E.g. ' + | ||
| '"basicoperations.GetCampaigns --customerId 1234567890"') | ||
| public void setExampleArguments(String exampleArguments) { | ||
| this.exampleArguments = exampleArguments.trim() | ||
| int firstSpaceIndex = this.exampleArguments.indexOf(' ') | ||
|
|
||
| // No additional arguments were passed, just the example name. | ||
| if (firstSpaceIndex == -1) { | ||
| main = basePackage + this.exampleArguments | ||
| } | ||
| // Otherwise, separate the input and set the arguments to pass to the | ||
| // main class. | ||
| else { | ||
| main = basePackage + this.exampleArguments[0..firstSpaceIndex - 1] | ||
| argsString(exampleArguments[(firstSpaceIndex + 1)..-1]) | ||
| } | ||
| } | ||
|
|
||
| @TaskAction | ||
| @Override | ||
| public void exec() { | ||
| if (!(exampleArguments?.trim())) { | ||
| throw new GradleException('\033[0;31mMissing example!\033[0m ' + | ||
| 'Please rerun with one provided, e.g. ' + | ||
| '\033[0;35m--example="basicoperations.GetCampaigns"\033[0m') | ||
| } | ||
| logQuietMessage('Running example: ' + main + ', args: ' + | ||
| args.toString()) | ||
| try { | ||
| super.exec() | ||
| } | ||
| catch (Exception e) { | ||
| logQuietMessage('\n\033[0;31mrunExample exception!\033[0m Did ' + | ||
| 'you provide a valid example identifier? E.g. ' + | ||
| '\033[0;35m--example="basicoperations.GetCampaigns"\033[0m\n\n' + | ||
| e.message) | ||
| } | ||
| } | ||
|
|
||
| public String getExampleArguments() { | ||
| return exampleArguments | ||
| } | ||
|
|
||
| private void logQuietMessage(String message) { | ||
| logger.quiet(message) | ||
| } | ||
|
|
||
| } |
This file contains hidden or 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,31 @@ | ||
| /* | ||
| * Copyright 2020 Google LLC | ||
| * | ||
| * 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. | ||
| * | ||
| * This is the build configuration for the google-ads-annotation-processing | ||
| * subproject. | ||
| */ | ||
|
|
||
| plugins { | ||
| id 'com.google.api-ads.java-conventions' | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation 'com.squareup:javapoet:1.11.1' | ||
| implementation 'javax.annotation:javax.annotation-api:1.3.2' | ||
| testImplementation 'org.mockito:mockito-all:1.9.5' | ||
| } | ||
|
|
||
| description = 'Google Ads API client library for Java annotation processor' | ||
|
|
This file contains hidden or 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,47 @@ | ||
| /* | ||
| * Copyright 2020 Google LLC | ||
| * | ||
| * 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. | ||
| * | ||
| * This is the build file for the google-ads-examples subproject. It depends on | ||
| * the google-ads subproject. | ||
| * | ||
| * This project contains examples for using the Google Ads API. You can launch | ||
| * examples by navigating to the google-ads-examples folder and running the | ||
| * provided runExample gradle task. Note that we recommend running with the | ||
| * quiet flag (-q) to reduce screen clutter: | ||
| * -- Mac/Linux -- | ||
| * ./gradlew -q runExample --example='basicoperations.GetCampaigns --customerId 1234567890' | ||
| * | ||
| * -- Windows -- | ||
| * gradlew -q runExample --example='basicoperations.GetCampaigns --customerId 1234567890' | ||
| */ | ||
|
|
||
| plugins { | ||
| id 'com.google.api-ads.java-conventions' | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation project(':google-ads') | ||
| implementation 'org.apache.commons:commons-lang3:3.11' | ||
| implementation 'com.beust:jcommander:1.72' | ||
| implementation 'joda-time:joda-time:2.8.2' | ||
| runtimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.1' | ||
| testImplementation 'org.mockito:mockito-core:2.27.0' | ||
| } | ||
|
|
||
| description = 'Google Ads API client library for Java examples' | ||
|
|
||
| task runExample(type: ExampleRunnerTask) { | ||
| classpath = sourceSets.main.runtimeClasspath | ||
| } |
This file contains hidden or 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,39 @@ | ||
| /* | ||
| * Copyright 2020 Google LLC | ||
| * | ||
| * 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. | ||
| * | ||
| * This is the build configuration for the google-ads-migration-examples | ||
| * subproject. It depends on the google-ads subproject. | ||
| */ | ||
|
|
||
| plugins { | ||
| id 'com.google.api-ads.java-conventions' | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation project(':google-ads') | ||
| implementation 'com.google.api-ads:ads-lib:4.4.0' | ||
| implementation 'com.google.api-ads:adwords-axis:4.4.0' | ||
| implementation 'com.beust:jcommander:1.72' | ||
| implementation 'joda-time:joda-time:2.8.2' | ||
| runtimeOnly 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.1' | ||
| testImplementation 'org.mockito:mockito-core:2.27.0' | ||
| } | ||
|
|
||
| description = 'Google Ads API client library for Java migration examples' | ||
|
|
||
| task runMigrationExample(type: ExampleRunnerTask) { | ||
| classpath = sourceSets.main.runtimeClasspath | ||
| basePackage = 'com.google.ads.googleads.migration.' | ||
| } |
This file contains hidden or 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,54 @@ | ||
| /* | ||
| * Copyright 2020 Google LLC | ||
| * | ||
| * 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. | ||
| * | ||
| * This is the build configuration for the google-ads-java subproject. It depends | ||
| * on the google-ads-annotation-processing subproject. | ||
| */ | ||
|
|
||
| plugins { | ||
| id 'com.google.api-ads.java-conventions' | ||
| id 'com.google.protobuf' version "0.8.15" | ||
| } | ||
|
|
||
| sourceSets { | ||
| test { | ||
| proto { | ||
| srcDir 'src/test/resources/protos/' | ||
| } | ||
| } | ||
| } | ||
|
|
||
| protobuf { | ||
| protoc { | ||
| artifact = 'com.google.protobuf:protoc:3.15.0-rc-1' | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation 'io.netty:netty-tcnative-boringssl-static:2.0.26.Final' | ||
| implementation 'org.slf4j:slf4j-api:1.7.25' | ||
| implementation project(':google-ads-annotation-processing') | ||
| annotationProcessor project(':google-ads-annotation-processing') | ||
| annotationProcessor "com.google.auto.value:auto-value:1.7.3" | ||
| testImplementation 'org.hamcrest:java-hamcrest:2.0.0.0' | ||
| testImplementation 'org.mockito:mockito-all:1.9.5' | ||
| testImplementation 'com.google.api:gax-grpc:1.60.1:testlib' | ||
| testImplementation 'io.grpc:grpc-context:1.30.0' | ||
| testImplementation 'com.google.truth:truth:0.27' | ||
| testImplementation 'com.google.auto.value:auto-value-annotations:1.7.3' | ||
| } | ||
|
|
||
| description = 'Google Ads API client library for Java' | ||
|
|
This file contains hidden or 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,22 @@ | ||
| # | ||
| # Copyright 2020 Google LLC | ||
| # | ||
| # 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. | ||
| # | ||
| # These are global settings for the gradle build process. | ||
|
|
||
|
nwbirnie marked this conversation as resolved.
|
||
| org.gradle.jvmargs=-Xmx5g -XX:MaxMetaspaceSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 | ||
| org.gradle.caching=true | ||
| org.gradle.console=rich | ||
| org.gradle.parallel=true | ||
|
|
||
|
nwbirnie marked this conversation as resolved.
|
||
Binary file not shown.
This file contains hidden or 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 @@ | ||
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip | ||
| zipStoreBase=GRADLE_USER_HOME | ||
| zipStorePath=wrapper/dists |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more: please add build directories and .gradle to .gitignore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.