googleapis / sample-tester

Tool for testing semantically equivalent samples in multiple languages and environments
Apache License 2.0
10 stars 12 forks source link

bin script with `@args` still appends arguments #131

Closed chingor13 closed 5 years ago

chingor13 commented 5 years ago

For java, we try to run samples through mvn exec:java which doesn't allow arbitrary arguments. Thus, the arguments are provided via -Dexec.args="...".

The @args is correctly being substituted for the arguments, but the arguments are still being appended to the command causing maven to crash.

type: manifest/samples
schema_version: 3
base: &common
  env: 'java'
  bin: 'mvn exec:java -q -D{sample} -Dexec.args="@args"'
  chdir: '{@manifest_dir}/../..'
  basepath: '.'
samples:
- <<: *common
  path: '{basepath}/src/main/java/com/google/cloud/examples/speech/v1/SpeechTranscribeAsyncWordTimeOffsetsGcs.java'
  sample: 'speech_transcribe_async_word_time_offsets_gcs'

Example:

mvn exec:java -q -Dspeech_transcribe_sync_gcs -Dexec.args="--storage_uri="gs://cloud-samples-data/speech/hello.raw"" ./src/main/java/com/google/cloud/examples/speech/v1/SpeechTranscribeSyncGcs.java --storage_uri="gs://cloud-samples-data/speech/hello.raw"
vchudnov-g commented 5 years ago

This is WAI; see the documentation

The bin field is deprecated. We're only keeping it in order to not break previous testplans. I'd like to remove it as soon as it is safe to do so. As the documentation states, the semantics for bin is that it appends the arguments to the value provided for that field.

What you should be using instead is invocation: that does not append the arguments.