Skip to content

Commit 9e60f92

Browse files
committed
Move the Tools dir out of the Source dir.
Should help simplify some of the SwiftPM support in the future. Split out the github action for the service generator into a new workflow. oops
1 parent 55f9c0a commit 9e60f92

22 files changed

+102
-64
lines changed

.github/workflows/cocoapods.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@ on:
44
push:
55
branches: [ main ]
66
paths:
7-
- 'Sources/**'
8-
- '!Sources/Tools/**'
7+
- 'Source/**'
98
- '*.podspec'
109
- '.github/workflows/cocoapods.yml'
1110
pull_request:
1211
branches: [ main ]
1312
paths:
14-
- 'Sources/**'
15-
- '!Sources/Tools/**'
13+
- 'Source/**'
1614
- '*.podspec'
1715
- '.github/workflows/cocoapods.yml'
1816
schedule:

.github/workflows/examples.yml

+14-14
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,27 @@ on:
66
paths:
77
- 'Examples/**'
88
- '!Examples/**/*.md'
9-
- 'Sources/GTLRDefines.h'
10-
- 'Sources/GeneratedServices/Calendar/**'
11-
- 'Sources/GeneratedServices/Drive/**'
12-
- 'Sources/GeneratedServices/Storage/**'
13-
- 'Sources/GeneratedServices/YouTube/**'
14-
- 'Sources/Objects/**'
15-
- 'Sources/Utilities/**'
9+
- 'Source/GTLRDefines.h'
10+
- 'Source/GeneratedServices/Calendar/**'
11+
- 'Source/GeneratedServices/Drive/**'
12+
- 'Source/GeneratedServices/Storage/**'
13+
- 'Source/GeneratedServices/YouTube/**'
14+
- 'Source/Objects/**'
15+
- 'Source/Utilities/**'
1616
- '*.podspec'
1717
- '.github/workflows/examples.yml'
1818
pull_request:
1919
branches: [ main ]
2020
paths:
2121
- 'Examples/**'
2222
- '!Examples/**/*.md'
23-
- 'Sources/GTLRDefines.h'
24-
- 'Sources/GeneratedServices/Calendar/**'
25-
- 'Sources/GeneratedServices/Drive/**'
26-
- 'Sources/GeneratedServices/Storage/**'
27-
- 'Sources/GeneratedServices/YouTube/**'
28-
- 'Sources/Objects/**'
29-
- 'Sources/Utilities/**'
23+
- 'Source/GTLRDefines.h'
24+
- 'Source/GeneratedServices/Calendar/**'
25+
- 'Source/GeneratedServices/Drive/**'
26+
- 'Source/GeneratedServices/Storage/**'
27+
- 'Source/GeneratedServices/YouTube/**'
28+
- 'Source/Objects/**'
29+
- 'Source/Utilities/**'
3030
- '*.podspec'
3131
- '.github/workflows/examples.yml'
3232
schedule:
+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: SwiftPM
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'Source/GTLRDefines.h'
8+
- 'Source/GeneratedServices/Discovery/**'
9+
- 'Source/Objects/**'
10+
- 'Source/Utilities/**'
11+
- 'Tools/**'
12+
- '!Tools/**/*.md'
13+
- '!Tools/**/*.py'
14+
- '!Tools/GenerateCheckedInServices*'
15+
- 'Package*.swift'
16+
- '.github/workflows/service_generator.yml'
17+
pull_request:
18+
branches: [ main ]
19+
paths:
20+
- 'Source/GTLRDefines.h'
21+
- 'Source/GeneratedServices/Discovery/**'
22+
- 'Source/Objects/**'
23+
- 'Source/Utilities/**'
24+
- 'Tools/**'
25+
- '!Tools/**/*.md'
26+
- '!Tools/**/*.py'
27+
- '!Tools/GenerateCheckedInServices*'
28+
- 'Package*.swift'
29+
- '.github/workflows/service_generator.yml'
30+
schedule:
31+
# Run the first and fifteenth of every month at 6:32 UTC
32+
- cron: '6 32 1,15 * *'
33+
34+
jobs:
35+
swift:
36+
runs-on: macos-latest
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
CONFIGURATION: ["debug", "release"]
41+
steps:
42+
- uses: actions/checkout@v2
43+
- name: Build ServiceGenerator
44+
run: |
45+
set -eu
46+
cd Tools
47+
swift build --configuration ${{ matrix.CONFIGURATION }}
48+
49+
xcodebuild:
50+
runs-on: macos-latest
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
CONFIGURATION: ["Debug", "Release"]
55+
steps:
56+
- uses: actions/checkout@v2
57+
- name: Build ServiceGenerator
58+
run: |
59+
set -eu
60+
cd Tools
61+
set -o pipefail
62+
xcodebuild \
63+
-scheme GTLR_ServiceGenerator \
64+
-configuration ${{ matrix.CONFIGURATION }} \
65+
-destination "platform=macOS" \
66+
build \
67+
| xcpretty

.github/workflows/swiftpm.yml

+2-19
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ on:
44
push:
55
branches: [ main ]
66
paths:
7-
- 'Sources/**'
7+
- 'Source/**'
88
- 'Package*.swift'
99
- '.github/workflows/swiftpm.yml'
1010
pull_request:
1111
branches: [ main ]
1212
paths:
13-
- 'Sources/**'
13+
- 'Source/**'
1414
- 'Package*.swift'
1515
- '.github/workflows/swiftpm.yml'
1616
schedule:
@@ -32,11 +32,6 @@ jobs:
3232
set -eu
3333
swift build --configuration ${{ matrix.CONFIGURATION }}
3434
swift test --configuration ${{ matrix.CONFIGURATION }}
35-
- name: Build ServiceGenerator
36-
run: |
37-
set -eu
38-
cd Source/Tools
39-
swift build --configuration ${{ matrix.CONFIGURATION }}
4035
4136
xcodebuild:
4237
# Job(s) to build for all the platforms to ensure that is working and the
@@ -74,15 +69,3 @@ jobs:
7469
-destination "${DESTINATION}" \
7570
build test \
7671
| xcpretty
77-
- name: Build ServiceGenerator
78-
if: ${{ matrix.PLATFORM == 'macos' }}
79-
run: |
80-
set -eu
81-
cd Source/Tools
82-
set -o pipefail
83-
xcodebuild \
84-
-scheme GTLR_ServiceGenerator \
85-
-configuration ${{ matrix.CONFIGURATION }} \
86-
-destination "platform=macOS" \
87-
build \
88-
| xcpretty

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# Xcode
55
build/
6-
Source/Tools/ServiceGenerator/build/
6+
Tools/ServiceGenerator/build/
77
*.pbxuser
88
!default.pbxuser
99
*.mode1v3

Package.swift

+1-3
Original file line numberDiff line numberDiff line change
@@ -991,8 +991,7 @@ let package = Package(
991991
path: "Source",
992992
exclude: [
993993
"GeneratedServices",
994-
"Tests",
995-
"Tools"
994+
"Tests"
996995
],
997996
sources: [
998997
"Objects",
@@ -1010,7 +1009,6 @@ let package = Package(
10101009
dependencies: [
10111010
"GoogleAPIClientForRESTCore"
10121011
],
1013-
path: "Source/Tests",
10141012
exclude: [
10151013
"CompiledTestNoARC.m"
10161014
],

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
[![CocoaPods](https://github.com/google/google-api-objectivec-client-for-rest/actions/workflows/cocoapods.yml/badge.svg?branch=main)](https://github.com/google/google-api-objectivec-client-for-rest/actions/workflows/cocoapods.yml)
77
[![SwiftPM](https://github.com/google/google-api-objectivec-client-for-rest/actions/workflows/swiftpm.yml/badge.svg?branch=main)](https://github.com/google/google-api-objectivec-client-for-rest/actions/workflows/swiftpm.yml)
8+
[![ServiceGenerator](https://github.com/google/google-api-objectivec-client-for-rest/actions/workflows/service_generator.yml/badge.svg?branch=main)](https://github.com/google/google-api-objectivec-client-for-rest/actions/workflows/service_generator.yml)
89

910
Written by Google, this library is a flexible and efficient Objective-C
1011
framework for accessing JSON APIs.
@@ -26,7 +27,7 @@ In addition to the pre generated classes included with the library, you can
2627
generate your own source for other services that have a
2728
[discovery document](https://developers.google.com/discovery/v1/reference/apis#resource-representations)
2829
by using the
29-
[ServiceGenerator](https://github.com/google/google-api-objectivec-client-for-rest/tree/main/Source/Tools/ServiceGenerator).
30+
[ServiceGenerator](https://github.com/google/google-api-objectivec-client-for-rest/tree/main/Tools/ServiceGenerator).
3031

3132
**If you have a problem** or want a new feature to be included in the library,
3233
please join the

Source/Tests/GenerateTestingSvc

+4-11
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ set -e
77
readonly TestsDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")")
88
readonly ScriptName=$(basename "$0")
99

10-
readonly ServiceGeneratorDir="${TestsDir}/../Tools/ServiceGenerator"
11-
12-
readonly TMP_INSTALL_DIR=$(mktemp -dt "$ScriptName") || exit 1
13-
trap "rm -rf $TMP_INSTALL_DIR" EXIT HUP INT QUIT TERM
14-
readonly ServiceGeneratorBinary="${TMP_INSTALL_DIR}/usr/local/bin/ServiceGenerator"
10+
readonly ToolsDir="${TestsDir}/../../Tools"
11+
readonly Configuration=debug
12+
readonly ServiceGeneratorBinary="${ToolsDir}/.build/${Configuration}/ServiceGenerator"
1513

1614
# -----------------------------------------------------------------------------
1715

@@ -27,12 +25,7 @@ Banner() {
2725
# -----------------------------------------------------------------------------
2826

2927
Banner "Ensuring ServiceGenerator is up to date..."
30-
/usr/bin/xcodebuild \
31-
-project "${ServiceGeneratorDir}/ServiceGenerator.xcodeproj" \
32-
-scheme ServiceGenerator \
33-
-configuration Debug \
34-
install \
35-
DSTROOT="${TMP_INSTALL_DIR}"
28+
( cd "${ToolsDir}" && swift build --configuration "${Configuration}" )
3629

3730
# -----------------------------------------------------------------------------
3831

Source/Tools/GenerateCheckedInServices renamed to Tools/GenerateCheckedInServices

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set -eu
88
readonly ToolsDir=$(dirname "$(echo $0 | sed -e "s,^\([^/]\),$(pwd)/\1,")")
99
readonly ScriptName=$(basename "$0")
1010

11-
readonly GeneratedServicesDir="${ToolsDir}/../GeneratedServices"
11+
readonly GeneratedServicesDir="${ToolsDir}/../Source/GeneratedServices"
1212
readonly Configuration=debug
1313
readonly ServiceGeneratorBinary="${ToolsDir}/.build/${Configuration}/ServiceGenerator"
1414

Source/Tools/Package.swift renamed to Tools/Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ let package = Package(
1515
],
1616
dependencies: [
1717
.package(url: "https://github.com/google/gtm-session-fetcher.git", "1.6.1" ..< "2.0.0"),
18-
.package(path: "../..")
18+
.package(path: "..")
1919
],
2020
targets: [
2121
.target(

Source/Tools/ServiceGenerator/README.md renamed to Tools/ServiceGenerator/README.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
If you need to build the generator, the simplest way is to directly pull the code:
44

55
```shell
6-
$ git clone --recursive \
7-
https://github.com/google/google-api-objectivec-client-for-rest.git
8-
$ cd google-api-objectivec-client-for-rest/Source/Tools/ServiceGenerator
9-
$ xcodebuild -project ServiceGenerator.xcodeproj -alltargets \
10-
-configuration Release build
6+
$ git clone
7+
$ cd google-api-objectivec-client-for-rest/Tools/ServiceGenerator
8+
$ swift build -configuration release
119
```
1210

1311
With Xcode's default preferences, that will create a `build` directory next to the project file;
14-
and you will find the built generator as `build/Release/ServiceGenerator`.
12+
and you will find the built generator as `.build/release/ServiceGenerator`.
1513

1614
_NOTE:_ If you are using GTLR from CocoaPods, you likely will want to use the command line
1715
option: `--gtlrFrameworkName` `GTLR` when generating a custom service so the generated
@@ -21,7 +19,7 @@ framework imports matching the CocoaPod.
2119
For information on the options, invoke the generator with `--help`:
2220

2321
```Shell
24-
$ build/Release/ServiceGenerator --help
22+
$ .build/release/ServiceGenerator --help
2523
Usage: ServiceGenerator --outputDir PATH [FLAGS] [ARGS]
2624
...lots of usage info...
2725
```
File renamed without changes.

Source/Tools/update_podspec_services.py renamed to Tools/update_podspec_services.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def Main(args):
8383
"""Main method."""
8484
assert not args, 'No args supported on this script!'
8585
script_dir = os.path.dirname(os.path.realpath(__file__))
86-
root_dir = os.path.dirname(os.path.dirname(script_dir))
86+
root_dir = os.path.dirname(script_dir)
8787
podspec_path = os.path.join(root_dir, _PODSPEC_NAME)
8888
assert os.path.isfile(podspec_path), (
8989
'Failed to find %r' % _PODSPEC_NAME)

Source/Tools/update_swiftpm_services.py renamed to Tools/update_swiftpm_services.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def Main(args):
108108
"""Main method."""
109109
assert not args, 'No args supported on this script!'
110110
script_dir = os.path.dirname(os.path.realpath(__file__))
111-
root_dir = os.path.dirname(os.path.dirname(script_dir))
111+
root_dir = os.path.dirname(script_dir)
112112
package_path = os.path.join(root_dir, _PACKAGE_FILE)
113113
assert os.path.isfile(package_path), (
114114
'Failed to find %r' % _PACKAGE_FILE)

0 commit comments

Comments
 (0)