Skip to content

Commit

Permalink
feat(clients): generate common LICENSE (#3258)
Browse files Browse the repository at this point in the history
  • Loading branch information
shortcuts authored Jun 26, 2024
1 parent c07eab7 commit e5cfcf0
Show file tree
Hide file tree
Showing 27 changed files with 27 additions and 64 deletions.
21 changes: 0 additions & 21 deletions clients/algoliasearch-client-dart/packages/client_core/LICENSE

This file was deleted.

21 changes: 0 additions & 21 deletions clients/algoliasearch-client-dart/packages/client_insights/LICENSE

This file was deleted.

This file was deleted.

2 changes: 2 additions & 0 deletions config/generation.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,6 @@ export const patterns = [
'tests/output/swift/Package.swift',
'!tests/output/swift/handwritten/**',
'!tests/output/swift/Utils/**',

'clients/**/LICENSE'
];
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public void processOpts() {
supportingFiles.add(new SupportingFile("globaljson.mustache", "../", "global.json"));
supportingFiles.add(new SupportingFile("netcore_project.mustache", "Algolia.Search.csproj"));
supportingFiles.add(new SupportingFile("Configuration.mustache", "Clients", packageName + "Configuration.cs"));
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));
}

/** Escape <> in generic with {} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public void processOpts() {
supportingFiles.removeIf(file -> file.getTemplateFile().contains("README"));

supportingFiles.add(new SupportingFile("version.mustache", srcFolder, "version.dart"));
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));

// Search config
additionalProperties.put("isSearchClient", client.equals("search"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public void processOpts() {
supportingFiles.clear();
supportingFiles.add(new SupportingFile("configuration.mustache", "", "configuration.go"));
supportingFiles.add(new SupportingFile("client.mustache", "", "client.go"));
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));

try {
additionalProperties.put("packageVersion", Helpers.getClientConfigField("go", "packageVersion"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public void processOpts() {
supportingFiles.add(new SupportingFile("build_config.mustache", invokerFolder, "BuildConfig.java"));
supportingFiles.add(new SupportingFile("gradle.properties.mustache", "", "gradle.properties"));
additionalProperties.put("isSearchClient", client.equals("search"));
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));

try {
additionalProperties.put("packageVersion", Helpers.getClientConfigField("java", "packageVersion"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public void processOpts() {
// root export files
supportingFiles.add(new SupportingFile("index.mustache", "", "index.js"));
supportingFiles.add(new SupportingFile("index.d.mustache", "", "index.d.ts"));
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));

// `client` related files, `algoliasearch` have it's own logic below
if (!isAlgoliasearchClient) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public void processOpts() {
supportingFiles.add(new SupportingFile("ApiClient.kt.mustache", apiFolder, "ApiClient.kt"));
supportingFiles.add(new SupportingFile("gradle.properties.mustache", "", "gradle.properties"));
supportingFiles.add(new SupportingFile("README_BOM.mustache", "client-bom", "README.md"));
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));

additionalProperties.put("packageVersion", Helpers.getClientConfigField("kotlin", "packageVersion"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public void processOpts() {
supportingFiles.add(new SupportingFile("client_config.mustache", "lib/Configuration", getClientName(client) + "Config.php"));
supportingFiles.add(new SupportingFile("Algolia.mustache", "lib", "Algolia.php"));

supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));

additionalProperties.put("isSearchClient", client.equals("search"));
additionalProperties.put("configClassname", getClientName(client) + "Config");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public void processOpts() {
supportingFiles.add(new SupportingFile("__init__.mustache", packageName + "/models", "__init__.py"));
supportingFiles.add(new SupportingFile("__init__.mustache", "http", "__init__.py"));
supportingFiles.add(new SupportingFile("config.mustache", packageName, "config.py"));
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public void processOpts() {
apiTestTemplateFiles.clear();
modelTestTemplateFiles.clear();

supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));

// Remove some files we don't want to output or change their paths
supportingFiles.removeIf(file ->
file.getTemplateFile().equals("gitignore.mustache") ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public void processOpts() {
var modelFolder = sourceFolder + File.separator + modelPackage.replace(".", File.separator);
supportingFiles.add(new SupportingFile("version.mustache", "", "version.sbt"));
supportingFiles.add(new SupportingFile("jsonSupport.mustache", modelFolder, "JsonSupport.scala"));
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));
additionalProperties.put("isSearchClient", client.equals("search"));
typeMapping.put("AnyType", "Any");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ public void processOpts() {
supportingFiles.add(
new SupportingFile("client_configuration.mustache", sourceFolder, getClientName(CLIENT) + "ClientConfiguration.swift")
);
supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE"));
supportingFiles.add(new SupportingFile("Package.mustache", "Package.swift"));
supportingFiles.add(new SupportingFile("podspec.mustache", projectName + ".podspec"));
supportingFiles.add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
1 change: 1 addition & 0 deletions templates/csharp/LICENSE
1 change: 1 addition & 0 deletions templates/dart/LICENSE
1 change: 1 addition & 0 deletions templates/go/LICENSE
1 change: 1 addition & 0 deletions templates/java/LICENSE
1 change: 1 addition & 0 deletions templates/javascript/clients/LICENSE
1 change: 1 addition & 0 deletions templates/kotlin/LICENSE
1 change: 1 addition & 0 deletions templates/php/LICENSE
1 change: 1 addition & 0 deletions templates/python/LICENSE
1 change: 1 addition & 0 deletions templates/ruby/LICENSE
1 change: 1 addition & 0 deletions templates/scala/LICENSE
1 change: 1 addition & 0 deletions templates/swift/LICENSE

1 comment on commit e5cfcf0

@github-actions
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.