Skip to content

Commit b224604

Browse files
DSL based Migrator API and a Updated Change Model (#6)
1 parent f81263e commit b224604

309 files changed

Lines changed: 9984 additions & 5426 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ jobs:
2020
uses: Apodini/.github/.github/workflows/build-and-test.yml@main
2121
with:
2222
packagename: ApodiniMigrator
23-
usexcodebuild: false
23+
supportsmacos11: true
2424
testdocc: false

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: Apodini/.github/.github/workflows/build-and-test.yml@main
1919
with:
2020
packagename: ApodiniMigrator
21-
usexcodebuild: false
21+
supportsmacos11: true
2222
testdocc: false
2323
reuse_action:
2424
name: REUSE Compliance Check

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
.idea
1212

1313
# Swift Package Manager
14-
Package.resolved
1514
*.xcodeproj
1615
.swiftpm
1716
.build/

.swiftlint.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -325,17 +325,16 @@ only_rules:
325325
excluded: # paths to ignore during linting. Takes precedence over `included`.
326326
- .build
327327
- .swiftpm
328-
- Tests
329-
- Sources/ApodiniMigratorCompare/Change/ProviderSupport.swift
330-
- Sources/ApodiniMigratorCompare/AnyCodableElement.swift
328+
- Sources/RESTMigrator/Resources
329+
- Tests/ApodiniMigratorTests/Resources
331330

332331
closure_body_length: # Closure bodies should not span too many lines.
333332
- 35 # warning - default: 20
334333
- 35 # error - default: 100
335334

336335
enum_case_associated_values_count: # Number of associated values in an enum case should be low
337-
- 5 # warning - default: 5
338-
- 5 # error - default: 6
336+
- 8 # warning - default: 5
337+
- 8 # error - default: 6
339338

340339
file_length: # Files should not span too many lines.
341340
- 500 # warning - default: 400
@@ -351,18 +350,21 @@ function_parameter_count: # Number of function parameters should be low.
351350

352351
identifier_name:
353352
excluded: # excluded names
353+
- v1
354+
- v2
354355
- id
355356
- ok
356357
- or
357358
- to
359+
- at
358360

359361
large_tuple: # Tuples shouldn't have too many members. Create a custom type instead.
360362
- 2 # warning - default: 2
361363
- 2 # error - default: 3
362364

363365
line_length: # Lines should not span too many characters.
364-
warning: 200 # default: 120
365-
error: 200
366+
warning: 150 # default: 120
367+
error: 150
366368
ignores_comments: true # default: false
367369
ignores_urls: true # default: false
368370
ignores_function_declarations: false # default: false

Package.resolved

Lines changed: 124 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 62 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,81 +18,113 @@ let package = Package(
1818
.iOS(.v13)
1919
],
2020
products: [
21-
// Products define the executables and libraries a package produces, and make them visible to other packages.
22-
.library(name: "ApodiniMigratorCore", targets: ["ApodiniMigratorCore"]),
23-
.library(name: "ApodiniMigrator", targets: ["ApodiniMigrator"]),
2421
.library(name: "ApodiniMigratorShared", targets: ["ApodiniMigratorShared"]),
22+
.library(name: "ApodiniMigratorCore", targets: ["ApodiniMigratorCore"]),
2523
.library(name: "ApodiniMigratorClientSupport", targets: ["ApodiniMigratorClientSupport"]),
2624
.library(name: "ApodiniMigratorCompare", targets: ["ApodiniMigratorCompare"]),
25+
.library(name: "ApodiniMigrator", targets: ["ApodiniMigrator"]),
26+
.library(name: "RESTMigrator", targets: ["RESTMigrator"]),
2727
.executable(name: "migrator", targets: ["ApodiniMigratorCLI"])
2828
],
2929
dependencies: [
30-
// Dependencies declare other packages that this package depends on.
31-
.package(url: "https://github.com/Apodini/ApodiniTypeInformation.git", .upToNextMinor(from: "0.2.0")),
30+
.package(url: "https://github.com/Apodini/ApodiniTypeInformation.git", .upToNextMinor(from: "0.3.0")),
3231
.package(url: "https://github.com/kylef/PathKit.git", from: "1.0.1"),
3332
.package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "0.4.0")),
3433
.package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"),
3534
.package(url: "https://github.com/omochi/FineJSON.git", from: "1.14.0"),
36-
.package(url: "https://github.com/jpsim/Yams.git", from: "4.0.0")
35+
.package(url: "https://github.com/jpsim/Yams.git", from: "4.0.0"),
36+
.package(url: "https://github.com/apple/swift-collections.git", .upToNextMajor(from: "1.0.0")),
37+
38+
// testing runtime crashes
39+
.package(url: "https://github.com/norio-nomura/XCTAssertCrash.git", from: "0.2.0")
3740
],
3841
targets: [
39-
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
40-
// Targets can depend on other targets in this package, and on products in packages this package depends on.
42+
// The lowest level ApodiniMigrator package providing common API used across several targets, including
43+
// common file extensions, encoding and decoding strategies and output formatting
4144
.target(
42-
name: "ApodiniMigratorCore",
45+
name: "ApodiniMigratorShared",
4346
dependencies: [
44-
.target(name: "ApodiniMigratorShared"),
45-
.product(name: "ApodiniTypeInformation", package: "ApodiniTypeInformation"),
47+
.product(name: "PathKit", package: "PathKit"),
48+
.product(name: "FineJSON", package: "FineJSON"),
4649
.product(name: "Yams", package: "Yams")
4750
]
4851
),
49-
.executableTarget(
50-
name: "ApodiniMigratorCLI",
52+
53+
// The core ApodiniMigrator package. It provides access to the TypeInformation framework and introduces
54+
// the generalized API document.
55+
.target(
56+
name: "ApodiniMigratorCore",
5157
dependencies: [
52-
.target(name: "ApodiniMigrator"),
53-
.product(name: "ArgumentParser", package: "swift-argument-parser"),
54-
.product(name: "Logging", package: "swift-log")
58+
.target(name: "ApodiniMigratorShared"),
59+
.product(name: "ApodiniTypeInformation", package: "ApodiniTypeInformation"),
60+
.product(name: "Yams", package: "Yams"),
61+
.product(name: "OrderedCollections", package: "swift-collections")
5562
]
5663
),
64+
65+
// This target provides any necessary interfaces for REST client libraries!
5766
.target(
5867
name: "ApodiniMigratorClientSupport",
5968
dependencies: [
6069
.target(name: "ApodiniMigratorCore")
6170
]
6271
),
72+
73+
// The Compare target builds upon the Core package containing the generalized MigrationGuide
74+
// and all the necessary utilities for the comparison algorithms.
75+
.target(
76+
name: "ApodiniMigratorCompare",
77+
dependencies: [
78+
.target(name: "ApodiniMigratorClientSupport")
79+
]
80+
),
81+
82+
// The Migrator package provides the Migrator Interface. So everything which is required
83+
// to build your own Migrator. LibraryStructure generation, Source Code generation, ...
6384
.target(
6485
name: "ApodiniMigrator",
6586
dependencies: [
6687
.target(name: "ApodiniMigratorCompare"),
67-
.target(name: "ApodiniMigratorClientSupport"),
6888
.product(name: "Logging", package: "swift-log")
69-
],
70-
resources: [
71-
.process("Templates")
7289
]
7390
),
91+
92+
// This target packages the REST client library generator and migrator.
93+
// Further it contain the template files for the REST client library.
7494
.target(
75-
name: "ApodiniMigratorShared",
95+
name: "RESTMigrator",
7696
dependencies: [
77-
.product(name: "PathKit", package: "PathKit"),
78-
.product(name: "FineJSON", package: "FineJSON"),
79-
.product(name: "Yams", package: "Yams")
97+
.target(name: "ApodiniMigrator"),
98+
.target(name: "ApodiniMigratorCompare"),
99+
.target(name: "ApodiniMigratorClientSupport"),
100+
.product(name: "Logging", package: "swift-log")
101+
],
102+
resources: [
103+
.process("Resources")
80104
]
81105
),
82-
83-
.target(
84-
name: "ApodiniMigratorCompare",
106+
107+
// This target implements the command line interface of the ApodiniMigrator utility.
108+
// It offers command to generate and migrate client libraries and a sub command
109+
// to compare API documents.
110+
.executableTarget(
111+
name: "ApodiniMigratorCLI",
85112
dependencies: [
86-
.target(name: "ApodiniMigratorClientSupport")
113+
.target(name: "RESTMigrator"),
114+
.product(name: "ArgumentParser", package: "swift-argument-parser"),
115+
.product(name: "Logging", package: "swift-log")
87116
]
88117
),
118+
119+
// The unified test target.
89120
.testTarget(
90121
name: "ApodiniMigratorTests",
91122
dependencies: [
92123
"ApodiniMigratorCore",
93-
"ApodiniMigrator",
124+
"RESTMigrator",
94125
"ApodiniMigratorCompare",
95-
"ApodiniMigratorClientSupport"
126+
"ApodiniMigratorClientSupport",
127+
.product(name: "XCTAssertCrash", package: "XCTAssertCrash", condition: .when(platforms: [.macOS]))
96128
],
97129
resources: [
98130
.process("Resources")

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ SPDX-License-Identifier: MIT
2020
[![Build and Test](https://github.com/Apodini/ApodiniMigrator/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/Apodini/ApodiniMigrator/actions/workflows/build-and-test.yml)
2121
[![codecov](https://codecov.io/gh/Apodini/ApodiniMigrator/branch/develop/graph/badge.svg?token=5MMKMPO5NR)](https://codecov.io/gh/Apodini/ApodiniMigrator)
2222

23-
`ApodiniMigrator` is a Swift package that performs several automated tasks, to migrate client applications after a Web Service publishes a new version that contains breaking changes. The tasks include automated generation of an intermediary client library that contains all required components to establish a client-server communication. Furthermore, `ApodiniMigrator` is able to automatically generate a machine-readable migration guide in either `json` or `yaml` format, that describes the changes between two subsequent Web API versions, and includes auxiliary migrating actions. By means of the migration guide, `ApodiniMigrator` can automatically migrate the intermadiary client library, ensuring therefore the compatibility with the new Web API version. It is part of [**Apodini**](https://github.com/Apodini/Apodini), a composable framework to build Web Services in using Swift.
23+
`ApodiniMigrator` is a Swift package that performs several automated tasks, to migrate client applications after a Web Service publishes a new version that contains breaking changes. The tasks include automated generation of an intermediary client library that contains all required components to establish a client-server communication. Furthermore, `ApodiniMigrator` is able to automatically generate a machine-readable migration guide in either `json` or `yaml` format, that describes the changes between two subsequent Web API versions, and includes auxiliary migrating actions. By means of the migration guide, `ApodiniMigrator` can automatically migrate the intermediary client library, ensuring therefore the compatibility with the new Web API version. It is part of [**Apodini**](https://github.com/Apodini/Apodini), a composable framework to build Web Services in using Swift.
2424

2525
## Requirements
2626

@@ -168,7 +168,7 @@ info org.apodini.migrator : Starting generation of the migration guide...
168168
info org.apodini.migrator : Migration guide was generated successfully at /path/to/ApodiniMigrator/Resources/ExampleDocuments/migration_guide.json.
169169
```
170170

171-
Once the migration guide has been generate, use `migrate` argument to migrate the initial library:
171+
Once the migration guide has been generated, use `migrate` argument to migrate the initial library:
172172

173173
```console
174174
$ ./migrator migrate
@@ -185,7 +185,7 @@ info org.apodini.migrator : Package QONECTIQ was migrated successfully. You can
185185
```
186186

187187
## Contributing
188-
Contributions to this projects are welcome. Please make sure to read the [contribution guidelines](https://github.com/Apodini/.github/blob/release/CONTRIBUTING.md) first.
188+
Contributions to the projects are welcome. Please make sure to read the [contribution guidelines](https://github.com/Apodini/.github/blob/release/CONTRIBUTING.md) first.
189189

190190
## License
191191
This project is licensed under the MIT License. See [License](https://github.com/Apodini/ApodiniMigrator/blob/develop/LICENSES) for more information.

0 commit comments

Comments
 (0)