Skip to content

[AutoPR azure-contoso-widgetmanager] Dw/test cadl project sample4 #2973

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
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
36 changes: 26 additions & 10 deletions eng/mgmt/automation/generate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def sdk_automation_cadl(config: dict) -> List[dict]:

sdk_folder = get_cadl_sdk_folder(os.path.join(cadl_dir, 'cadl-project.yaml'))
if not sdk_folder:
logging.warning('[Skip] "sdk-folder" option not found in cadl-project.yaml')
logging.warning('[Skip] "options.@azure-tools/cadl-java.emitter-output-dir" '
'or "parameters.service-directory-name.default" not found in cadl-project.yaml')
else:
sdk_folder_abspath = os.path.join(sdk_root, sdk_folder)
require_sdk_integration = not os.path.exists(os.path.join(sdk_folder_abspath, 'src'))
Expand All @@ -54,20 +55,30 @@ def sdk_automation_cadl(config: dict) -> List[dict]:
module = match.group(2)

if not module:
logging.warning('[Skip] sdk-folder option {} not match format sdk/<service>/<module>'
.format(sdk_folder))
logging.warning('[Skip] "emitter-output-dir" not match format '
'{java-sdk-folder}/sdk/{service-directory-name}/<module>')
else:
# cadl
succeeded = False
pwd = os.getcwd()
os.chdir(cadl_dir)
try:
subprocess.run('npm install', shell=True, check=True)
# install dependencies
subprocess.run('npm install "@azure-tools/[email protected]" "@cadl-lang/[email protected]" "@cadl-lang/[email protected]" "@cadl-lang/[email protected]"', shell=True, check=True)

# install latest @azure-tools/cadl-java
subprocess.run('npm install "@azure-tools/[email protected]"', shell=True, check=True)

# check client.cadl
cadl_source = '.'
if os.path.exists(os.path.join(cadl_dir, 'client.cadl')):
cadl_source = 'client.cadl'

# generate Java project
subprocess.run('npx cadl compile . --emit @azure-tools/cadl-java --output-path={}'
.format(sdk_folder_abspath),
shell=True, check=True)
command = 'npx cadl compile {0} --emit=@azure-tools/cadl-java --arg="java-sdk-folder={1}"'\
.format(cadl_source, sdk_root)
logging.info(command)
subprocess.run(command, shell=True, check=True)

succeeded = True
except subprocess.CalledProcessError:
Expand Down Expand Up @@ -111,12 +122,17 @@ def sdk_automation_cadl(config: dict) -> List[dict]:


def get_cadl_sdk_folder(project_filename: str) -> Optional[str]:
sdk_folder = None
sdk_folder: Optional[str] = None
if os.path.exists(project_filename):
with open(project_filename, 'r', encoding='utf-8') as f_in:
project_yaml = yaml.safe_load(f_in)
sdk_folder = project_yaml['emitters']['@azure-tools/cadl-java']['sdk-folder']

if 'parameters' in project_yaml and 'service-directory-name' in project_yaml['parameters'] \
and 'options' in project_yaml and '@azure-tools/cadl-java' in project_yaml['options']:
service: str = project_yaml['parameters']['service-directory-name']['default']
sdk_folder = project_yaml['options']['@azure-tools/cadl-java']['emitter-output-dir']
sdk_folder = sdk_folder.replace(
r'{java-sdk-folder}/sdk/{service-directory-name}/',
'sdk/{0}/'.format(service))
return sdk_folder


Expand Down
1 change: 1 addition & 0 deletions eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ com.azure:perf-test-core;1.0.0-beta.1;1.0.0-beta.1
com.azure:azure-communication-email;1.0.0-beta.1;1.0.0-beta.2
com.azure:azure-developer-loadtesting;1.0.0-beta.1;1.0.0-beta.2
com.azure:azure-identity-extensions;1.0.0;1.1.0-beta.1
com.azure:azure-contoso-widgetmanager;1.0.0-beta.1;1.0.0-beta.1
com.azure.spring:azure-spring-cloud-appconfiguration-config-web;2.10.0;2.11.0-beta.1
com.azure.spring:azure-spring-cloud-appconfiguration-config;2.10.0;2.11.0-beta.1
com.azure.spring:azure-spring-cloud-feature-management-web;2.9.0;2.10.0-beta.1
Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<module>sdk/connectedvmware</module>
<module>sdk/consumption</module>
<module>sdk/containerregistry</module>
<module>sdk/contosowidgetmanager</module>
<module>sdk/core</module>
<module>sdk/cosmos</module>
<module>sdk/costmanagement</module>
Expand Down
13 changes: 13 additions & 0 deletions sdk/contosowidgetmanager/azure-contoso-widgetmanager/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Release History

## 1.0.0-beta.1 (Unreleased)

- Azure WidgetManager client library for Java. This package contains Microsoft Azure WidgetManager client library.

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes
63 changes: 63 additions & 0 deletions sdk/contosowidgetmanager/azure-contoso-widgetmanager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Azure WidgetManager client library for Java

Azure WidgetManager client library for Java.

This package contains Microsoft Azure WidgetManager client library.

## Documentation

Various documentation is available to help you get started

- [API reference documentation][docs]
- [Product documentation][product_documentation]

## Getting started

### Prerequisites

- [Java Development Kit (JDK)][jdk] with version 8 or above
- [Azure Subscription][azure_subscription]

### Adding the package to your product

[//]: # ({x-version-update-start;com.azure:azure-contoso-widgetmanager;current})
```xml
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-contoso-widgetmanager</artifactId>
<version>1.0.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})

### Authentication

[Azure Identity][azure_identity] package provides the default implementation for authenticating the client.

## Key concepts

## Examples

```java com.azure.contoso.widgetmanager.readme
```

## Troubleshooting

## Next steps

## Contributing

For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md).

1. Fork it
1. Create your feature branch (`git checkout -b my-new-feature`)
1. Commit your changes (`git commit -am 'Add some feature'`)
1. Push to the branch (`git push origin my-new-feature`)
1. Create new Pull Request

<!-- LINKS -->
[product_documentation]: https://azure.microsoft.com/services/
[docs]: https://azure.github.io/azure-sdk-for-java/
[jdk]: https://docs.microsoft.com/java/azure/jdk/
[azure_subscription]: https://azure.microsoft.com/free/
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity
91 changes: 91 additions & 0 deletions sdk/contosowidgetmanager/azure-contoso-widgetmanager/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.azure</groupId>
<artifactId>azure-client-sdk-parent</artifactId>
<version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} -->
<relativePath>../../parents/azure-client-sdk-parent</relativePath>
</parent>

<groupId>com.azure</groupId>
<artifactId>azure-contoso-widgetmanager</artifactId>
<version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:azure-contoso-widgetmanager;current} -->
<packaging>jar</packaging>

<name>Microsoft Azure SDK for WidgetManager Management</name>
<description>This package contains Microsoft Azure WidgetManager client library.</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>

<licenses>
<license>
<name>The MIT License (MIT)</name>
<url>http://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<url>https://github.com/Azure/azure-sdk-for-java</url>
<connection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</connection>
<developerConnection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</developerConnection>
<tag>HEAD</tag>
</scm>
<developers>
<developer>
<id>microsoft</id>
<name>Microsoft</name>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jacoco.skip>true</jacoco.skip>
</properties>
<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.34.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-netty</artifactId>
<version>1.12.7</version> <!-- {x-version-update;com.azure:azure-core-http-netty;dependency} -->
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.1</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-api;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.9.1</version> <!-- {x-version-update;org.junit.jupiter:junit-jupiter-engine;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.5.1</version> <!-- {x-version-update;org.mockito:mockito-core;external_dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-test</artifactId>
<version>1.13.0</version> <!-- {x-version-update;com.azure:azure-core-test;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.7.2</version> <!-- {x-version-update;com.azure:azure-identity;dependency} -->
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.36</version> <!-- {x-version-update;org.slf4j:slf4j-simple;external_dependency} -->
<scope>test</scope>
</dependency>
</dependencies>
</project>
Loading