Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,12 @@ google-ads/*/dependency-reduced-pom.xml
## buildnumber-maven-plugin output
buildNumber.properties
google-ads/*/buildNumber.properties

# Gradle build output
.gradle/
buildSrc/.gradle/
buildSrc/build/
google-ads-annotation-processing/build/
google-ads-examples/build/
google-ads-migration-examples/build/
google-ads/build/
26 changes: 26 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Copy link
Copy Markdown
Contributor

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.

image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

* 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 {
Comment thread
jradcliff marked this conversation as resolved.
id 'groovy-gradle-plugin'
Comment thread
nwbirnie marked this conversation as resolved.
}

repositories {
gradlePluginPortal()
}
123 changes: 123 additions & 0 deletions buildSrc/src/main/groovy/com.google.api-ads.java-conventions.gradle
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)
}

}
31 changes: 31 additions & 0 deletions google-ads-annotation-processing/build.gradle
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'

47 changes: 47 additions & 0 deletions google-ads-examples/build.gradle
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
}
39 changes: 39 additions & 0 deletions google-ads-migration-examples/build.gradle
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.'
}
54 changes: 54 additions & 0 deletions google-ads/build.gradle
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'

22 changes: 22 additions & 0 deletions gradle.properties
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.

Comment thread
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

Comment thread
nwbirnie marked this conversation as resolved.
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
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
Loading